Extend critical section protection around portions of selection processing
authorPeter Avalos <pavalos@dragonflybsd.org>
Fri, 6 Jul 2007 02:46:40 +0000 (02:46 +0000)
committerPeter Avalos <pavalos@dragonflybsd.org>
Fri, 6 Jul 2007 02:46:40 +0000 (02:46 +0000)
that cannot tolerate changes to the waiting for selection queue by the
host or the host canceling an active selection.

Obtained-from: FreeBSD

sys/dev/disk/aic7xxx/aic7xxx.seq

index 5c0733b..7563df2 100644 (file)
@@ -37,8 +37,8 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $FreeBSD: src/sys/dev/aic7xxx/aic7xxx.seq,v 1.126 2003/12/17 00:02:09 gibbs Exp $
- * $DragonFly: src/sys/dev/disk/aic7xxx/aic7xxx.seq,v 1.3 2007/07/06 00:01:16 pavalos Exp $
+ * $FreeBSD: src/sys/dev/aic7xxx/aic7xxx.seq,v 1.127 2004/08/13 21:41:23 gibbs Exp $
+ * $DragonFly: src/sys/dev/disk/aic7xxx/aic7xxx.seq,v 1.4 2007/07/06 02:46:40 pavalos Exp $
  */
 
 VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic7xxx.seq#58 $"
@@ -84,7 +84,9 @@ poll_for_work:
                xor     SBLKCTL,SELBUSB;        /* Toggle to the other bus */
                test    SCSISEQ, ENSELO         jnz poll_for_selection;
        }
+BEGIN_CRITICAL;
        cmp     WAITING_SCBH,SCB_LIST_NULL jne start_waiting;
+END_CRITICAL;
 poll_for_work_loop:
        if ((ahc->features & AHC_TWIN) != 0) {
                xor     SBLKCTL,SELBUSB;        /* Toggle to the other bus */
@@ -142,13 +144,13 @@ BEGIN_CRITICAL;
                inc     QINPOS;
        }
        and     SEQ_FLAGS2, ~SCB_DMA;
-END_CRITICAL;
 start_waiting:
        /*
         * Start the first entry on the waiting SCB list.
         */
        mov     SCBPTR, WAITING_SCBH;
        call    start_selection;
+END_CRITICAL;
 
 poll_for_selection:
        /*
@@ -356,6 +358,7 @@ abort_qinscb:
        call    add_scb_to_free_list;
        jmp     poll_for_work_loop;
 
+BEGIN_CRITICAL;
 start_selection:
        /*
         * If bus reset interrupts have been disabled (from a previous
@@ -389,6 +392,7 @@ initialize_scsiid:
        } else {
                mov     SCSISEQ, SCSISEQ_TEMPLATE ret;
        }
+END_CRITICAL;
 
 /*
  * Initialize transfer settings with SCB provided settings.