changeset 5156:6b4e412afcf5

6524011 pcie slots show up in cfgadm as "Slot<n>" vs. "pcie<n>" in Nevada/s10u4
author prasad
date Mon, 01 Oct 2007 14:01:48 -0700
parents f8171ea20722
children 55436046775e
files usr/src/uts/intel/io/pci/pci_boot.c
diffstat 1 files changed, 37 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/intel/io/pci/pci_boot.c	Mon Oct 01 12:49:44 2007 -0700
+++ b/usr/src/uts/intel/io/pci/pci_boot.c	Mon Oct 01 14:01:48 2007 -0700
@@ -99,6 +99,7 @@
 static void alloc_res_array();
 static void create_ioapic_node(int bus, int dev, int fn, ushort_t vendorid,
     ushort_t deviceid);
+static void pciex_slot_names_prop(dev_info_t *, ushort_t);
 
 extern int pci_slot_names_prop(int, char *, int);
 extern ACPI_STATUS pciehpc_acpi_eval_osc(ACPI_HANDLE, uint32_t *);
@@ -1091,9 +1092,12 @@
 	if (status & PCI_STAT_UDF)
 		(void) ndi_prop_create_boolean(DDI_DEV_T_NONE, dip,
 		    "udf-supported");
-	if (pciex && slot_num)
+	if (pciex && slot_num) {
 		(void) ndi_prop_update_int(DDI_DEV_T_NONE, dip,
 		    "physical-slot#", slot_num);
+		if (!is_pci_bridge)
+			pciex_slot_names_prop(dip, slot_num);
+	}
 
 	(void) ndi_prop_update_int_array(DDI_DEV_T_NONE, dip,
 	    "power-consumption", power, 2);
@@ -1880,6 +1884,13 @@
 	char slotprop[256];
 	int len;
 
+	if (pci_bus_res[bus].dip != NULL) {
+		/* simply return if the property is already defined */
+		if (ddi_prop_exists(DDI_DEV_T_ANY, pci_bus_res[bus].dip,
+		    DDI_PROP_DONTPASS, "slot-names"))
+			return;
+	}
+
 	len = pci_slot_names_prop(bus, slotprop, sizeof (slotprop));
 	if (len > 0) {
 		/*
@@ -2078,3 +2089,28 @@
 	(void) ndi_prop_update_int64(DDI_DEV_T_NONE, ioapic_node,
 	    "reg", physaddr);
 }
+
+/*
+ * NOTE: For PCIe slots, the name is generated from the slot number
+ * information obtained from Slot Capabilities register.
+ * For non-PCIe slots, it is generated based on the slot number
+ * information in the PCI IRQ table.
+ */
+static void
+pciex_slot_names_prop(dev_info_t *dip, ushort_t slot_num)
+{
+	char slotprop[256];
+	int len;
+
+	bzero(slotprop, sizeof (slotprop));
+
+	/* set mask to 1 as there is only one slot (i.e dev 0) */
+	*(uint32_t *)slotprop = 1;
+	len = 4;
+	(void) snprintf(slotprop + len, sizeof (slotprop) - len, "pcie%d",
+	    slot_num);
+	len += strlen(slotprop + len) + 1;
+	len += len % 4;
+	(void) ndi_prop_update_int_array(DDI_DEV_T_NONE, dip, "slot-names",
+	    (int *)slotprop, len / sizeof (int));
+}