I have plans to revamp dev/ic/wdc.c, but in the mean time, I want to make some small cleanups so the final diff is easier to follow.
First cleanup: The HWLOCK, ATA_NOSTREAM, and ATAPI_NOSTREAM 'capabilities' don't appear to be set by any wdc-based adapters. They've been here since r1.1, so I think it's just cruft that can be safely removed... right? (Conversely, the SATA and SINGLE_DRIVE capabilities are set by some adapters, but don't actually do anything. I'm tempted to kill them too out of principle, but I don't think that's necessary just yet.) ok? Index: dev/ic/wdc.c =================================================================== RCS file: /home/mdempsky/anoncvs/cvs/src/sys/dev/ic/wdc.c,v retrieving revision 1.113 diff -u -p -r1.113 wdc.c --- dev/ic/wdc.c 18 Apr 2011 04:16:13 -0000 1.113 +++ dev/ic/wdc.c 7 May 2011 19:57:00 -0000 @@ -861,9 +861,6 @@ wdcstart(struct channel_softc *chp) if ((chp->ch_flags & WDCF_IRQ_WAIT) != 0) panic("wdcstart: channel waiting for irq"); #endif /* DIAGNOSTIC */ - 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, chp->channel, xfer->drive), DEBUG_XFERS); @@ -1919,7 +1916,6 @@ wdc_get_xfer(int flags) void wdc_free_xfer(struct channel_softc *chp, struct wdc_xfer *xfer) { - struct wdc_softc *wdc = chp->wdc; int s; if (xfer->c_flags & C_PRIVATEXFER) { @@ -1928,8 +1924,6 @@ wdc_free_xfer(struct channel_softc *chp, return; } - if (wdc->cap & WDC_CAPABILITY_HWLOCK) - (*wdc->free_hw)(chp); s = splbio(); chp->ch_flags &= ~WDCF_ACTIVE; TAILQ_REMOVE(&chp->ch_queue->sc_xfer, xfer, c_xferchain); Index: dev/ic/wdcvar.h =================================================================== RCS file: /home/mdempsky/anoncvs/cvs/src/sys/dev/ic/wdcvar.h,v retrieving revision 1.49 diff -u -p -r1.49 wdcvar.h --- dev/ic/wdcvar.h 18 Apr 2011 04:16:14 -0000 1.49 +++ dev/ic/wdcvar.h 8 May 2011 03:10:11 -0000 @@ -157,9 +157,6 @@ struct wdc_softc { /* Per controller sta #define WDC_CAPABILITY_MODE 0x0004 /* controller knows its PIO/DMA modes */ #define WDC_CAPABILITY_DMA 0x0008 /* DMA */ #define WDC_CAPABILITY_UDMA 0x0010 /* Ultra-DMA/33 */ -#define WDC_CAPABILITY_HWLOCK 0x0020 /* Needs to lock HW */ -#define WDC_CAPABILITY_ATA_NOSTREAM 0x0040 /* Don't use stream funcs on ATA */ -#define WDC_CAPABILITY_ATAPI_NOSTREAM 0x0080 /* Don't use stream f on ATAPI */ #define WDC_CAPABILITY_NO_EXTRA_RESETS 0x0100 /* only reset once */ #define WDC_CAPABILITY_PREATA 0x0200 /* ctrl can be a pre-ata one */ #define WDC_CAPABILITY_IRQACK 0x0400 /* callback to ack interrupt */ @@ -195,10 +192,6 @@ struct wdc_softc { /* Per controller sta #define WDC_DMAST_NOIRQ 0x01 /* missing IRQ */ #define WDC_DMAST_ERR 0x02 /* DMA error */ #define WDC_DMAST_UNDER 0x04 /* DMA underrun */ - - /* if WDC_CAPABILITY_HWLOCK set in 'cap' */ - int (*claim_hw)(void *, int); - void (*free_hw)(void *); /* if WDC_CAPABILITY_MODE set in 'cap' */ void (*set_modes)(struct channel_softc *);