Add a callback (*irqack), for controllers that need special action to ack

the interrupt once it has been ack'd on the drive.
This commit is contained in:
bouyer 2000-06-12 21:10:40 +00:00
parent 778f1338aa
commit 12d3bf8c1a
4 changed files with 29 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ata_wdc.c,v 1.27 2000/05/15 08:32:07 bouyer Exp $ */ /* $NetBSD: ata_wdc.c,v 1.28 2000/06/12 21:10:40 bouyer Exp $ */
/* /*
* Copyright (c) 1998 Manuel Bouyer. * Copyright (c) 1998 Manuel Bouyer.
@ -457,6 +457,8 @@ wdc_ata_bio_intr(chp, xfer, irq)
wdc_ata_bio_done(chp, xfer); wdc_ata_bio_done(chp, xfer);
return 1; return 1;
} }
if (chp->wdc->cap & WDC_CAPABILITY_IRQACK)
chp->wdc->irqack(chp);
drv_err = wdc_ata_err(drvp, ata_bio); drv_err = wdc_ata_err(drvp, ata_bio);
@ -654,6 +656,8 @@ again:
errstring = "recal"; errstring = "recal";
if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, delay)) if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, delay))
goto timeout; goto timeout;
if (chp->wdc->cap & WDC_CAPABILITY_IRQACK)
chp->wdc->irqack(chp);
if (chp->ch_status & (WDCS_ERR | WDCS_DWF)) if (chp->ch_status & (WDCS_ERR | WDCS_DWF))
goto error; goto error;
/* fall through */ /* fall through */
@ -674,6 +678,8 @@ again:
errstring = "piomode"; errstring = "piomode";
if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, delay)) if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, delay))
goto timeout; goto timeout;
if (chp->wdc->cap & WDC_CAPABILITY_IRQACK)
chp->wdc->irqack(chp);
if (chp->ch_status & (WDCS_ERR | WDCS_DWF)) if (chp->ch_status & (WDCS_ERR | WDCS_DWF))
goto error; goto error;
/* fall through */ /* fall through */
@ -694,6 +700,8 @@ again:
errstring = "dmamode"; errstring = "dmamode";
if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, delay)) if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, delay))
goto timeout; goto timeout;
if (chp->wdc->cap & WDC_CAPABILITY_IRQACK)
chp->wdc->irqack(chp);
if (chp->ch_status & (WDCS_ERR | WDCS_DWF)) if (chp->ch_status & (WDCS_ERR | WDCS_DWF))
goto error; goto error;
/* fall through */ /* fall through */
@ -714,6 +722,8 @@ again:
errstring = "geometry"; errstring = "geometry";
if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, delay)) if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, delay))
goto timeout; goto timeout;
if (chp->wdc->cap & WDC_CAPABILITY_IRQACK)
chp->wdc->irqack(chp);
if (chp->ch_status & (WDCS_ERR | WDCS_DWF)) if (chp->ch_status & (WDCS_ERR | WDCS_DWF))
goto error; goto error;
/* fall through */ /* fall through */
@ -731,6 +741,8 @@ again:
errstring = "setmulti"; errstring = "setmulti";
if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, delay)) if (wdcwait(chp, WDCS_DRDY, WDCS_DRDY, delay))
goto timeout; goto timeout;
if (chp->wdc->cap & WDC_CAPABILITY_IRQACK)
chp->wdc->irqack(chp);
if (chp->ch_status & (WDCS_ERR | WDCS_DWF)) if (chp->ch_status & (WDCS_ERR | WDCS_DWF))
goto error; goto error;
/* fall through */ /* fall through */

View File

@ -1,4 +1,4 @@
/* $NetBSD: wdc.c,v 1.90 2000/06/11 17:09:34 bouyer Exp $ */ /* $NetBSD: wdc.c,v 1.91 2000/06/12 21:10:41 bouyer Exp $ */
/* /*
@ -1323,6 +1323,8 @@ __wdccommand_intr(chp, xfer, irq)
__wdccommand_done(chp, xfer); __wdccommand_done(chp, xfer);
return 1; return 1;
} }
if (chp->wdc->cap & WDC_CAPABILITY_IRQACK)
chp->wdc->irqack(chp);
if (wdc_c->flags & AT_READ) { if (wdc_c->flags & AT_READ) {
if (chp->ch_drive[xfer->drive].drive_flags & DRIVE_CAP32) { if (chp->ch_drive[xfer->drive].drive_flags & DRIVE_CAP32) {
bus_space_read_multi_4(chp->data32iot, chp->data32ioh, bus_space_read_multi_4(chp->data32iot, chp->data32ioh,

View File

@ -1,4 +1,4 @@
/* $NetBSD: wdcvar.h,v 1.24 2000/04/01 14:32:22 bouyer Exp $ */ /* $NetBSD: wdcvar.h,v 1.25 2000/06/12 21:10:41 bouyer Exp $ */
/*- /*-
* Copyright (c) 1998 The NetBSD Foundation, Inc. * Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -98,6 +98,7 @@ struct wdc_softc { /* Per controller state */
#define WDC_CAPABILITY_ATAPI_NOSTREAM 0x0080 /* Don't use stream f on ATAPI */ #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_NO_EXTRA_RESETS 0x0100 /* only reset once */
#define WDC_CAPABILITY_PREATA 0x0200 /* ctrl can be a pre-ata one */ #define WDC_CAPABILITY_PREATA 0x0200 /* ctrl can be a pre-ata one */
#define WDC_CAPABILITY_IRQACK 0x0400 /* callback to ack interrupt */
u_int8_t PIO_cap; /* highest PIO mode supported */ u_int8_t PIO_cap; /* highest PIO mode supported */
u_int8_t DMA_cap; /* highest DMA mode supported */ u_int8_t DMA_cap; /* highest DMA mode supported */
u_int8_t UDMA_cap; /* highest UDMA mode supported */ u_int8_t UDMA_cap; /* highest UDMA mode supported */
@ -129,6 +130,9 @@ struct wdc_softc { /* Per controller state */
/* if WDC_CAPABILITY_MODE set in 'cap' */ /* if WDC_CAPABILITY_MODE set in 'cap' */
void (*set_modes) __P((struct channel_softc *)); void (*set_modes) __P((struct channel_softc *));
/* if WDC_CAPABILITY_IRQACK set in 'cap' */
void (*irqack) __P((struct channel_softc *));
}; };
/* /*

View File

@ -1,4 +1,4 @@
/* $NetBSD: atapi_wdc.c,v 1.35 2000/05/15 08:48:25 bouyer Exp $ */ /* $NetBSD: atapi_wdc.c,v 1.36 2000/06/12 21:10:40 bouyer Exp $ */
/* /*
* Copyright (c) 1998 Manuel Bouyer. * Copyright (c) 1998 Manuel Bouyer.
@ -467,6 +467,9 @@ wdc_atapi_intr(chp, xfer, irq)
wdc_atapi_reset(chp, xfer); wdc_atapi_reset(chp, xfer);
return 1; return 1;
} }
if (chp->wdc->cap & WDC_CAPABILITY_IRQACK)
chp->wdc->irqack(chp);
/* If we missed an IRQ and were using DMA, flag it as a DMA error */ /* If we missed an IRQ and were using DMA, flag it as a DMA error */
if ((xfer->c_flags & C_TIMEOU) && (xfer->c_flags & C_DMA)) { if ((xfer->c_flags & C_TIMEOU) && (xfer->c_flags & C_DMA)) {
ata_dmaerr(drvp); ata_dmaerr(drvp);
@ -847,6 +850,8 @@ piomode:
errstring = "piomode"; errstring = "piomode";
if (wait_for_unbusy(chp, delay)) if (wait_for_unbusy(chp, delay))
goto timeout; goto timeout;
if (chp->wdc->cap & WDC_CAPABILITY_IRQACK)
chp->wdc->irqack(chp);
if (chp->ch_status & WDCS_ERR) { if (chp->ch_status & WDCS_ERR) {
if (drvp->PIO_mode < 3) { if (drvp->PIO_mode < 3) {
drvp->PIO_mode = 3; drvp->PIO_mode = 3;
@ -873,6 +878,8 @@ piomode:
errstring = "dmamode"; errstring = "dmamode";
if (wait_for_unbusy(chp, delay)) if (wait_for_unbusy(chp, delay))
goto timeout; goto timeout;
if (chp->wdc->cap & WDC_CAPABILITY_IRQACK)
chp->wdc->irqack(chp);
if (chp->ch_status & WDCS_ERR) if (chp->ch_status & WDCS_ERR)
goto error; goto error;
/* fall through */ /* fall through */