xref: /illumos-gate/usr/src/lib/fm/topo/modules/i86pc/chip/chip.h (revision 56e2cc86321ec889bf83a888d902c60d6fb2ef8d)
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 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _CHIP_H
27 #define	_CHIP_H
28 
29 #include <kstat.h>
30 #include <libnvpair.h>
31 #include <fm/libtopo.h>
32 #include <fm/topo_mod.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 #define	CHIP_VERSION		TOPO_VERSION
39 
40 #define	CHIP_NODE_NAME		"chip"
41 #define	CORE_NODE_NAME		"core"
42 #define	STRAND_NODE_NAME	"strand"
43 #define	MCT_NODE_NAME		"memory-controller"
44 #define	CHAN_NODE_NAME		"dram-channel"
45 #define	CS_NODE_NAME		"chip-select"
46 #define	DIMM_NODE_NAME		"dimm"
47 #define	RANK_NODE_NAME		"rank"
48 
49 #define	PGNAME(prefix)	(prefix##_NODE_NAME "-properties")
50 
51 /*
52  * chip-properties
53  */
54 #define	CHIP_VENDOR_ID		"vendor_id"
55 #define	CHIP_FAMILY		"family"
56 #define	CHIP_MODEL		"model"
57 #define	CHIP_STEPPING		"stepping"
58 #define	CHIP_NCORE		"ncore_per_chip"
59 
60 /*
61  * core-properties
62  */
63 #define	CORE_CHIP_ID		"chip_id"
64 
65 /*
66  * strand-properties
67  */
68 #define	STRAND_CHIP_ID		"chip_id"
69 #define	STRAND_CORE_ID		"core_id"
70 #define	STRAND_PKG_CORE_ID	"pkg_core_id"
71 #define	STRAND_CPU_ID		"cpuid"
72 
73 /*
74  * label property methods
75  */
76 #define	SIMPLE_DIMM_LBL		"simple_dimm_label"
77 #define	SIMPLE_DIMM_LBL_MP	"simple_dimm_label_mp"
78 #define	SEQ_DIMM_LBL		"seq_dimm_label"
79 #define	G4_DIMM_LBL		"g4_dimm_label"
80 #define	G12F_DIMM_LBL		"g12f_dimm_label"
81 #define	SIMPLE_CHIP_LBL		"simple_chip_label"
82 #define	G4_CHIP_LBL		"g4_chip_label"
83 #define	A4FPLUS_CHIP_LBL	"a4fplus_chip_label"
84 #define	SIMPLE_CS_LBL_MP	"simple_cs_label_mp"
85 #define	FSB2_CHIP_LBL		"fsb2_chip_label"
86 
87 /*
88  * DIMM serial number property methods
89  */
90 #define	GET_DIMM_SERIAL		"get_dimm_serial"
91 #define	GET_CS_SERIAL		"get_cs_serial"
92 
93 extern int simple_dimm_label(topo_mod_t *, tnode_t *, topo_version_t,
94     nvlist_t *, nvlist_t **);
95 extern int simple_dimm_label_mp(topo_mod_t *, tnode_t *, topo_version_t,
96     nvlist_t *, nvlist_t **);
97 extern int seq_dimm_label(topo_mod_t *, tnode_t *, topo_version_t,
98     nvlist_t *, nvlist_t **);
99 extern int g4_dimm_label(topo_mod_t *, tnode_t *, topo_version_t, nvlist_t *,
100     nvlist_t **);
101 
102 extern int g12f_dimm_label(topo_mod_t *, tnode_t *, topo_version_t, nvlist_t *,
103     nvlist_t **);
104 
105 extern int simple_chip_label(topo_mod_t *, tnode_t *, topo_version_t,
106     nvlist_t *, nvlist_t **);
107 extern int g4_chip_label(topo_mod_t *, tnode_t *, topo_version_t,
108     nvlist_t *, nvlist_t **);
109 extern int a4fplus_chip_label(topo_mod_t *, tnode_t *, topo_version_t,
110     nvlist_t *, nvlist_t **);
111 extern int simple_cs_label_mp(topo_mod_t *, tnode_t *, topo_version_t,
112     nvlist_t *, nvlist_t **);
113 extern int get_cs_serial(topo_mod_t *, tnode_t *, topo_version_t,
114     nvlist_t *, nvlist_t **);
115 extern int get_dimm_serial(topo_mod_t *, tnode_t *, topo_version_t, nvlist_t *,
116     nvlist_t **);
117 extern int fsb2_chip_label(topo_mod_t *, tnode_t *, topo_version_t,
118     nvlist_t *, nvlist_t **);
119 
120 /*
121  * Support functions of chip_subr.c
122  */
123 extern void whinge(topo_mod_t *, int *, const char *, ...);
124 extern int nvprop_add(topo_mod_t *, nvpair_t *, const char *, tnode_t *);
125 extern int add_nvlist_strprop(topo_mod_t *, tnode_t *, nvlist_t *,
126     const char *, const char *, const char **);
127 extern int add_nvlist_longprop(topo_mod_t *, tnode_t *, nvlist_t *,
128     const char *, const char *, int32_t *);
129 extern int add_nvlist_longprops(topo_mod_t *, tnode_t *, nvlist_t *,
130     const char *, int32_t *, ...);
131 extern int mkrsrc(topo_mod_t *, tnode_t *, const char *, int,
132     nvlist_t *, nvlist_t **);
133 extern nvlist_t *cpu_fmri_create(topo_mod_t *, uint32_t, char *, uint8_t);
134 extern boolean_t is_xpv();
135 
136 /*
137  * topo methods
138  */
139 extern int mem_asru_compute(topo_mod_t *, tnode_t *, topo_version_t,
140     nvlist_t *, nvlist_t **);
141 extern int rank_fmri_present(topo_mod_t *, tnode_t *, topo_version_t,
142     nvlist_t *, nvlist_t **);
143 extern int rank_fmri_replaced(topo_mod_t *, tnode_t *, topo_version_t,
144     nvlist_t *, nvlist_t **);
145 extern int retire_strands(topo_mod_t *, tnode_t *, topo_version_t,
146     nvlist_t *, nvlist_t **);
147 extern int unretire_strands(topo_mod_t *, tnode_t *, topo_version_t,
148     nvlist_t *, nvlist_t **);
149 extern int service_state_strands(topo_mod_t *, tnode_t *, topo_version_t,
150     nvlist_t *, nvlist_t **);
151 extern int unusable_strands(topo_mod_t *, tnode_t *, topo_version_t,
152     nvlist_t *, nvlist_t **);
153 extern int ntv_page_retire(topo_mod_t *, tnode_t *, topo_version_t,
154     nvlist_t *, nvlist_t **);
155 extern int ntv_page_service_state(topo_mod_t *, tnode_t *, topo_version_t,
156     nvlist_t *, nvlist_t **);
157 extern int ntv_page_unretire(topo_mod_t *, tnode_t *, topo_version_t,
158     nvlist_t *, nvlist_t **);
159 extern int ntv_page_unusable(topo_mod_t *, tnode_t *, topo_version_t,
160     nvlist_t *, nvlist_t **);
161 
162 extern int mem_asru_create(topo_mod_t *, nvlist_t *, nvlist_t **);
163 
164 /*
165  * Prototypes for chip_amd.c
166  */
167 extern void amd_mc_create(topo_mod_t *, tnode_t *, const char *, nvlist_t *,
168     int, int, int, int *);
169 
170 /*
171  * Prototypes for chip_intel.c
172  */
173 extern int mc_offchip_open(void);
174 extern int mc_offchip_create(topo_mod_t *, tnode_t *, const char *, nvlist_t *);
175 extern void onchip_mc_create(topo_mod_t *, tnode_t *, const char *, nvlist_t *);
176 
177 extern char *get_fmtstr(topo_mod_t *, nvlist_t *);
178 extern int store_prop_val(topo_mod_t *, char *, char *, nvlist_t **out);
179 
180 #ifdef __cplusplus
181 }
182 #endif
183 
184 #endif /* _CHIP_H */
185