1074bb90dSTom Pothier /* 2074bb90dSTom Pothier * CDDL HEADER START 3074bb90dSTom Pothier * 4074bb90dSTom Pothier * The contents of this file are subject to the terms of the 5074bb90dSTom Pothier * Common Development and Distribution License (the "License"). 6074bb90dSTom Pothier * You may not use this file except in compliance with the License. 7074bb90dSTom Pothier * 8074bb90dSTom Pothier * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9074bb90dSTom Pothier * or http://www.opensolaris.org/os/licensing. 10074bb90dSTom Pothier * See the License for the specific language governing permissions 11074bb90dSTom Pothier * and limitations under the License. 12074bb90dSTom Pothier * 13074bb90dSTom Pothier * When distributing Covered Code, include this CDDL HEADER in each 14074bb90dSTom Pothier * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15074bb90dSTom Pothier * If applicable, add the following below this CDDL HEADER, with the 16074bb90dSTom Pothier * fields enclosed by brackets "[]" replaced with your own identifying 17074bb90dSTom Pothier * information: Portions Copyright [yyyy] [name of copyright owner] 18074bb90dSTom Pothier * 19074bb90dSTom Pothier * CDDL HEADER END 20074bb90dSTom Pothier */ 21074bb90dSTom Pothier 22074bb90dSTom Pothier /* 23efd31e1dSTrang Do * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. 24074bb90dSTom Pothier */ 25074bb90dSTom Pothier 26074bb90dSTom Pothier #ifndef _X86PI_IMPL_H 27074bb90dSTom Pothier #define _X86PI_IMPL_H 28074bb90dSTom Pothier 29074bb90dSTom Pothier /* 30074bb90dSTom Pothier * i86pc Generic Enumerator private interfaces 31074bb90dSTom Pothier */ 32074bb90dSTom Pothier 33074bb90dSTom Pothier #ifdef __cplusplus 34074bb90dSTom Pothier extern "C" { 35074bb90dSTom Pothier #endif 36074bb90dSTom Pothier 37074bb90dSTom Pothier #include <smbios.h> 38074bb90dSTom Pothier #include <ctype.h> 39074bb90dSTom Pothier 40074bb90dSTom Pothier 41074bb90dSTom Pothier /* 42074bb90dSTom Pothier * Table showing the relationship between hc-canonical names and the 43074bb90dSTom Pothier * SMBIOS tables/values. 44074bb90dSTom Pothier * 45074bb90dSTom Pothier * ************************************************************************** 46074bb90dSTom Pothier * | hc-name | SMB Table | Offset - Name | Value | 47074bb90dSTom Pothier * -------------------------------------------------------------------------- 48074bb90dSTom Pothier * -------------------------------------------------------------------------- 49074bb90dSTom Pothier * | "motherboard" | Type 2 | 0x0D - Board Type | 0x0A | 50074bb90dSTom Pothier * -------------------------------------------------------------------------- 51074bb90dSTom Pothier * | "cpuboard" | Type 2 | 0x0D - Board Type | 0x06 | 52074bb90dSTom Pothier * -------------------------------------------------------------------------- 53074bb90dSTom Pothier * | "memboard" | Type 2 | 0x0D - Board Type | 0x08 | 54074bb90dSTom Pothier * -------------------------------------------------------------------------- 55074bb90dSTom Pothier * | "ioboard" | Type 2 | 0x0D - Board Type | 0x07 | 56074bb90dSTom Pothier * -------------------------------------------------------------------------- 57074bb90dSTom Pothier * | "systemboard" | Type 2 | 0x0D - Board Type | 0x03,0x09,| 58074bb90dSTom Pothier * | | | | 0x0B,0x0C | 59074bb90dSTom Pothier * -------------------------------------------------------------------------- 6003f9f63dSTom Pothier * | "bay" | Type 136 | | 6103f9f63dSTom Pothier * -------------------------------------------------------------------------- 62074bb90dSTom Pothier * | "hostbridge" | Type 138 | | 63074bb90dSTom Pothier * -------------------------------------------------------------------------- 64074bb90dSTom Pothier * | "pciexrc" | Type 138 | | 65074bb90dSTom Pothier * ************************************************************************** 66074bb90dSTom Pothier */ 67074bb90dSTom Pothier 68074bb90dSTom Pothier 69074bb90dSTom Pothier /* Definitions used when registering the enumerator with libtopo */ 70074bb90dSTom Pothier #define X86PI_DESC "i86pc Generic Topology Enumerator" 71074bb90dSTom Pothier #define X86PI_SCHEME "hc" 72074bb90dSTom Pothier #define X86PI_VERSION TOPO_VERSION 73074bb90dSTom Pothier 74074bb90dSTom Pothier /* 75074bb90dSTom Pothier * Solaris FMA Compliance level for SMBIOS. 76074bb90dSTom Pothier * The same X86PI_* definitions are used in chip.h 77074bb90dSTom Pothier * please keep them in sync 78074bb90dSTom Pothier */ 79074bb90dSTom Pothier #define X86PI_FULL 1 80074bb90dSTom Pothier #define X86PI_NONE 2 81074bb90dSTom Pothier 82074bb90dSTom Pothier /* used in traversing contained bboards */ 83074bb90dSTom Pothier #define X86PI_VISITED 1 84074bb90dSTom Pothier 85074bb90dSTom Pothier #define LABEL 1 86074bb90dSTom Pothier 87074bb90dSTom Pothier /* Flags used by x86pi_enum_generic */ 88074bb90dSTom Pothier #define X86PI_ENUM_FRU 0x0001 /* Indicates a FRU */ 89074bb90dSTom Pothier 90074bb90dSTom Pothier /* max allowed contained count */ 91074bb90dSTom Pothier #define SMB_MAX_ID 0x40 92074bb90dSTom Pothier 93074bb90dSTom Pothier /* indication of successful fac node creation */ 94*2a685872SToomas Soome extern int fac_done; 95074bb90dSTom Pothier 96074bb90dSTom Pothier /* 97074bb90dSTom Pothier * Count and smbios struct id(s) for each smbios struct type. 98074bb90dSTom Pothier */ 99074bb90dSTom Pothier typedef struct smbs_con_ids { 100074bb90dSTom Pothier id_t id; /* smbios struct id */ 101074bb90dSTom Pothier id_t con_cnt; /* containee count */ 102074bb90dSTom Pothier id_t con_ids[SMB_MAX_ID]; /* containee ids */ 103074bb90dSTom Pothier id_t con_by_id; /* container id */ 104074bb90dSTom Pothier int visited; /* visit flag */ 105074bb90dSTom Pothier tnode_t *node; 106074bb90dSTom Pothier } smbs_con_ids_t; 107074bb90dSTom Pothier 108074bb90dSTom Pothier typedef struct smbs_cnt { 109074bb90dSTom Pothier int type; /* SMBIOS stucture type */ 110074bb90dSTom Pothier int count; /* number of table entries */ 111074bb90dSTom Pothier smbs_con_ids_t ids[SMB_MAX_ID]; /* SMBIOS table entry id(s) */ 112074bb90dSTom Pothier } smbs_cnt_t; 113074bb90dSTom Pothier 114*2a685872SToomas Soome extern smbs_cnt_t stypes[SMB_TYPE_OEM_HI]; /* one for each struct */ 115074bb90dSTom Pothier 116074bb90dSTom Pothier /* 117074bb90dSTom Pothier * The enumerator needs to pass some state in to the function that walks 118074bb90dSTom Pothier * the PRI graph. This structure contains the necessary information. 119074bb90dSTom Pothier */ 120074bb90dSTom Pothier struct x86pi_enum_s { 121074bb90dSTom Pothier topo_mod_t *mod; /* Topo module handle */ 122074bb90dSTom Pothier tnode_t *t_parent; /* "Chassis" parent */ 123074bb90dSTom Pothier uint32_t force; /* force legacy */ 124074bb90dSTom Pothier void *priv; /* Private data */ 125074bb90dSTom Pothier }; 126074bb90dSTom Pothier typedef struct x86pi_enum_s x86pi_enum_t; 127074bb90dSTom Pothier 128074bb90dSTom Pothier /* 129074bb90dSTom Pothier * x86gentopo hcfmri info structure. 130074bb90dSTom Pothier * 131074bb90dSTom Pothier * Available unformed SMBIOS strings: 132074bb90dSTom Pothier * smbi_manufacturer 133074bb90dSTom Pothier * smbi_product 134074bb90dSTom Pothier * smbi_version 135074bb90dSTom Pothier * smbi_serial 136074bb90dSTom Pothier * smbi_asset 137074bb90dSTom Pothier * smbi_location 138074bb90dSTom Pothier * smbi_part 139074bb90dSTom Pothier * 140074bb90dSTom Pothier */ 141074bb90dSTom Pothier struct x86pi_hcfmri_info_s { 142074bb90dSTom Pothier int instance; 143074bb90dSTom Pothier int rev; 144074bb90dSTom Pothier 145074bb90dSTom Pothier const char *hc_name; 146074bb90dSTom Pothier const char *manufacturer; 147074bb90dSTom Pothier const char *product; 148074bb90dSTom Pothier const char *version; 149074bb90dSTom Pothier const char *serial_number; 150074bb90dSTom Pothier const char *asset_tag; 151074bb90dSTom Pothier const char *location; 152074bb90dSTom Pothier const char *part_number; 153074bb90dSTom Pothier }; 154074bb90dSTom Pothier typedef struct x86pi_hcfmri_info_s x86pi_hcfmri_t; 155074bb90dSTom Pothier 156074bb90dSTom Pothier /* 157074bb90dSTom Pothier * Prototypes 158074bb90dSTom Pothier */ 159074bb90dSTom Pothier 160074bb90dSTom Pothier /* SMBIOS */ 161074bb90dSTom Pothier smbios_hdl_t *x86pi_smb_open(topo_mod_t *); 162efd31e1dSTrang Do void x86pi_smb_strcnt(topo_mod_t *, smbs_cnt_t *); 163efd31e1dSTrang Do int x86pi_check_comp(topo_mod_t *); 164074bb90dSTom Pothier 165074bb90dSTom Pothier /* Node generation */ 166efd31e1dSTrang Do tnode_t *x86pi_gen_chassis(topo_mod_t *, tnode_t *, int, int); 167efd31e1dSTrang Do tnode_t *x86pi_gen_bboard(topo_mod_t *, tnode_t *, int, int, 168074bb90dSTom Pothier int); 169074bb90dSTom Pothier int x86pi_gen_cmp(topo_mod_t *, tnode_t *, smbios_hdl_t *, int, int, int); 170074bb90dSTom Pothier int x86pi_gen_core(topo_mod_t *, tnode_t *, int, int, int); 171074bb90dSTom Pothier int x86pi_gen_strand(topo_mod_t *, tnode_t *, int, int, int); 172074bb90dSTom Pothier int x86pi_gen_memarray(topo_mod_t *, tnode_t *, smbios_hdl_t *, int, int); 173074bb90dSTom Pothier void x86pi_gen_memdev(topo_mod_t *, tnode_t *, smbios_hdl_t *, int, int, int); 174efd31e1dSTrang Do int x86pi_gen_hbr(topo_mod_t *, tnode_t *, int, topo_instance_t, 175efd31e1dSTrang Do topo_instance_t *); 176efd31e1dSTrang Do int x86pi_gen_bay(topo_mod_t *, tnode_t *, smbios_port_ext_t *, 17703f9f63dSTom Pothier int); 178074bb90dSTom Pothier 179074bb90dSTom Pothier /* support routines */ 180074bb90dSTom Pothier int x86pi_enum_generic(topo_mod_t *, x86pi_hcfmri_t *, tnode_t *, tnode_t *, 181074bb90dSTom Pothier tnode_t **, int); 182074bb90dSTom Pothier tnode_t *x86pi_node_bind(topo_mod_t *, tnode_t *, x86pi_hcfmri_t *, nvlist_t *, 183074bb90dSTom Pothier int); 184074bb90dSTom Pothier void x86pi_hcfmri_info_fini(topo_mod_t *, x86pi_hcfmri_t *); 18503f9f63dSTom Pothier uint16_t x86pi_bdf(topo_mod_t *, di_node_t); 18603f9f63dSTom Pothier int x86pi_phy(topo_mod_t *, di_node_t); 187074bb90dSTom Pothier 188074bb90dSTom Pothier /* get/set info */ 189074bb90dSTom Pothier char *x86pi_get_serverid(topo_mod_t *); 190074bb90dSTom Pothier int x86pi_set_frufmri(topo_mod_t *, x86pi_hcfmri_t *, tnode_t *, tnode_t *, 191074bb90dSTom Pothier int); 192074bb90dSTom Pothier int x86pi_set_label(topo_mod_t *, const char *, const char *, tnode_t *); 193074bb90dSTom Pothier int x86pi_set_auth(topo_mod_t *, x86pi_hcfmri_t *, tnode_t *, tnode_t *); 194074bb90dSTom Pothier int x86pi_set_system(topo_mod_t *, tnode_t *); 195074bb90dSTom Pothier 196074bb90dSTom Pothier /* hostbridge */ 197074bb90dSTom Pothier int x86pi_hbr_enum_init(topo_mod_t *); 198074bb90dSTom Pothier void x86pi_hbr_enum_fini(topo_mod_t *); 199074bb90dSTom Pothier 200074bb90dSTom Pothier /* base board */ 201efd31e1dSTrang Do id_t x86pi_bb_topparent(topo_mod_t *, int, tnode_t **, id_t *); 202efd31e1dSTrang Do int x86pi_bb_contains(topo_mod_t *); 203efd31e1dSTrang Do int x86pi_bb_getchips(topo_mod_t *, int, int); 204074bb90dSTom Pothier 205074bb90dSTom Pothier const char *x86pi_cleanup_smbios_str(topo_mod_t *, const char *, int); 206074bb90dSTom Pothier 207074bb90dSTom Pothier #ifdef __cplusplus 208074bb90dSTom Pothier } 209074bb90dSTom Pothier #endif 210074bb90dSTom Pothier 211074bb90dSTom Pothier #endif /* _X86PI_IMPL_H */ 212