# HG changeset patch # User myers # Date 1175900239 25200 # Node ID 8f772ca46fa3ded3b4614f46b894945c78ffe332 # Parent b4f7d0163d40f3143577d993fd85719f55fe1372 6472670 Internal pci bus numbering should be independent of bios enumeration order (for non-x8400 systems) diff -r b4f7d0163d40 -r 8f772ca46fa3 usr/src/pkgdefs/SUNWrmodr/i.bootenvrc --- a/usr/src/pkgdefs/SUNWrmodr/i.bootenvrc Fri Apr 06 15:31:12 2007 -0700 +++ b/usr/src/pkgdefs/SUNWrmodr/i.bootenvrc Fri Apr 06 15:57:19 2007 -0700 @@ -3,9 +3,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -23,7 +22,7 @@ # #ident "%Z%%M% %I% %E% SMI" # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # while read src dest @@ -31,6 +30,8 @@ if [ ! -f $dest ] ; then # Initial installation cp $src $dest + # Enable pci-renumber-buses property for initial install + echo setprop pci-renumber-buses 1 >> $dest else # # Preserve the installed version of @@ -92,7 +93,34 @@ echo $line >> $merge fi done - + + # + # Make sure the merged file has a pci-renumber-buses property. + # If $dest doesn't already have the property, add it to the + # merged file using the following rule: + # - if on a Sun Blade x8400, add "pci-renumber-buses=1" + # - on all other systems, add "pci-renumber-buses=0" + # + /usr/bin/nawk '{print $2}' $dest | \ + grep -w pci-renumber-buses > /dev/null + if [ $? != 0 ] ; then + # smbios parameters + smtype=SMB_TYPE_BASEBOARD + name="Sun Blade x8400 Server Module" + # + # if smbios fails, we're not on an x8400, so it's + # the same as grep not finding the x8400 ID + # + (/usr/sbin/smbios -t $smtype | \ + grep "$name") > /dev/null 2>&1 + if [ $? != 0 ] ; then + val="0" + else + val="1" + fi + echo setprop pci-renumber-buses $val >> $merge + fi + # # copy the merged file to $dest # diff -r b4f7d0163d40 -r 8f772ca46fa3 usr/src/uts/intel/io/pci/pci_boot.c --- 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;