summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorRob Johnston <rob.johnston@joyent.com>2019-01-05 05:53:40 +0000
committerRob Johnston <rob.johnston@joyent.com>2019-01-05 05:53:40 +0000
commit216463e298e7afdaf10746f89402a97565a2ddc4 (patch)
tree2942266b7c2fba83d58c02bc7caf0263148099be /usr
parenta3dc23a7f97b64f69d332537f51f3cf1b92fb473 (diff)
downloadillumos-joyent-216463e298e7afdaf10746f89402a97565a2ddc4.tar.gz
Initial work for:
OS-7071 Add platform topo map for HGST Ultrastar Serv60+8 OS-7158 PCIe expansion slots mis-labelled in topo
Diffstat (limited to 'usr')
-rw-r--r--usr/src/lib/fm/topo/maps/Makefile3
-rw-r--r--usr/src/lib/fm/topo/maps/WDC,H4060-S/H4060-S-chassis-hc-topology.xml33
-rwxr-xr-xusr/src/lib/fm/topo/maps/WDC,H4060-S/H4060-S-disk-hc-topology.xmlgenksh104
-rw-r--r--usr/src/lib/fm/topo/maps/WDC,H4060-S/H4060-S-hc-topology.xml215
-rw-r--r--usr/src/lib/fm/topo/maps/WDC,H4060-S/Makefile35
-rw-r--r--usr/src/lib/fm/topo/modules/common/disk/disk.c5
-rw-r--r--usr/src/lib/fm/topo/modules/common/pcibus/did.c95
-rw-r--r--usr/src/lib/fm/topo/modules/common/pcibus/pcibus_labels.c6
8 files changed, 472 insertions, 24 deletions
diff --git a/usr/src/lib/fm/topo/maps/Makefile b/usr/src/lib/fm/topo/maps/Makefile
index a35419192f..230609a82b 100644
--- a/usr/src/lib/fm/topo/maps/Makefile
+++ b/usr/src/lib/fm/topo/maps/Makefile
@@ -55,7 +55,8 @@ i386_SUBDIRS = i86pc \
Joyent,Joyent-Storage-Platform-7001 \
SMCI,SSG-2028R-ACR24L \
SMCI,SSG-6049P-E1CR36L \
- SMCI,SSG-2029P-ACR24L
+ SMCI,SSG-2029P-ACR24L \
+ WDC,H4060-S
SUBDIRS = $($(MACH)_SUBDIRS)
diff --git a/usr/src/lib/fm/topo/maps/WDC,H4060-S/H4060-S-chassis-hc-topology.xml b/usr/src/lib/fm/topo/maps/WDC,H4060-S/H4060-S-chassis-hc-topology.xml
new file mode 100644
index 0000000000..5bba0b3b90
--- /dev/null
+++ b/usr/src/lib/fm/topo/maps/WDC,H4060-S/H4060-S-chassis-hc-topology.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!DOCTYPE topology SYSTEM "/usr/share/lib/xml/dtd/topology.dtd.1">
+<!--
+ Copyright (c) 2018, Joyent, Inc.
+
+
+ This file and its contents are supplied under the terms of the
+ Common Development and Distribution License ("CDDL"), version 1.0.
+ You may only use this file in accordance with the terms of version
+ 1.0 of the CDDL.
+
+ A full copy of the text of the CDDL should have accompanied this
+ source. A copy of the CDDL is also available via the Internet at
+ http://www.illumos.org/license/CDDL.
+
+-->
+
+<topology name='chassis' scheme='hc'>
+ <range name='chassis' min='0' max='0'>
+ <node instance='0'>
+ <fac-enum provider='fac_prov_ipmi' />
+ <propgroup name='ipmi' version='1'
+ name-stability='Private' data-stability='Private' >
+ <propval name='entity-list' type='string_array' >
+ <propitem value='Physical Scrty' />
+ <propitem value='FP NMI Diag Int' />
+ <propitem value='Button' />
+ <propitem value='Fan Redundancy' />
+ </propval>
+ </propgroup>
+ </node>
+ </range>
+</topology>
diff --git a/usr/src/lib/fm/topo/maps/WDC,H4060-S/H4060-S-disk-hc-topology.xmlgenksh b/usr/src/lib/fm/topo/maps/WDC,H4060-S/H4060-S-disk-hc-topology.xmlgenksh
new file mode 100755
index 0000000000..0a29af6b37
--- /dev/null
+++ b/usr/src/lib/fm/topo/maps/WDC,H4060-S/H4060-S-disk-hc-topology.xmlgenksh
@@ -0,0 +1,104 @@
+#!/bin/ksh -x
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright (c) 2018, Joyent, Inc.
+#
+
+#
+# The 60 LFF drive bays and their occupants will get enumerated by the ses
+# module. However, the labels we get from SES have the drive serial number
+# embedded in them - for example: "SLOT 00,8DGNA1EH".
+#
+# So we override the labels here. There are no physical labels on the LFF
+# drive bays. And the service sticker label on the underside of the top
+# chassis cover simply refers to the bays by number (starting from 0). As
+# these bays are intended to be occupied by hard drives, we set the FRU labels
+# "HDD 0" to "HDD 59".
+#
+function do_hdd_bay
+{
+ cat <<EOF
+ <node instance='${1}' static='true'>
+ <propgroup name='protocol' version='1' name-stability='Private'
+ data-stability='Private'>
+ <propval name='label' type='string' value='${2}' />
+ </propgroup>
+ </node>
+EOF
+}
+
+#
+# Generate the topology map the 8 SFF SAS bays. LED managment for these
+# bays is driven by the IOM and so empty bays will already have been enumerated
+# by the ses module. We simply add the necessary binding properties to these
+# bay nodes so that the disk module can enumerate any occupants. The SFF
+# bays, which are intended to carry SSDs are physically labeled "SSD 60" to
+# "SSD 67"
+#
+function do_ssd_bay
+{
+ cat <<EOF
+ <node instance='${1}' static='true'>
+ <propgroup name='protocol' version='1' name-stability='Private'
+ data-stability='Private'>
+ <propval name='label' type='string' value='${2}' />
+ </propgroup>
+ <propgroup name='binding' version='1' name-stability='Private'
+ data-stability='Private'>
+ <propval name='driver' type='string' value='mpt_sas' />
+ <propval name='devctl' type='string'
+ value='${3}' />
+ <propval name='enclosure' type='uint32' value='${4}' />
+ <propval name='slot' type='uint32' value='${5}' />
+ </propgroup>
+ </node>
+EOF
+}
+
+cat <<EOF
+<topology name='disk' scheme='hc'>
+ <range name='ses-enclosure' min='0' max='0'>
+ <node instance='0' static='true'>
+ <dependents grouping='children'>
+ <range name='bay' min='0' max='67'>
+EOF
+
+bay=0
+while (( bay <= 59 )); do
+ do_hdd_bay $bay "HDD $bay"
+ (( bay = bay + 1 ))
+done
+
+enclosure=1
+bay=60
+slot=0
+devctl='/devices/pci@cd,0/pci8086,2032@2/pci1000,30e0@0:devctl'
+while (( slot <= 7 )); do
+ do_ssd_bay $bay "SSD $bay" "$devctl" $enclosure $slot
+ (( bay = bay + 1 ))
+ (( slot = slot + 1 ))
+done
+
+cat <<EOF
+ <dependents grouping='children'>
+ <range name='disk' min='0' max='0'>
+ <enum-method name='disk' version='1' />
+ </range>
+ </dependents>
+ </range> <!-- bay -->
+ </dependents>
+ </node>
+</range> <!-- ses-enclosure -->
+
+</topology>
+EOF
diff --git a/usr/src/lib/fm/topo/maps/WDC,H4060-S/H4060-S-hc-topology.xml b/usr/src/lib/fm/topo/maps/WDC,H4060-S/H4060-S-hc-topology.xml
new file mode 100644
index 0000000000..fb109baad7
--- /dev/null
+++ b/usr/src/lib/fm/topo/maps/WDC,H4060-S/H4060-S-hc-topology.xml
@@ -0,0 +1,215 @@
+<?xml version="1.0"?>
+<!DOCTYPE topology SYSTEM "/usr/share/lib/xml/dtd/topology.dtd.1">
+<!--
+ This file and its contents are supplied under the terms of the
+ Common Development and Distribution License ("CDDL"), version 1.0.
+ You may only use this file in accordance with the terms of version
+ 1.0 of the CDDL.
+
+ A full copy of the text of the CDDL should have accompanied this
+ source. A copy of the CDDL is also available via the Internet at
+ http://www.illumos.org/license/CDDL.
+
+ Copyright (c) 2018, Joyent, Inc.
+-->
+<topology name='i86pc' scheme='hc'>
+
+ <range name='motherboard' min='0' max='0'>
+ <enum-method name='smbios' version='1' />
+ <node instance='0' static='true'>
+ <fac-enum provider='fac_prov_ipmi' />
+ <facility name='BMC Watchdog' type='sensor' provider='fac_prov_ipmi' >
+ <propgroup name='facility' version='1' name-stability='Private'
+ data-stability='Private' >
+ <propval name='type' type='uint32' value='269' />
+ <propval name='sensor-class' type='string' value='discrete' />
+ <propval name='entity_ref' type='string_array' value='discrete' >
+ <propitem value='BMC Watchdog' />
+ </propval>
+ <propmethod name='ipmi_sensor_state' version='0'
+ propname='state' proptype='uint32' >
+ </propmethod>
+ </propgroup>
+ </facility>
+ <facility name='CPU ERR2' type='sensor' provider='fac_prov_ipmi' >
+ <propgroup name='facility' version='1' name-stability='Private'
+ data-stability='Private' >
+ <propval name='type' type='uint32' value='269' />
+ <propval name='sensor-class' type='string' value='discrete' />
+ <propval name='entity_ref' type='string_array' value='discrete' >
+ <propitem value='CPU ERR2' />
+ </propval>
+ <propmethod name='ipmi_sensor_state' version='0'
+ propname='state' proptype='uint32' >
+ </propmethod>
+ </propgroup>
+ </facility>
+ <facility name='CPU Missing' type='sensor' provider='fac_prov_ipmi' >
+ <propgroup name='facility' version='1' name-stability='Private'
+ data-stability='Private' >
+ <propval name='type' type='uint32' value='269' />
+ <propval name='sensor-class' type='string' value='discrete' />
+ <propval name='entity_ref' type='string_array' value='discrete' >
+ <propitem value='CPU Missing' />
+ </propval>
+ <propmethod name='ipmi_sensor_state' version='0'
+ propname='state' proptype='uint32' >
+ </propmethod>
+ </propgroup>
+ </facility>
+ <facility name='SSB Therm Trip' type='sensor' provider='fac_prov_ipmi' >
+ <propgroup name='facility' version='1' name-stability='Private'
+ data-stability='Private' >
+ <propval name='type' type='uint32' value='269' />
+ <propval name='sensor-class' type='string' value='discrete' />
+ <propval name='entity_ref' type='string_array' value='discrete' >
+ <propitem value='SSB Therm Trip' />
+ </propval>
+ <propmethod name='ipmi_sensor_state' version='0'
+ propname='state' proptype='uint32' >
+ </propmethod>
+ </propgroup>
+ </facility>
+ <facility name='SMI Watchdog' type='sensor' provider='fac_prov_ipmi' >
+ <propgroup name='facility' version='1' name-stability='Private'
+ data-stability='Private' >
+ <propval name='type' type='uint32' value='269' />
+ <propval name='sensor-class' type='string' value='discrete' />
+ <propval name='entity_ref' type='string_array' value='discrete' >
+ <propitem value='SMI Watchdog' />
+ </propval>
+ <propmethod name='ipmi_sensor_state' version='0'
+ propname='state' proptype='uint32' >
+ </propmethod>
+ </propgroup>
+ </facility>
+ <facility name='Voltage Fault' type='sensor' provider='fac_prov_ipmi' >
+ <propgroup name='facility' version='1' name-stability='Private'
+ data-stability='Private' >
+ <propval name='type' type='uint32' value='269' />
+ <propval name='sensor-class' type='string' value='discrete' />
+ <propval name='entity_ref' type='string_array' value='discrete' >
+ <propitem value='Voltage Fault' />
+ </propval>
+ <propmethod name='ipmi_sensor_state' version='0'
+ propname='state' proptype='uint32' >
+ </propmethod>
+ </propgroup>
+ </facility>
+ <facility name='VR Watchdog' type='sensor' provider='fac_prov_ipmi' >
+ <propgroup name='facility' version='1' name-stability='Private'
+ data-stability='Private' >
+ <propval name='type' type='uint32' value='269' />
+ <propval name='sensor-class' type='string' value='discrete' />
+ <propval name='entity_ref' type='string_array' value='discrete' >
+ <propitem value='VR Watchdog' />
+ </propval>
+ <propmethod name='ipmi_sensor_state' version='0'
+ propname='state' proptype='uint32' >
+ </propmethod>
+ </propgroup>
+ </facility>
+ <facility name='VRD Hot' type='sensor' provider='fac_prov_ipmi' >
+ <propgroup name='facility' version='1' name-stability='Private'
+ data-stability='Private' >
+ <propval name='type' type='uint32' value='269' />
+ <propval name='sensor-class' type='string' value='discrete' />
+ <propval name='entity_ref' type='string_array' value='discrete' >
+ <propitem value='VRD Hot' />
+ </propval>
+ <propmethod name='ipmi_sensor_state' version='0'
+ propname='state' proptype='uint32' >
+ </propmethod>
+ </propgroup>
+ </facility>
+ <facility name='P1 Therm Ctrl %' type='sensor' provider='fac_prov_ipmi' >
+ <propgroup name='facility' version='1' name-stability='Private'
+ data-stability='Private' >
+ <propval name='type' type='uint32' value='257' />
+ <propval name='units' type='uint32' value='200' />
+ <propval name='sensor-class' type='string' value='threshold' />
+ <propval name='entity_ref' type='string_array' value='discrete' >
+ <propitem value='P1 Therm Ctrl %' />
+ </propval>
+ <propmethod name='ipmi_sensor_state' version='0'
+ propname='state' proptype='uint32' >
+ </propmethod>
+ <propmethod name='ipmi_sensor_reading' version='0'
+ propname='reading' proptype='double' >
+ </propmethod>
+ </propgroup>
+ </facility>
+ <facility name='P2 Therm Ctrl %' type='sensor' provider='fac_prov_ipmi' >
+ <propgroup name='facility' version='1' name-stability='Private'
+ data-stability='Private' >
+ <propval name='type' type='uint32' value='257' />
+ <propval name='units' type='uint32' value='200' />
+ <propval name='sensor-class' type='string' value='threshold' />
+ <propval name='entity_ref' type='string_array' value='discrete' >
+ <propitem value='P2 Therm Ctrl %' />
+ </propval>
+ <propmethod name='ipmi_sensor_state' version='0'
+ propname='state' proptype='uint32' >
+ </propmethod>
+ <propmethod name='ipmi_sensor_reading' version='0'
+ propname='reading' proptype='double' >
+ </propmethod>
+ </propgroup>
+ </facility>
+ <propgroup name='protocol' version='1'
+ name-stability='Private' data-stability='Private' >
+ <propval name='label' type='string' value='MB' />
+ </propgroup>
+ <propgroup name='ipmi' version='1'
+ name-stability='Private' data-stability='Private' >
+ <propval name='entity-list' type='string_array' >
+ <propitem value='BB Ambient Temp' />
+ <propitem value='BB BMC Temp' />
+ <propitem value='BB Mem VRM Temp' />
+ <propitem value='BB Mem VR Temp' />
+ <propitem value='BB M.2 Temp' />
+ <propitem value='BB P2 VR Temp' />
+ <propitem value='BB +12.0V' />
+ <propitem value='BB +3.3V Vbat' />
+ <propitem value='BMC FW Health' />
+ <propitem value='DIMM Thrm Mrgn 1' />
+ <propitem value='DIMM Thrm Mrgn 2' />
+ <propitem value='DIMM Thrm Mrgn 3' />
+ <propitem value='DIMM Thrm Mrgn 4' />
+ <propitem value='FW Update Status ' />
+ <propitem value='LAN NIC Temp' />
+ <propitem value='IPMI Watchdog' />
+ <propitem value='P1 DTS Therm Mgn' />
+ <propitem value='P1 Status' />
+ <propitem value='P2 DTS Therm Mgn' />
+ <propitem value='P2 Status' />
+ <propitem value='SSB Temp' />
+ <propitem value='System Event Log' />
+ <propitem value='System Event' />
+ </propval>
+ </propgroup>
+ </node>
+
+ <dependents grouping='children'>
+ <range name='chip' min='0' max='1'>
+ <enum-method name='chip' version='1' />
+ </range>
+ <range name='hostbridge' min='0' max='254'>
+ <enum-method name='hostbridge' version='1' />
+ </range>
+ <range name='sp' min='0' max='0'>
+ <enum-method name='ipmi' version='1' />
+ </range>
+ </dependents>
+
+ </range>
+
+ <range name='chassis' min='0' max='0'>
+ <propmap name='H4060-S-chassis' />
+ </range>
+ <range name='ses-enclosure' min='0' max='0'>
+ <enum-method name='ses' version='1' />
+ <propmap name='H4060-S-disk' />
+ </range>
+
+</topology>
diff --git a/usr/src/lib/fm/topo/maps/WDC,H4060-S/Makefile b/usr/src/lib/fm/topo/maps/WDC,H4060-S/Makefile
new file mode 100644
index 0000000000..1a5e9c97d4
--- /dev/null
+++ b/usr/src/lib/fm/topo/maps/WDC,H4060-S/Makefile
@@ -0,0 +1,35 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright (c) 2018, Joyent, Inc.
+#
+
+# NOTE: The name of the xml file we are building is 'platform'
+# specific, but its build is structured as 'arch' specific since
+# 'uname -i' on all x86 platforms returns i86pc.
+
+ARCH = i86pc
+CLASS = arch
+DTDFILE = topology.dtd.1
+
+TOPOFILE = \
+ H4060-S-hc-topology.xml \
+ H4060-S-chassis-hc-topology.xml \
+ H4060-S-disk-hc-topology.xml \
+
+SRCDIR = ../WDC,H4060-S
+
+PLATFORM = H4060-S
+
+CLOBBERFILES += H4060-S-disk-hc-topology.xml
+
+include ../Makefile.map
diff --git a/usr/src/lib/fm/topo/modules/common/disk/disk.c b/usr/src/lib/fm/topo/modules/common/disk/disk.c
index c16fa28aae..eb77c35044 100644
--- a/usr/src/lib/fm/topo/modules/common/disk/disk.c
+++ b/usr/src/lib/fm/topo/modules/common/disk/disk.c
@@ -22,7 +22,7 @@
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/*
- * Copyright (c) 2018, Joyent, Inc.
+ * Copyright (c) 2019, Joyent, Inc.
*/
#include <strings.h>
@@ -102,7 +102,8 @@ disk_enum(topo_mod_t *mod, tnode_t *baynode,
topo_strerror(err));
return (-1);
}
- if (topo_node_fru_set(baynode, fmri, 0, &err) != 0) {
+ if (topo_node_fru_set(baynode, fmri, 0, &err) != 0 &&
+ err != ETOPO_PROP_DEFD) {
topo_mod_dprintf(mod, "disk_enum: "
"topo_node_fru error %s\n", topo_strerror(err));
nvlist_free(fmri);
diff --git a/usr/src/lib/fm/topo/modules/common/pcibus/did.c b/usr/src/lib/fm/topo/modules/common/pcibus/did.c
index 59ba171c75..4ffa1ef692 100644
--- a/usr/src/lib/fm/topo/modules/common/pcibus/did.c
+++ b/usr/src/lib/fm/topo/modules/common/pcibus/did.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, Joyent, Inc. All rights reserved.
*/
/*
@@ -104,11 +105,37 @@ di_devtype_get(topo_mod_t *mp, di_node_t src, char **devtype)
typedef struct smbios_slot_cb {
int cb_slotnum;
+ int cb_bdf;
const char *cb_label;
} smbios_slot_cb_t;
static int
-di_smbios_find_slot(smbios_hdl_t *shp, const smbios_struct_t *strp, void *data)
+di_smbios_find_slot_by_bdf(smbios_hdl_t *shp, const smbios_struct_t *strp,
+ void *data)
+{
+ smbios_slot_cb_t *cbp = data;
+ smbios_slot_t slot;
+ int bus, df;
+
+ bus = (cbp->cb_bdf & 0xFF00) >> 8;
+ df = cbp->cb_bdf & 0xFF;
+
+ if (strp->smbstr_type != SMB_TYPE_SLOT ||
+ smbios_info_slot(shp, strp->smbstr_id, &slot) != 0)
+ return (0);
+
+ if (slot.smbl_bus == bus && slot.smbl_df == df) {
+ cbp->cb_label = slot.smbl_name;
+ cbp->cb_slotnum = slot.smbl_id;
+ return (1);
+ }
+
+ return (0);
+}
+
+static int
+di_smbios_find_slot_by_id(smbios_hdl_t *shp, const smbios_struct_t *strp,
+ void *data)
{
smbios_slot_cb_t *cbp = data;
smbios_slot_t slot;
@@ -126,7 +153,8 @@ di_smbios_find_slot(smbios_hdl_t *shp, const smbios_struct_t *strp, void *data)
}
static int
-di_physlotinfo_get(topo_mod_t *mp, di_node_t src, int *slotnum, char **slotname)
+di_physlotinfo_get(topo_mod_t *mp, di_node_t src, int bdf, int *slotnum,
+ char **slotname)
{
char *slotbuf;
int sz;
@@ -154,14 +182,12 @@ di_physlotinfo_get(topo_mod_t *mp, di_node_t src, int *slotnum, char **slotname)
(void) sscanf((char *)&buf[4], "Slot%d", slotnum);
}
- if (*slotnum == -1)
- return (0);
-
/*
* Order of preference
- * 1) take slotnum and look up in SMBIOS table
- * 2) use slot-names
- * 3) fabricate name based on slotnum
+ * 1) cross-reference BDF w\ slot records in SMBIOS
+ * 2) cross-reference slot-id w\ slot records in SMBIOS
+ * 3) use slot-names
+ * 4) fabricate name based on slot-id
*/
if ((shp = topo_mod_smbios(mp)) != NULL) {
/*
@@ -170,22 +196,55 @@ di_physlotinfo_get(topo_mod_t *mp, di_node_t src, int *slotnum, char **slotname)
* this, so we have to treat slot 0 as a valid device.
* But other platforms use 0 to identify an internal
* device. We deal with this by letting SMBIOS be the
- * final decision maker. If SMBIOS is supported, but
- * the given slot number is not represented in the
- * SMBIOS tables, then ignore the slot entirely.
+ * final decision maker.
+ *
+ * If SMBIOS is supported and is at least version 2.6 then
+ * we try to find a matching slot record based on the BDF.
+ *
+ * On systems with older SMBIOS implementations, we attempt
+ * to instead match the slot record using the slot number.
+ *
+ * If neither of the above mechanisms find a match, then
+ * ignore the slot entirely.
*/
smbios_slot_cb_t cbdata;
+ smbios_version_t smbv;
+ boolean_t bdf_supp = B_TRUE;
cbdata.cb_slotnum = *slotnum;
+ cbdata.cb_bdf = bdf;
cbdata.cb_label = NULL;
- if (smbios_iter(shp, di_smbios_find_slot, &cbdata) <= 0)
+
+ /*
+ * The bus and device/fn payload members of the SMBIOS slot
+ * record were added in SMBIOS 2.6.
+ */
+ smbios_info_smbios_version(shp, &smbv);
+ if (smbv.smbv_major < 2 && smbv.smbv_minor < 6)
+ bdf_supp = B_FALSE;
+
+ /*
+ * If the SMBIOS implementation is too old to look up the slot
+ * records by BDF and we weren't able to derive a slotnum then
+ * there's not much we can do here.
+ */
+ if (!bdf_supp && *slotnum == -1)
+ return (0);
+
+ if (bdf_supp &&
+ smbios_iter(shp, di_smbios_find_slot_by_bdf, &cbdata) <= 0)
return (0);
+
+ if (!bdf_supp &&
+ smbios_iter(shp, di_smbios_find_slot_by_id, &cbdata) <= 0)
+ return (0);
+
slotbuf = (char *)cbdata.cb_label;
- topo_mod_dprintf(mp, "%s: node=%p: using smbios name\n",
+ topo_mod_dprintf(mp, "%s: di_node=%p: using smbios name\n",
__func__, src);
} else if (got_slotprop == B_TRUE) {
slotbuf = (char *)&buf[4];
- topo_mod_dprintf(mp, "%s: node=%p: found %s property\n",
+ topo_mod_dprintf(mp, "%s: di_node=%p: found %s property\n",
__func__, src, DI_SLOTPROP);
} else {
/*
@@ -194,13 +253,13 @@ di_physlotinfo_get(topo_mod_t *mp, di_node_t src, int *slotnum, char **slotname)
*/
slotbuf = alloca(16);
(void) snprintf(slotbuf, 16, "SLOT %d", *slotnum);
- topo_mod_dprintf(mp, "%s: node=%p: using generic slot name\n",
- __func__, src);
+ topo_mod_dprintf(mp, "%s: di_node=%p: using generic slot "
+ "name\n", __func__, src);
}
if ((*slotname = topo_mod_strdup(mp, slotbuf)) == NULL)
return (-1);
- topo_mod_dprintf(mp, "%s: node=%p: slotname=%s\n",
+ topo_mod_dprintf(mp, "%s: di_node=%p: slotname=%s\n",
__func__, src, *slotname);
return (0);
@@ -325,7 +384,7 @@ did_create(topo_mod_t *mp, di_node_t src,
/*
* This is a pciex node.
*/
- if (di_physlotinfo_get(mp, src, &np->dp_physlot,
+ if (di_physlotinfo_get(mp, src, np->dp_bdf, &np->dp_physlot,
&np->dp_physlot_name) < 0) {
if (np->dp_devtype != NULL)
topo_mod_strfree(mp, np->dp_devtype);
diff --git a/usr/src/lib/fm/topo/modules/common/pcibus/pcibus_labels.c b/usr/src/lib/fm/topo/modules/common/pcibus/pcibus_labels.c
index a7e59ec300..2311b5ebfb 100644
--- a/usr/src/lib/fm/topo/modules/common/pcibus/pcibus_labels.c
+++ b/usr/src/lib/fm/topo/modules/common/pcibus/pcibus_labels.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, Joyent, Inc.
*/
#include <alloca.h>
@@ -245,7 +246,7 @@ pci_slot_label_lookup(topo_mod_t *mod, tnode_t *node, did_t *dp, did_t *pdp)
* of a slot while the child contains the label.
*
* Note that this algorithm only applies to nodes which have
- * a physcal slot number. (i.e. PCIE devices or PCI/PCIX
+ * a physical slot number. (i.e. PCIE devices or PCI/PCIX
* devices off of a PCIE to PCIX switch)
*/
if (did_physlot(pdp) >= 0) {
@@ -258,7 +259,6 @@ pci_slot_label_lookup(topo_mod_t *mod, tnode_t *node, did_t *dp, did_t *pdp)
* Get this device's physical slot name.
*/
l = (char *)did_physlot_name(pdp, d);
-
anode = topo_node_parent(node);
/*
@@ -386,7 +386,7 @@ pci_slot_label_lookup(topo_mod_t *mod, tnode_t *node, did_t *dp, did_t *pdp)
*/
if ((l = (char *)pci_label_physlot_lookup(mod, pp, pdp))
== NULL) {
- if ((l = (char *)did_physlot_name(pdp, d)) != NULL) {
+ if ((l = (char *)did_physlot_name(dp, d)) != NULL) {
l = (char *)
pci_label_slotname_lookup(mod, pp, l, dp);
}