tech-kern 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 Thu, Oct 30, 2008 at 07:52:42PM +0100, Manuel Bouyer wrote:
> 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.

Let me ask a couple potentially stupid questions:

        1. How does one differentiate between a succesfull (completed)
           transfer and short xfer?  In other words, is there a status
           bit that indicates short xfer?  Should IDEDMA_CTL_ERR be
           set in that case?

        2. Presumably we know if this is an ATA or ATAPI DMA request;
           would this be any less bothersome to you if we only did
           this for pure ATA requests? (and obviously made it chip-
           specific).

        3. Can you give me a good way to try and provoke short xfers
           with ATAPI?  I suspect that on this controller / machine
           that ATAPI DMA is in general broken, see below:

    aceride0:0:0: lost interrupt
            type: atapi tc_bcount: 32 tc_skip: 0
    aceride0:0:0: bus-master DMA error: missing interrupt, status=0x21
    cd0: transfer error, downgrading to Ultra-DMA mode 1
    cd0(aceride0:0:0): using PIO mode 4, Ultra-DMA mode 1 (using DMA)
    aceride0:0:0: lost interrupt
            type: atapi tc_bcount: 32 tc_skip: 0
    aceride0:0:0: bus-master DMA error: missing interrupt, status=0x21
    cd0: transfer error, downgrading to PIO mode 4
    cd0(aceride0:0:0): using PIO mode 4

> > @@ -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.

Yeah, I removed this; it didn't help without the above change and with the
above change present, the absence/presence of this change didn't make any
difference.

--rafal

-- 
  Time is an illusion; lunchtime, doubly so.     |/\/\|           Rafal Boni
                   -- Ford Prefect               |\/\/|      
rafal%pobox.com@localhost


Home | Main Index | Thread Index | Old Index