Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/sys/dev/pci Pull up
details: https://anonhg.NetBSD.org/src/rev/102a34c0e2d1
branches: netbsd-1-5
changeset: 488461:102a34c0e2d1
user: bouyer <bouyer%NetBSD.org@localhost>
date: Fri Jul 07 11:49:14 2000 +0000
description:
Pull up
pciide.c 1.77 -> 1.78
pciide_amd_reg.h 1.1 -> 1.2
(approved by thorpej): workaround for a bug in some revs of the AMD IDE
controller, which can lock up the machine when multiword DMA is used.
diffstat:
sys/dev/pci/pciide.c | 24 +++++++++++++++++++++---
sys/dev/pci/pciide_amd_reg.h | 17 ++++++++++++++++-
2 files changed, 37 insertions(+), 4 deletions(-)
diffs (84 lines):
diff -r a6d00abbfc41 -r 102a34c0e2d1 sys/dev/pci/pciide.c
--- a/sys/dev/pci/pciide.c Fri Jul 07 11:33:33 2000 +0000
+++ b/sys/dev/pci/pciide.c Fri Jul 07 11:49:14 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pciide.c,v 1.68.2.5 2000/07/06 01:20:13 enami Exp $ */
+/* $NetBSD: pciide.c,v 1.68.2.6 2000/07/07 11:49:14 bouyer Exp $ */
/*
@@ -1781,6 +1781,8 @@
struct ata_drive_datas *drvp;
struct pciide_channel *cp = (struct pciide_channel*)chp;
struct pciide_softc *sc = (struct pciide_softc *)cp->wdc_channel.wdc;
+ int rev = PCI_REVISION(
+ pci_conf_read(sc->sc_pc, sc->sc_tag, PCI_CLASS_REG));
idedma_ctl = 0;
datatim_reg = pci_conf_read(sc->sc_pc, sc->sc_tag, AMD756_DATATIM);
@@ -1813,8 +1815,25 @@
/* can use PIO timings, MW DMA unused */
mode = drvp->PIO_mode;
} else {
- /* use Multiword DMA */
+ /* use Multiword DMA, but only if revision is OK */
drvp->drive_flags &= ~DRIVE_UDMA;
+#ifndef PCIIDE_AMD756_ENABLEDMA
+ /*
+ * The workaround doesn't seem to be necessary
+ * with all drives, so it can be disabled by
+ * PCIIDE_AMD756_ENABLEDMA. It causes a hard hang if
+ * triggered.
+ */
+ if (AMD756_CHIPREV_DISABLEDMA(rev)) {
+ printf("%s:%d:%d: multi-word DMA disabled due "
+ "to chip revision\n",
+ sc->sc_wdcdev.sc_dev.dv_xname,
+ chp->channel, drive);
+ mode = drvp->PIO_mode;
+ drvp->drive_flags &= ~DRIVE_DMA;
+ goto pio;
+ }
+#endif
/* mode = min(pio, dma+2) */
if (drvp->PIO_mode <= (drvp->DMA_mode +2))
mode = drvp->PIO_mode;
@@ -2830,7 +2849,6 @@
sc->sc_wdcdev.set_modes = hpt_setup_channel;
sc->sc_wdcdev.channels = sc->wdc_chanarray;
- sc->sc_wdcdev.nchannels = (revision == HPT366_REV) ? 1 : 2;
if (revision == HPT366_REV) {
/*
* The 366 has 2 PCI IDE functions, one for primary and one
diff -r a6d00abbfc41 -r 102a34c0e2d1 sys/dev/pci/pciide_amd_reg.h
--- a/sys/dev/pci/pciide_amd_reg.h Fri Jul 07 11:33:33 2000 +0000
+++ b/sys/dev/pci/pciide_amd_reg.h Fri Jul 07 11:49:14 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pciide_amd_reg.h,v 1.1 2000/03/06 18:02:27 bouyer Exp $ */
+/* $NetBSD: pciide_amd_reg.h,v 1.1.4.1 2000/07/07 11:49:15 bouyer Exp $ */
/*
* Copyright (c) 2000 David Sainty.
@@ -38,6 +38,21 @@
* available at: http://www.amd.com/products/cpg/athlon/techdocs/pdf/22548.pdf
*/
+/* Chip revisions */
+#define AMD756_CHIPREV_D2 3
+
+/* Chip revision tests */
+
+/*
+ * The AMD756 chip revision D2 has a bug affecting DMA (but not UDMA)
+ * modes. The workaround documented by AMD is to not use DMA on any
+ * drive which does not support UDMA modes.
+ *
+ * See: http://www.amd.com/products/cpg/athlon/techdocs/pdf/22591.pdf
+ */
+#define AMD756_CHIPREV_DISABLEDMA(rev) ((rev) <= AMD756_CHIPREV_D2)
+
+
/* Channel enable */
#define AMD756_CHANSTATUS_EN 0x40
#define AMD756_CHAN_EN(chan) (0x01 << (1 - (chan)))
Home |
Main Index |
Thread Index |
Old Index