Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Fix the bug that both BGE_PCIE and BGE_PCIX are ...



details:   https://anonhg.NetBSD.org/src/rev/018869f59d27
branches:  trunk
changeset: 751087:018869f59d27
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Sun Jan 24 15:29:10 2010 +0000

description:
Fix the bug that both BGE_PCIE and BGE_PCIX are set on PCI-Express devices.

diffstat:

 sys/dev/pci/if_bge.c |  21 ++++++++-------------
 1 files changed, 8 insertions(+), 13 deletions(-)

diffs (45 lines):

diff -r d70f94a3c65c -r 018869f59d27 sys/dev/pci/if_bge.c
--- a/sys/dev/pci/if_bge.c      Sun Jan 24 15:03:02 2010 +0000
+++ b/sys/dev/pci/if_bge.c      Sun Jan 24 15:29:10 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bge.c,v 1.170 2010/01/24 14:10:00 msaitoh Exp $     */
+/*     $NetBSD: if_bge.c,v 1.171 2010/01/24 15:29:10 msaitoh Exp $     */
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.170 2010/01/24 14:10:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.171 2010/01/24 15:29:10 msaitoh Exp $");
 
 #include "vlan.h"
 #include "rnd.h"
@@ -2357,20 +2357,15 @@
            pci_conf_read(sc->sc_pc, sc->sc_pcitag, BGE_PCI_MISC_CTL) &
            BGE_PCIMISCCTL_ASICREV;
 
-       /*
-        * Detect PCI-Express devices
-        * XXX: guessed from Linux/FreeBSD; no documentation
-        */
        if (pci_get_capability(sc->sc_pc, sc->sc_pcitag, PCI_CAP_PCIEXPRESS,
-               NULL, NULL) != 0)
+               NULL, NULL) != 0) {
+               /* PCIe */
                sc->bge_flags |= BGE_PCIE;
-
-       /*
-        * PCI-X check.
-        */
-       if ((pci_conf_read(sc->sc_pc, sc->sc_pcitag, BGE_PCI_PCISTATE) &
-               BGE_PCISTATE_PCI_BUSMODE) == 0)
+       } else if ((pci_conf_read(sc->sc_pc, sc->sc_pcitag, BGE_PCI_PCISTATE) &
+               BGE_PCISTATE_PCI_BUSMODE) == 0) {
+               /* PCI-X */
                sc->bge_flags |= BGE_PCIX;
+       }
 
        if (sc->bge_chipid == BGE_CHIPID_BCM5701_A0 ||
            sc->bge_chipid == BGE_CHIPID_BCM5701_B0)



Home | Main Index | Thread Index | Old Index