Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/dev/pci Pull up following revision(s) (requested by j...



details:   https://anonhg.NetBSD.org/src/rev/2275257a0cff
branches:  netbsd-9
changeset: 455390:2275257a0cff
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Oct 15 19:33:23 2019 +0000

description:
Pull up following revision(s) (requested by jmcneill in ticket #331):

        sys/dev/pci/pci.c: revision 1.155

The PCI Local Bus Specification says that we should probe devices by
reading PCI_ID_REG. pci_enumerate_bus was incorrectly reading PCI_BHLC_REG
first, which surprisingly has worked for the past 16 years. Unfortunately,
this undefined behavior does the wrong thing on Amazon's Annapurna Labs
PCIe host controller.

diffstat:

 sys/dev/pci/pci.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (40 lines):

diff -r 77eb1089d4a6 -r 2275257a0cff sys/dev/pci/pci.c
--- a/sys/dev/pci/pci.c Tue Oct 15 19:30:50 2019 +0000
+++ b/sys/dev/pci/pci.c Tue Oct 15 19:33:23 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci.c,v 1.154 2018/12/15 05:38:45 msaitoh Exp $        */
+/*     $NetBSD: pci.c,v 1.154.4.1 2019/10/15 19:33:23 martin Exp $     */
 
 /*
  * Copyright (c) 1995, 1996, 1997, 1998
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.154 2018/12/15 05:38:45 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.154.4.1 2019/10/15 19:33:23 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -723,10 +723,6 @@
 
                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? */
@@ -736,6 +732,10 @@
                if (PCI_VENDOR(id) == 0)
                        continue;
 
+               bhlcr = pci_conf_read(pc, tag, PCI_BHLC_REG);
+               if (PCI_HDRTYPE_TYPE(bhlcr) > 2)
+                       continue;
+
                qd = pci_lookup_quirkdata(PCI_VENDOR(id), PCI_PRODUCT(id));
 
                if (qd != NULL &&



Home | Main Index | Thread Index | Old Index