1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
*/
#ifndef _X86PI_IMPL_H
#define _X86PI_IMPL_H
/*
* i86pc Generic Enumerator private interfaces
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <smbios.h>
#include <ctype.h>
/*
* Table showing the relationship between hc-canonical names and the
* SMBIOS tables/values.
*
* **************************************************************************
* | hc-name | SMB Table | Offset - Name | Value |
* --------------------------------------------------------------------------
* --------------------------------------------------------------------------
* | "motherboard" | Type 2 | 0x0D - Board Type | 0x0A |
* --------------------------------------------------------------------------
* | "cpuboard" | Type 2 | 0x0D - Board Type | 0x06 |
* --------------------------------------------------------------------------
* | "memboard" | Type 2 | 0x0D - Board Type | 0x08 |
* --------------------------------------------------------------------------
* | "ioboard" | Type 2 | 0x0D - Board Type | 0x07 |
* --------------------------------------------------------------------------
* | "systemboard" | Type 2 | 0x0D - Board Type | 0x03,0x09,|
* | | | | 0x0B,0x0C |
* --------------------------------------------------------------------------
* | "bay" | Type 136 | |
* --------------------------------------------------------------------------
* | "hostbridge" | Type 138 | |
* --------------------------------------------------------------------------
* | "pciexrc" | Type 138 | |
* **************************************************************************
*/
/* Definitions used when registering the enumerator with libtopo */
#define X86PI_DESC "i86pc Generic Topology Enumerator"
#define X86PI_SCHEME "hc"
#define X86PI_VERSION TOPO_VERSION
/*
* Solaris FMA Compliance level for SMBIOS.
* The same X86PI_* definitions are used in chip.h
* please keep them in sync
*/
#define X86PI_FULL 1
#define X86PI_NONE 2
/* used in traversing contained bboards */
#define X86PI_VISITED 1
#define LABEL 1
/* Flags used by x86pi_enum_generic */
#define X86PI_ENUM_FRU 0x0001 /* Indicates a FRU */
/* max allowed contained count */
#define SMB_MAX_ID 0x40
/* indication of successful fac node creation */
extern int fac_done;
/*
* Count and smbios struct id(s) for each smbios struct type.
*/
typedef struct smbs_con_ids {
id_t id; /* smbios struct id */
id_t con_cnt; /* containee count */
id_t con_ids[SMB_MAX_ID]; /* containee ids */
id_t con_by_id; /* container id */
int visited; /* visit flag */
tnode_t *node;
} smbs_con_ids_t;
typedef struct smbs_cnt {
int type; /* SMBIOS stucture type */
int count; /* number of table entries */
smbs_con_ids_t ids[SMB_MAX_ID]; /* SMBIOS table entry id(s) */
} smbs_cnt_t;
extern smbs_cnt_t stypes[SMB_TYPE_OEM_HI]; /* one for each struct */
/*
* The enumerator needs to pass some state in to the function that walks
* the PRI graph. This structure contains the necessary information.
*/
struct x86pi_enum_s {
topo_mod_t *mod; /* Topo module handle */
tnode_t *t_parent; /* "Chassis" parent */
uint32_t force; /* force legacy */
void *priv; /* Private data */
};
typedef struct x86pi_enum_s x86pi_enum_t;
/*
* x86gentopo hcfmri info structure.
*
* Available unformed SMBIOS strings:
* smbi_manufacturer
* smbi_product
* smbi_version
* smbi_serial
* smbi_asset
* smbi_location
* smbi_part
*
*/
struct x86pi_hcfmri_info_s {
int instance;
int rev;
const char *hc_name;
const char *manufacturer;
const char *product;
const char *version;
const char *serial_number;
const char *asset_tag;
const char *location;
const char *part_number;
};
typedef struct x86pi_hcfmri_info_s x86pi_hcfmri_t;
/*
* Prototypes
*/
/* SMBIOS */
smbios_hdl_t *x86pi_smb_open(topo_mod_t *);
void x86pi_smb_strcnt(topo_mod_t *, smbs_cnt_t *);
int x86pi_check_comp(topo_mod_t *);
/* Node generation */
tnode_t *x86pi_gen_chassis(topo_mod_t *, tnode_t *, int, int);
tnode_t *x86pi_gen_bboard(topo_mod_t *, tnode_t *, int, int,
int);
int x86pi_gen_cmp(topo_mod_t *, tnode_t *, smbios_hdl_t *, int, int, int);
int x86pi_gen_core(topo_mod_t *, tnode_t *, int, int, int);
int x86pi_gen_strand(topo_mod_t *, tnode_t *, int, int, int);
int x86pi_gen_memarray(topo_mod_t *, tnode_t *, smbios_hdl_t *, int, int);
void x86pi_gen_memdev(topo_mod_t *, tnode_t *, smbios_hdl_t *, int, int, int);
int x86pi_gen_hbr(topo_mod_t *, tnode_t *, int, topo_instance_t,
topo_instance_t *);
int x86pi_gen_bay(topo_mod_t *, tnode_t *, smbios_port_ext_t *,
int);
/* support routines */
int x86pi_enum_generic(topo_mod_t *, x86pi_hcfmri_t *, tnode_t *, tnode_t *,
tnode_t **, int);
tnode_t *x86pi_node_bind(topo_mod_t *, tnode_t *, x86pi_hcfmri_t *, nvlist_t *,
int);
void x86pi_hcfmri_info_fini(topo_mod_t *, x86pi_hcfmri_t *);
uint16_t x86pi_bdf(topo_mod_t *, di_node_t);
int x86pi_phy(topo_mod_t *, di_node_t);
/* get/set info */
char *x86pi_get_serverid(topo_mod_t *);
int x86pi_set_frufmri(topo_mod_t *, x86pi_hcfmri_t *, tnode_t *, tnode_t *,
int);
int x86pi_set_label(topo_mod_t *, const char *, const char *, tnode_t *);
int x86pi_set_auth(topo_mod_t *, x86pi_hcfmri_t *, tnode_t *, tnode_t *);
int x86pi_set_system(topo_mod_t *, tnode_t *);
/* hostbridge */
int x86pi_hbr_enum_init(topo_mod_t *);
void x86pi_hbr_enum_fini(topo_mod_t *);
/* base board */
id_t x86pi_bb_topparent(topo_mod_t *, int, tnode_t **, id_t *);
int x86pi_bb_contains(topo_mod_t *);
int x86pi_bb_getchips(topo_mod_t *, int, int);
const char *x86pi_cleanup_smbios_str(topo_mod_t *, const char *, int);
#ifdef __cplusplus
}
#endif
#endif /* _X86PI_IMPL_H */
|