Source-Changes-HG archive

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

[src/netbsd-1-6]: src/sys/dev/pci Pull up revision 1.81 (requested by itojun ...



details:   https://anonhg.NetBSD.org/src/rev/efb8736fe652
branches:  netbsd-1-6
changeset: 530556:efb8736fe652
user:      tron <tron%NetBSD.org@localhost>
date:      Fri Aug 15 12:45:51 2003 +0000

description:
Pull up revision 1.81 (requested by itojun in ticket #1412):
- check HDRTYPE early, and ignore if it is not supported (n > 2).
- defer access to interrupt configuration register, as its existence depends on
  HDRTYPE.
- add "skip particular funtion in multifunction device" functionality
  to quirk table.
- add GEODE/NS SC1100 quirk (now boots on soekris Net4801).

diffstat:

 sys/dev/pci/pci.c |  32 +++++++++++++++++++++++---------
 1 files changed, 23 insertions(+), 9 deletions(-)

diffs (81 lines):

diff -r d49d0146cb5a -r efb8736fe652 sys/dev/pci/pci.c
--- a/sys/dev/pci/pci.c Fri Aug 15 08:49:04 2003 +0000
+++ b/sys/dev/pci/pci.c Fri Aug 15 12:45:51 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci.c,v 1.65 2002/05/18 21:40:41 sommerfeld Exp $      */
+/*     $NetBSD: pci.c,v 1.65.2.1 2003/08/15 12:45:51 tron Exp $        */
 
 /*
  * Copyright (c) 1995, 1996, 1997, 1998
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.65 2002/05/18 21:40:41 sommerfeld Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.65.2.1 2003/08/15 12:45:51 tron Exp $");
 
 #include "opt_pci.h"
 
@@ -252,11 +252,13 @@
 
        pci_decompose_tag(pc, tag, &bus, &device, &function);
 
+       bhlcr = pci_conf_read(pc, tag, PCI_BHLC_REG);
+       if (PCI_HDRTYPE_TYPE(bhlcr) > 2)
+               return (0);
+
        id = pci_conf_read(pc, tag, PCI_ID_REG);
        csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
        class = pci_conf_read(pc, tag, PCI_CLASS_REG);
-       intr = pci_conf_read(pc, tag, PCI_INTERRUPT_REG);
-       bhlcr = pci_conf_read(pc, tag, PCI_BHLC_REG);
 
        /* Invalid vendor ID value? */
        if (PCI_VENDOR(id) == PCI_VENDOR_INVALID)
@@ -301,6 +303,9 @@
                pa.pa_intrswiz = sc->sc_intrswiz + device;
                pa.pa_intrtag = sc->sc_intrtag;
        }
+
+       intr = pci_conf_read(pc, tag, PCI_INTERRUPT_REG);
+
        pin = PCI_INTERRUPT_PIN(intr);
        pa.pa_rawintrpin = pin;
        if (pin == PCI_INTERRUPT_PIN_NONE) {
@@ -420,6 +425,11 @@
 #endif
        {
                tag = pci_make_tag(pc, sc->sc_bus, device, 0);
+
+               bhlcr = pci_conf_read(pc, tag, PCI_BHLC_REG);
+               if (PCI_HDRTYPE_TYPE(bhlcr) > 2)
+                       continue;
+
                id = pci_conf_read(pc, tag, PCI_ID_REG);
 
                /* Invalid vendor ID value? */
@@ -431,15 +441,19 @@
 
                qd = pci_lookup_quirkdata(PCI_VENDOR(id), PCI_PRODUCT(id));
 
-               bhlcr = pci_conf_read(pc, tag, PCI_BHLC_REG);
-               if (PCI_HDRTYPE_MULTIFN(bhlcr) ||
-                   (qd != NULL &&
-                     (qd->quirks & PCI_QUIRK_MULTIFUNCTION) != 0))
+               if (qd != NULL &&
+                     (qd->quirks & PCI_QUIRK_MULTIFUNCTION) != 0)
                        nfunctions = 8;
+               else if (qd != NULL &&
+                     (qd->quirks & PCI_QUIRK_MONOFUNCTION) != 0)
+                       nfunctions = 1;
                else
-                       nfunctions = 1;
+                       nfunctions = PCI_HDRTYPE_MULTIFN(bhlcr) ? 8 : 1;
 
                for (function = 0; function < nfunctions; function++) {
+                       if (qd != NULL &&
+                           (qd->quirks & PCI_QUIRK_SKIP_FUNC(function)) != 0)
+                               continue;
                        tag = pci_make_tag(pc, sc->sc_bus, device, function);
                        ret = pci_probe_device(sc, tag, match, pap);
                        if (match != NULL && ret != 0)



Home | Main Index | Thread Index | Old Index