From 336193c58e0268264418be683b38cf333f4ea15c Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Mon, 6 Mar 2006 19:32:19 +0000 Subject: Make UDMA on the VT8237 work again. ok jsg@, grange@ --- sys/dev/pci/pciide.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) (limited to 'sys') diff --git a/sys/dev/pci/pciide.c b/sys/dev/pci/pciide.c index 2c2bbc5269f..7d51b8a51bd 100644 --- a/sys/dev/pci/pciide.c +++ b/sys/dev/pci/pciide.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pciide.c,v 1.226 2006/02/24 20:59:04 kettenis Exp $ */ +/* $OpenBSD: pciide.c,v 1.227 2006/03/06 19:32:18 kettenis Exp $ */ /* $NetBSD: pciide.c,v 1.127 2001/08/03 01:31:08 tsutsui Exp $ */ /* @@ -2736,8 +2736,8 @@ apollo_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) int channel; u_int32_t ideconf; bus_size_t cmdsize, ctlsize; - pcitag_t pcib_tag; - pcireg_t pcib_id, pcib_class; + pcitag_t tag; + pcireg_t id, class; /* * Fake interface since VT6410 is claimed to be a ``RAID'' device. @@ -2756,22 +2756,28 @@ apollo_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) printf(": ATA133"); sc->sc_wdcdev.UDMA_cap = 6; } else { - /* Determine the DMA capabilities by looking at the ISA bridge. */ - pcib_tag = pci_make_tag(pa->pa_pc, pa->pa_bus, pa->pa_device, 0); - pcib_id = pci_conf_read(sc->sc_pc, pcib_tag, PCI_ID_REG); - pcib_class = pci_conf_read(sc->sc_pc, pcib_tag, PCI_CLASS_REG); + /* + * Determine the DMA capabilities by looking at the + * ISA bridge. + */ + tag = pci_make_tag(pa->pa_pc, pa->pa_bus, pa->pa_device, 0); + id = pci_conf_read(sc->sc_pc, tag, PCI_ID_REG); + class = pci_conf_read(sc->sc_pc, tag, PCI_CLASS_REG); - /* XXX On the VT8237, the ISA bridge is on a different device. */ - if (PCI_CLASS(pcib_class) != PCI_CLASS_BRIDGE && pa->pa_device == 15 && - PCI_PRODUCT(pcib_id) == PCI_PRODUCT_VIATECH_VT82C571) { - pcib_tag = pci_make_tag(pa->pa_pc, pa->pa_bus, 17, 0); - pcib_id = pci_conf_read(sc->sc_pc, pcib_tag, PCI_ID_REG); - pcib_class = pci_conf_read(sc->sc_pc, pcib_tag, PCI_CLASS_REG); + /* + * XXX On the VT8237, the ISA bridge is on a different + * device. + */ + if (PCI_CLASS(class) != PCI_CLASS_BRIDGE && + pa->pa_device == 15) { + tag = pci_make_tag(pa->pa_pc, pa->pa_bus, 17, 0); + id = pci_conf_read(sc->sc_pc, tag, PCI_ID_REG); + class = pci_conf_read(sc->sc_pc, tag, PCI_CLASS_REG); } - switch (PCI_PRODUCT(pcib_id)) { + switch (PCI_PRODUCT(id)) { case PCI_PRODUCT_VIATECH_VT82C586_ISA: - if (PCI_REVISION(pcib_class) >= 0x02) { + if (PCI_REVISION(class) >= 0x02) { printf(": ATA33"); sc->sc_wdcdev.UDMA_cap = 2; } else { @@ -2780,7 +2786,7 @@ apollo_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) } break; case PCI_PRODUCT_VIATECH_VT82C596A: - if (PCI_REVISION(pcib_class) >= 0x12) { + if (PCI_REVISION(class) >= 0x12) { printf(": ATA66"); sc->sc_wdcdev.UDMA_cap = 4; } else { @@ -2790,7 +2796,7 @@ apollo_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) break; case PCI_PRODUCT_VIATECH_VT82C686A_ISA: - if (PCI_REVISION(pcib_class) >= 0x40) { + if (PCI_REVISION(class) >= 0x40) { printf(": ATA100"); sc->sc_wdcdev.UDMA_cap = 5; } else { @@ -2806,7 +2812,6 @@ apollo_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) case PCI_PRODUCT_VIATECH_VT8233A_ISA: case PCI_PRODUCT_VIATECH_VT8235_ISA: case PCI_PRODUCT_VIATECH_VT8237_ISA: - case PCI_PRODUCT_VIATECH_VT6410: printf(": ATA133"); sc->sc_wdcdev.UDMA_cap = 6; break; -- cgit v1.2.3