diff options
| author | thorpej <thorpej@NetBSD.org> | 2004-01-01 17:18:53 +0000 |
|---|---|---|
| committer | thorpej <thorpej@NetBSD.org> | 2004-01-01 17:18:53 +0000 |
| commit | 527c829fa00bf52b39ef97b7dabeafc8aa271052 (patch) | |
| tree | 3ac11748c262d4a7eaa6442e7c4582ced5dc4c14 /sys/dev | |
| parent | 0eb77d4bef950ea7a3669968a3d0695edf15dc3b (diff) | |
Rename:
- wdc_xfer to ata_xfer
- channel_queue to ata_queue
and move them to <dev/ata/atavar.h> so they can be used by non-wdc ATA
controllers. Clean up the member names of these structures while at it.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/ata/ata.c | 8 | ||||
| -rw-r--r-- | sys/dev/ata/ata_wdc.c | 127 | ||||
| -rw-r--r-- | sys/dev/ata/atavar.h | 39 | ||||
| -rw-r--r-- | sys/dev/ic/wdc.c | 116 | ||||
| -rw-r--r-- | sys/dev/ic/wdc_upc.c | 6 | ||||
| -rw-r--r-- | sys/dev/ic/wdcvar.h | 44 | ||||
| -rw-r--r-- | sys/dev/isa/wdc_isa.c | 6 | ||||
| -rw-r--r-- | sys/dev/isapnp/wdc_isapnp.c | 6 | ||||
| -rw-r--r-- | sys/dev/ofisa/wdc_ofisa.c | 6 | ||||
| -rw-r--r-- | sys/dev/pci/cmdide.c | 6 | ||||
| -rw-r--r-- | sys/dev/pci/cypide.c | 4 | ||||
| -rw-r--r-- | sys/dev/pci/pciide_common.c | 6 | ||||
| -rw-r--r-- | sys/dev/pci/satalink.c | 4 | ||||
| -rw-r--r-- | sys/dev/pcmcia/wdc_pcmcia.c | 6 | ||||
| -rw-r--r-- | sys/dev/podulebus/dtide.c | 6 | ||||
| -rw-r--r-- | sys/dev/podulebus/hcide.c | 6 | ||||
| -rw-r--r-- | sys/dev/scsipi/atapi_wdc.c | 122 |
17 files changed, 263 insertions, 255 deletions
diff --git a/sys/dev/ata/ata.c b/sys/dev/ata/ata.c index 8d2a33d1b58..9d18ecacd9f 100644 --- a/sys/dev/ata/ata.c +++ b/sys/dev/ata/ata.c @@ -1,4 +1,4 @@ -/* $NetBSD: ata.c,v 1.23 2003/12/30 16:28:37 thorpej Exp $ */ +/* $NetBSD: ata.c,v 1.24 2004/01/01 17:18:54 thorpej Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.23 2003/12/30 16:28:37 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.24 2004/01/01 17:18:54 thorpej Exp $"); #ifndef WDCDEBUG #define WDCDEBUG @@ -119,7 +119,7 @@ atabus_thread(void *arg) { struct atabus_softc *sc = arg; struct channel_softc *chp = sc->sc_chan; - struct wdc_xfer *xfer; + struct ata_xfer *xfer; int s; s = splbio(); @@ -157,7 +157,7 @@ atabus_thread(void *arg) * Caller has bumped queue_freeze, decrease it. */ chp->ch_queue->queue_freeze--; - xfer = TAILQ_FIRST(&chp->ch_queue->sc_xfer); + xfer = TAILQ_FIRST(&chp->ch_queue->queue_xfer); KASSERT(xfer != NULL); (*xfer->c_start)(chp, xfer); } else if (chp->ch_queue->queue_freeze > 1) diff --git a/sys/dev/ata/ata_wdc.c b/sys/dev/ata/ata_wdc.c index b8ed80e0d39..d177ceb77c4 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.47 2003/12/14 05:35:34 thorpej Exp $ */ +/* $NetBSD: ata_wdc.c,v 1.48 2004/01/01 17:18:54 thorpej Exp $ */ /* * Copyright (c) 1998, 2001, 2003 Manuel Bouyer. @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ata_wdc.c,v 1.47 2003/12/14 05:35:34 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ata_wdc.c,v 1.48 2004/01/01 17:18:54 thorpej Exp $"); #ifndef WDCDEBUG #define WDCDEBUG @@ -115,12 +115,12 @@ extern int wdcdebug_wd_mask; /* inited in wd.c */ #define ATA_DELAY 10000 /* 10s for a drive I/O */ static int wdc_ata_bio(struct ata_drive_datas*, struct ata_bio*); -static void wdc_ata_bio_start(struct channel_softc *,struct wdc_xfer *); -static void _wdc_ata_bio_start(struct channel_softc *,struct wdc_xfer *); -static int wdc_ata_bio_intr(struct channel_softc *, struct wdc_xfer *, +static void wdc_ata_bio_start(struct channel_softc *,struct ata_xfer *); +static void _wdc_ata_bio_start(struct channel_softc *,struct ata_xfer *); +static int wdc_ata_bio_intr(struct channel_softc *, struct ata_xfer *, int); -static void wdc_ata_bio_kill_xfer(struct channel_softc *,struct wdc_xfer *); -static void wdc_ata_bio_done(struct channel_softc *, struct wdc_xfer *); +static void wdc_ata_bio_kill_xfer(struct channel_softc *,struct ata_xfer *); +static void wdc_ata_bio_done(struct channel_softc *, struct ata_xfer *); static int wdc_ata_err(struct ata_drive_datas *, struct ata_bio *); #define WDC_ATA_NOERR 0x00 /* Drive doesn't report an error */ #define WDC_ATA_RECOV 0x01 /* There was a recovered error */ @@ -172,7 +172,7 @@ int to48(int cmd32) static int wdc_ata_bio(struct ata_drive_datas *drvp, struct ata_bio *ata_bio) { - struct wdc_xfer *xfer; + struct ata_xfer *xfer; struct channel_softc *chp = drvp->chnl_softc; xfer = wdc_get_xfer(WDC_NOSLEEP); @@ -185,9 +185,9 @@ wdc_ata_bio(struct ata_drive_datas *drvp, struct ata_bio *ata_bio) if ((drvp->drive_flags & (DRIVE_DMA | DRIVE_UDMA)) && (ata_bio->flags & ATA_SINGLE) == 0) xfer->c_flags |= C_DMA; - xfer->drive = drvp->drive; - xfer->cmd = ata_bio; - xfer->databuf = ata_bio->databuf; + xfer->c_drive = drvp->drive; + xfer->c_cmd = ata_bio; + xfer->c_databuf = ata_bio->databuf; xfer->c_bcount = ata_bio->bcount; xfer->c_start = wdc_ata_bio_start; xfer->c_intr = wdc_ata_bio_intr; @@ -197,15 +197,15 @@ wdc_ata_bio(struct ata_drive_datas *drvp, struct ata_bio *ata_bio) } static void -wdc_ata_bio_start(struct channel_softc *chp, struct wdc_xfer *xfer) +wdc_ata_bio_start(struct channel_softc *chp, struct ata_xfer *xfer) { - struct ata_bio *ata_bio = xfer->cmd; - struct ata_drive_datas *drvp = &chp->ch_drive[xfer->drive]; + struct ata_bio *ata_bio = xfer->c_cmd; + struct ata_drive_datas *drvp = &chp->ch_drive[xfer->c_drive]; int wait_flags = (xfer->c_flags & C_POLL) ? AT_POLL : 0; char *errstring; WDCDEBUG_PRINT(("wdc_ata_bio_start %s:%d:%d\n", - chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive), + chp->wdc->sc_dev.dv_xname, chp->channel, xfer->c_drive), DEBUG_XFERS); /* Do control operations specially. */ @@ -229,13 +229,13 @@ wdc_ata_bio_start(struct channel_softc *chp, struct wdc_xfer *xfer) bus_space_write_1(chp->ctl_iot, chp->ctl_ioh, wd_aux_ctlr, WDCTL_4BIT | WDCTL_IDS); if (chp->wdc->cap & WDC_CAPABILITY_SELECT) - chp->wdc->select(chp,xfer->drive); + chp->wdc->select(chp, xfer->c_drive); bus_space_write_1(chp->cmd_iot, chp->cmd_iohs[wd_sdh], 0, - WDSD_IBM | (xfer->drive << 4)); + WDSD_IBM | (xfer->c_drive << 4)); errstring = "wait"; if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, ATA_DELAY, wait_flags)) goto ctrltimeout; - wdccommandshort(chp, xfer->drive, WDCC_RECAL); + wdccommandshort(chp, xfer->c_drive, WDCC_RECAL); /* Wait for at last 400ns for status bit to be valid */ DELAY(1); errstring = "recal"; @@ -273,7 +273,7 @@ wdc_ata_bio_start(struct channel_softc *chp, struct wdc_xfer *xfer) geometry: if (ata_bio->flags & ATA_LBA) goto multimode; - wdccommand(chp, xfer->drive, WDCC_IDP, + wdccommand(chp, xfer->c_drive, WDCC_IDP, ata_bio->lp->d_ncylinders, ata_bio->lp->d_ntracks - 1, 0, ata_bio->lp->d_nsectors, (ata_bio->lp->d_type == DTYPE_ST506) ? @@ -286,7 +286,7 @@ geometry: multimode: if (ata_bio->multi == 1) goto ready; - wdccommand(chp, xfer->drive, WDCC_SETMULTI, 0, 0, 0, + wdccommand(chp, xfer->c_drive, WDCC_SETMULTI, 0, 0, 0, ata_bio->multi, 0); errstring = "setmulti"; if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, ATA_DELAY, wait_flags)) @@ -306,12 +306,12 @@ ready: return; ctrltimeout: printf("%s:%d:%d: %s timed out\n", - chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive, errstring); + chp->wdc->sc_dev.dv_xname, chp->channel, xfer->c_drive, errstring); ata_bio->error = TIMEOUT; goto ctrldone; ctrlerror: printf("%s:%d:%d: %s ", - chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive, + chp->wdc->sc_dev.dv_xname, chp->channel, xfer->c_drive, errstring); if (chp->ch_status & WDCS_DWF) { printf("drive fault\n"); @@ -329,18 +329,18 @@ ctrldone: } static void -_wdc_ata_bio_start(struct channel_softc *chp, struct wdc_xfer *xfer) +_wdc_ata_bio_start(struct channel_softc *chp, struct ata_xfer *xfer) { int wait_flags = (xfer->c_flags & C_POLL) ? AT_POLL : 0; - struct ata_bio *ata_bio = xfer->cmd; - struct ata_drive_datas *drvp = &chp->ch_drive[xfer->drive]; + struct ata_bio *ata_bio = xfer->c_cmd; + struct ata_drive_datas *drvp = &chp->ch_drive[xfer->c_drive]; u_int16_t cyl; u_int8_t head, sect, cmd = 0; int nblks; int dma_flags = 0; WDCDEBUG_PRINT(("_wdc_ata_bio_start %s:%d:%d\n", - chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive), + chp->wdc->sc_dev.dv_xname, chp->channel, xfer->c_drive), DEBUG_INTR | DEBUG_XFERS); if (xfer->c_flags & C_DMA) { @@ -411,8 +411,8 @@ again: WDCC_READDMA : WDCC_WRITEDMA; /* Init the DMA channel. */ if ((*chp->wdc->dma_init)(chp->wdc->dma_arg, - chp->channel, xfer->drive, - (char *)xfer->databuf + xfer->c_skip, + chp->channel, xfer->c_drive, + (char *)xfer->c_databuf + xfer->c_skip, ata_bio->nbytes, dma_flags) != 0) { ata_bio->error = ERR_DMA; ata_bio->r_error = 0; @@ -421,9 +421,9 @@ again: } /* Initiate command */ if (chp->wdc->cap & WDC_CAPABILITY_SELECT) - chp->wdc->select(chp,xfer->drive); + chp->wdc->select(chp, xfer->c_drive); bus_space_write_1(chp->cmd_iot, chp->cmd_iohs[wd_sdh], - 0, WDSD_IBM | (xfer->drive << 4)); + 0, WDSD_IBM | (xfer->c_drive << 4)); switch(wait_for_ready(chp, ATA_DELAY, wait_flags)) { case WDCWAIT_OK: break; @@ -433,15 +433,15 @@ again: return; } if (ata_bio->flags & ATA_LBA48) { - wdccommandext(chp, xfer->drive, to48(cmd), + wdccommandext(chp, xfer->c_drive, to48(cmd), (u_int64_t)ata_bio->blkno, nblks); } else { - wdccommand(chp, xfer->drive, cmd, cyl, + wdccommand(chp, xfer->c_drive, cmd, cyl, head, sect, nblks, 0); } /* start the DMA channel */ (*chp->wdc->dma_start)(chp->wdc->dma_arg, - chp->channel, xfer->drive); + chp->channel, xfer->c_drive); chp->ch_flags |= WDCF_DMA_WAIT; /* start timeout machinery */ if ((xfer->c_flags & C_POLL) == 0) @@ -461,9 +461,9 @@ again: } /* Initiate command! */ if (chp->wdc->cap & WDC_CAPABILITY_SELECT) - chp->wdc->select(chp,xfer->drive); + chp->wdc->select(chp, xfer->c_drive); bus_space_write_1(chp->cmd_iot, chp->cmd_iohs[wd_sdh], 0, - WDSD_IBM | (xfer->drive << 4)); + WDSD_IBM | (xfer->c_drive << 4)); switch(wait_for_ready(chp, ATA_DELAY, wait_flags)) { case WDCWAIT_OK: break; @@ -473,10 +473,10 @@ again: return; } if (ata_bio->flags & ATA_LBA48) { - wdccommandext(chp, xfer->drive, to48(cmd), + wdccommandext(chp, xfer->c_drive, to48(cmd), (u_int64_t) ata_bio->blkno, nblks); } else { - wdccommand(chp, xfer->drive, cmd, cyl, + wdccommand(chp, xfer->c_drive, cmd, cyl, head, sect, nblks, (ata_bio->lp->d_type == DTYPE_ST506) ? ata_bio->lp->d_precompcyl / 4 : 0); @@ -503,7 +503,7 @@ again: printf("%s:%d:%d: timeout waiting for DRQ, " "st=0x%02x, err=0x%02x\n", chp->wdc->sc_dev.dv_xname, chp->channel, - xfer->drive, chp->ch_status, chp->ch_error); + xfer->c_drive, chp->ch_status, chp->ch_error); if (wdc_ata_err(drvp, ata_bio) != WDC_ATA_ERR) ata_bio->error = TIMEOUT; wdc_ata_bio_done(chp, xfer); @@ -517,13 +517,13 @@ again: if (drvp->drive_flags & DRIVE_CAP32) { bus_space_write_multi_4(chp->data32iot, chp->data32ioh, 0, - (u_int32_t *)((char *)xfer->databuf + + (u_int32_t *)((char *)xfer->c_databuf + xfer->c_skip), ata_bio->nbytes >> 2); } else { bus_space_write_multi_2(chp->cmd_iot, chp->cmd_iohs[wd_data], 0, - (u_int16_t *)((char *)xfer->databuf + + (u_int16_t *)((char *)xfer->c_databuf + xfer->c_skip), ata_bio->nbytes >> 1); } @@ -531,13 +531,13 @@ again: if (drvp->drive_flags & DRIVE_CAP32) { bus_space_write_multi_stream_4(chp->data32iot, chp->data32ioh, 0, - (u_int32_t *)((char *)xfer->databuf + + (u_int32_t *)((char *)xfer->c_databuf + xfer->c_skip), ata_bio->nbytes >> 2); } else { bus_space_write_multi_stream_2(chp->cmd_iot, chp->cmd_iohs[wd_data], 0, - (u_int16_t *)((char *)xfer->databuf + + (u_int16_t *)((char *)xfer->c_databuf + xfer->c_skip), ata_bio->nbytes >> 1); } @@ -561,7 +561,7 @@ intr: /* Wait for IRQ (either real or polled) */ return; timeout: printf("%s:%d:%d: not ready, st=0x%02x, err=0x%02x\n", - chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive, + chp->wdc->sc_dev.dv_xname, chp->channel, xfer->c_drive, chp->ch_status, chp->ch_error); if (wdc_ata_err(drvp, ata_bio) != WDC_ATA_ERR) ata_bio->error = TIMEOUT; @@ -570,21 +570,21 @@ timeout: } static int -wdc_ata_bio_intr(struct channel_softc *chp, struct wdc_xfer *xfer, int irq) +wdc_ata_bio_intr(struct channel_softc *chp, struct ata_xfer *xfer, int irq) { - struct ata_bio *ata_bio = xfer->cmd; - struct ata_drive_datas *drvp = &chp->ch_drive[xfer->drive]; + struct ata_bio *ata_bio = xfer->c_cmd; + struct ata_drive_datas *drvp = &chp->ch_drive[xfer->c_drive]; int drv_err; WDCDEBUG_PRINT(("wdc_ata_bio_intr %s:%d:%d\n", - chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive), + chp->wdc->sc_dev.dv_xname, chp->channel, xfer->c_drive), DEBUG_INTR | DEBUG_XFERS); /* Is it not a transfer, but a control operation? */ if (drvp->state < READY) { printf("%s:%d:%d: bad state %d in wdc_ata_bio_intr\n", - chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive, + chp->wdc->sc_dev.dv_xname, chp->channel, xfer->c_drive, drvp->state); panic("wdc_ata_bio_intr: bad state"); } @@ -604,7 +604,7 @@ wdc_ata_bio_intr(struct channel_softc *chp, struct wdc_xfer *xfer, int irq) if (irq && (xfer->c_flags & C_TIMEOU) == 0) return 0; /* IRQ was not for us */ printf("%s:%d:%d: device timeout, c_bcount=%d, c_skip%d\n", - chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive, + chp->wdc->sc_dev.dv_xname, chp->channel, xfer->c_drive, xfer->c_bcount, xfer->c_skip); /* if we were using DMA, flag a DMA error */ if (xfer->c_flags & C_DMA) { @@ -633,7 +633,8 @@ wdc_ata_bio_intr(struct channel_softc *chp, struct wdc_xfer *xfer, int irq) ATA_DELAY, ATA_POLL) == WDCWAIT_TOUT) { printf("%s:%d:%d: polled transfer timed out " "(st=0x%x)\n", chp->wdc->sc_dev.dv_xname, - chp->channel, xfer->drive, chp->ch_status); + chp->channel, xfer->c_drive, + chp->ch_status); ata_bio->error = TIMEOUT; drv_err = WDC_ATA_ERR; } @@ -648,7 +649,7 @@ wdc_ata_bio_intr(struct channel_softc *chp, struct wdc_xfer *xfer, int irq) if (drv_err != WDC_ATA_ERR) { printf("%s:%d:%d: intr with DRQ (st=0x%x)\n", chp->wdc->sc_dev.dv_xname, chp->channel, - xfer->drive, chp->ch_status); + xfer->c_drive, chp->ch_status); ata_bio->error = TIMEOUT; drv_err = WDC_ATA_ERR; } @@ -669,7 +670,7 @@ wdc_ata_bio_intr(struct channel_softc *chp, struct wdc_xfer *xfer, int irq) if ((chp->ch_status & WDCS_DRQ) != WDCS_DRQ) { printf("%s:%d:%d: read intr before drq\n", chp->wdc->sc_dev.dv_xname, chp->channel, - xfer->drive); + xfer->c_drive); ata_bio->error = TIMEOUT; wdc_ata_bio_done(chp, xfer); return 1; @@ -678,13 +679,13 @@ wdc_ata_bio_intr(struct channel_softc *chp, struct wdc_xfer *xfer, int irq) if (drvp->drive_flags & DRIVE_CAP32) { bus_space_read_multi_4(chp->data32iot, chp->data32ioh, 0, - (u_int32_t *)((char *)xfer->databuf + + (u_int32_t *)((char *)xfer->c_databuf + xfer->c_skip), ata_bio->nbytes >> 2); } else { bus_space_read_multi_2(chp->cmd_iot, chp->cmd_iohs[wd_data], 0, - (u_int16_t *)((char *)xfer->databuf + + (u_int16_t *)((char *)xfer->c_databuf + xfer->c_skip), ata_bio->nbytes >> 1); } @@ -692,13 +693,13 @@ wdc_ata_bio_intr(struct channel_softc *chp, struct wdc_xfer *xfer, int irq) if (drvp->drive_flags & DRIVE_CAP32) { bus_space_read_multi_stream_4(chp->data32iot, chp->data32ioh, 0, - (u_int32_t *)((char *)xfer->databuf + + (u_int32_t *)((char *)xfer->c_databuf + xfer->c_skip), ata_bio->nbytes >> 2); } else { bus_space_read_multi_stream_2(chp->cmd_iot, chp->cmd_iohs[wd_data], 0, - (u_int16_t *)((char *)xfer->databuf + + (u_int16_t *)((char *)xfer->c_databuf + xfer->c_skip), ata_bio->nbytes >> 1); } @@ -735,10 +736,10 @@ wdc_ata_kill_pending(struct ata_drive_datas *drvp) } static void -wdc_ata_bio_kill_xfer(struct channel_softc *chp, struct wdc_xfer *xfer) +wdc_ata_bio_kill_xfer(struct channel_softc *chp, struct ata_xfer *xfer) { - struct ata_bio *ata_bio = xfer->cmd; - int drive = xfer->drive; + struct ata_bio *ata_bio = xfer->c_cmd; + int drive = xfer->c_drive; callout_stop(&chp->ch_callout); /* remove this command from xfer queue */ @@ -752,13 +753,13 @@ wdc_ata_bio_kill_xfer(struct channel_softc *chp, struct wdc_xfer *xfer) } static void -wdc_ata_bio_done(struct channel_softc *chp, struct wdc_xfer *xfer) +wdc_ata_bio_done(struct channel_softc *chp, struct ata_xfer *xfer) { - struct ata_bio *ata_bio = xfer->cmd; - int drive = xfer->drive; + struct ata_bio *ata_bio = xfer->c_cmd; + int drive = xfer->c_drive; WDCDEBUG_PRINT(("wdc_ata_bio_done %s:%d:%d: flags 0x%x\n", - chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive, + chp->wdc->sc_dev.dv_xname, chp->channel, xfer->c_drive, (u_int)xfer->c_flags), DEBUG_XFERS); diff --git a/sys/dev/ata/atavar.h b/sys/dev/ata/atavar.h index 3b722673ff4..11be268d734 100644 --- a/sys/dev/ata/atavar.h +++ b/sys/dev/ata/atavar.h @@ -1,4 +1,4 @@ -/* $NetBSD: atavar.h,v 1.38 2003/12/30 19:12:24 thorpej Exp $ */ +/* $NetBSD: atavar.h,v 1.39 2004/01/01 17:18:54 thorpej Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. @@ -35,6 +35,43 @@ #include <sys/lock.h> #include <sys/queue.h> +/* + * Description of a command to be handled by an ATA controller. These + * commands are queued in a list. + */ +struct ata_xfer { + __volatile u_int c_flags; /* command state flags */ + + /* Channel and drive that are to process the request. */ + struct channel_softc *c_chp; + int c_drive; + + void *c_cmd; /* private request structure pointer */ + void *c_databuf; /* pointer to data buffer */ + int c_bcount; /* byte count left */ + int c_skip; /* bytes already transferred */ + int c_dscpoll; /* counter for dsc polling (ATAPI) */ + + /* Link on the command queue. */ + TAILQ_ENTRY(ata_xfer) c_xferchain; + + /* Low-level protocol handlers. */ + void (*c_start)(struct channel_softc *, struct ata_xfer *); + int (*c_intr)(struct channel_softc *, struct ata_xfer *, int); + void (*c_kill_xfer)(struct channel_softc *, struct ata_xfer *); +}; + +#define C_ATAPI 0x0001 /* xfer is ATAPI request */ +#define C_TIMEOU 0x0002 /* xfer processing timed out */ +#define C_POLL 0x0004 /* command is polled */ +#define C_DMA 0x0008 /* command uses DMA */ + +/* Per-channel queue of ata_xfers. May be shared by multiple channels. */ +struct ata_queue { + TAILQ_HEAD(, ata_xfer) queue_xfer; + int queue_freeze; +}; + /* ATA bus instance state information. */ struct atabus_softc { struct device sc_dev; diff --git a/sys/dev/ic/wdc.c b/sys/dev/ic/wdc.c index de454e3b56f..8b10c906614 100644 --- a/sys/dev/ic/wdc.c +++ b/sys/dev/ic/wdc.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc.c,v 1.164 2003/12/30 17:18:11 thorpej Exp $ */ +/* $NetBSD: wdc.c,v 1.165 2004/01/01 17:18:53 thorpej Exp $ */ /* * Copyright (c) 1998, 2001, 2003 Manuel Bouyer. All rights reserved. @@ -70,7 +70,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.164 2003/12/30 17:18:11 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.165 2004/01/01 17:18:53 thorpej Exp $"); #ifndef WDCDEBUG #define WDCDEBUG @@ -146,9 +146,9 @@ const struct ata_bustype wdc_ata_bustype = { int wdcprobe1 __P((struct channel_softc*, int)); static void __wdcerror __P((struct channel_softc*, char *)); static int __wdcwait_reset __P((struct channel_softc *, int, int)); -void __wdccommand_done __P((struct channel_softc *, struct wdc_xfer *)); -void __wdccommand_start __P((struct channel_softc *, struct wdc_xfer *)); -int __wdccommand_intr __P((struct channel_softc *, struct wdc_xfer *, int)); +void __wdccommand_done __P((struct channel_softc *, struct ata_xfer *)); +void __wdccommand_start __P((struct channel_softc *, struct ata_xfer *)); +int __wdccommand_intr __P((struct channel_softc *, struct ata_xfer *, int)); int __wdcwait __P((struct channel_softc *, int, int, int)); void wdc_finish_attach __P((struct device *)); void wdc_channel_attach __P((struct channel_softc *)); @@ -661,12 +661,12 @@ wdcattach(struct channel_softc *chp) if (chp->wdc->drv_probe == NULL) chp->wdc->drv_probe = wdc_drvprobe; if (inited == 0) { - /* Initialize the wdc_xfer pool. */ - pool_init(&wdc_xfer_pool, sizeof(struct wdc_xfer), 0, + /* Initialize the ata_xfer pool. */ + pool_init(&wdc_xfer_pool, sizeof(struct ata_xfer), 0, 0, 0, "wdcspl", NULL); inited++; } - TAILQ_INIT(&chp->ch_queue->sc_xfer); + TAILQ_INIT(&chp->ch_queue->queue_xfer); chp->ch_queue->queue_freeze = 0; chp->atabus = config_found(&chp->wdc->sc_dev, chp, atabusprint); @@ -722,7 +722,7 @@ wdcdetach(struct device *self, int flags) void wdcstart(struct channel_softc *chp) { - struct wdc_xfer *xfer; + struct ata_xfer *xfer; #ifdef WDC_DIAGNOSTIC int spl1, spl2; @@ -738,11 +738,11 @@ wdcstart(struct channel_softc *chp) #endif /* WDC_DIAGNOSTIC */ /* is there a xfer ? */ - if ((xfer = chp->ch_queue->sc_xfer.tqh_first) == NULL) + if ((xfer = TAILQ_FIRST(&chp->ch_queue->queue_xfer)) == NULL) return; /* adjust chp, in case we have a shared queue */ - chp = xfer->chp; + chp = xfer->c_chp; if ((chp->ch_flags & WDCF_ACTIVE) != 0 ) { return; /* channel aleady active */ @@ -759,11 +759,11 @@ wdcstart(struct channel_softc *chp) return; WDCDEBUG_PRINT(("wdcstart: xfer %p channel %d drive %d\n", xfer, - chp->channel, xfer->drive), DEBUG_XFERS); + chp->channel, xfer->c_drive), DEBUG_XFERS); chp->ch_flags |= WDCF_ACTIVE; - if (chp->ch_drive[xfer->drive].drive_flags & DRIVE_RESET) { - chp->ch_drive[xfer->drive].drive_flags &= ~DRIVE_RESET; - chp->ch_drive[xfer->drive].state = 0; + if (chp->ch_drive[xfer->c_drive].drive_flags & DRIVE_RESET) { + chp->ch_drive[xfer->c_drive].drive_flags &= ~DRIVE_RESET; + chp->ch_drive[xfer->c_drive].state = 0; } if (chp->wdc->cap & WDC_CAPABILITY_NOIRQ) KASSERT(xfer->c_flags & C_POLL); @@ -793,7 +793,7 @@ int wdcintr(void *arg) { struct channel_softc *chp = arg; - struct wdc_xfer *xfer; + struct ata_xfer *xfer; int ret; if ((chp->wdc->sc_dev.dv_flags & DVF_ACTIVE) == 0) { @@ -810,11 +810,11 @@ wdcintr(void *arg) } WDCDEBUG_PRINT(("wdcintr\n"), DEBUG_INTR); - xfer = chp->ch_queue->sc_xfer.tqh_first; + xfer = TAILQ_FIRST(&chp->ch_queue->queue_xfer); if (chp->ch_flags & WDCF_DMA_WAIT) { chp->wdc->dma_status = (*chp->wdc->dma_finish)(chp->wdc->dma_arg, chp->channel, - xfer->drive, 0); + xfer->c_drive, 0); if (chp->wdc->dma_status & WDC_DMAST_NOIRQ) { /* IRQ not for us, not detected by DMA engine */ return 0; @@ -1035,7 +1035,7 @@ __wdcwait(struct channel_softc *chp, int mask, int bits, int timeout) #ifdef WDCNDELAY_DEBUG /* After autoconfig, there should be no long delays. */ if (!cold && time > WDCNDELAY_DEBUG) { - struct wdc_xfer *xfer = chp->ch_queue->sc_xfer.tqh_first; + struct ata_xfer *xfer = TAILQ_FIRST(&chp->ch_queue->queue_xfer); if (xfer == NULL) printf("%s channel %d: warning: busy-wait took %dus\n", chp->wdc->sc_dev.dv_xname, chp->channel, @@ -1102,20 +1102,20 @@ wdcwait(struct channel_softc *chp, int mask, int bits, int timeout, int flags) * Busy-wait for DMA to complete */ int -wdc_dmawait(struct channel_softc *chp, struct wdc_xfer *xfer, int timeout) +wdc_dmawait(struct channel_softc *chp, struct ata_xfer *xfer, int timeout) { int time; for (time = 0; time < timeout * 1000 / WDCDELAY; time++) { chp->wdc->dma_status = (*chp->wdc->dma_finish)(chp->wdc->dma_arg, - chp->channel, xfer->drive, 0); + chp->channel, xfer->c_drive, 0); if ((chp->wdc->dma_status & WDC_DMAST_NOIRQ) == 0) return 0; delay(WDCDELAY); } /* timeout, force a DMA halt */ chp->wdc->dma_status = (*chp->wdc->dma_finish)(chp->wdc->dma_arg, - chp->channel, xfer->drive, 1); + chp->channel, xfer->c_drive, 1); return 1; } @@ -1123,7 +1123,7 @@ void wdctimeout(void *arg) { struct channel_softc *chp = (struct channel_softc *)arg; - struct wdc_xfer *xfer = chp->ch_queue->sc_xfer.tqh_first; + struct ata_xfer *xfer = TAILQ_FIRST(&chp->ch_queue->queue_xfer); int s; WDCDEBUG_PRINT(("wdctimeout\n"), DEBUG_FUNCS); @@ -1138,7 +1138,7 @@ wdctimeout(void *arg) if (chp->ch_flags & WDCF_DMA_WAIT) { chp->wdc->dma_status = (*chp->wdc->dma_finish)(chp->wdc->dma_arg, - chp->channel, xfer->drive, 1); + chp->channel, xfer->c_drive, 1); chp->ch_flags &= ~WDCF_DMA_WAIT; } /* @@ -1442,7 +1442,7 @@ int wdc_exec_command(struct ata_drive_datas *drvp, struct wdc_command *wdc_c) { struct channel_softc *chp = drvp->chnl_softc; - struct wdc_xfer *xfer; + struct ata_xfer *xfer; int s, ret; WDCDEBUG_PRINT(("wdc_exec_command %s:%d:%d\n", @@ -1460,10 +1460,10 @@ wdc_exec_command(struct ata_drive_datas *drvp, struct wdc_command *wdc_c) wdc_c->flags |= AT_POLL; if (wdc_c->flags & AT_POLL) xfer->c_flags |= C_POLL; - xfer->drive = drvp->drive; - xfer->databuf = wdc_c->data; + xfer->c_drive = drvp->drive; + xfer->c_databuf = wdc_c->data; xfer->c_bcount = wdc_c->bcount; - xfer->cmd = wdc_c; + xfer->c_cmd = wdc_c; xfer->c_start = __wdccommand_start; xfer->c_intr = __wdccommand_intr; xfer->c_kill_xfer = __wdccommand_done; @@ -1492,13 +1492,13 @@ wdc_exec_command(struct ata_drive_datas *drvp, struct wdc_command *wdc_c) } void -__wdccommand_start(struct channel_softc *chp, struct wdc_xfer *xfer) +__wdccommand_start(struct channel_softc *chp, struct ata_xfer *xfer) { - int drive = xfer->drive; - struct wdc_command *wdc_c = xfer->cmd; + int drive = xfer->c_drive; + struct wdc_command *wdc_c = xfer->c_cmd; WDCDEBUG_PRINT(("__wdccommand_start %s:%d:%d\n", - chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive), + chp->wdc->sc_dev.dv_xname, chp->channel, xfer->c_drive), DEBUG_FUNCS); if (chp->wdc->cap & WDC_CAPABILITY_SELECT) @@ -1539,9 +1539,9 @@ __wdccommand_start(struct channel_softc *chp, struct wdc_xfer *xfer) } int -__wdccommand_intr(struct channel_softc *chp, struct wdc_xfer *xfer, int irq) +__wdccommand_intr(struct channel_softc *chp, struct ata_xfer *xfer, int irq) { - struct wdc_command *wdc_c = xfer->cmd; + struct wdc_command *wdc_c = xfer->c_cmd; int bcount = wdc_c->bcount; char *data = wdc_c->data; int wflags; @@ -1555,7 +1555,8 @@ __wdccommand_intr(struct channel_softc *chp, struct wdc_xfer *xfer, int irq) again: WDCDEBUG_PRINT(("__wdccommand_intr %s:%d:%d\n", - chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive), DEBUG_INTR); + chp->wdc->sc_dev.dv_xname, chp->channel, xfer->c_drive), + DEBUG_INTR); /* * after a ATAPI_SOFT_RESET, the device will have released the bus. * Reselect again, it doesn't hurt for others commands, and the time @@ -1563,7 +1564,7 @@ __wdccommand_intr(struct channel_softc *chp, struct wdc_xfer *xfer, int irq) * wdc_exec_command() isn't called often (mosly for autoconfig) */ bus_space_write_1(chp->cmd_iot, chp->cmd_iohs[wd_sdh], 0, - WDSD_IBM | (xfer->drive << 4)); + WDSD_IBM | (xfer->c_drive << 4)); if ((wdc_c->flags & AT_XFDONE) != 0) { /* * We have completed a data xfer. The drive should now be @@ -1592,7 +1593,7 @@ __wdccommand_intr(struct channel_softc *chp, struct wdc_xfer *xfer, int irq) wdc_c->flags |= AT_TIMEOU; goto out; } - if (chp->ch_drive[xfer->drive].drive_flags & DRIVE_CAP32) { + if (chp->ch_drive[xfer->c_drive].drive_flags & DRIVE_CAP32) { bus_space_read_multi_4(chp->data32iot, chp->data32ioh, 0, (u_int32_t*)data, bcount >> 2); data += bcount & 0xfffffffc; @@ -1610,7 +1611,7 @@ __wdccommand_intr(struct channel_softc *chp, struct wdc_xfer *xfer, int irq) wdc_c->flags |= AT_TIMEOU; goto out; } - if (chp->ch_drive[xfer->drive].drive_flags & DRIVE_CAP32) { + if (chp->ch_drive[xfer->c_drive].drive_flags & DRIVE_CAP32) { bus_space_write_multi_4(chp->data32iot, chp->data32ioh, 0, (u_int32_t*)data, bcount >> 2); data += bcount & 0xfffffffc; @@ -1636,12 +1637,13 @@ __wdccommand_intr(struct channel_softc *chp, struct wdc_xfer *xfer, int irq) } void -__wdccommand_done(struct channel_softc *chp, struct wdc_xfer *xfer) +__wdccommand_done(struct channel_softc *chp, struct ata_xfer *xfer) { - struct wdc_command *wdc_c = xfer->cmd; + struct wdc_command *wdc_c = xfer->c_cmd; WDCDEBUG_PRINT(("__wdccommand_done %s:%d:%d\n", - chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive), DEBUG_FUNCS); + chp->wdc->sc_dev.dv_xname, chp->channel, xfer->c_drive), + DEBUG_FUNCS); callout_stop(&chp->ch_callout); @@ -1790,14 +1792,14 @@ wdccommandshort(struct channel_softc *chp, int drive, int command) /* Add a command to the queue and start controller. Must be called at splbio */ void -wdc_exec_xfer(struct channel_softc *chp, struct wdc_xfer *xfer) +wdc_exec_xfer(struct channel_softc *chp, struct ata_xfer *xfer) { WDCDEBUG_PRINT(("wdc_exec_xfer %p channel %d drive %d\n", xfer, - chp->channel, xfer->drive), DEBUG_XFERS); + chp->channel, xfer->c_drive), DEBUG_XFERS); /* complete xfer setup */ - xfer->chp = chp; + xfer->c_chp = chp; /* * If we are a polled command, and the list is not empty, @@ -1805,20 +1807,20 @@ wdc_exec_xfer(struct channel_softc *chp, struct wdc_xfer *xfer) * to complete, we're going to reboot soon anyway. */ if ((xfer->c_flags & C_POLL) != 0 && - chp->ch_queue->sc_xfer.tqh_first != NULL) { - TAILQ_INIT(&chp->ch_queue->sc_xfer); + TAILQ_FIRST(&chp->ch_queue->queue_xfer) != NULL) { + TAILQ_INIT(&chp->ch_queue->queue_xfer); } /* insert at the end of command list */ - TAILQ_INSERT_TAIL(&chp->ch_queue->sc_xfer,xfer , c_xferchain); + TAILQ_INSERT_TAIL(&chp->ch_queue->queue_xfer, xfer, c_xferchain); WDCDEBUG_PRINT(("wdcstart from wdc_exec_xfer, flags 0x%x\n", chp->ch_flags), DEBUG_XFERS); wdcstart(chp); } -struct wdc_xfer * +struct ata_xfer * wdc_get_xfer(int flags) { - struct wdc_xfer *xfer; + struct ata_xfer *xfer; int s; s = splbio(); @@ -1826,13 +1828,13 @@ wdc_get_xfer(int flags) ((flags & WDC_NOSLEEP) != 0 ? PR_NOWAIT : PR_WAITOK)); splx(s); if (xfer != NULL) { - memset(xfer, 0, sizeof(struct wdc_xfer)); + memset(xfer, 0, sizeof(struct ata_xfer)); } return xfer; } void -wdc_free_xfer(struct channel_softc *chp, struct wdc_xfer *xfer) +wdc_free_xfer(struct channel_softc *chp, struct ata_xfer *xfer) { struct wdc_softc *wdc = chp->wdc; int s; @@ -1841,7 +1843,7 @@ wdc_free_xfer(struct channel_softc *chp, struct wdc_xfer *xfer) (*wdc->free_hw)(chp); s = splbio(); chp->ch_flags &= ~WDCF_ACTIVE; - TAILQ_REMOVE(&chp->ch_queue->sc_xfer, xfer, c_xferchain); + TAILQ_REMOVE(&chp->ch_queue->queue_xfer, xfer, c_xferchain); pool_put(&wdc_xfer_pool, xfer); splx(s); } @@ -1854,10 +1856,10 @@ wdc_free_xfer(struct channel_softc *chp, struct wdc_xfer *xfer) void wdc_kill_pending(struct channel_softc *chp) { - struct wdc_xfer *xfer; + struct ata_xfer *xfer; - while ((xfer = TAILQ_FIRST(&chp->ch_queue->sc_xfer)) != NULL) { - chp = xfer->chp; + while ((xfer = TAILQ_FIRST(&chp->ch_queue->queue_xfer)) != NULL) { + chp = xfer->c_chp; (*xfer->c_kill_xfer)(chp, xfer); } } @@ -1865,14 +1867,14 @@ wdc_kill_pending(struct channel_softc *chp) static void __wdcerror(struct channel_softc *chp, char *msg) { - struct wdc_xfer *xfer = chp->ch_queue->sc_xfer.tqh_first; + struct ata_xfer *xfer = TAILQ_FIRST(&chp->ch_queue->queue_xfer); if (xfer == NULL) printf("%s:%d: %s\n", chp->wdc->sc_dev.dv_xname, chp->channel, msg); else printf("%s:%d:%d: %s\n", chp->wdc->sc_dev.dv_xname, - chp->channel, xfer->drive, msg); + chp->channel, xfer->c_drive, msg); } /* diff --git a/sys/dev/ic/wdc_upc.c b/sys/dev/ic/wdc_upc.c index f2cf400e22a..72620e420d0 100644 --- a/sys/dev/ic/wdc_upc.c +++ b/sys/dev/ic/wdc_upc.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_upc.c,v 1.12 2003/12/30 20:20:21 thorpej Exp $ */ +/* $NetBSD: wdc_upc.c,v 1.13 2004/01/01 17:18:53 thorpej Exp $ */ /*- * Copyright (c) 2000 Ben Harris * All rights reserved. @@ -28,7 +28,7 @@ /* This file is part of NetBSD/arm26 -- a port of NetBSD to ARM2/3 machines. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc_upc.c,v 1.12 2003/12/30 20:20:21 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_upc.c,v 1.13 2004/01/01 17:18:53 thorpej Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -51,7 +51,7 @@ struct wdc_upc_softc { struct wdc_softc sc_wdc; struct channel_softc *sc_chanlist[1]; struct channel_softc sc_channel; - struct channel_queue sc_chqueue; + struct ata_queue sc_chqueue; }; CFATTACH_DECL(wdc_upc, sizeof(struct wdc_upc_softc), diff --git a/sys/dev/ic/wdcvar.h b/sys/dev/ic/wdcvar.h index a3a94b25409..82fc8f1195d 100644 --- a/sys/dev/ic/wdcvar.h +++ b/sys/dev/ic/wdcvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: wdcvar.h,v 1.48 2003/12/30 17:18:11 thorpej Exp $ */ +/* $NetBSD: wdcvar.h,v 1.49 2004/01/01 17:18:53 thorpej Exp $ */ /*- * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc. @@ -45,11 +45,6 @@ #define WAITTIME (10 * hz) /* time to wait for a completion */ /* this is a lot for hard drives, but not for cdroms */ -struct channel_queue { /* per channel queue (may be shared) */ - TAILQ_HEAD(xferhead, wdc_xfer) sc_xfer; - int queue_freeze; -}; - #define WDC_NREG 8 /* number of command registers */ struct channel_softc { /* Per channel data */ @@ -92,7 +87,7 @@ struct channel_softc { /* Per channel data */ * channel queues. May be the same for all channels, if hw channels * are not independent. */ - struct channel_queue *ch_queue; + struct ata_queue *ch_queue; /* the channel kernel thread */ struct proc *thread; @@ -160,33 +155,6 @@ struct wdc_softc { /* Per controller state */ void (*irqack) __P((struct channel_softc *)); }; - /* - * Description of a command to be handled by a controller. - * These commands are queued in a list. - */ -struct wdc_xfer { - volatile u_int c_flags; -#define C_ATAPI 0x0001 /* xfer is ATAPI request */ -#define C_TIMEOU 0x0002 /* xfer processing timed out */ -#define C_POLL 0x0004 /* cmd is polled */ -#define C_DMA 0x0008 /* cmd uses DMA */ - - /* Informations about our location */ - struct channel_softc *chp; - u_int8_t drive; - - /* Information about the current transfer */ - void *cmd; /* wdc, ata or scsipi command structure */ - void *databuf; - int c_bcount; /* byte count left */ - int c_skip; /* bytes already transferred */ - int c_dscpoll; /* counter for dsc polling (ATAPI) */ - TAILQ_ENTRY(wdc_xfer) c_xferchain; - void (*c_start) __P((struct channel_softc *, struct wdc_xfer *)); - int (*c_intr) __P((struct channel_softc *, struct wdc_xfer *, int)); - void (*c_kill_xfer) __P((struct channel_softc *, struct wdc_xfer *)); -}; - /* * Public functions which can be called by ATA or ATAPI specific parts, * or bus-specific backends. @@ -197,11 +165,11 @@ void wdcattach __P((struct channel_softc *)); int wdcdetach __P((struct device *, int)); int wdcactivate __P((struct device *, enum devact)); int wdcintr __P((void *)); -void wdc_exec_xfer __P((struct channel_softc *, struct wdc_xfer *)); -struct wdc_xfer *wdc_get_xfer __P((int)); /* int = WDC_NOSLEEP/CANSLEEP */ +void wdc_exec_xfer __P((struct channel_softc *, struct ata_xfer *)); +struct ata_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 wdc_free_xfer __P((struct channel_softc *, struct ata_xfer *)); void wdcstart __P((struct channel_softc *)); void wdcrestart __P((void*)); int wdcreset __P((struct channel_softc *, int)); @@ -211,7 +179,7 @@ int wdcwait __P((struct channel_softc *, int, int, int, int)); #define WDCWAIT_OK 0 /* we have what we asked */ #define WDCWAIT_TOUT -1 /* timed out */ #define WDCWAIT_THR 1 /* return, the kernel thread has been awakened */ -int wdc_dmawait __P((struct channel_softc *, struct wdc_xfer *, int)); +int wdc_dmawait __P((struct channel_softc *, struct ata_xfer *, int)); void wdcbit_bucket __P(( struct channel_softc *, int)); void wdccommand __P((struct channel_softc *, u_int8_t, u_int8_t, u_int16_t, u_int8_t, u_int8_t, u_int8_t, u_int8_t)); diff --git a/sys/dev/isa/wdc_isa.c b/sys/dev/isa/wdc_isa.c index e8a3f421ad5..8ac6f06836e 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.37 2003/11/27 23:02:40 fvdl Exp $ */ +/* $NetBSD: wdc_isa.c,v 1.38 2004/01/01 17:18:53 thorpej Exp $ */ /*- * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc_isa.c,v 1.37 2003/11/27 23:02:40 fvdl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_isa.c,v 1.38 2004/01/01 17:18:53 thorpej Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -67,7 +67,7 @@ struct wdc_isa_softc { struct wdc_softc sc_wdcdev; struct channel_softc *wdc_chanlist[1]; struct channel_softc wdc_channel; - struct channel_queue wdc_chqueue; + struct ata_queue wdc_chqueue; isa_chipset_tag_t sc_ic; void *sc_ih; int sc_drq; diff --git a/sys/dev/isapnp/wdc_isapnp.c b/sys/dev/isapnp/wdc_isapnp.c index 4db4106746a..17cb9f2e954 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.23 2003/11/27 23:02:40 fvdl Exp $ */ +/* $NetBSD: wdc_isapnp.c,v 1.24 2004/01/01 17:18:53 thorpej Exp $ */ /*- * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc_isapnp.c,v 1.23 2003/11/27 23:02:40 fvdl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_isapnp.c,v 1.24 2004/01/01 17:18:53 thorpej Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -62,7 +62,7 @@ struct wdc_isapnp_softc { struct wdc_softc sc_wdcdev; struct channel_softc *wdc_chanlist[1]; struct channel_softc wdc_channel; - struct channel_queue wdc_chqueue; + struct ata_queue wdc_chqueue; isa_chipset_tag_t sc_ic; void *sc_ih; int sc_drq; diff --git a/sys/dev/ofisa/wdc_ofisa.c b/sys/dev/ofisa/wdc_ofisa.c index 3f7737506cb..3d4d27a8241 100644 --- a/sys/dev/ofisa/wdc_ofisa.c +++ b/sys/dev/ofisa/wdc_ofisa.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_ofisa.c,v 1.16 2003/11/27 23:02:40 fvdl Exp $ */ +/* $NetBSD: wdc_ofisa.c,v 1.17 2004/01/01 17:18:53 thorpej Exp $ */ /* * Copyright 1997, 1998 @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc_ofisa.c,v 1.16 2003/11/27 23:02:40 fvdl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_ofisa.c,v 1.17 2004/01/01 17:18:53 thorpej Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -61,7 +61,7 @@ struct wdc_ofisa_softc { struct wdc_softc sc_wdcdev; struct channel_softc *wdc_chanlist[1]; struct channel_softc wdc_channel; - struct channel_queue wdc_chqueue; + struct ata_queue wdc_chqueue; void *sc_ih; }; diff --git a/sys/dev/pci/cmdide.c b/sys/dev/pci/cmdide.c index f0f81882b3c..24a71ae4498 100644 --- a/sys/dev/pci/cmdide.c +++ b/sys/dev/pci/cmdide.c @@ -1,4 +1,4 @@ -/* $NetBSD: cmdide.c,v 1.7 2003/12/13 23:13:41 thorpej Exp $ */ +/* $NetBSD: cmdide.c,v 1.8 2004/01/01 17:18:53 thorpej Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Manuel Bouyer. @@ -165,7 +165,7 @@ cmd_channel_map(struct pci_attach_args *pa, struct pciide_softc *sc, sc->pciide_channels[0].wdc_channel.ch_queue; } else { cp->wdc_channel.ch_queue = - malloc(sizeof(struct channel_queue), M_DEVBUF, M_NOWAIT); + malloc(sizeof(struct ata_queue), M_DEVBUF, M_NOWAIT); } if (cp->wdc_channel.ch_queue == NULL) { aprint_error("%s %s channel: " @@ -508,7 +508,7 @@ cmd680_channel_map(struct pci_attach_args *pa, struct pciide_softc *sc, cp->wdc_channel.wdc = &sc->sc_wdcdev; cp->wdc_channel.ch_queue = - malloc(sizeof(struct channel_queue), M_DEVBUF, M_NOWAIT); + malloc(sizeof(struct ata_queue), M_DEVBUF, M_NOWAIT); if (cp->wdc_channel.ch_queue == NULL) { aprint_error("%s %s channel: " "can't allocate memory for command queue", diff --git a/sys/dev/pci/cypide.c b/sys/dev/pci/cypide.c index 177bac73425..0d9e2b2b1e1 100644 --- a/sys/dev/pci/cypide.c +++ b/sys/dev/pci/cypide.c @@ -1,4 +1,4 @@ -/* $NetBSD: cypide.c,v 1.4 2003/11/27 23:02:40 fvdl Exp $ */ +/* $NetBSD: cypide.c,v 1.5 2004/01/01 17:18:53 thorpej Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Manuel Bouyer. @@ -150,7 +150,7 @@ cy693_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) cp->wdc_channel.channel = 0; cp->wdc_channel.wdc = &sc->sc_wdcdev; cp->wdc_channel.ch_queue = - malloc(sizeof(struct channel_queue), M_DEVBUF, M_NOWAIT); + malloc(sizeof(struct ata_queue), M_DEVBUF, M_NOWAIT); if (cp->wdc_channel.ch_queue == NULL) { aprint_error("%s primary channel: " "can't allocate memory for command queue", diff --git a/sys/dev/pci/pciide_common.c b/sys/dev/pci/pciide_common.c index 98ca5b24dff..4e09d9348ad 100644 --- a/sys/dev/pci/pciide_common.c +++ b/sys/dev/pci/pciide_common.c @@ -1,4 +1,4 @@ -/* $NetBSD: pciide_common.c,v 1.5 2003/12/19 19:09:20 thorpej Exp $ */ +/* $NetBSD: pciide_common.c,v 1.6 2004/01/01 17:18:53 thorpej Exp $ */ /* @@ -76,7 +76,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.5 2003/12/19 19:09:20 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.6 2004/01/01 17:18:53 thorpej Exp $"); #include <sys/param.h> #include <sys/malloc.h> @@ -749,7 +749,7 @@ pciide_chansetup(sc, channel, interface) cp->wdc_channel.channel = channel; cp->wdc_channel.wdc = &sc->sc_wdcdev; cp->wdc_channel.ch_queue = - malloc(sizeof(struct channel_queue), M_DEVBUF, M_NOWAIT); + malloc(sizeof(struct ata_queue), M_DEVBUF, M_NOWAIT); if (cp->wdc_channel.ch_queue == NULL) { aprint_error("%s %s channel: " "can't allocate memory for command queue", diff --git a/sys/dev/pci/satalink.c b/sys/dev/pci/satalink.c index b54daab5c30..9158a0a96fa 100644 --- a/sys/dev/pci/satalink.c +++ b/sys/dev/pci/satalink.c @@ -1,4 +1,4 @@ -/* $NetBSD: satalink.c,v 1.8 2003/12/31 12:46:04 martin Exp $ */ +/* $NetBSD: satalink.c,v 1.9 2004/01/01 17:18:53 thorpej Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -542,7 +542,7 @@ sii3114_chansetup(struct pciide_softc *sc, int channel) cp->wdc_channel.channel = channel; cp->wdc_channel.wdc = &sc->sc_wdcdev; cp->wdc_channel.ch_queue = - malloc(sizeof(struct channel_queue), M_DEVBUF, M_NOWAIT); + malloc(sizeof(struct ata_queue), M_DEVBUF, M_NOWAIT); if (cp->wdc_channel.ch_queue == NULL) { aprint_error("%s %s channel: " "can't allocate memory for command queue", diff --git a/sys/dev/pcmcia/wdc_pcmcia.c b/sys/dev/pcmcia/wdc_pcmcia.c index bd34337e379..f1c878d5e41 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.64 2003/11/27 23:02:40 fvdl Exp $ */ +/* $NetBSD: wdc_pcmcia.c,v 1.65 2004/01/01 17:18:53 thorpej Exp $ */ /*- * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.64 2003/11/27 23:02:40 fvdl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.65 2004/01/01 17:18:53 thorpej Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -63,7 +63,7 @@ struct wdc_pcmcia_softc { struct wdc_softc sc_wdcdev; struct channel_softc *wdc_chanlist[1]; struct channel_softc wdc_channel; - struct channel_queue wdc_chqueue; + struct ata_queue wdc_chqueue; struct pcmcia_io_handle sc_pioh; struct pcmcia_io_handle sc_auxpioh; struct pcmcia_mem_handle sc_pmembaseh; diff --git a/sys/dev/podulebus/dtide.c b/sys/dev/podulebus/dtide.c index b44a61ef914..e573f5cf1df 100644 --- a/sys/dev/podulebus/dtide.c +++ b/sys/dev/podulebus/dtide.c @@ -1,4 +1,4 @@ -/* $NetBSD: dtide.c,v 1.12 2003/11/29 20:30:27 bjh21 Exp $ */ +/* $NetBSD: dtide.c,v 1.13 2004/01/01 17:18:54 thorpej Exp $ */ /*- * Copyright (c) 2000, 2001 Ben Harris @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: dtide.c,v 1.12 2003/11/29 20:30:27 bjh21 Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dtide.c,v 1.13 2004/01/01 17:18:54 thorpej Exp $"); #include <sys/param.h> @@ -53,7 +53,7 @@ struct dtide_softc { struct wdc_softc sc_wdc; struct channel_softc *sc_chp[DTIDE_NCHANNELS];/* pointers to sc_chan */ struct channel_softc sc_chan[DTIDE_NCHANNELS]; - struct channel_queue sc_chq[DTIDE_NCHANNELS]; + struct ata_queue sc_chq[DTIDE_NCHANNELS]; bus_space_tag_t sc_magict; bus_space_handle_t sc_magich; }; diff --git a/sys/dev/podulebus/hcide.c b/sys/dev/podulebus/hcide.c index 807500d73c3..f2dc8ed20af 100644 --- a/sys/dev/podulebus/hcide.c +++ b/sys/dev/podulebus/hcide.c @@ -1,4 +1,4 @@ -/* $NetBSD: hcide.c,v 1.9 2003/11/29 20:30:27 bjh21 Exp $ */ +/* $NetBSD: hcide.c,v 1.10 2004/01/01 17:18:54 thorpej Exp $ */ /*- * Copyright (c) 2000, 2001 Ben Harris @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: hcide.c,v 1.9 2003/11/29 20:30:27 bjh21 Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hcide.c,v 1.10 2004/01/01 17:18:54 thorpej Exp $"); #include <sys/param.h> @@ -52,7 +52,7 @@ struct hcide_softc { struct wdc_softc sc_wdc; struct channel_softc *sc_chp[HCIDE_NCHANNELS];/* pointers to sc_chan */ struct channel_softc sc_chan[HCIDE_NCHANNELS]; - struct channel_queue sc_chq[HCIDE_NCHANNELS]; + struct ata_queue sc_chq[HCIDE_NCHANNELS]; }; static int hcide_match (struct device *, struct cfdata *, void *); diff --git a/sys/dev/scsipi/atapi_wdc.c b/sys/dev/scsipi/atapi_wdc.c index 4343a142fc6..0acd70ca93f 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.62 2003/11/27 23:02:41 fvdl Exp $ */ +/* $NetBSD: atapi_wdc.c,v 1.63 2004/01/01 17:18:54 thorpej Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.62 2003/11/27 23:02:41 fvdl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.63 2004/01/01 17:18:54 thorpej Exp $"); #ifndef WDCDEBUG #define WDCDEBUG @@ -86,12 +86,12 @@ int wdc_atapi_get_params __P((struct scsipi_channel *, int, struct ataparams *)); void wdc_atapi_probe_device __P((struct atapibus_softc *, int)); void wdc_atapi_minphys __P((struct buf *bp)); -void wdc_atapi_start __P((struct channel_softc *,struct wdc_xfer *)); -int wdc_atapi_intr __P((struct channel_softc *, struct wdc_xfer *, int)); -void wdc_atapi_kill_xfer __P((struct channel_softc *, struct wdc_xfer *)); -void wdc_atapi_phase_complete __P((struct wdc_xfer *)); -void wdc_atapi_done __P((struct channel_softc *, struct wdc_xfer *)); -void wdc_atapi_reset __P((struct channel_softc *, struct wdc_xfer *)); +void wdc_atapi_start __P((struct channel_softc *,struct ata_xfer *)); +int wdc_atapi_intr __P((struct channel_softc *, struct ata_xfer *, int)); +void wdc_atapi_kill_xfer __P((struct channel_softc *, struct ata_xfer *)); +void wdc_atapi_phase_complete __P((struct ata_xfer *)); +void wdc_atapi_done __P((struct channel_softc *, struct ata_xfer *)); +void wdc_atapi_reset __P((struct channel_softc *, struct ata_xfer *)); void wdc_atapi_scsipi_request __P((struct scsipi_channel *, scsipi_adapter_req_t, void *)); void wdc_atapi_kill_pending __P((struct scsipi_periph *)); @@ -173,9 +173,9 @@ wdc_atapi_kill_pending(periph) void wdc_atapi_kill_xfer(chp, xfer) struct channel_softc *chp; - struct wdc_xfer *xfer; + struct ata_xfer *xfer; { - struct scsipi_xfer *sc_xfer = xfer->cmd; + struct scsipi_xfer *sc_xfer = xfer->c_cmd; callout_stop(&chp->ch_callout); /* remove this command from xfer queue */ @@ -324,7 +324,7 @@ wdc_atapi_scsipi_request(chan, req, arg) struct scsipi_periph *periph; struct scsipi_xfer *sc_xfer; struct wdc_softc *wdc = (void *)adapt->adapt_dev; - struct wdc_xfer *xfer; + struct ata_xfer *xfer; int channel = chan->chan_channel; int drive, s; @@ -354,7 +354,7 @@ wdc_atapi_scsipi_request(chan, req, arg) if ((wdc->channels[channel]->ch_drive[drive].drive_flags & (DRIVE_DMA | DRIVE_UDMA)) && sc_xfer->datalen > 0) xfer->c_flags |= C_DMA; - xfer->drive = drive; + xfer->c_drive = drive; xfer->c_flags |= C_ATAPI; if (sc_xfer->cmd->opcode == GPCMD_REPORT_KEY || sc_xfer->cmd->opcode == GPCMD_SEND_KEY || @@ -376,8 +376,8 @@ wdc_atapi_scsipi_request(chan, req, arg) if (sc_xfer->datalen < 4 || (sc_xfer->datalen & 0x01)) xfer->c_flags &= ~C_DMA; - xfer->cmd = sc_xfer; - xfer->databuf = sc_xfer->data; + xfer->c_cmd = sc_xfer; + xfer->c_databuf = sc_xfer->data; xfer->c_bcount = sc_xfer->datalen; xfer->c_start = wdc_atapi_start; xfer->c_intr = wdc_atapi_intr; @@ -403,10 +403,10 @@ wdc_atapi_scsipi_request(chan, req, arg) void wdc_atapi_start(chp, xfer) struct channel_softc *chp; - struct wdc_xfer *xfer; + struct ata_xfer *xfer; { - struct scsipi_xfer *sc_xfer = xfer->cmd; - struct ata_drive_datas *drvp = &chp->ch_drive[xfer->drive]; + struct scsipi_xfer *sc_xfer = xfer->c_cmd; + struct ata_drive_datas *drvp = &chp->ch_drive[xfer->c_drive]; int wait_flags = (sc_xfer->xs_control & XS_CTL_POLL) ? AT_POLL : 0; char *errstring; @@ -431,9 +431,9 @@ wdc_atapi_start(chp, xfer) bus_space_write_1(chp->ctl_iot, chp->ctl_ioh, wd_aux_ctlr, WDCTL_4BIT | WDCTL_IDS); if (chp->wdc->cap & WDC_CAPABILITY_SELECT) - chp->wdc->select(chp,xfer->drive); + chp->wdc->select(chp, xfer->c_drive); bus_space_write_1(chp->cmd_iot, chp->cmd_iohs[wd_sdh], 0, - WDSD_IBM | (xfer->drive << 4)); + WDSD_IBM | (xfer->c_drive << 4)); /* Don't try to set mode if controller can't be adjusted */ if ((chp->wdc->cap & WDC_CAPABILITY_MODE) == 0) goto ready; @@ -461,7 +461,7 @@ wdc_atapi_start(chp, xfer) printf("%s:%d:%d: pio setting rejected, " "falling back to PIO mode 0\n", chp->wdc->sc_dev.dv_xname, - chp->channel, xfer->drive); + chp->channel, xfer->c_drive); chp->wdc->set_modes(chp); goto ready; } @@ -492,9 +492,9 @@ ready: wdctimeout, chp); if (chp->wdc->cap & WDC_CAPABILITY_SELECT) - chp->wdc->select(chp,xfer->drive); + chp->wdc->select(chp, xfer->c_drive); bus_space_write_1(chp->cmd_iot, chp->cmd_iohs[wd_sdh], 0, - WDSD_IBM | (xfer->drive << 4)); + WDSD_IBM | (xfer->c_drive << 4)); switch (wait_for_unbusy(chp, ATAPI_DELAY, wait_flags) < 0) { case WDCWAIT_OK: break; @@ -517,7 +517,7 @@ ready: * data is necessary, multiple data transfer phases will be done. */ - wdccommand(chp, xfer->drive, ATAPI_PKT_CMD, + wdccommand(chp, xfer->c_drive, ATAPI_PKT_CMD, xfer->c_bcount <= 0xffff ? xfer->c_bcount : 0xffff, 0, 0, 0, (xfer->c_flags & C_DMA) ? ATAPI_PKT_CMD_FTRE_DMA : 0); @@ -549,14 +549,14 @@ ready: return; timeout: printf("%s:%d:%d: %s timed out\n", - chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive, errstring); + chp->wdc->sc_dev.dv_xname, chp->channel, xfer->c_drive, errstring); sc_xfer->error = XS_TIMEOUT; bus_space_write_1(chp->ctl_iot, chp->ctl_ioh, wd_aux_ctlr, WDCTL_4BIT); wdc_atapi_reset(chp, xfer); return; error: printf("%s:%d:%d: %s ", - chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive, + chp->wdc->sc_dev.dv_xname, chp->channel, xfer->c_drive, errstring); printf("error (0x%x)\n", chp->ch_error); sc_xfer->error = XS_SHORTSENSE; @@ -569,11 +569,11 @@ error: int wdc_atapi_intr(chp, xfer, irq) struct channel_softc *chp; - struct wdc_xfer *xfer; + struct ata_xfer *xfer; int irq; { - struct scsipi_xfer *sc_xfer = xfer->cmd; - struct ata_drive_datas *drvp = &chp->ch_drive[xfer->drive]; + struct scsipi_xfer *sc_xfer = xfer->c_cmd; + struct ata_drive_datas *drvp = &chp->ch_drive[xfer->c_drive]; int len, phase, i, retries=0; int ire; int dma_flags = 0; @@ -585,7 +585,7 @@ wdc_atapi_intr(chp, xfer, irq) /* Is it not a transfer, but a control operation? */ if (drvp->state < READY) { printf("%s:%d:%d: bad state %d in wdc_atapi_intr\n", - chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive, + chp->wdc->sc_dev.dv_xname, chp->channel, xfer->c_drive, drvp->state); panic("wdc_atapi_intr: bad state"); } @@ -601,15 +601,15 @@ wdc_atapi_intr(chp, xfer, irq) /* Ack interrupt done in wait_for_unbusy */ if (chp->wdc->cap & WDC_CAPABILITY_SELECT) - chp->wdc->select(chp,xfer->drive); + chp->wdc->select(chp, xfer->c_drive); bus_space_write_1(chp->cmd_iot, chp->cmd_iohs[wd_sdh], 0, - WDSD_IBM | (xfer->drive << 4)); + WDSD_IBM | (xfer->c_drive << 4)); if (wait_for_unbusy(chp, (irq == 0) ? sc_xfer->timeout : 0, AT_POLL) == WDCWAIT_TOUT) { if (irq && (xfer->c_flags & C_TIMEOU) == 0) return 0; /* IRQ was not for us */ printf("%s:%d:%d: device timeout, c_bcount=%d, c_skip=%d\n", - chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive, + chp->wdc->sc_dev.dv_xname, chp->channel, xfer->c_drive, xfer->c_bcount, xfer->c_skip); if (xfer->c_flags & C_DMA) { ata_dmaerr(drvp, @@ -656,8 +656,8 @@ again: /* Init the DMA channel if necessary */ if (xfer->c_flags & C_DMA) { if ((*chp->wdc->dma_init)(chp->wdc->dma_arg, - chp->channel, xfer->drive, - xfer->databuf, xfer->c_bcount, dma_flags) != 0) { + chp->channel, xfer->c_drive, + xfer->c_databuf, xfer->c_bcount, dma_flags) != 0) { sc_xfer->error = XS_DRIVER_STUFFUP; break; } @@ -686,7 +686,7 @@ again: /* Start the DMA channel if necessary */ if (xfer->c_flags & C_DMA) { (*chp->wdc->dma_start)(chp->wdc->dma_arg, - chp->channel, xfer->drive); + chp->channel, xfer->c_drive); chp->ch_flags |= WDCF_DMA_WAIT; } @@ -715,13 +715,13 @@ again: if ((chp->wdc->cap & WDC_CAPABILITY_ATAPI_NOSTREAM)) { bus_space_write_multi_2(chp->cmd_iot, chp->cmd_iohs[wd_data], 0, - (u_int16_t *)((char *)xfer->databuf + + (u_int16_t *)((char *)xfer->c_databuf + xfer->c_skip), xfer->c_bcount >> 1); } else { bus_space_write_multi_stream_2(chp->cmd_iot, chp->cmd_iohs[wd_data], 0, - (u_int16_t *)((char *)xfer->databuf + + (u_int16_t *)((char *)xfer->c_databuf + xfer->c_skip), xfer->c_bcount >> 1); } @@ -735,13 +735,13 @@ again: if ((chp->wdc->cap & WDC_CAPABILITY_ATAPI_NOSTREAM)) bus_space_write_multi_4(chp->data32iot, chp->data32ioh, 0, - (u_int32_t *)((char *)xfer->databuf + + (u_int32_t *)((char *)xfer->c_databuf + xfer->c_skip), len >> 2); else bus_space_write_multi_stream_4(chp->data32iot, chp->data32ioh, wd_data, - (u_int32_t *)((char *)xfer->databuf + + (u_int32_t *)((char *)xfer->c_databuf + xfer->c_skip), len >> 2); @@ -753,13 +753,13 @@ again: if ((chp->wdc->cap & WDC_CAPABILITY_ATAPI_NOSTREAM)) bus_space_write_multi_2(chp->cmd_iot, chp->cmd_iohs[wd_data], 0, - (u_int16_t *)((char *)xfer->databuf + + (u_int16_t *)((char *)xfer->c_databuf + xfer->c_skip), len >> 1); else bus_space_write_multi_stream_2(chp->cmd_iot, chp->cmd_iohs[wd_data], 0, - (u_int16_t *)((char *)xfer->databuf + + (u_int16_t *)((char *)xfer->c_databuf + xfer->c_skip), len >> 1); xfer->c_skip += len; @@ -791,13 +791,13 @@ again: if ((chp->wdc->cap & WDC_CAPABILITY_ATAPI_NOSTREAM)) { bus_space_read_multi_2(chp->cmd_iot, chp->cmd_iohs[wd_data], 0, - (u_int16_t *)((char *)xfer->databuf + + (u_int16_t *)((char *)xfer->c_databuf + xfer->c_skip), xfer->c_bcount >> 1); } else { bus_space_read_multi_stream_2(chp->cmd_iot, chp->cmd_iohs[wd_data], 0, - (u_int16_t *)((char *)xfer->databuf + + (u_int16_t *)((char *)xfer->c_databuf + xfer->c_skip), xfer->c_bcount >> 1); } @@ -809,13 +809,13 @@ again: if ((chp->wdc->cap & WDC_CAPABILITY_ATAPI_NOSTREAM)) bus_space_read_multi_4(chp->data32iot, chp->data32ioh, 0, - (u_int32_t *)((char *)xfer->databuf + + (u_int32_t *)((char *)xfer->c_databuf + xfer->c_skip), len >> 2); else bus_space_read_multi_stream_4(chp->data32iot, chp->data32ioh, wd_data, - (u_int32_t *)((char *)xfer->databuf + + (u_int32_t *)((char *)xfer->c_databuf + xfer->c_skip), len >> 2); @@ -827,13 +827,13 @@ again: if ((chp->wdc->cap & WDC_CAPABILITY_ATAPI_NOSTREAM)) bus_space_read_multi_2(chp->cmd_iot, chp->cmd_iohs[wd_data], 0, - (u_int16_t *)((char *)xfer->databuf + + (u_int16_t *)((char *)xfer->c_databuf + xfer->c_skip), len >> 1); else bus_space_read_multi_stream_2(chp->cmd_iot, chp->cmd_iohs[wd_data], 0, - (u_int16_t *)((char *)xfer->databuf + + (u_int16_t *)((char *)xfer->c_databuf + xfer->c_skip), len >> 1); xfer->c_skip += len; @@ -887,17 +887,17 @@ again: void wdc_atapi_phase_complete(xfer) - struct wdc_xfer *xfer; + struct ata_xfer *xfer; { - struct channel_softc *chp = xfer->chp; - struct scsipi_xfer *sc_xfer = xfer->cmd; - struct ata_drive_datas *drvp = &chp->ch_drive[xfer->drive]; + struct channel_softc *chp = xfer->c_chp; + struct scsipi_xfer *sc_xfer = xfer->c_cmd; + struct ata_drive_datas *drvp = &chp->ch_drive[xfer->c_drive]; /* wait for DSC if needed */ if (drvp->drive_flags & DRIVE_ATAPIST) { WDCDEBUG_PRINT(("wdc_atapi_phase_complete(%s:%d:%d) " "polldsc %d\n", chp->wdc->sc_dev.dv_xname, chp->channel, - xfer->drive, xfer->c_dscpoll), DEBUG_XFERS); + xfer->c_drive, xfer->c_dscpoll), DEBUG_XFERS); #if 1 if (cold) panic("wdc_atapi_phase_complete: cold"); @@ -910,7 +910,7 @@ wdc_atapi_phase_complete(xfer) printf("%s:%d:%d: wait_for_dsc " "failed\n", chp->wdc->sc_dev.dv_xname, - chp->channel, xfer->drive); + chp->channel, xfer->c_drive); sc_xfer->error = XS_TIMEOUT; wdc_atapi_reset(chp, xfer); return; @@ -966,12 +966,12 @@ wdc_atapi_phase_complete(xfer) void wdc_atapi_done(chp, xfer) struct channel_softc *chp; - struct wdc_xfer *xfer; + struct ata_xfer *xfer; { - struct scsipi_xfer *sc_xfer = xfer->cmd; + struct scsipi_xfer *sc_xfer = xfer->c_cmd; WDCDEBUG_PRINT(("wdc_atapi_done %s:%d:%d: flags 0x%x\n", - chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive, + chp->wdc->sc_dev.dv_xname, chp->channel, xfer->c_drive, (u_int)xfer->c_flags), DEBUG_XFERS); callout_stop(&chp->ch_callout); /* remove this command from xfer queue */ @@ -987,17 +987,17 @@ wdc_atapi_done(chp, xfer) void wdc_atapi_reset(chp, xfer) struct channel_softc *chp; - struct wdc_xfer *xfer; + struct ata_xfer *xfer; { - struct ata_drive_datas *drvp = &chp->ch_drive[xfer->drive]; - struct scsipi_xfer *sc_xfer = xfer->cmd; + struct ata_drive_datas *drvp = &chp->ch_drive[xfer->c_drive]; + struct scsipi_xfer *sc_xfer = xfer->c_cmd; - wdccommandshort(chp, xfer->drive, ATAPI_SOFT_RESET); + wdccommandshort(chp, xfer->c_drive, ATAPI_SOFT_RESET); drvp->state = 0; if (wait_for_unbusy(chp, WDC_RESET_WAIT, AT_POLL) != 0) { printf("%s:%d:%d: reset failed\n", chp->wdc->sc_dev.dv_xname, chp->channel, - xfer->drive); + xfer->c_drive); sc_xfer->error = XS_SELTIMEOUT; } wdc_atapi_done(chp, xfer); |
