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 chassis topology node from SMBIOS Type 3 structure
efd31e1d839d4665462b5c267a1c654548082663Trang Dox86pi_gen_chassis(topo_mod_t *mod, tnode_t *t_parent, int smb_id, int instance)
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier char *f = "x86pi_gen_chassis";
efd31e1d839d4665462b5c267a1c654548082663Trang Do topo_mod_dprintf(mod, "%s: failed to load SMBIOS\n", f);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier /* init fmri struct */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier /* grab SMBIOS strings */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier /* grab SMBIOS type 3 struct */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier /* populate string entries */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier ch_hcfmri.serial_number = x86pi_cleanup_smbios_str(mod,
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier ch_hcfmri.version = x86pi_cleanup_smbios_str(mod, ip.smbi_version, 0);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier ch_hcfmri.manufacturer = x86pi_cleanup_smbios_str(mod,
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier /* set hc_name and instance */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier ch_hcfmri.hc_name = topo_mod_strdup(mod, "chassis");
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_dprintf(mod, "%s: instance (%d)\n", f, ch_hcfmri.instance);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_dprintf(mod, "%s: hc name (%s)\n", f, ch_hcfmri.hc_name);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_dprintf(mod, "%s: Serial Number (%s)\n",
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_dprintf(mod, "%s: Version (%s)\n", f, ch_hcfmri.version);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_dprintf(mod, "%s: Manufacturer (%s)\n",
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier /* create topo node */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier /* First Chassis SMBIOS Record is Chassis topo instance 0 */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier rv = x86pi_enum_generic(mod, &ch_hcfmri, t_parent, NULL,
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier rv = x86pi_enum_generic(mod, &ch_hcfmri, t_parent, t_parent,
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_dprintf(mod, "%s: failed to create %d tnode\n", f,
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier /* free up strings */
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_strfree(mod, (char *)ch_hcfmri.serial_number);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_strfree(mod, (char *)ch_hcfmri.version);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_strfree(mod, (char *)ch_hcfmri.manufacturer);