xref: /illumos-gate/usr/src/lib/fm/topo/modules/i86pc/chip/chip.h (revision 8c69cc8fbe729fa7b091e901c4b50508ccc6bb33)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 
25 #ifndef _CHIP_H
26 #define	_CHIP_H
27 
28 #include <kstat.h>
29 #include <libnvpair.h>
30 #include <fm/libtopo.h>
31 #include <fm/topo_mod.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 #define	CHIP_VERSION		TOPO_VERSION
38 
39 /* Below should match the definitions in x86pi_impl.h */
40 #define	X86PI_FULL		1
41 #define	X86PI_NONE		2
42 
43 /*
44  * FM_AWARE_SMBIOS means SMBIOS meets FMA needs
45  * X86PI_FULL is defined as 1 in x86pi.so
46  * And passed from x86pi.so to chip.so as module
47  * private data
48  */
49 #define	FM_AWARE_SMBIOS(mod)	\
50 	(topo_mod_getspecific(mod) != NULL && \
51 	    (*(int *)topo_mod_getspecific(mod) == X86PI_FULL))
52 #define	IGNORE_ID	0xFFFF
53 
54 /*
55  * These definitions are for the Tree Nodes
56  * in the FM Topology
57  */
58 #define	CHIP_NODE_NAME		"chip"
59 #define	CORE_NODE_NAME		"core"
60 #define	STRAND_NODE_NAME	"strand"
61 #define	MCT_NODE_NAME		"memory-controller"
62 #define	CHAN_NODE_NAME		"dram-channel"
63 #define	CS_NODE_NAME		"chip-select"
64 #define	DIMM_NODE_NAME		"dimm"
65 #define	RANK_NODE_NAME		"rank"
66 
67 #define	PGNAME(prefix)	(prefix##_NODE_NAME "-properties")
68 
69 /*
70  * chip-properties
71  */
72 #define	CHIP_VENDOR_ID		"vendor_id"
73 #define	CHIP_FAMILY		"family"
74 #define	CHIP_MODEL		"model"
75 #define	CHIP_STEPPING		"stepping"
76 #define	CHIP_NCORE		"ncore_per_chip"
77 
78 /*
79  * memory-controller-properties
80  * check usr/src/uts/i86pc/os/cpuid.c to understand more
81  * on procnodeid values for AMD & Intel
82  */
83 #define	MCT_PROCNODE_ID		"procnodeid"
84 
85 /*
86  * core-properties
87  */
88 #define	CORE_CHIP_ID		"chip_id"
89 #define	CORE_PROCNODE_ID	"procnodeid"
90 
91 /*
92  * strand-properties
93  */
94 #define	STRAND_CHIP_ID		"chip_id"
95 #define	STRAND_PROCNODE_ID	"procnodeid"
96 #define	STRAND_CORE_ID		"core_id"
97 #define	STRAND_PKG_CORE_ID	"pkg_core_id"
98 #define	STRAND_CPU_ID		"cpuid"
99 
100 /*
101  * label property methods
102  */
103 #define	SIMPLE_DIMM_LBL		"simple_dimm_label"
104 #define	SIMPLE_DIMM_LBL_MP	"simple_dimm_label_mp"
105 #define	SEQ_DIMM_LBL		"seq_dimm_label"
106 #define	G4_DIMM_LBL		"g4_dimm_label"
107 #define	G12F_DIMM_LBL		"g12f_dimm_label"
108 #define	SIMPLE_CHIP_LBL		"simple_chip_label"
109 #define	G4_CHIP_LBL		"g4_chip_label"
110 #define	A4FPLUS_CHIP_LBL	"a4fplus_chip_label"
111 #define	SIMPLE_CS_LBL_MP	"simple_cs_label_mp"
112 #define	FSB2_CHIP_LBL		"fsb2_chip_label"
113 
114 /*
115  * DIMM serial number property methods
116  */
117 #define	GET_DIMM_SERIAL		"get_dimm_serial"
118 
119 extern int simple_dimm_label(topo_mod_t *, tnode_t *, topo_version_t,
120     nvlist_t *, nvlist_t **);
121 extern int simple_dimm_label_mp(topo_mod_t *, tnode_t *, topo_version_t,
122     nvlist_t *, nvlist_t **);
123 extern int seq_dimm_label(topo_mod_t *, tnode_t *, topo_version_t,
124     nvlist_t *, nvlist_t **);
125 extern int g4_dimm_label(topo_mod_t *, tnode_t *, topo_version_t, nvlist_t *,
126     nvlist_t **);
127 
128 extern int g12f_dimm_label(topo_mod_t *, tnode_t *, topo_version_t, nvlist_t *,
129     nvlist_t **);
130 
131 extern int simple_chip_label(topo_mod_t *, tnode_t *, topo_version_t,
132     nvlist_t *, nvlist_t **);
133 extern int g4_chip_label(topo_mod_t *, tnode_t *, topo_version_t,
134     nvlist_t *, nvlist_t **);
135 extern int a4fplus_chip_label(topo_mod_t *, tnode_t *, topo_version_t,
136     nvlist_t *, nvlist_t **);
137 extern int simple_cs_label_mp(topo_mod_t *, tnode_t *, topo_version_t,
138     nvlist_t *, nvlist_t **);
139 extern int get_dimm_serial(topo_mod_t *, tnode_t *, topo_version_t, nvlist_t *,
140     nvlist_t **);
141 extern int fsb2_chip_label(topo_mod_t *, tnode_t *, topo_version_t,
142     nvlist_t *, nvlist_t **);
143 
144 /*
145  * Support functions of chip_subr.c
146  */
147 extern void whinge(topo_mod_t *, int *, const char *, ...);
148 extern int nvprop_add(topo_mod_t *, nvpair_t *, const char *, tnode_t *);
149 extern int add_nvlist_strprop(topo_mod_t *, tnode_t *, nvlist_t *,
150     const char *, const char *, const char **);
151 extern int add_nvlist_longprop(topo_mod_t *, tnode_t *, nvlist_t *,
152     const char *, const char *, int32_t *);
153 extern int add_nvlist_longprops(topo_mod_t *, tnode_t *, nvlist_t *,
154     const char *, int32_t *, ...);
155 extern int mkrsrc(topo_mod_t *, tnode_t *, const char *, int,
156     nvlist_t *, nvlist_t **);
157 extern nvlist_t *cpu_fmri_create(topo_mod_t *, uint32_t, char *, uint8_t);
158 extern boolean_t is_xpv();
159 
160 /*
161  * topo methods
162  */
163 extern int mem_asru_compute(topo_mod_t *, tnode_t *, topo_version_t,
164     nvlist_t *, nvlist_t **);
165 extern int rank_fmri_present(topo_mod_t *, tnode_t *, topo_version_t,
166     nvlist_t *, nvlist_t **);
167 extern int rank_fmri_replaced(topo_mod_t *, tnode_t *, topo_version_t,
168     nvlist_t *, nvlist_t **);
169 extern int retire_strands(topo_mod_t *, tnode_t *, topo_version_t,
170     nvlist_t *, nvlist_t **);
171 extern int unretire_strands(topo_mod_t *, tnode_t *, topo_version_t,
172     nvlist_t *, nvlist_t **);
173 extern int service_state_strands(topo_mod_t *, tnode_t *, topo_version_t,
174     nvlist_t *, nvlist_t **);
175 extern int unusable_strands(topo_mod_t *, tnode_t *, topo_version_t,
176     nvlist_t *, nvlist_t **);
177 extern int ntv_page_retire(topo_mod_t *, tnode_t *, topo_version_t,
178     nvlist_t *, nvlist_t **);
179 extern int ntv_page_service_state(topo_mod_t *, tnode_t *, topo_version_t,
180     nvlist_t *, nvlist_t **);
181 extern int ntv_page_unretire(topo_mod_t *, tnode_t *, topo_version_t,
182     nvlist_t *, nvlist_t **);
183 extern int ntv_page_unusable(topo_mod_t *, tnode_t *, topo_version_t,
184     nvlist_t *, nvlist_t **);
185 
186 extern int mem_asru_create(topo_mod_t *, nvlist_t *, nvlist_t **);
187 
188 /*
189  * Prototypes for chip_amd.c
190  */
191 extern void amd_mc_create(topo_mod_t *, uint16_t, tnode_t *, const char *,
192     nvlist_t *, int32_t, int32_t, int, int, int *);
193 
194 /*
195  * Prototypes for chip_intel.c
196  */
197 extern int mc_offchip_open(void);
198 extern int mc_offchip_create(topo_mod_t *, tnode_t *, const char *, nvlist_t *);
199 extern void onchip_mc_create(topo_mod_t *, uint16_t, tnode_t *,
200     const char *, nvlist_t *);
201 
202 extern char *get_fmtstr(topo_mod_t *, nvlist_t *);
203 extern int store_prop_val(topo_mod_t *, char *, char *, nvlist_t **out);
204 
205 /*
206  * Prototypes for chip_smbios.c
207  */
208 
209 extern int init_chip_smbios(topo_mod_t *);
210 extern int chip_status_smbios_get(topo_mod_t *, id_t);
211 extern int chip_fru_smbios_get(topo_mod_t *, id_t);
212 extern const char *chip_label_smbios_get(topo_mod_t *, tnode_t *, id_t, char *);
213 extern const char *chip_serial_smbios_get(topo_mod_t *, id_t);
214 extern const char *chip_part_smbios_get(topo_mod_t *, id_t);
215 extern const char *chip_rev_smbios_get(topo_mod_t *, id_t);
216 extern id_t memnode_to_smbiosid(topo_mod_t *, uint16_t, const char *,
217     uint64_t, void *);
218 
219 
220 #ifdef __cplusplus
221 }
222 #endif
223 
224 #endif /* _CHIP_H */
225