2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. 2N/A * Subroutines used by the i86pc Generic Topology Enumerator 2N/A * Free hcfmri strings. 2N/A * Get the server hostname (the ID as far as the topo authority is 2N/A * concerned) from sysinfo and return a copy to the caller. 2N/A * The string must be freed with topo_mod_strfree() 2N/A /* Everything is freed up and it's time to return the platform-id */ 2N/A * Go through the smbios structures looking for a type. Fill in 2N/A * the structure count as well as the id(s) of the struct types. 2N/A * Calculate the authority information for a node. Always create the 2N/A * appropriate property group even if complete authority is not found. 2N/A char *f =
"x86pi_set_auth";
2N/A * We failed to create the property group and it was not 2N/A * already defined. Set the err code and return failure. 2N/A /* Determnine if this is a chassis node and set it's instance */ 2N/A * Set the authority data. 2N/A * Continue even if some authority information is not available 2N/A * to enumerate as much as possible. 2N/A /* either not a chassis node, or chassis #0 */ 2N/A * Get the chassis authority information. 2N/A "%s: failed to set %s for %s node\n",
2N/A * Calculate a generic FRU for the given node. If the node is not a FRU, 2N/A * then inherit the FRU data from the nodes parent. 2N/A * Determine if this node is a FRU 2N/A /* This node is not a FRU. Inherit from parent and return */ 2N/A * This node is a FRU. Create an FMRI. 2N/A /* Set the FRU, whether NULL or not */ 2N/A * Set the label for a topo node. 2N/A * Set the label for this topology node. 2N/A * Note that a NULL label will inherit the label from topology 2N/A * Calculate the system information for a node. Inherit the data if 2N/A * possible, but always create an appropriate property group. 2N/A * We failed to create the property group and it was not 2N/A * already defined. Set the err code and return failure. 2N/A /* Preserve the error and continue */ 2N/A /* Preserve the error and continue */ 2N/A "x86pi_set_auth: failed to " 2N/A "set property %s (%d) : %s\n",
2N/A /* Preserve the error and continue */ 2N/A /* Preserve the error and continue */ 2N/A "x86pi_set_auth: failed to " 2N/A "set property %s (%d) : %s\n",
2N/A * Topo module routine to update authority identity. 2N/A * handle auth structure. This data is held in SMBIOS structures. 2N/A * System - Type 129 System Extended Information SUN_OEM_EXT_SYSTEM 129 2N/A * System Component - Type 1 System Information SMB_TYPE_SYSTEM 1 2N/A * Chassis - Type 3 System Enclosure or Chassis SMB_TYPE_CHASSIS 3 2N/A char *f =
"x86pi_set_topo_auth";
2N/A /* the order of the next two must be maintained */ 2N/A /* make sure we have an SMBIOS handle */ 2N/A /* allocate the topo authority nvlist */ 2N/A "%s: failed to xalloc topo auth nvlist\n", f);
2N/A * There should only be one SMBIOS type 1 and type 129 structure, and 2N/A * we only want the first SMBIOS type 3 (chassis=0) structure. So use 2N/A * the first one found here. 2N/A /* find SMBIOS structure */ 2N/A "mfg(%s) product(%s) part(%s) serial(%s)\n",
2N/A /* cleanup strings */ 2N/A /* ch name is in version field */ 2N/A /* sys p/n is in SKU field */ 2N/A /* ch p/n is in asset tag field */ 2N/A /* save off product-id */ 2N/A "%s: failed to get type %d strings\n",
2N/A "name(%s) part(%s) serial(%s)\n", f,
2N/A /* use product_id if old BIOS or no chassis name */ 2N/A /* no values set to "unknown" */ 2N/A /* set identity strings into topo handle */ 2N/A /* copy the nvlist to the topo handle */ 2N/A * All the checks for compatibility are done within the kernel where the 2N/A * ereport generators are. They'll determine first if there's a problem 2N/A * and the topo enum will follow suit. The /dev/fm ioclt returns the value 2N/A * of the x86gentopo_legacy kernel variable which determines if this platform 2N/A * will provide an x86 generic topo or legacy topo enumeration. 2N/A char *f =
"x86pi_check_comp";
2N/A /* set up buffers and ioctl data structure */ 2N/A /* send the ioctl to /dev/fm to retrieve legacy variable */ 2N/A /* legacy kernel variable set; will do the same */ 2N/A /* legacy kernel variable not set; generic topo enum */ 2N/A if (c ==
':' || c ==
'=' || c ==
'/' ||
2N/A * Return PHY from "sata-phy" devinfo proporty.