On Thu, Jun 23, 2011 at 11:33:53AM -0700, Matthew Dempsky wrote:
> Diff below cleans up ahc(4) to use scsi_link::bus instead of
> (mis)using scsi_link::scsibus.
> 
> If you have an ahc(4) (particularly a dual-channel one), I'd
> appreciate test reports + dmesg.  (As long as your devices still show
> up, then it's working.)

Haven't had any feedback on this diff yet.  Potential testers, please
find a revised version of this diff below.

This version uses the SDEV_2NDBUS flag like isp(4), instead of the
hack I had before.  I don't particularly like this approach either,
but at least by doing the same thing as isp(4), it means only one hack
I don't like rather than two. ;)

Anyway, this is blocking some other SCSI cleanups I'd like to do, so
please test and report back if you have an ahc(4).

Thanks!


Index: ic/aic7xxx_openbsd.c
===================================================================
RCS file: /home/mdempsky/anoncvs/cvs/src/sys/dev/ic/aic7xxx_openbsd.c,v
retrieving revision 1.48
diff -u -p -r1.48 aic7xxx_openbsd.c
--- ic/aic7xxx_openbsd.c        28 Jun 2010 18:31:02 -0000      1.48
+++ ic/aic7xxx_openbsd.c        28 Jun 2011 05:00:09 -0000
@@ -94,6 +94,7 @@ ahc_attach(struct ahc_softc *ahc)
                /* Configure the second scsi bus */
                ahc->sc_channel_b = ahc->sc_channel;
                ahc->sc_channel_b.adapter_target = ahc->our_id_b;
+               ahc->sc_channel_b.flags |= SDEV_2NDBUS;
        }
 
 #ifndef DEBUG          
Index: ic/aic7xxx_openbsd.h
===================================================================
RCS file: /home/mdempsky/anoncvs/cvs/src/sys/dev/ic/aic7xxx_openbsd.h,v
retrieving revision 1.19
diff -u -p -r1.19 aic7xxx_openbsd.h
--- ic/aic7xxx_openbsd.h        15 Sep 2007 10:10:37 -0000      1.19
+++ ic/aic7xxx_openbsd.h        28 Jun 2011 04:45:54 -0000
@@ -88,7 +88,7 @@
 /****************************** Platform Macros 
*******************************/
 
 #define        SCSI_IS_SCSIBUS_B(ahc, sc_link) \
-       ((sc_link)->scsibus == (ahc)->sc_channel_b.scsibus)
+       (((sc_link)->flags & SDEV_2NDBUS) != 0)
 #define        SCSI_SCSI_ID(ahc, sc_link)      \
        (SCSI_IS_SCSIBUS_B(ahc, sc_link) ? ahc->our_id_b : ahc->our_id)
 #define        SCSI_CHANNEL(ahc, sc_link)      \
Index: pci/ahc_pci.c
===================================================================
RCS file: /home/mdempsky/anoncvs/cvs/src/sys/dev/pci/ahc_pci.c,v
retrieving revision 1.53
diff -u -p -r1.53 ahc_pci.c
--- pci/ahc_pci.c       13 May 2008 02:24:08 -0000      1.53
+++ pci/ahc_pci.c       28 Jun 2011 04:59:51 -0000
@@ -737,12 +737,6 @@ ahc_pci_attach(parent, self, aux)
        for (i = 0; i < AHC_NUM_TARGETS; i++)
                TAILQ_INIT(&ahc->untagged_queues[i]);
 
-       /*
-        * SCSI_IS_SCSIBUS_B() must returns false until sc_channel_b
-        * has been properly initialized. XXX Breaks if >254 scsi buses.
-        */
-       ahc->sc_channel_b.scsibus = 0xff;
-
        ahc->dev_softc = pa;
 
        ahc_set_name(ahc, ahc->sc_dev.dv_xname);

Reply via email to