diff usr/src/uts/intel/io/pci/pci_boot.c @ 3986:8f772ca46fa3

6472670 Internal pci bus numbering should be independent of bios enumeration order (for non-x8400 systems)
author myers
date Fri, 06 Apr 2007 15:57:19 -0700
parents 9405aaf598cd
children 72f0f2d75d29
line wrap: on
line diff
--- a/usr/src/uts/intel/io/pci/pci_boot.c	Fri Apr 06 15:31:12 2007 -0700
+++ b/usr/src/uts/intel/io/pci/pci_boot.c	Fri Apr 06 15:57:19 2007 -0700
@@ -98,7 +98,7 @@
 
 extern int pci_slot_names_prop(int, char *, int);
 
-/* set non-zero to force PCI peer-bus renumbering */
+/* set to 1 to force PCI peer-bus renumbering, -1 to prevent it */
 int pci_bus_always_renumber = 0;
 
 /* get the subordinate bus # for a root/peer bus */
@@ -289,21 +289,35 @@
 static int
 pci_bus_renumber()
 {
-	ACPI_TABLE_HEADER *fadt;
+	char *bus_prop;
+	long val;
 
-	if (pci_bus_always_renumber)
+	/* allow over-ride via patchable variable */
+	if (pci_bus_always_renumber > 0)
 		return (1);
-
-	/* get the FADT */
-	if (AcpiGetFirmwareTable(FADT_SIG, 1, ACPI_LOGICAL_ADDRESSING,
-	    (ACPI_TABLE_HEADER **)&fadt) != AE_OK)
+	else if (pci_bus_always_renumber < 0)
 		return (0);
 
-	/* compare OEM Table ID to "SUNm31" */
-	if (strncmp("SUNm31", fadt->OemId, 6))
-		return (0);
-	else
-		return (1);
+	/*
+	 * Get the "pci-renumber-buses" boot property
+	 * This property is set-up during installation;
+	 * upgraded systems disable re-numbering to avoid the
+	 * complication of changing physical device paths.
+	 *
+	 * If the "pci-renumber-buses" property is not found,
+	 * this suggests an incomplete BFU or failure during
+	 * upgrade.  In either case, default to "don't renumber"
+	 * so that a botched BFU/upgrade doesn't render a system
+	 * unbootable.
+	 */
+	val = 0;
+	if (ddi_prop_lookup_string(DDI_DEV_T_ANY, ddi_root_node(),
+	    DDI_PROP_DONTPASS, "pci-renumber-buses", &bus_prop) ==
+	    DDI_PROP_SUCCESS) {
+		(void) ddi_strtol(bus_prop, NULL, 0, &val);
+		ddi_prop_free(bus_prop);
+	}
+	return (val);
 }
 
 /*
@@ -321,11 +335,6 @@
 	int pci_regs[] = {0, 0, 0};
 	int	i, root_addr = 0;
 
-	/*
-	 * Currently, we only enable the re-numbering on specific
-	 * Sun machines; this is a work-around for the more complicated
-	 * issue of upgrade changing physical device paths
-	 */
 	if (!pci_bus_renumber())
 		return;