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 Pothiertypedef int smbios_rec_f(topo_mod_t *, const smbios_struct_t *);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothiersmb_export(const smb_struct_t *stp, smbios_struct_t *sp)
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier sp->smbstr_size = (size_t)(stp->smbst_end - (uchar_t *)hdr);
efd31e1d839d4665462b5c267a1c654548082663Trang Doextdimmslot_to_dimmslot(topo_mod_t *mod, id_t chip_smbid, int channum,
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier int i, j, k;
efd31e1d839d4665462b5c267a1c654548082663Trang Do return (-1);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier if (chip_smbid == IGNORE_ID && bb_count <= 1 && nmct_ids <= 1) {
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier for (i = 0; i < ndimm_ids; i++) {
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier for (j = 0; j < nmct_ids; j++) {
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier for (i = 0; i < ndimm_ids; i++) {
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier return (-1);
efd31e1d839d4665462b5c267a1c654548082663Trang Domemnode_to_smbiosid(topo_mod_t *mod, uint16_t chip_smbid, const char *name,
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier return (-1);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * Set the DIMM Slot label to the Chip Select Node
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * Set the "data" to carry the DIMM instance
efd31e1d839d4665462b5c267a1c654548082663Trang Do dimmslot = extdimmslot_to_dimmslot(mod, chip_smbid, channum,
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier *((id_t *)data) = dimmslot % (dimmsmb[0].dimm_id);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * On certain Intel Chips, topology does not have
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * chip-select nodes, it has the below layout
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * so we check if channel instance is passed
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * and get the SMBIOS ID based on the channel
efd31e1d839d4665462b5c267a1c654548082663Trang Do dimmslot = extdimmslot_to_dimmslot(mod, chip_smbid,
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier return (-1);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothierchip_get_smbstruct(topo_mod_t *mod, const smbios_struct_t *sp)
efd31e1d839d4665462b5c267a1c654548082663Trang Do return (-1);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier "smbios_info_extmemarray()"
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier "failed\n");
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier return (-1);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier return (-1);
bb1fad37c75defa7a6ae25f00c1d4b356713b734Srihari Venkatesan for (int i = 0; i < nmct_ids; i++) {
bb1fad37c75defa7a6ae25f00c1d4b356713b734Srihari Venkatesan if (extma.smbmae_ma == mctsmb[i].mct_id) {
bb1fad37c75defa7a6ae25f00c1d4b356713b734Srihari Venkatesan topo_mod_dprintf(mod, "chip_get_smbstruct : "
bb1fad37c75defa7a6ae25f00c1d4b356713b734Srihari Venkatesan "EXT_MEMARRAY-MEMARRAY records are mismatched\n");
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier return (-1);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier return (-1);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier return (-1);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * Every SMB_TYPE_MEMDEVICE SHOULD have a
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * corresponding SUN_OEM_EXT_MEMDEVICE
bb1fad37c75defa7a6ae25f00c1d4b356713b734Srihari Venkatesan topo_mod_dprintf(mod, "chip_get_smbstruct : "
bb1fad37c75defa7a6ae25f00c1d4b356713b734Srihari Venkatesan "smbios_info_extmemdevice()"
bb1fad37c75defa7a6ae25f00c1d4b356713b734Srihari Venkatesan for (int i = 0; i < ndimm_ids; i++) {
bb1fad37c75defa7a6ae25f00c1d4b356713b734Srihari Venkatesan if (extmd.smbmdeve_md == dimmsmb[i].dimm_id) {
bb1fad37c75defa7a6ae25f00c1d4b356713b734Srihari Venkatesan topo_mod_dprintf(mod, "chip_get_smbstruct : "
bb1fad37c75defa7a6ae25f00c1d4b356713b734Srihari Venkatesan "EXT_MEMDEVICE-MEMDEVICE records are mismatched\n");
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier "smbios_info_processor()"
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier "failed\n");
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier return (-1);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * Every SMB_TYPE_PROCESSOR SHOULD have a
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * corresponding SUN_OEM_EXT_PROCESSOR
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier "smbios_info_extprocessor()"
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier "failed\n");
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier return (-1);
bb1fad37c75defa7a6ae25f00c1d4b356713b734Srihari Venkatesan for (int i = 0; i < ncpu_ids; i++) {
bb1fad37c75defa7a6ae25f00c1d4b356713b734Srihari Venkatesan if (extp.smbpe_processor == cpusmb[i].cpu_id) {
bb1fad37c75defa7a6ae25f00c1d4b356713b734Srihari Venkatesan topo_mod_dprintf(mod, "chip_get_smbstruct : "
bb1fad37c75defa7a6ae25f00c1d4b356713b734Srihari Venkatesan "EXT_PROCESSOR-PROCESSOR records are mismatched\n");
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothierchip_smbios_iterate(topo_mod_t *mod, smbios_rec_f *func_iter)
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier if (sp->smbst_hdr->smbh_type != SMB_TYPE_INACTIVE &&
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier if (chip_smbios_iterate(mod, chip_get_smbstruct) == -1)
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier return (-1);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothierchip_status_smbios_get(topo_mod_t *mod, id_t smb_id)
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * Type-4 Socket Status bit definitions per SMBIOS Version 2.6
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * CPU Socket Populated
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * CPU Socket Unpopulated
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * Populated : Enabled
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * Populated : Disabled by BIOS (Setup)
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * Populated : Disabled by BIOS (Error)
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * Populated : Idle
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier for (int i = 0; i < ncpu_ids; i++) {
bb1fad37c75defa7a6ae25f00c1d4b356713b734Srihari Venkatesan topo_mod_dprintf(mod, "chip_status_smbios_get() failed"
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier " considering that Type 4 ID : %d is disabled", smb_id);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothierchip_fru_smbios_get(topo_mod_t *mod, id_t smb_id)
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * smbios_processor_ext_t->smbpe_fru : if set to 1
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * processor is a FRU
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier for (int i = 0; i < ncpu_ids; i++) {
bb1fad37c75defa7a6ae25f00c1d4b356713b734Srihari Venkatesan topo_mod_dprintf(mod, "chip_fru_smbios_get() failed"
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier " considering that Type 4 ID : %d is not a FRU", smb_id);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * This could be defined as topo_mod_strlen()
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * We clean Serials, Revisions, Part No. strings, to
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * avoid getting lost when fmd synthesizes these
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * strings. :, =, /, ' ' characters are replaced
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * with character '-' any non-printable characters
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * as seen with !isprint() is also replaced with '-'
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * Labels are checked only for non-printable characters.
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothierstatic const char *
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothierchip_cleanup_smbios_str(topo_mod_t *mod, const char *begin, int str_type)
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothierchip_label_smbios_get(topo_mod_t *mod, tnode_t *pnode, id_t smb_id,
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * Get Parent FRU's label
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier if (topo_prop_get_string(pnode, TOPO_PGROUP_PROTOCOL,
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * On Intel the driver gets the label from ksmbios
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * so we check if we already have it, if not we
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * get it from libsmbios
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier if (smbios_info_common(shp, smb_id, &c) != SMB_ERR) {
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier for (int i = 0; i < ndimm_ids; i++) {
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier bufsz += chip_strlen(label) + chip_strlen(delim) +
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * If we are working on a DIMM
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * and we are deriving from libsmbios
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * smbi_location has the Device Locator.
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * add the Device Locator
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier * add Bank Locator latter
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier clean_label = chip_cleanup_smbios_str(mod, buf, LABEL);
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothierchip_serial_smbios_get(topo_mod_t *mod, id_t smb_id)
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier if (smbios_info_common(shp, smb_id, &c) != SMB_ERR) {
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_dprintf(mod, "Failed to get Serial \n");
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothierchip_part_smbios_get(topo_mod_t *mod, id_t smb_id)
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier if (smbios_info_common(shp, smb_id, &c) != SMB_ERR) {
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothierchip_rev_smbios_get(topo_mod_t *mod, id_t smb_id)
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier if (smbios_info_common(shp, smb_id, &c) != SMB_ERR) {
074bb90d80fdbeb2d04a8450a55ecbc96de28785Tom Pothier topo_mod_dprintf(mod, "Failed to get Revision\n");