Module Name:    src
Committed By:   jakllsch
Date:           Fri Jun 10 23:07:52 UTC 2016

Modified Files:
        src/sys/arch/x86/pci: pci_machdep.c

Log Message:
Avoid trying to create a tag for locating AMD HyperTransport bridge that will
panic a machine that uses Configuration Mechanism 2.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/x86/pci/pci_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/pci/pci_machdep.c
diff -u src/sys/arch/x86/pci/pci_machdep.c:1.73 src/sys/arch/x86/pci/pci_machdep.c:1.74
--- src/sys/arch/x86/pci/pci_machdep.c:1.73	Thu Nov 26 16:27:05 2015
+++ src/sys/arch/x86/pci/pci_machdep.c	Fri Jun 10 23:07:52 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.73 2015/11/26 16:27:05 jakllsch Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.74 2016/06/10 23:07:52 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.73 2015/11/26 16:27:05 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.74 2016/06/10 23:07:52 jakllsch Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -512,10 +512,12 @@ pci_attach_hook(device_t parent, device_
 	 * If that device has a HyperTransport capability, bus 0 must
 	 * be a HyperTransport bus and we disable MSI.
 	 */
-	tag = pci_make_tag(pc, 0, 24, 0);
-	if (pci_get_capability(pc, tag, PCI_CAP_LDT, NULL, NULL)) {
-		pba->pba_flags &= ~PCI_FLAGS_MSI_OKAY;
-		pba->pba_flags &= ~PCI_FLAGS_MSIX_OKAY;
+	if (24 < pci_bus_maxdevs(pc, 0)) {
+		tag = pci_make_tag(pc, 0, 24, 0);
+		if (pci_get_capability(pc, tag, PCI_CAP_LDT, NULL, NULL)) {
+			pba->pba_flags &= ~PCI_FLAGS_MSI_OKAY;
+			pba->pba_flags &= ~PCI_FLAGS_MSIX_OKAY;
+		}
 	}
 #endif /* __HAVE_PCI_MSI_MSIX */
 }

Reply via email to