074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * CDDL HEADER START
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * The contents of this file are subject to the terms of the
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * Common Development and Distribution License (the "License").
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * You may not use this file except in compliance with the License.
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * See the License for the specific language governing permissions
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * and limitations under the License.
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * When distributing Covered Code, include this CDDL HEADER in each
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * If applicable, add the following below this CDDL HEADER, with the
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * fields enclosed by brackets "[]" replaced with your own identifying
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * information: Portions Copyright [yyyy] [name of copyright owner]
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * CDDL HEADER END
efd31e1d839d4665462b5c267a1c654548082663Trang Do * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * Create Base Board (MB) topology node from SMBIOS Type 2 structure
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier/* base baoed type values to hc-canonical-name */
efd31e1d839d4665462b5c267a1c654548082663Trang Dox86pi_gen_bboard(topo_mod_t *mod, tnode_t *t_parent, int smb_id,
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier char *f = "x86pi_gen_bboard";
efd31e1d839d4665462b5c267a1c654548082663Trang Do topo_mod_dprintf(mod, "%s: failed to load SMBIOS\n", f);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier /* SMBIOS Base Board struct */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_dprintf(mod, "%s: smbios_info_bboard() failed\n", f);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_dprintf(mod, "%s: base board (%d) does not belong to "
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier /* SMBIOS Base Board strings */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * populate string entries
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * We don't set "product" because it may contain characters
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * unacceptable by fmri. topo_mod_auth() will set the product-id
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * for us and call topo_cleanup_auth_str() when necessary.
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier bb_hcfmri.serial_number = x86pi_cleanup_smbios_str(mod,
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier bb_hcfmri.version = x86pi_cleanup_smbios_str(mod, ip.smbi_version, 0);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier /* asset tag string contains the part number */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier bb_hcfmri.part_number = x86pi_cleanup_smbios_str(mod,
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier bb_hcfmri.location = x86pi_cleanup_smbios_str(mod, ip.smbi_location, 0);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier /* determine the hc-name */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier for (bbnp = x86pi_bb_names; bbnp->type != 0x00; bbnp++) {
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * Enumerate any other baseboard type
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * as systemboard.
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * SMB_BBT_UNKNOWN
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * SMB_BBT_OTHER
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * SMB_BBT_SBLADE
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * SMB_BBT_CSWITCH
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * SMB_BBT_SMM
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * SMB_BBT_DAUGHTER
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * SMB_BBT_PROCMEM
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * SMB_BBT_PROCIO
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * SMB_BBT_INTER
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier bb_hcfmri.hc_name = topo_mod_strdup(mod, bbnp->name);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier bb_hcfmri.hc_name = topo_mod_strdup(mod, "NULL");
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_dprintf(mod, "%s: S/N (%s)\n", f, bb_hcfmri.serial_number);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_dprintf(mod, "%s: version/N (%s)\n", f, bb_hcfmri.version);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_dprintf(mod, "%s: Part/N (%s)\n", f, bb_hcfmri.part_number);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_dprintf(mod, "%s: location (%s)\n", f, bb_hcfmri.location);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_dprintf(mod, "%s: instance (%d)\n", f, bb_hcfmri.instance);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_dprintf(mod, "%s: hc_name (%s)\n", f, bb_hcfmri.hc_name);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier rv = x86pi_enum_generic(mod, &bb_hcfmri, t_parent, t_parent, &bb_node,
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_dprintf(mod, "%s: failed to create tnode %d\n", f,
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier /* free up strings */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_strfree(mod, (char *)bb_hcfmri.hc_name);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_strfree(mod, (char *)bb_hcfmri.part_number);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_strfree(mod, (char *)bb_hcfmri.serial_number);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_strfree(mod, (char *)bb_hcfmri.version);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_strfree(mod, (char *)bb_hcfmri.location);
efd31e1d839d4665462b5c267a1c654548082663Trang Dox86pi_bb_getchips(topo_mod_t *mod, int index, int nboards)
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier cid = stypes[SMB_TYPE_BASEBOARD].ids[index].con_ids;
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier count = stypes[SMB_TYPE_BASEBOARD].ids[index].con_cnt;
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier for (int i = 0; i < count; i++) {
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * If there are missing SMB_TYPE_PROCESSOR structures
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * contained within SMB_TYPE_BASEBOARD, and if the
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * system has only one baseboard we enumerate
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * all processors under it.
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_dprintf(mod, "failed to get processors"
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier " (or) no processors are contained"
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier " within baseboard instance %d, unable to"
efd31e1d839d4665462b5c267a1c654548082663Trang Dox86pi_bb_topparent(topo_mod_t *mod, int index, tnode_t **pnode, id_t *psmbid)
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier smb_id = stypes[SMB_TYPE_BASEBOARD].ids[index].con_by_id;
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier top_bb_smbid = stypes[SMB_TYPE_BASEBOARD].ids[index].id;
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier for (int i = 0; i < ch_count; i++)
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier if (stypes[SMB_TYPE_CHASSIS].ids[i].id == *psmbid)
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier } else if (sp.smbstr_type == SMB_TYPE_BASEBOARD) {
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier for (int i = 0; i < bb_count; i++) {
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier if (stypes[SMB_TYPE_BASEBOARD].ids[i].id == smb_id) {
efd31e1d839d4665462b5c267a1c654548082663Trang Do return (-1);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier return (-1);
efd31e1d839d4665462b5c267a1c654548082663Trang Do return (-1);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier for (int i = 0; i < bb_count; i++) {
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier /* SMBIOS Base Board struct */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier return (-1);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier /* Set Baseboard - Chassis Relationship */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier if (stypes[SMB_TYPE_BASEBOARD].ids[i].con_by_id == 0) {
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier " the chassis handle\n");
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier /* SMBIOS contained object handles */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier /* allocate space for and get contained handles */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier rv = smbios_info_contains(shp, smb_id, cont_cnt,
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier return (-1);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier /* attach contained handles */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier stypes[SMB_TYPE_BASEBOARD].ids[i].con_cnt = cont_cnt;
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier for (int j = 0; j < cont_cnt; j++) {
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier for (int k = 0; k < bb_count; k++)