Mercurial > illumos > illumos-gate
changeset 12844:f4172e28e09f
6966488 topo chip enumerator uses stale smbios handle
author | Trang Do <Trang.Do@Sun.COM> |
---|---|
date | Thu, 15 Jul 2010 11:31:02 -0700 |
parents | dc4b386c586d |
children | f0e4ac2993aa |
files | usr/src/lib/fm/topo/modules/i86pc/chip/chip.h usr/src/lib/fm/topo/modules/i86pc/chip/chip_amd.c usr/src/lib/fm/topo/modules/i86pc/chip/chip_intel.c usr/src/lib/fm/topo/modules/i86pc/chip/chip_smbios.c usr/src/lib/fm/topo/modules/i86pc/x86pi/x86pi.c usr/src/lib/fm/topo/modules/i86pc/x86pi/x86pi_bay.c usr/src/lib/fm/topo/modules/i86pc/x86pi/x86pi_bboard.c usr/src/lib/fm/topo/modules/i86pc/x86pi/x86pi_chassis.c usr/src/lib/fm/topo/modules/i86pc/x86pi/x86pi_hostbridge.c usr/src/lib/fm/topo/modules/i86pc/x86pi/x86pi_impl.h usr/src/lib/fm/topo/modules/i86pc/x86pi/x86pi_subr.c |
diffstat | 11 files changed, 170 insertions(+), 91 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/lib/fm/topo/modules/i86pc/chip/chip.h Thu Jul 15 10:59:37 2010 -0600 +++ b/usr/src/lib/fm/topo/modules/i86pc/chip/chip.h Thu Jul 15 11:31:02 2010 -0700 @@ -19,8 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. */ #ifndef _CHIP_H @@ -214,7 +213,8 @@ extern const char *chip_serial_smbios_get(topo_mod_t *, id_t); extern const char *chip_part_smbios_get(topo_mod_t *, id_t); extern const char *chip_rev_smbios_get(topo_mod_t *, id_t); -extern id_t memnode_to_smbiosid(uint16_t, const char *, uint64_t, void *); +extern id_t memnode_to_smbiosid(topo_mod_t *, uint16_t, const char *, + uint64_t, void *); #ifdef __cplusplus
--- a/usr/src/lib/fm/topo/modules/i86pc/chip/chip_amd.c Thu Jul 15 10:59:37 2010 -0600 +++ b/usr/src/lib/fm/topo/modules/i86pc/chip/chip_amd.c Thu Jul 15 11:31:02 2010 -0700 @@ -20,8 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. */ /* @@ -265,7 +264,7 @@ (void) topo_pgroup_create(csnode, &cs_pgroup, &err); inst = chan; - dimm_smbid = memnode_to_smbiosid(smbid, + dimm_smbid = memnode_to_smbiosid(mod, smbid, CS_NODE_NAME, cs, &inst); serial = chip_serial_smbios_get(mod, dimm_smbid); @@ -498,8 +497,8 @@ continue; } if (FM_AWARE_SMBIOS(mod)) { - smbid = memnode_to_smbiosid(chip_smbid, DIMM_NODE_NAME, - i, NULL); + smbid = memnode_to_smbiosid(mod, chip_smbid, + DIMM_NODE_NAME, i, NULL); serial = chip_serial_smbios_get(mod, smbid); part = chip_part_smbios_get(mod, smbid); rev = chip_rev_smbios_get(mod, smbid);
--- a/usr/src/lib/fm/topo/modules/i86pc/chip/chip_intel.c Thu Jul 15 10:59:37 2010 -0600 +++ b/usr/src/lib/fm/topo/modules/i86pc/chip/chip_intel.c Thu Jul 15 11:31:02 2010 -0700 @@ -20,8 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. */ #include <unistd.h> @@ -213,8 +212,8 @@ int channum; channum = topo_node_instance(pnode); - smbid = memnode_to_smbiosid(chip_smbid, DIMM_NODE_NAME, - i, &channum); + smbid = memnode_to_smbiosid(mod, chip_smbid, + DIMM_NODE_NAME, i, &channum); if (serial == NULL) serial = (char *)chip_serial_smbios_get(mod, smbid);
--- a/usr/src/lib/fm/topo/modules/i86pc/chip/chip_smbios.c Thu Jul 15 10:59:37 2010 -0600 +++ b/usr/src/lib/fm/topo/modules/i86pc/chip/chip_smbios.c Thu Jul 15 11:31:02 2010 -0700 @@ -20,8 +20,7 @@ */ /* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. */ #include <unistd.h> @@ -73,7 +72,6 @@ static int bb_count = 0; static int ndimm_ids, nmct_ids = 0; -static smbios_hdl_t *shp = NULL; static int fill_chip_smbios = 0; typedef int smbios_rec_f(topo_mod_t *, const smbios_struct_t *); @@ -95,12 +93,18 @@ } static int -extdimmslot_to_dimmslot(id_t chip_smbid, int channum, int csnum) +extdimmslot_to_dimmslot(topo_mod_t *mod, id_t chip_smbid, int channum, + int csnum) { smbios_memdevice_ext_t emd; smbios_memdevice_t md; int i, j, k; int match = 0; + smbios_hdl_t *shp; + + shp = topo_mod_smbios(mod); + if (shp == NULL) + return (-1); if (chip_smbid == IGNORE_ID && bb_count <= 1 && nmct_ids <= 1) { for (i = 0; i < ndimm_ids; i++) { @@ -143,8 +147,8 @@ } id_t -memnode_to_smbiosid(uint16_t chip_smbid, const char *name, uint64_t nodeid, - void *data) +memnode_to_smbiosid(topo_mod_t *mod, uint16_t chip_smbid, const char *name, + uint64_t nodeid, void *data) { if (strcmp(name, CS_NODE_NAME) == 0) { @@ -159,7 +163,8 @@ * Set the DIMM Slot label to the Chip Select Node * Set the "data" to carry the DIMM instance */ - dimmslot = extdimmslot_to_dimmslot(chip_smbid, channum, csnum); + dimmslot = extdimmslot_to_dimmslot(mod, chip_smbid, channum, + csnum); if (dimmslot != -1 && dimmsmb[0].dimm_id != 0) *((id_t *)data) = dimmslot % (dimmsmb[0].dimm_id); else @@ -182,7 +187,7 @@ id_t dimmslot = -1; channum = *(int *)data; - dimmslot = extdimmslot_to_dimmslot(chip_smbid, + dimmslot = extdimmslot_to_dimmslot(mod, chip_smbid, channum, SKIP_CS); return (dimmslot); @@ -204,6 +209,11 @@ smbios_memarray_ext_t extma; smbios_memdevice_ext_t extmd; int ext_match = 0; + smbios_hdl_t *shp; + + shp = topo_mod_smbios(mod); + if (shp == NULL) + return (-1); switch (sp->smbstr_type) { case SMB_TYPE_BASEBOARD: @@ -323,10 +333,16 @@ static int chip_smbios_iterate(topo_mod_t *mod, smbios_rec_f *func_iter) { - const smb_struct_t *sp = shp->sh_structs; + const smb_struct_t *sp; smbios_struct_t s; int i, rv = 0; + smbios_hdl_t *shp; + shp = topo_mod_smbios(mod); + if (shp == NULL) + return (rv); + + sp = shp->sh_structs; for (i = 0; i < shp->sh_nstructs; i++, sp++) { if (sp->smbst_hdr->smbh_type != SMB_TYPE_INACTIVE && (rv = func_iter(mod, smb_export(sp, &s))) != 0) @@ -338,14 +354,6 @@ int init_chip_smbios(topo_mod_t *mod) { - if (shp == NULL) { - if ((shp = topo_mod_smbios(mod)) == NULL) { - whinge(mod, NULL, "init_chip_smbios: smbios " - "handle get failed\n"); - return (-1); - } - } - if (!fill_chip_smbios) { if (chip_smbios_iterate(mod, chip_get_smbstruct) == -1) return (-1); @@ -490,7 +498,9 @@ const char *dimm_bank = NULL; const char *clean_label = NULL; int err; + smbios_hdl_t *shp; + shp = topo_mod_smbios(mod); if (shp != NULL) { /* * Get Parent FRU's label @@ -575,7 +585,9 @@ { smbios_info_t c; const char *clean_serial = NULL; + smbios_hdl_t *shp; + shp = topo_mod_smbios(mod); if (shp != NULL && smb_id != -1) if (smbios_info_common(shp, smb_id, &c) != SMB_ERR) { clean_serial = chip_cleanup_smbios_str(mod, @@ -593,7 +605,9 @@ { smbios_info_t c; const char *clean_part = NULL; + smbios_hdl_t *shp; + shp = topo_mod_smbios(mod); if (shp != NULL && smb_id != -1) if (smbios_info_common(shp, smb_id, &c) != SMB_ERR) { clean_part = chip_cleanup_smbios_str(mod, @@ -610,7 +624,9 @@ { smbios_info_t c; const char *clean_rev = NULL; + smbios_hdl_t *shp; + shp = topo_mod_smbios(mod); if (shp != NULL && smb_id != -1) if (smbios_info_common(shp, smb_id, &c) != SMB_ERR) { clean_rev = chip_cleanup_smbios_str(mod,
--- a/usr/src/lib/fm/topo/modules/i86pc/x86pi/x86pi.c Thu Jul 15 10:59:37 2010 -0600 +++ b/usr/src/lib/fm/topo/modules/i86pc/x86pi/x86pi.c Thu Jul 15 11:31:02 2010 -0700 @@ -43,7 +43,7 @@ static int x86pi_enum_start(topo_mod_t *, x86pi_enum_t *); -static int x86pi_enum_gentopo(topo_mod_t *, tnode_t *, smbios_hdl_t *); +static int x86pi_enum_gentopo(topo_mod_t *, tnode_t *); /* * Entry point called by libtopo when enumeration is required @@ -171,7 +171,7 @@ topo_mod_dprintf(mod, "%s: failed to open SMBIOS\n", f); complvl = X86PI_NONE; } else { - complvl = x86pi_check_comp(mod, shp); + complvl = x86pi_check_comp(mod); } topo_mod_dprintf(mod, "%s: SMBIOS x86pi compliance: %s\n", f, @@ -198,7 +198,7 @@ * Create the topology. */ fac_done = 0; - rv = x86pi_enum_gentopo(mod, x86pi->t_parent, shp); + rv = x86pi_enum_gentopo(mod, x86pi->t_parent); x86pi_hbr_enum_fini(mod); @@ -238,7 +238,7 @@ * */ static int -x86pi_enum_gentopo(topo_mod_t *mod, tnode_t *t_parent, smbios_hdl_t *shp) +x86pi_enum_gentopo(topo_mod_t *mod, tnode_t *t_parent) { int rv; int nch, nbb, ncmp, i; @@ -258,6 +258,13 @@ smbios_pciexrc_t hbr; smbios_port_ext_t export; char *f = "x86pi_enum_gentopo"; + smbios_hdl_t *shp; + + shp = topo_mod_smbios(mod); + if (shp == NULL) { + topo_mod_dprintf(mod, "%s: failed to load SMBIOS\n", f); + return (-1); + } if (t_parent == NULL) { topo_mod_dprintf(mod, "%s: NULL parent\n", f); @@ -269,7 +276,7 @@ */ /* Type 3 structs */ stypes[SMB_TYPE_CHASSIS].type = SMB_TYPE_CHASSIS; - x86pi_smb_strcnt(shp, &stypes[SMB_TYPE_CHASSIS]); + x86pi_smb_strcnt(mod, &stypes[SMB_TYPE_CHASSIS]); ch_count = stypes[SMB_TYPE_CHASSIS].count; @@ -285,16 +292,15 @@ */ if (nch == 0) motherchassis_node = chassis_node = - x86pi_gen_chassis(mod, t_parent, shp, - ch_smbid, ch_inst++); + x86pi_gen_chassis(mod, t_parent, ch_smbid, + ch_inst++); else { if (motherchassis_node != NULL) chassis_node = x86pi_gen_chassis(mod, - motherchassis_node, shp, - ch_smbid, ch_inst++); + motherchassis_node, ch_smbid, ch_inst++); else chassis_node = x86pi_gen_chassis(mod, - t_parent, shp, ch_smbid, ch_inst++); + t_parent, ch_smbid, ch_inst++); } if (chassis_node == NULL) { @@ -307,7 +313,7 @@ /* count SMBIOS extended port connector structures */ smbc = &stypes[SUN_OEM_EXT_PORT]; smbc->type = SUN_OEM_EXT_PORT; - x86pi_smb_strcnt(shp, smbc); + x86pi_smb_strcnt(mod, smbc); /* * enumerate direct attached SATA disks if we found a @@ -343,8 +349,8 @@ * create "bay" node * call "disk" enum passing in "bay" node */ - rv = x86pi_gen_bay(mod, chassis_node, shp, - &export, disk_inst); + rv = x86pi_gen_bay(mod, chassis_node, &export, + disk_inst); if (rv != 0) topo_mod_dprintf(mod, "Failed to create disk %d\n", i); @@ -357,7 +363,7 @@ */ /* Type 2 structs */ stypes[SMB_TYPE_BASEBOARD].type = SMB_TYPE_BASEBOARD; - x86pi_smb_strcnt(shp, &stypes[SMB_TYPE_BASEBOARD]); + x86pi_smb_strcnt(mod, &stypes[SMB_TYPE_BASEBOARD]); bb_count = notvisited = stypes[SMB_TYPE_BASEBOARD].count; for (nbb = 0; nbb < bb_count; nbb++) { @@ -365,7 +371,7 @@ stypes[SMB_TYPE_BASEBOARD].ids[nbb].con_by_id = 0; stypes[SMB_TYPE_BASEBOARD].ids[nbb].node = NULL; } - (void) x86pi_bb_contains(mod, shp); + (void) x86pi_bb_contains(mod); min = 0; nbb = 0; @@ -396,7 +402,7 @@ * If this Baseboard has no Baseboard parents * place it under the chassis that contains it */ - bb_smbid = x86pi_bb_topparent(shp, nbb, &pnode, &psmbid); + bb_smbid = x86pi_bb_topparent(mod, nbb, &pnode, &psmbid); if (bb_smbid == -1 || pnode == NULL) { topo_mod_dprintf(mod, "Failed to get BaseBoard node (%d): parent\n", @@ -419,8 +425,8 @@ notvisited--; } - basebd_node = x86pi_gen_bboard(mod, pnode, shp, - bb_smbid, nbb, psmbid); + basebd_node = x86pi_gen_bboard(mod, pnode, bb_smbid, + nbb, psmbid); if (basebd_node == NULL) { topo_mod_dprintf(mod, "Failed to create BaseBoard node (%d)\n", nbb); @@ -433,7 +439,7 @@ * Look for contained handles here and if there are * make sure the chip handle below is part of it. */ - ncmp = x86pi_bb_getchips(mod, shp, nbb, bb_count); + ncmp = x86pi_bb_getchips(mod, nbb, bb_count); if (ncmp > 0) { max = min + ncmp - 1; /* make sure the chip enum is loaded */ @@ -484,7 +490,7 @@ smbc = &stypes[SUN_OEM_PCIEXRC]; smbc->type = SUN_OEM_PCIEXRC; - x86pi_smb_strcnt(shp, smbc); + x86pi_smb_strcnt(mod, smbc); for (i = 0; i < smbc->count; i++) { if (smbios_info_pciexrc(shp, smbc->ids[i].id, &hbr) != 0) { @@ -496,7 +502,7 @@ if (hbr.smbpcie_bb != bb_smbid) continue; - rv = x86pi_gen_hbr(mod, basebd_node, shp, + rv = x86pi_gen_hbr(mod, basebd_node, smbc->ids[i].id, hbri, &rci); if (rv != 0) topo_mod_dprintf(mod,
--- a/usr/src/lib/fm/topo/modules/i86pc/x86pi/x86pi_bay.c Thu Jul 15 10:59:37 2010 -0600 +++ b/usr/src/lib/fm/topo/modules/i86pc/x86pi/x86pi_bay.c Thu Jul 15 11:31:02 2010 -0700 @@ -20,8 +20,7 @@ */ /* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. */ /* @@ -61,15 +60,20 @@ * Return PCI Bus/Dev/Func */ int -bay_bdf(topo_mod_t *mod, smbios_hdl_t *shp, smbios_port_ext_t *epp, - uint16_t *bdf) +bay_bdf(topo_mod_t *mod, smbios_port_ext_t *epp, uint16_t *bdf) { int devt; id_t dev_id; uint8_t bus, dev_funct; char *f = "bay_bdf"; + smbios_hdl_t *shp; + shp = topo_mod_smbios(mod); + if (shp == NULL) { + topo_mod_dprintf(mod, "%s: failed to load SMBIOS\n", f); + return (-1); + } /* * Depending on device type, BDF comes from either slot (type-9) or * on-board (type-41) SMBIOS structure. @@ -253,8 +257,8 @@ * call "disk" enum passing in "bay" node */ int -x86pi_gen_bay(topo_mod_t *mod, tnode_t *t_parent, smbios_hdl_t *shp, - smbios_port_ext_t *eport, int instance) +x86pi_gen_bay(topo_mod_t *mod, tnode_t *t_parent, smbios_port_ext_t *eport, + int instance) { int rv; int min = 0, max = 0; @@ -265,6 +269,13 @@ tnode_t *tn_bay; char *f = "x86pi_gen_disk"; + smbios_hdl_t *shp; + + shp = topo_mod_smbios(mod); + if (shp == NULL) { + topo_mod_dprintf(mod, "%s: failed to load SMBIOS\n", f); + return (topo_mod_seterrno(mod, EMOD_PARTIAL_ENUM)); + } /* * Label comes from the port (type-8) SMBIOS structure. @@ -305,7 +316,7 @@ /* * Determine the bay BDF. */ - rv = bay_bdf(mod, shp, eport, &bdf); + rv = bay_bdf(mod, eport, &bdf); if (rv != 0) { topo_mod_dprintf(mod, "%s: failed to get BDF\n", f); return (topo_mod_seterrno(mod, EMOD_PARTIAL_ENUM));
--- a/usr/src/lib/fm/topo/modules/i86pc/x86pi/x86pi_bboard.c Thu Jul 15 10:59:37 2010 -0600 +++ b/usr/src/lib/fm/topo/modules/i86pc/x86pi/x86pi_bboard.c Thu Jul 15 11:31:02 2010 -0700 @@ -20,8 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. */ /* @@ -55,8 +54,8 @@ }; tnode_t * -x86pi_gen_bboard(topo_mod_t *mod, tnode_t *t_parent, smbios_hdl_t *shp, - int smb_id, int instance, int psmb_id) +x86pi_gen_bboard(topo_mod_t *mod, tnode_t *t_parent, int smb_id, + int instance, int psmb_id) { int rv; smbios_info_t ip; @@ -71,9 +70,16 @@ static int systemboard = 0; static int motherboard = 0; char *f = "x86pi_gen_bboard"; + smbios_hdl_t *shp; topo_mod_dprintf(mod, "%s\n", f); + shp = topo_mod_smbios(mod); + if (shp == NULL) { + topo_mod_dprintf(mod, "%s: failed to load SMBIOS\n", f); + return (NULL); + } + /* SMBIOS Base Board struct */ rv = smbios_info_bboard(shp, smb_id, &bb); if (rv != 0) { @@ -190,13 +196,18 @@ int -x86pi_bb_getchips(topo_mod_t *mod, smbios_hdl_t *shp, int index, int nboards) +x86pi_bb_getchips(topo_mod_t *mod, int index, int nboards) { id_t *cid; int count; int ncmp = 0; smbios_struct_t sp; smbs_cnt_t *smbc = NULL; + smbios_hdl_t *shp; + + shp = topo_mod_smbios(mod); + if (shp == NULL) + return (ncmp); cid = stypes[SMB_TYPE_BASEBOARD].ids[index].con_ids; count = stypes[SMB_TYPE_BASEBOARD].ids[index].con_cnt; @@ -216,7 +227,7 @@ */ smbc = &stypes[SMB_TYPE_PROCESSOR]; smbc->type = SMB_TYPE_PROCESSOR; - x86pi_smb_strcnt(shp, smbc); + x86pi_smb_strcnt(mod, smbc); if (nboards == 1) { if (ncmp != stypes[SMB_TYPE_PROCESSOR].count) @@ -235,13 +246,18 @@ id_t -x86pi_bb_topparent(smbios_hdl_t *shp, int index, tnode_t **pnode, id_t *psmbid) +x86pi_bb_topparent(topo_mod_t *mod, int index, tnode_t **pnode, id_t *psmbid) { id_t top_bb_smbid = -1; id_t smb_id; int bb_count, ch_count; smbios_struct_t sp; + smbios_hdl_t *shp; + + shp = topo_mod_smbios(mod); + if (shp == NULL) + return (top_bb_smbid); smb_id = stypes[SMB_TYPE_BASEBOARD].ids[index].con_by_id; (void) smbios_lookup_id(shp, smb_id, &sp); @@ -273,7 +289,7 @@ id; break; } - top_bb_smbid = x86pi_bb_topparent(shp, + top_bb_smbid = x86pi_bb_topparent(mod, i, pnode, psmbid); break; } @@ -285,10 +301,15 @@ id_t -x86pi_bb_chassis(smbios_hdl_t *shp, id_t bb_smbid) +x86pi_bb_chassis(topo_mod_t *mod, id_t bb_smbid) { smbios_bboard_t bb; int rv; + smbios_hdl_t *shp; + + shp = topo_mod_smbios(mod); + if (shp == NULL) + return (-1); rv = smbios_info_bboard(shp, bb_smbid, &bb); if (rv != 0) @@ -299,7 +320,7 @@ int -x86pi_bb_contains(topo_mod_t *mod, smbios_hdl_t *shp) +x86pi_bb_contains(topo_mod_t *mod) { int rv; id_t smb_id; @@ -307,6 +328,11 @@ int bb_count = 0; uint_t cont_cnt = 0; smbios_struct_t sp; + smbios_hdl_t *shp; + + shp = topo_mod_smbios(mod); + if (shp == NULL) + return (-1); bb_count = stypes[SMB_TYPE_BASEBOARD].count; for (int i = 0; i < bb_count; i++) { @@ -318,7 +344,7 @@ /* Set Baseboard - Chassis Relationship */ if (stypes[SMB_TYPE_BASEBOARD].ids[i].con_by_id == 0) { stypes[SMB_TYPE_BASEBOARD].ids[i].con_by_id = - rv = x86pi_bb_chassis(shp, smb_id); + rv = x86pi_bb_chassis(mod, smb_id); if (rv == -1) { topo_mod_dprintf(mod, " failed to get" " the chassis handle\n");
--- a/usr/src/lib/fm/topo/modules/i86pc/x86pi/x86pi_chassis.c Thu Jul 15 10:59:37 2010 -0600 +++ b/usr/src/lib/fm/topo/modules/i86pc/x86pi/x86pi_chassis.c Thu Jul 15 11:31:02 2010 -0700 @@ -20,8 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. */ /* @@ -38,8 +37,7 @@ tnode_t * -x86pi_gen_chassis(topo_mod_t *mod, tnode_t *t_parent, smbios_hdl_t *shp, - int smb_id, int instance) +x86pi_gen_chassis(topo_mod_t *mod, tnode_t *t_parent, int smb_id, int instance) { int rv; smbios_info_t ip; @@ -47,7 +45,13 @@ x86pi_hcfmri_t ch_hcfmri; tnode_t *ch_node; char *f = "x86pi_gen_chassis"; + smbios_hdl_t *shp; + shp = topo_mod_smbios(mod); + if (shp == NULL) { + topo_mod_dprintf(mod, "%s: failed to load SMBIOS\n", f); + return (NULL); + } /* init fmri struct */ bzero(&ch_hcfmri, sizeof (x86pi_hcfmri_t));
--- a/usr/src/lib/fm/topo/modules/i86pc/x86pi/x86pi_hostbridge.c Thu Jul 15 10:59:37 2010 -0600 +++ b/usr/src/lib/fm/topo/modules/i86pc/x86pi/x86pi_hostbridge.c Thu Jul 15 11:31:02 2010 -0700 @@ -232,7 +232,7 @@ } int -x86pi_gen_hbr(topo_mod_t *mod, tnode_t *tn_bb, smbios_hdl_t *shp, +x86pi_gen_hbr(topo_mod_t *mod, tnode_t *tn_bb, int hbr_smbid, topo_instance_t hbri, topo_instance_t *rcip) { x86pi_hcfmri_t hcfmri = {0}; @@ -241,6 +241,11 @@ smbios_pciexrc_t smb_rc; int i, rv, err = 0; const char *f = "x86pi_gen_hbr"; + smbios_hdl_t *shp; + + shp = topo_mod_smbios(mod); + if (shp == NULL) + return (topo_mod_seterrno(mod, EMOD_PARTIAL_ENUM)); hcfmri.hc_name = HOSTBRIDGE; hcfmri.instance = hbri;
--- a/usr/src/lib/fm/topo/modules/i86pc/x86pi/x86pi_impl.h Thu Jul 15 10:59:37 2010 -0600 +++ b/usr/src/lib/fm/topo/modules/i86pc/x86pi/x86pi_impl.h Thu Jul 15 11:31:02 2010 -0700 @@ -20,8 +20,7 @@ */ /* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. */ #ifndef _X86PI_IMPL_H @@ -160,21 +159,21 @@ /* SMBIOS */ smbios_hdl_t *x86pi_smb_open(topo_mod_t *); -void x86pi_smb_strcnt(smbios_hdl_t *, smbs_cnt_t *); -int x86pi_check_comp(topo_mod_t *, smbios_hdl_t *); +void x86pi_smb_strcnt(topo_mod_t *, smbs_cnt_t *); +int x86pi_check_comp(topo_mod_t *); /* Node generation */ -tnode_t *x86pi_gen_chassis(topo_mod_t *, tnode_t *, smbios_hdl_t *, int, int); -tnode_t *x86pi_gen_bboard(topo_mod_t *, tnode_t *, smbios_hdl_t *, int, int, +tnode_t *x86pi_gen_chassis(topo_mod_t *, tnode_t *, int, int); +tnode_t *x86pi_gen_bboard(topo_mod_t *, tnode_t *, int, int, int); int x86pi_gen_cmp(topo_mod_t *, tnode_t *, smbios_hdl_t *, int, int, int); int x86pi_gen_core(topo_mod_t *, tnode_t *, int, int, int); int x86pi_gen_strand(topo_mod_t *, tnode_t *, int, int, int); int x86pi_gen_memarray(topo_mod_t *, tnode_t *, smbios_hdl_t *, int, int); void x86pi_gen_memdev(topo_mod_t *, tnode_t *, smbios_hdl_t *, int, int, int); -int x86pi_gen_hbr(topo_mod_t *, tnode_t *, smbios_hdl_t *, int, - topo_instance_t, topo_instance_t *); -int x86pi_gen_bay(topo_mod_t *, tnode_t *, smbios_hdl_t *, smbios_port_ext_t *, +int x86pi_gen_hbr(topo_mod_t *, tnode_t *, int, topo_instance_t, + topo_instance_t *); +int x86pi_gen_bay(topo_mod_t *, tnode_t *, smbios_port_ext_t *, int); /* support routines */ @@ -199,9 +198,9 @@ void x86pi_hbr_enum_fini(topo_mod_t *); /* base board */ -id_t x86pi_bb_topparent(smbios_hdl_t *, int, tnode_t **, id_t *); -int x86pi_bb_contains(topo_mod_t *, smbios_hdl_t *); -int x86pi_bb_getchips(topo_mod_t *, smbios_hdl_t *, int, int); +id_t x86pi_bb_topparent(topo_mod_t *, int, tnode_t **, id_t *); +int x86pi_bb_contains(topo_mod_t *); +int x86pi_bb_getchips(topo_mod_t *, int, int); const char *x86pi_cleanup_smbios_str(topo_mod_t *, const char *, int);
--- a/usr/src/lib/fm/topo/modules/i86pc/x86pi/x86pi_subr.c Thu Jul 15 10:59:37 2010 -0600 +++ b/usr/src/lib/fm/topo/modules/i86pc/x86pi/x86pi_subr.c Thu Jul 15 11:31:02 2010 -0700 @@ -20,8 +20,7 @@ */ /* - * Copyright 2010 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. */ /* @@ -136,11 +135,21 @@ * the structure count as well as the id(s) of the struct types. */ void -x86pi_smb_strcnt(smbios_hdl_t *shp, smbs_cnt_t *stype) +x86pi_smb_strcnt(topo_mod_t *mod, smbs_cnt_t *stype) { - const smb_struct_t *sp = shp->sh_structs; - int nstructs = shp->sh_nstructs; + const smb_struct_t *sp; + int nstructs; int i, cnt; + smbios_hdl_t *shp; + + shp = topo_mod_smbios(mod); + if (shp == NULL) { + stype->count = 0; + return; + } + + nstructs = shp->sh_nstructs; + sp = shp->sh_structs; for (i = 0, cnt = 0; i < nstructs; i++, sp++) { if (sp->smbst_hdr->smbh_type == stype->type) { @@ -548,7 +557,7 @@ */ /* ARGSUSED */ int -x86pi_check_comp(topo_mod_t *mod, smbios_hdl_t *shp) +x86pi_check_comp(topo_mod_t *mod) { int rv; int fd; @@ -558,6 +567,11 @@ char *ibuf = NULL, *obuf = NULL; size_t insz = 0, outsz = 0; char *f = "x86pi_check_comp"; + smbios_hdl_t *shp; + + shp = topo_mod_smbios(mod); + if (shp == NULL) + return (X86PI_NONE); /* open /dev/fm */ fd = open("/dev/fm", O_RDONLY);