Module Name: src
Committed By: riz
Date: Sun Nov 21 23:41:21 UTC 2010
Modified Files:
src/sys/dev/pci [netbsd-5]: aceride.c
Log Message:
Pull up following revision(s) (requested by nakayama in ticket #1471):
sys/dev/pci/aceride.c: revision 1.28
Add a workaround for 48-bit LBA DMA access bug on M5229 rev. <= 0xc4.
- use DMA in 28-bit LBA addressing.
- use PIO in 48-bit LBA addressing.
Idea and message are from FreeBSD, and tested on M5229 rev. 0xc3 in
my Sun Netra X1 with 160GB drive.
To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.14.1 src/sys/dev/pci/aceride.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/aceride.c
diff -u src/sys/dev/pci/aceride.c:1.25 src/sys/dev/pci/aceride.c:1.25.14.1
--- src/sys/dev/pci/aceride.c:1.25 Tue Mar 18 20:46:36 2008
+++ src/sys/dev/pci/aceride.c Sun Nov 21 23:41:20 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: aceride.c,v 1.25 2008/03/18 20:46:36 cube Exp $ */
+/* $NetBSD: aceride.c,v 1.25.14.1 2010/11/21 23:41:20 riz Exp $ */
/*
* Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aceride.c,v 1.25 2008/03/18 20:46:36 cube Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aceride.c,v 1.25.14.1 2010/11/21 23:41:20 riz Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -46,6 +46,7 @@
static void acer_chip_map(struct pciide_softc*, struct pci_attach_args*);
static void acer_setup_channel(struct ata_channel*);
static int acer_pci_intr(void *);
+static int acer_dma_init(void *, int, int, void *, size_t, int);
static int aceride_match(device_t, cfdata_t, void *);
static void aceride_attach(device_t, device_t, void *);
@@ -144,6 +145,12 @@
sc->sc_wdcdev.sc_atac.atac_udma_cap = 2;
}
sc->sc_wdcdev.irqack = pciide_irqack;
+ if (rev <= 0xc4) {
+ sc->sc_wdcdev.dma_init = acer_dma_init;
+ aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev,
+ "using PIO transfers above 137GB as workaround for "
+ "48bit DMA access bug, expect reduced performance\n");
+ }
}
sc->sc_wdcdev.sc_atac.atac_pio_cap = 4;
@@ -375,3 +382,15 @@
}
return rv;
}
+
+static int
+acer_dma_init(void *v, int channel, int drive, void *databuf,
+ size_t datalen, int flags)
+{
+
+ /* use PIO for LBA48 transfer */
+ if (flags & WDC_DMA_LBA48)
+ return EINVAL;
+
+ return pciide_dma_init(v, channel, drive, databuf, datalen, flags);
+}