diff options
author | Matthew Dempsky <matthew@cvs.openbsd.org> | 2011-05-09 22:25:51 +0000 |
---|---|---|
committer | Matthew Dempsky <matthew@cvs.openbsd.org> | 2011-05-09 22:25:51 +0000 |
commit | a9b23f00f1cdf8ec5565371412b53af1247703da (patch) | |
tree | a32dcfc36e729577ada64efdf12187c01a19640b | |
parent | 4fc6c7d571672873667517ce1ace28721c145453 (diff) |
Initialize the wdc ata_drive_datas structs earlier in wdcattach() so
that chip-specific drv_probe routines can assume they've already been
initialized.
Tested by sthen@ on i386, armish, and amd64, with both affected and
non-affected pciide(4) chips.
ok dlg@
-rw-r--r-- | sys/dev/ic/wdc.c | 9 | ||||
-rw-r--r-- | sys/dev/pci/pciide.c | 26 |
2 files changed, 10 insertions, 25 deletions
diff --git a/sys/dev/ic/wdc.c b/sys/dev/ic/wdc.c index f17a9903963..734e447eb66 100644 --- a/sys/dev/ic/wdc.c +++ b/sys/dev/ic/wdc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wdc.c,v 1.114 2011/05/08 17:33:56 matthew Exp $ */ +/* $OpenBSD: wdc.c,v 1.115 2011/05/09 22:25:50 matthew Exp $ */ /* $NetBSD: wdc.c,v 1.68 1999/06/23 19:00:17 bouyer Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. @@ -718,6 +718,11 @@ wdcattach(struct channel_softc *chp) if (!chp->_vtbl) chp->_vtbl = &wdc_default_vtbl; + for (i = 0; i < 2; i++) { + chp->ch_drive[i].chnl_softc = chp; + chp->ch_drive[i].drive = i; + } + if (chp->wdc->drv_probe != NULL) { chp->wdc->drv_probe(chp); } else { @@ -756,8 +761,6 @@ wdcattach(struct channel_softc *chp) for (i = 0; i < 2; i++) { struct ata_drive_datas *drvp = &chp->ch_drive[i]; - drvp->chnl_softc = chp; - drvp->drive = i; /* If controller can't do 16bit flag the drives as 32bit */ if ((chp->wdc->cap & (WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_DATA32)) == diff --git a/sys/dev/pci/pciide.c b/sys/dev/pci/pciide.c index b42310bd9a9..e43fd1f1a08 100644 --- a/sys/dev/pci/pciide.c +++ b/sys/dev/pci/pciide.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pciide.c,v 1.328 2011/04/27 07:55:05 jsg Exp $ */ +/* $OpenBSD: pciide.c,v 1.329 2011/05/09 22:25:50 matthew Exp $ */ /* $NetBSD: pciide.c,v 1.127 2001/08/03 01:31:08 tsutsui Exp $ */ /* @@ -4301,13 +4301,7 @@ sii3112_drv_probe(struct channel_softc *chp) struct pciide_softc *sc = (struct pciide_softc *)cp->wdc_channel.wdc; uint32_t scontrol, sstatus; uint8_t scnt, sn, cl, ch; - int i, s; - - /* XXX This should be done by other code. */ - for (i = 0; i < 2; i++) { - chp->ch_drive[i].chnl_softc = chp; - chp->ch_drive[i].drive = i; - } + int s; /* * The 3112 is a 2-port part, and only has one drive per channel @@ -7103,13 +7097,7 @@ pdc205xx_drv_probe(struct channel_softc *chp) bus_space_handle_t *iohs; u_int32_t scontrol, sstatus; u_int16_t scnt, sn, cl, ch; - int i, s; - - /* XXX This should be done by other code. */ - for (i = 0; i < 2; i++) { - chp->ch_drive[i].chnl_softc = chp; - chp->ch_drive[i].drive = i; - } + int s; SCONTROL_WRITE(ps, chp->channel, 0); delay(50*1000); @@ -7763,13 +7751,7 @@ svwsata_drv_probe(struct channel_softc *chp) int channel = chp->channel; uint32_t scontrol, sstatus; uint8_t scnt, sn, cl, ch; - int i, s; - - /* XXX This should be done by other code. */ - for (i = 0; i < 2; i++) { - chp->ch_drive[i].chnl_softc = chp; - chp->ch_drive[i].drive = i; - } + int s; /* * Request communication initialization sequence, any speed. |