diff options
| author | thorpej <thorpej@NetBSD.org> | 2004-08-13 02:16:40 +0000 |
|---|---|---|
| committer | thorpej <thorpej@NetBSD.org> | 2004-08-13 02:16:40 +0000 |
| commit | 577bf670148d9ce5050c8f3693503ed16c970c64 (patch) | |
| tree | 15de64b79fae1e2906753d0e341d0acb57c79cf7 /sys/dev | |
| parent | 996c3ca90e2571624bdff8efdc29503573abb3eb (diff) | |
Move wdcstart() to ata.c and rename it to atastart().
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/ata/ata.c | 67 | ||||
| -rw-r--r-- | sys/dev/ata/ata_wdc.c | 8 | ||||
| -rw-r--r-- | sys/dev/ata/atavar.h | 3 | ||||
| -rw-r--r-- | sys/dev/ic/wdc.c | 69 | ||||
| -rw-r--r-- | sys/dev/ic/wdcvar.h | 3 | ||||
| -rw-r--r-- | sys/dev/scsipi/atapi_wdc.c | 8 |
6 files changed, 79 insertions, 79 deletions
diff --git a/sys/dev/ata/ata.c b/sys/dev/ata/ata.c index d480f654c15..381ac7666dd 100644 --- a/sys/dev/ata/ata.c +++ b/sys/dev/ata/ata.c @@ -1,4 +1,4 @@ -/* $NetBSD: ata.c,v 1.44 2004/08/13 02:10:43 thorpej Exp $ */ +/* $NetBSD: ata.c,v 1.45 2004/08/13 02:16:40 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.44 2004/08/13 02:10:43 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.45 2004/08/13 02:16:40 thorpej Exp $"); #ifndef WDCDEBUG #define WDCDEBUG @@ -516,9 +516,68 @@ ata_exec_xfer(struct wdc_channel *chp, struct ata_xfer *xfer) /* insert at the end of command list */ TAILQ_INSERT_TAIL(&chp->ch_queue->queue_xfer, xfer, c_xferchain); - WDCDEBUG_PRINT(("wdcstart from ata_exec_xfer, flags 0x%x\n", + WDCDEBUG_PRINT(("atastart from ata_exec_xfer, flags 0x%x\n", chp->ch_flags), DEBUG_XFERS); - wdcstart(chp); + atastart(chp); +} + +/* + * Start I/O on a controller, for the given channel. + * The first xfer may be not for our channel if the channel queues + * are shared. + */ +void +atastart(struct wdc_channel *chp) +{ + struct wdc_softc *wdc = chp->ch_wdc; + struct ata_xfer *xfer; + +#ifdef WDC_DIAGNOSTIC + int spl1, spl2; + + spl1 = splbio(); + spl2 = splbio(); + if (spl2 != spl1) { + printf("atastart: not at splbio()\n"); + panic("atastart"); + } + splx(spl2); + splx(spl1); +#endif /* WDC_DIAGNOSTIC */ + + /* is there a xfer ? */ + if ((xfer = TAILQ_FIRST(&chp->ch_queue->queue_xfer)) == NULL) + return; + + /* adjust chp, in case we have a shared queue */ + chp = xfer->c_chp; + + if (chp->ch_queue->active_xfer != NULL) { + return; /* channel aleady active */ + } + if (__predict_false(chp->ch_queue->queue_freeze > 0)) { + return; /* queue froozen */ + } +#ifdef DIAGNOSTIC + if ((chp->ch_flags & WDCF_IRQ_WAIT) != 0) + panic("atastart: channel waiting for irq"); +#endif + if (wdc->cap & WDC_CAPABILITY_HWLOCK) + if (!(*wdc->claim_hw)(chp, 0)) + return; + + WDCDEBUG_PRINT(("atastart: xfer %p channel %d drive %d\n", xfer, + chp->ch_channel, xfer->c_drive), DEBUG_XFERS); + 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; + } + chp->ch_queue->active_xfer = xfer; + TAILQ_REMOVE(&chp->ch_queue->queue_xfer, xfer, c_xferchain); + + if (wdc->cap & WDC_CAPABILITY_NOIRQ) + KASSERT(xfer->c_flags & C_POLL); + xfer->c_start(chp, xfer); } struct ata_xfer * diff --git a/sys/dev/ata/ata_wdc.c b/sys/dev/ata/ata_wdc.c index 53f08e9b9a3..e3142223fc2 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.68 2004/08/13 02:10:43 thorpej Exp $ */ +/* $NetBSD: ata_wdc.c,v 1.69 2004/08/13 02:16:40 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.68 2004/08/13 02:10:43 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ata_wdc.c,v 1.69 2004/08/13 02:16:40 thorpej Exp $"); #ifndef WDCDEBUG #define WDCDEBUG @@ -733,9 +733,9 @@ wdc_ata_bio_done(struct wdc_channel *chp, struct ata_xfer *xfer) ata_bio->flags |= ATA_ITSDONE; WDCDEBUG_PRINT(("wdc_ata_done: drv_done\n"), DEBUG_XFERS); (*chp->ch_drive[drive].drv_done)(chp->ch_drive[drive].drv_softc); - WDCDEBUG_PRINT(("wdcstart from wdc_ata_done, flags 0x%x\n", + WDCDEBUG_PRINT(("atastart from wdc_ata_done, flags 0x%x\n", chp->ch_flags), DEBUG_XFERS); - wdcstart(chp); + atastart(chp); } static int diff --git a/sys/dev/ata/atavar.h b/sys/dev/ata/atavar.h index e7e3abec39d..7aa2dbcdb19 100644 --- a/sys/dev/ata/atavar.h +++ b/sys/dev/ata/atavar.h @@ -1,4 +1,4 @@ -/* $NetBSD: atavar.h,v 1.57 2004/08/13 02:10:43 thorpej Exp $ */ +/* $NetBSD: atavar.h,v 1.58 2004/08/13 02:16:40 thorpej Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. @@ -318,6 +318,7 @@ void ata_kill_pending(struct ata_drive_datas *); int ata_addref(struct wdc_channel *); void ata_delref(struct wdc_channel *); +void atastart(struct wdc_channel *); void ata_print_modes(struct wdc_channel *); int ata_downgrade_mode(struct ata_drive_datas *, int); void ata_probe_caps(struct ata_drive_datas *); diff --git a/sys/dev/ic/wdc.c b/sys/dev/ic/wdc.c index ec03a69e4f4..88017946863 100644 --- a/sys/dev/ic/wdc.c +++ b/sys/dev/ic/wdc.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc.c,v 1.201 2004/08/13 02:10:43 thorpej Exp $ */ +/* $NetBSD: wdc.c,v 1.202 2004/08/13 02:16:40 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.201 2004/08/13 02:10:43 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.202 2004/08/13 02:16:40 thorpej Exp $"); #ifndef WDCDEBUG #define WDCDEBUG @@ -844,65 +844,6 @@ wdcdetach(struct device *self, int flags) return (error); } -/* - * Start I/O on a controller, for the given channel. - * The first xfer may be not for our channel if the channel queues - * are shared. - */ -void -wdcstart(struct wdc_channel *chp) -{ - struct wdc_softc *wdc = chp->ch_wdc; - struct ata_xfer *xfer; - -#ifdef WDC_DIAGNOSTIC - int spl1, spl2; - - spl1 = splbio(); - spl2 = splbio(); - if (spl2 != spl1) { - printf("wdcstart: not at splbio()\n"); - panic("wdcstart"); - } - splx(spl2); - splx(spl1); -#endif /* WDC_DIAGNOSTIC */ - - /* is there a xfer ? */ - if ((xfer = TAILQ_FIRST(&chp->ch_queue->queue_xfer)) == NULL) - return; - - /* adjust chp, in case we have a shared queue */ - chp = xfer->c_chp; - - if (chp->ch_queue->active_xfer != NULL) { - return; /* channel aleady active */ - } - if (__predict_false(chp->ch_queue->queue_freeze > 0)) { - return; /* queue froozen */ - } -#ifdef DIAGNOSTIC - if ((chp->ch_flags & WDCF_IRQ_WAIT) != 0) - panic("wdcstart: channel waiting for irq"); -#endif - if (wdc->cap & WDC_CAPABILITY_HWLOCK) - if (!(*wdc->claim_hw)(chp, 0)) - return; - - WDCDEBUG_PRINT(("wdcstart: xfer %p channel %d drive %d\n", xfer, - chp->ch_channel, xfer->c_drive), DEBUG_XFERS); - 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; - } - chp->ch_queue->active_xfer = xfer; - TAILQ_REMOVE(&chp->ch_queue->queue_xfer, xfer, c_xferchain); - - if (wdc->cap & WDC_CAPABILITY_NOIRQ) - KASSERT(xfer->c_flags & C_POLL); - xfer->c_start(chp, xfer); -} - /* restart an interrupted I/O */ void wdcrestart(void *v) @@ -911,7 +852,7 @@ wdcrestart(void *v) int s; s = splbio(); - wdcstart(chp); + atastart(chp); splx(s); } @@ -1092,7 +1033,7 @@ wdc_reset_channel(struct wdc_channel *chp, int flags) chp->ch_flags &= ~WDCF_TH_RESET; if ((flags & AT_RST_EMERG) == 0) { chp->ch_queue->queue_freeze--; - wdcstart(chp); + atastart(chp); } else { /* make sure that we can use polled commands */ TAILQ_INIT(&chp->ch_queue->queue_xfer); @@ -1676,7 +1617,7 @@ __wdccommand_done_end(struct wdc_channel *chp, struct ata_xfer *xfer) wakeup(ata_c); else if (ata_c->callback) ata_c->callback(ata_c->callback_arg); - wdcstart(chp); + atastart(chp); return; } diff --git a/sys/dev/ic/wdcvar.h b/sys/dev/ic/wdcvar.h index a108a678f27..6b580b43f52 100644 --- a/sys/dev/ic/wdcvar.h +++ b/sys/dev/ic/wdcvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: wdcvar.h,v 1.72 2004/08/13 02:10:43 thorpej Exp $ */ +/* $NetBSD: wdcvar.h,v 1.73 2004/08/13 02:16:40 thorpej Exp $ */ /*- * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc. @@ -192,7 +192,6 @@ int wdcdetach(struct device *, int); int wdcactivate(struct device *, enum devact); int wdcintr(void *); -void wdcstart(struct wdc_channel *); void wdcrestart(void*); int wdcreset(struct wdc_channel *, int); diff --git a/sys/dev/scsipi/atapi_wdc.c b/sys/dev/scsipi/atapi_wdc.c index ce750e9ced0..4b318a462c3 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.83 2004/08/13 02:10:43 thorpej Exp $ */ +/* $NetBSD: atapi_wdc.c,v 1.84 2004/08/13 02:16:40 thorpej Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.83 2004/08/13 02:10:43 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.84 2004/08/13 02:16:40 thorpej Exp $"); #ifndef WDCDEBUG #define WDCDEBUG @@ -910,9 +910,9 @@ wdc_atapi_done(struct wdc_channel *chp, struct ata_xfer *xfer) WDCDEBUG_PRINT(("wdc_atapi_done: scsipi_done\n"), DEBUG_XFERS); scsipi_done(sc_xfer); - WDCDEBUG_PRINT(("wdcstart from wdc_atapi_done, flags 0x%x\n", + WDCDEBUG_PRINT(("atastart from wdc_atapi_done, flags 0x%x\n", chp->ch_flags), DEBUG_XFERS); - wdcstart(chp); + atastart(chp); } static void |
