Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: SunFire v100 / Acer M5229 IDE DMA error workaround



On Wed, Oct 29, 2008 at 12:05:39PM -0400, Rafal Boni wrote:
> [...]
> Patch below... I'd love comments / feedback, esp. on ATAPI use cases,
> --rafal
> 
> ---8<------8<------8<------8<------8<------8<------8<------8<------8<---
> Index: pci/pciide_common.c
> ===================================================================
> RCS file: /cvsroot/src/sys/dev/pci/pciide_common.c,v
> retrieving revision 1.38
> diff -u -p -r1.38 pciide_common.c
> --- pci/pciide_common.c       18 Mar 2008 20:46:37 -0000      1.38
> +++ pci/pciide_common.c       29 Oct 2008 15:30:21 -0000
> @@ -737,7 +738,9 @@ pciide_dma_finish(v, channel, drive, for
>       ATADEBUG_PRINT(("pciide_dma_finish: status 0x%x\n", status),
>           DEBUG_XFERS);
>  
> -     if (force == WDC_DMAEND_END && (status & IDEDMA_CTL_INTR) == 0)
> +     /* XXXrkb: From FreeBSD; should probably add an evcnt here */
> +     if (force == WDC_DMAEND_END && 
> +         ((status & (IDEDMA_CTL_INTR | IDEDMA_CTL_ACT)) != IDEDMA_CTL_INTR))
>               return WDC_DMAST_NOIRQ;

As you guessed, this won't work for ATAPI. For ATAPI devices, we may have
short xfers, where we interrupt with the DMA channels still active.

>  
>       /* stop DMA channel */
> @@ -752,6 +755,9 @@ pciide_dma_finish(v, channel, drive, for
>           BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
>       bus_dmamap_unload(sc->sc_dmat, dma_maps->dmamap_xfer);
>  
> +     /* Clear status bits */
> +     bus_space_write_1(sc->sc_dma_iot, cp->dma_iohs[IDEDMA_CTL], 0, status);
> +
>       if ((status & IDEDMA_CTL_ERR) != 0 && force != WDC_DMAEND_ABRT_QUIET) {
>               aprint_error("%s:%d:%d: bus-master DMA error: status=0x%x\n",
>                   device_xname(sc->sc_wdcdev.sc_atac.atac_dev), channel,

this is done by pciide_irqack(). It should not be done there.

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--


Home | Main Index | Thread Index | Old Index