diff --git a/sys/dev/ata/ata_wdc.c b/sys/dev/ata/ata_wdc.c index bbe6141df5c2..cff294a95115 100644 --- a/sys/dev/ata/ata_wdc.c +++ b/sys/dev/ata/ata_wdc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ata_wdc.c,v 1.8 1998/11/20 01:23:52 thorpej Exp $ */ +/* $NetBSD: ata_wdc.c,v 1.9 1998/11/21 15:41:41 drochner Exp $ */ /* * Copyright (c) 1998 Manuel Bouyer. @@ -551,7 +551,7 @@ wdc_ata_bio_done(chp, xfer) } WDCDEBUG_PRINT(("wdcstart from wdc_ata_done, flags 0x%x\n", chp->ch_flags), DEBUG_XFERS); - wdcstart(chp->wdc, chp->channel); + wdcstart(chp); } /* diff --git a/sys/dev/ic/wdc.c b/sys/dev/ic/wdc.c index 4eca4a730804..cdafc388203a 100644 --- a/sys/dev/ic/wdc.c +++ b/sys/dev/ic/wdc.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc.c,v 1.44 1998/11/20 01:22:37 thorpej Exp $ */ +/* $NetBSD: wdc.c,v 1.45 1998/11/21 15:41:41 drochner Exp $ */ /* @@ -416,12 +416,10 @@ wdcattach(chp) * are shared. */ void -wdcstart(wdc, channel) - struct wdc_softc *wdc; - int channel; +wdcstart(chp) + struct channel_softc *chp; { struct wdc_xfer *xfer; - struct channel_softc *chp; #ifdef WDC_DIAGNOSTIC int spl1, spl2; @@ -437,9 +435,8 @@ wdcstart(wdc, channel) #endif /* WDC_DIAGNOSTIC */ /* is there a xfer ? */ - if ((xfer = wdc->channels[channel].ch_queue->sc_xfer.tqh_first) == NULL) + if ((xfer = chp->ch_queue->sc_xfer.tqh_first) == NULL) return; - chp = &wdc->channels[xfer->channel]; if ((chp->ch_flags & WDCF_ACTIVE) != 0 ) { return; /* channel aleady active */ } @@ -447,8 +444,8 @@ wdcstart(wdc, channel) if ((chp->ch_flags & WDCF_IRQ_WAIT) != 0) panic("wdcstart: channel waiting for irq\n"); #endif - if (wdc->cap & WDC_CAPABILITY_HWLOCK) - if (!(*wdc->claim_hw)(chp, 0)) + if (chp->wdc->cap & WDC_CAPABILITY_HWLOCK) + if (!(*chp->wdc->claim_hw)(chp, 0)) return; WDCDEBUG_PRINT(("wdcstart: xfer %p channel %d drive %d\n", xfer, @@ -470,7 +467,7 @@ wdcrestart(v) int s; s = splbio(); - wdcstart(chp->wdc, chp->channel); + wdcstart(chp); splx(s); } @@ -1006,7 +1003,7 @@ __wdccommand_done(chp, xfer) else wdc_c->callback(wdc_c->callback_arg); } - wdcstart(chp->wdc, chp->channel); + wdcstart(chp); return; } @@ -1091,7 +1088,7 @@ wdc_exec_xfer(chp, xfer) TAILQ_INSERT_TAIL(&chp->ch_queue->sc_xfer,xfer , c_xferchain); WDCDEBUG_PRINT(("wdcstart from wdc_exec_xfer, flags 0x%x\n", chp->ch_flags), DEBUG_XFERS); - wdcstart(chp->wdc, chp->channel); + wdcstart(chp); xfer->c_flags |= C_NEEDDONE; /* we can now call upper level done() */ } diff --git a/sys/dev/ic/wdcvar.h b/sys/dev/ic/wdcvar.h index b012b1f5c35a..8270ab0a87d5 100644 --- a/sys/dev/ic/wdcvar.h +++ b/sys/dev/ic/wdcvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: wdcvar.h,v 1.9 1998/11/20 01:22:37 thorpej Exp $ */ +/* $NetBSD: wdcvar.h,v 1.10 1998/11/21 15:41:42 drochner Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -93,7 +93,7 @@ struct wdc_softc { /* Per controller state */ u_int8_t pio_mode; /* highest PIO mode supported */ u_int8_t dma_mode; /* highest DMA mode supported */ int nchannels; /* Number of channels on this controller */ - struct channel_softc *channels; /* channels-specific datas (array) */ + struct channel_softc **channels; /* channels-specific datas (array) */ /* * The reference count here is used for both IDE and ATAPI devices. @@ -157,7 +157,7 @@ struct wdc_xfer *wdc_get_xfer __P((int)); /* int = WDC_NOSLEEP/CANSLEEP */ #define WDC_CANSLEEP 0x00 #define WDC_NOSLEEP 0x01 void wdc_free_xfer __P((struct channel_softc *, struct wdc_xfer *)); -void wdcstart __P((struct wdc_softc *, int)); +void wdcstart __P((struct channel_softc *)); void wdcrestart __P((void*)); int wdcreset __P((struct channel_softc *, int)); #define VERBOSE 1 diff --git a/sys/dev/isa/wdc_isa.c b/sys/dev/isa/wdc_isa.c index 0999def96c22..b7746d32c3db 100644 --- a/sys/dev/isa/wdc_isa.c +++ b/sys/dev/isa/wdc_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_isa.c,v 1.10 1998/10/12 16:09:19 bouyer Exp $ */ +/* $NetBSD: wdc_isa.c,v 1.11 1998/11/21 15:41:42 drochner Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -61,6 +61,7 @@ struct wdc_isa_softc { struct wdc_softc sc_wdcdev; + struct channel_softc *wdc_chanptr; struct channel_softc wdc_channel; isa_chipset_tag_t sc_ic; void *sc_ih; @@ -151,7 +152,8 @@ wdc_isa_attach(parent, self, aux) } sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_DATA32; sc->sc_wdcdev.pio_mode = 0; - sc->sc_wdcdev.channels = &sc->wdc_channel; + sc->wdc_chanptr = &sc->wdc_channel; + sc->sc_wdcdev.channels = &sc->wdc_chanptr; sc->sc_wdcdev.nchannels = 1; sc->wdc_channel.channel = 0; sc->wdc_channel.wdc = &sc->sc_wdcdev; diff --git a/sys/dev/isapnp/wdc_isapnp.c b/sys/dev/isapnp/wdc_isapnp.c index 7f8b5e23527d..b3ffea1bc3c8 100644 --- a/sys/dev/isapnp/wdc_isapnp.c +++ b/sys/dev/isapnp/wdc_isapnp.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_isapnp.c,v 1.8 1998/10/12 16:09:19 bouyer Exp $ */ +/* $NetBSD: wdc_isapnp.c,v 1.9 1998/11/21 15:41:42 drochner Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -58,6 +58,7 @@ struct wdc_isapnp_softc { struct wdc_softc sc_wdcdev; + struct channel_softc *wdc_chanptr; struct channel_softc wdc_channel; isa_chipset_tag_t sc_ic; void *sc_ih; @@ -148,7 +149,8 @@ wdc_isapnp_attach(parent, self, aux) #endif sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_DATA32; sc->sc_wdcdev.pio_mode = 0; - sc->sc_wdcdev.channels = &sc->wdc_channel; + sc->wdc_chanptr = &sc->wdc_channel; + sc->sc_wdcdev.channels = &sc->wdc_chanptr; sc->sc_wdcdev.nchannels = 1; sc->wdc_channel.channel = 0; sc->wdc_channel.wdc = &sc->sc_wdcdev; diff --git a/sys/dev/pcmcia/wdc_pcmcia.c b/sys/dev/pcmcia/wdc_pcmcia.c index 4d14f45b6f01..5eaa57789b8e 100644 --- a/sys/dev/pcmcia/wdc_pcmcia.c +++ b/sys/dev/pcmcia/wdc_pcmcia.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_pcmcia.c,v 1.15 1998/11/20 01:52:22 thorpej Exp $ */ +/* $NetBSD: wdc_pcmcia.c,v 1.16 1998/11/21 15:41:42 drochner Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -72,6 +72,7 @@ struct wdc_pcmcia_softc { struct wdc_softc sc_wdcdev; + struct channel_softc *wdc_chanptr; struct channel_softc wdc_channel; struct pcmcia_io_handle sc_pioh; struct pcmcia_io_handle sc_auxpioh; @@ -326,7 +327,8 @@ wdc_pcmcia_attach(parent, self, aux) sc->wdc_channel.data32ioh = sc->wdc_channel.cmd_ioh; sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_DATA32; sc->sc_wdcdev.pio_mode = 0; - sc->sc_wdcdev.channels = &sc->wdc_channel; + sc->wdc_chanptr = &sc->wdc_channel; + sc->sc_wdcdev.channels = &sc->wdc_chanptr; sc->sc_wdcdev.nchannels = 1; sc->wdc_channel.channel = 0; sc->wdc_channel.wdc = &sc->sc_wdcdev; diff --git a/sys/dev/scsipi/atapi_wdc.c b/sys/dev/scsipi/atapi_wdc.c index 188246475941..6734ae8e2525 100644 --- a/sys/dev/scsipi/atapi_wdc.c +++ b/sys/dev/scsipi/atapi_wdc.c @@ -1,4 +1,4 @@ -/* $NetBSD: atapi_wdc.c,v 1.9 1998/11/19 21:54:18 thorpej Exp $ */ +/* $NetBSD: atapi_wdc.c,v 1.10 1998/11/21 15:41:42 drochner Exp $ */ /* * Copyright (c) 1998 Manuel Bouyer. @@ -132,7 +132,7 @@ wdc_atapi_get_params(ab_link, drive, flags, id) { struct wdc_softc *wdc = (void*)ab_link->adapter_softc; struct channel_softc *chp = - &wdc->channels[ab_link->scsipi_atapi.channel]; + wdc->channels[ab_link->scsipi_atapi.channel]; struct wdc_command wdc_c; /* if no ATAPI device detected at wdc attach time, skip */ @@ -202,7 +202,7 @@ wdc_atapi_send_cmd(sc_xfer) } if (sc_xfer->flags & SCSI_POLL) xfer->c_flags |= C_POLL; - drvp = &wdc->channels[channel].ch_drive[drive]; + drvp = &wdc->channels[channel]->ch_drive[drive]; if ((drvp->drive_flags & (DRIVE_DMA | DRIVE_UDMA)) && sc_xfer->datalen > 0) xfer->c_flags |= C_DMA; @@ -214,7 +214,7 @@ wdc_atapi_send_cmd(sc_xfer) xfer->c_start = wdc_atapi_start; xfer->c_intr = wdc_atapi_intr; s = splbio(); - wdc_exec_xfer(&wdc->channels[channel], xfer); + wdc_exec_xfer(wdc->channels[channel], xfer); #ifdef DIAGNOSTIC if ((sc_xfer->flags & SCSI_POLL) != 0 && (sc_xfer->flags & ITSDONE) == 0) @@ -725,7 +725,6 @@ wdc_atapi_done(chp, xfer) struct wdc_xfer *xfer; { struct scsipi_xfer *sc_xfer = xfer->cmd; - struct wdc_softc *wdc = chp->wdc; int need_done = xfer->c_flags & C_NEEDDONE; WDCDEBUG_PRINT(("wdc_atapi_done %s:%d:%d: flags 0x%x\n", @@ -742,7 +741,7 @@ wdc_atapi_done(chp, xfer) } WDCDEBUG_PRINT(("wdcstart from wdc_atapi_done, flags 0x%x\n", chp->ch_flags), DEBUG_XFERS); - wdcstart(wdc, chp->channel); + wdcstart(chp); } void