Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Ali M5229 IDE controllers: tweak the rigth 0x79 ...



details:   https://anonhg.NetBSD.org/src/rev/3a86d912beff
branches:  trunk
changeset: 515429:3a86d912beff
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Mon Sep 24 20:03:47 2001 +0000

description:
Ali M5229 IDE controllers: tweak the rigth 0x79 register (the one from the
pci/isa bridge, not the one from the IDE controller).

diffstat:

 sys/dev/pci/pciide.c |  45 ++++++++++++++++++++++++++++++++++-----------
 1 files changed, 34 insertions(+), 11 deletions(-)

diffs (78 lines):

diff -r 699d9e8c3b16 -r 3a86d912beff sys/dev/pci/pciide.c
--- a/sys/dev/pci/pciide.c      Mon Sep 24 17:55:47 2001 +0000
+++ b/sys/dev/pci/pciide.c      Mon Sep 24 20:03:47 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pciide.c,v 1.128 2001/08/23 10:02:25 tsutsui Exp $     */
+/*     $NetBSD: pciide.c,v 1.129 2001/09/24 20:03:47 bouyer Exp $      */
 
 
 /*
@@ -184,6 +184,7 @@
 void acer_chip_map __P((struct pciide_softc*, struct pci_attach_args*));
 void acer_setup_channel __P((struct channel_softc*));
 int  acer_pci_intr __P((void *));
+int  acer_isabr_match __P(( struct pci_attach_args *));
 
 void pdc202xx_chip_map __P((struct pciide_softc*, struct pci_attach_args*));
 void pdc202xx_setup_channel __P((struct channel_softc*));
@@ -2887,11 +2888,23 @@
        pciide_print_modes(cp);
 }
 
+int
+acer_isabr_match(pa)
+       struct pci_attach_args *pa;
+{
+       if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ALI &&
+          PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ALI_M1543)
+               return 1;
+       return 0;
+}
+
+
 void
 acer_chip_map(sc, pa)
        struct pciide_softc *sc;
        struct pci_attach_args *pa;
 {
+       struct pci_attach_args isa_pa;
        struct pciide_channel *cp;
        int channel;
        pcireg_t cr, interface;
@@ -2953,16 +2966,26 @@
                    pciide_pci_read(sc->sc_pc, sc->sc_tag, ACER_0x4B)
                    | ACER_0x4B_CDETECT);
                /* set south-bridge's enable bit, m1533, 0x79 */
-               if (rev == 0xC2)
-                       /* 1543C-B0 (m1533, 0x79, bit 2) */
-                       pciide_pci_write(sc->sc_pc, sc->sc_tag, ACER_0x79,
-                           pciide_pci_read(sc->sc_pc, sc->sc_tag, ACER_0x79)
-                           | ACER_0x79_REVC2_EN);
-               else
-                       /* 1553/1535 (m1533, 0x79, bit 1) */
-                       pciide_pci_write(sc->sc_pc, sc->sc_tag, ACER_0x79,
-                           pciide_pci_read(sc->sc_pc, sc->sc_tag, ACER_0x79)
-                           | ACER_0x79_EN);
+               if (pci_find_device(&isa_pa, acer_isabr_match) == 0) {
+                       printf("%s: can't find PCI/ISA bridge, downgrading "
+                           "to Ultra/33\n", sc->sc_wdcdev.sc_dev.dv_xname);
+                       sc->sc_wdcdev.UDMA_cap = 2;
+               } else {
+                       if (rev == 0xC2)
+                               /* 1543C-B0 (m1533, 0x79, bit 2) */
+                               pciide_pci_write(isa_pa.pa_pc, isa_pa.pa_tag,
+                                   ACER_0x79,
+                                   pciide_pci_read(isa_pa.pa_pc, isa_pa.pa_tag,
+                                       ACER_0x79)
+                                   | ACER_0x79_REVC2_EN);
+                       else
+                               /* 1553/1535 (m1533, 0x79, bit 1) */
+                               pciide_pci_write(isa_pa.pa_pc, isa_pa.pa_tag,
+                                   ACER_0x79,
+                                   pciide_pci_read(isa_pa.pa_pc, isa_pa.pa_tag,
+                                       ACER_0x79)
+                                   | ACER_0x79_EN);
+               }
        }
 
        for (channel = 0; channel < sc->sc_wdcdev.nchannels; channel++) {



Home | Main Index | Thread Index | Old Index