diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2005-02-12 15:32:13 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2005-02-12 15:32:13 +0000 |
commit | 81bbc9304d93413707cb1c9b3f51aeb66eac779d (patch) | |
tree | 6dd11247b8211a04ecfd71acbed8c127f10077e5 /sys | |
parent | b54281255af4dd53234adc42eea75912558ce476 (diff) |
Fix crashes during probe by ensuring that SCSI_IS_SCSIBUS_B() returns
false until scsi bus b is initialized.
Set TWIN_CHNLB bit that is used elsewhere. Missed chunk from last code
sync.
Problem found and fixes tested on HP Proliant ML310 by Valov Oleg.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/aic7xxx_openbsd.c | 14 | ||||
-rw-r--r-- | sys/dev/ic/aic7xxx_openbsd.h | 5 | ||||
-rw-r--r-- | sys/dev/pci/ahc_pci.c | 10 |
3 files changed, 12 insertions, 17 deletions
diff --git a/sys/dev/ic/aic7xxx_openbsd.c b/sys/dev/ic/aic7xxx_openbsd.c index 3a9c0089b0a..62912bc9758 100644 --- a/sys/dev/ic/aic7xxx_openbsd.c +++ b/sys/dev/ic/aic7xxx_openbsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aic7xxx_openbsd.c,v 1.28 2005/01/12 00:50:17 krw Exp $ */ +/* $OpenBSD: aic7xxx_openbsd.c,v 1.29 2005/02/12 15:32:12 krw Exp $ */ /* $NetBSD: aic7xxx_osm.c,v 1.14 2003/11/02 11:07:44 wiz Exp $ */ /* @@ -123,24 +123,12 @@ ahc_attach(struct ahc_softc *ahc) ahc_reset_channel(ahc, 'B', TRUE); if ((ahc->flags & AHC_PRIMARY_CHANNEL) == 0) { - /* - * Ensure SCSI_IS_SCSIBUS_B() returns false for sc_channel - * until sc_channel_b has been properly initialized by scsi - * layer. - */ - ahc->sc_channel_b.scsibus = 0xff; ahc->sc_child = config_found((void *)&ahc->sc_dev, &ahc->sc_channel, scsiprint); if (ahc->features & AHC_TWIN) ahc->sc_child_b = config_found((void *)&ahc->sc_dev, &ahc->sc_channel_b, scsiprint); } else { - /* - * Ensure SCSI_IS_SCSIBUS_B() returns false for sc_channel_b - * until sc_channel has been properly initialized by scsi - * layer. - */ - ahc->sc_channel.scsibus = 0xff; if (ahc->features & AHC_TWIN) ahc->sc_child = config_found((void *)&ahc->sc_dev, &ahc->sc_channel_b, scsiprint); diff --git a/sys/dev/ic/aic7xxx_openbsd.h b/sys/dev/ic/aic7xxx_openbsd.h index ea58e6d688a..f06753dcb25 100644 --- a/sys/dev/ic/aic7xxx_openbsd.h +++ b/sys/dev/ic/aic7xxx_openbsd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: aic7xxx_openbsd.h,v 1.13 2004/10/24 04:28:33 krw Exp $ */ +/* $OpenBSD: aic7xxx_openbsd.h,v 1.14 2005/02/12 15:32:12 krw Exp $ */ /* $NetBSD: aic7xxx_osm.h,v 1.7 2003/11/02 11:07:44 wiz Exp $ */ /* @@ -92,7 +92,8 @@ #define SCSI_CHANNEL(ahc, sc_link) \ (SCSI_IS_SCSIBUS_B(ahc, sc_link) ? 'B' : 'A') #define BUILD_SCSIID(ahc, sc_link, target_id, our_id) \ - ((((target_id) << TID_SHIFT) & TID) | (our_id)) + ((((target_id) << TID_SHIFT) & TID) | (our_id) \ + | (SCSI_IS_SCSIBUS_B(ahc, sc_link) ? TWIN_CHNLB : 0)) #ifndef offsetof #define offsetof(type, member) ((size_t)(&((type *)0)->member)) diff --git a/sys/dev/pci/ahc_pci.c b/sys/dev/pci/ahc_pci.c index 28d20bd9e14..451b36813fa 100644 --- a/sys/dev/pci/ahc_pci.c +++ b/sys/dev/pci/ahc_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ahc_pci.c,v 1.45 2004/08/13 23:38:54 krw Exp $ */ +/* $OpenBSD: ahc_pci.c,v 1.46 2005/02/12 15:32:11 krw Exp $ */ /* * Product specific probe and attach routines for: * 3940, 2940, aic7895, aic7890, aic7880, @@ -40,7 +40,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGES. * - * $Id: ahc_pci.c,v 1.45 2004/08/13 23:38:54 krw Exp $ + * $Id: ahc_pci.c,v 1.46 2005/02/12 15:32:11 krw Exp $ * * //depot/aic7xxx/aic7xxx/aic7xxx_pci.c#57 $ * @@ -740,6 +740,12 @@ 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); |