xref: /illumos-gate/usr/src/lib/fm/topo/modules/i86pc/chip/chip.h (revision d0caeb890c33e30d7a9addcbccdda2343401d3e7)
17aec1d6eScindi /*
27aec1d6eScindi  * CDDL HEADER START
37aec1d6eScindi  *
47aec1d6eScindi  * The contents of this file are subject to the terms of the
58a40a695Sgavinm  * Common Development and Distribution License (the "License").
68a40a695Sgavinm  * You may not use this file except in compliance with the License.
77aec1d6eScindi  *
87aec1d6eScindi  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97aec1d6eScindi  * or http://www.opensolaris.org/os/licensing.
107aec1d6eScindi  * See the License for the specific language governing permissions
117aec1d6eScindi  * and limitations under the License.
127aec1d6eScindi  *
137aec1d6eScindi  * When distributing Covered Code, include this CDDL HEADER in each
147aec1d6eScindi  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157aec1d6eScindi  * If applicable, add the following below this CDDL HEADER, with the
167aec1d6eScindi  * fields enclosed by brackets "[]" replaced with your own identifying
177aec1d6eScindi  * information: Portions Copyright [yyyy] [name of copyright owner]
187aec1d6eScindi  *
197aec1d6eScindi  * CDDL HEADER END
207aec1d6eScindi  */
217aec1d6eScindi /*
22efd31e1dSTrang Do  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
23f2dbfd32SRobert Mustacchi  * Copyright 2019, Joyent, Inc.
24*d0caeb89SRobert Mustacchi  * Copyright 2020 Oxide Computer Company
257aec1d6eScindi  */
267aec1d6eScindi 
277aec1d6eScindi #ifndef _CHIP_H
287aec1d6eScindi #define	_CHIP_H
297aec1d6eScindi 
307aec1d6eScindi #include <kstat.h>
317aec1d6eScindi #include <libnvpair.h>
327aec1d6eScindi #include <fm/libtopo.h>
3320c794b3Sgavinm #include <fm/topo_mod.h>
347aec1d6eScindi 
357aec1d6eScindi #ifdef __cplusplus
367aec1d6eScindi extern "C" {
377aec1d6eScindi #endif
387aec1d6eScindi 
397aec1d6eScindi #define	CHIP_VERSION		TOPO_VERSION
407aec1d6eScindi 
41074bb90dSTom Pothier /* Below should match the definitions in x86pi_impl.h */
42074bb90dSTom Pothier #define	X86PI_FULL		1
43074bb90dSTom Pothier #define	X86PI_NONE		2
44074bb90dSTom Pothier 
45074bb90dSTom Pothier /*
46074bb90dSTom Pothier  * FM_AWARE_SMBIOS means SMBIOS meets FMA needs
47074bb90dSTom Pothier  * X86PI_FULL is defined as 1 in x86pi.so
48074bb90dSTom Pothier  * And passed from x86pi.so to chip.so as module
49074bb90dSTom Pothier  * private data
50074bb90dSTom Pothier  */
51074bb90dSTom Pothier #define	FM_AWARE_SMBIOS(mod)	\
52074bb90dSTom Pothier 	(topo_mod_getspecific(mod) != NULL && \
53074bb90dSTom Pothier 	    (*(int *)topo_mod_getspecific(mod) == X86PI_FULL))
54074bb90dSTom Pothier #define	IGNORE_ID	0xFFFF
55074bb90dSTom Pothier 
568031591dSSrihari Venkatesan /*
578031591dSSrihari Venkatesan  * These definitions are for the Tree Nodes
588031591dSSrihari Venkatesan  * in the FM Topology
598031591dSSrihari Venkatesan  */
609dd0f810Scindi #define	CHIP_NODE_NAME		"chip"
61e4b86885SCheng Sean Ye #define	CORE_NODE_NAME		"core"
62e4b86885SCheng Sean Ye #define	STRAND_NODE_NAME	"strand"
638a40a695Sgavinm #define	MCT_NODE_NAME		"memory-controller"
648a40a695Sgavinm #define	CHAN_NODE_NAME		"dram-channel"
657aec1d6eScindi #define	CS_NODE_NAME		"chip-select"
667aec1d6eScindi #define	DIMM_NODE_NAME		"dimm"
678a40a695Sgavinm #define	RANK_NODE_NAME		"rank"
687aec1d6eScindi 
699dd0f810Scindi #define	PGNAME(prefix)	(prefix##_NODE_NAME "-properties")
707aec1d6eScindi 
717aec1d6eScindi /*
729dd0f810Scindi  * chip-properties
737aec1d6eScindi  */
74c26bf377SRob Johnston #define	CHIP_BRAND		"brand"
757aec1d6eScindi #define	CHIP_FAMILY		"family"
767aec1d6eScindi #define	CHIP_MODEL		"model"
77e4b86885SCheng Sean Ye #define	CHIP_NCORE		"ncore_per_chip"
78*d0caeb89SRobert Mustacchi #define	CHIP_SOCKET		"socket"
79c26bf377SRob Johnston #define	CHIP_STEPPING		"stepping"
80c26bf377SRob Johnston #define	CHIP_VENDOR_ID		"vendor_id"
817aec1d6eScindi 
829dd0f810Scindi /*
838031591dSSrihari Venkatesan  * memory-controller-properties
848031591dSSrihari Venkatesan  * check usr/src/uts/i86pc/os/cpuid.c to understand more
858031591dSSrihari Venkatesan  * on procnodeid values for AMD & Intel
868031591dSSrihari Venkatesan  */
878031591dSSrihari Venkatesan #define	MCT_PROCNODE_ID		"procnodeid"
888031591dSSrihari Venkatesan 
898031591dSSrihari Venkatesan /*
90e4b86885SCheng Sean Ye  * core-properties
919dd0f810Scindi  */
92e4b86885SCheng Sean Ye #define	CORE_CHIP_ID		"chip_id"
938031591dSSrihari Venkatesan #define	CORE_PROCNODE_ID	"procnodeid"
94e4b86885SCheng Sean Ye 
95e4b86885SCheng Sean Ye /*
96e4b86885SCheng Sean Ye  * strand-properties
97e4b86885SCheng Sean Ye  */
98e4b86885SCheng Sean Ye #define	STRAND_CHIP_ID		"chip_id"
998031591dSSrihari Venkatesan #define	STRAND_PROCNODE_ID	"procnodeid"
100e4b86885SCheng Sean Ye #define	STRAND_CORE_ID		"core_id"
101e4b86885SCheng Sean Ye #define	STRAND_PKG_CORE_ID	"pkg_core_id"
102e4b86885SCheng Sean Ye #define	STRAND_CPU_ID		"cpuid"
1039dd0f810Scindi 
1044557a2a1Srobj /*
1054557a2a1Srobj  * label property methods
1064557a2a1Srobj  */
1074557a2a1Srobj #define	SIMPLE_DIMM_LBL		"simple_dimm_label"
1084557a2a1Srobj #define	SIMPLE_DIMM_LBL_MP	"simple_dimm_label_mp"
1094557a2a1Srobj #define	SEQ_DIMM_LBL		"seq_dimm_label"
1102cb5535aSrobj #define	G4_DIMM_LBL		"g4_dimm_label"
111918a0d8aSrobj #define	G12F_DIMM_LBL		"g12f_dimm_label"
1124557a2a1Srobj #define	SIMPLE_CHIP_LBL		"simple_chip_label"
1134557a2a1Srobj #define	G4_CHIP_LBL		"g4_chip_label"
1142cb5535aSrobj #define	A4FPLUS_CHIP_LBL	"a4fplus_chip_label"
1155108f83cSrobj #define	SIMPLE_CS_LBL_MP	"simple_cs_label_mp"
11664d1d4abSAdrian Frost #define	FSB2_CHIP_LBL		"fsb2_chip_label"
1174557a2a1Srobj 
1182cb5535aSrobj /*
1192cb5535aSrobj  * DIMM serial number property methods
1202cb5535aSrobj  */
1212cb5535aSrobj #define	GET_DIMM_SERIAL		"get_dimm_serial"
1222cb5535aSrobj 
1234557a2a1Srobj extern int simple_dimm_label(topo_mod_t *, tnode_t *, topo_version_t,
1244557a2a1Srobj     nvlist_t *, nvlist_t **);
1254557a2a1Srobj extern int simple_dimm_label_mp(topo_mod_t *, tnode_t *, topo_version_t,
1264557a2a1Srobj     nvlist_t *, nvlist_t **);
1274557a2a1Srobj extern int seq_dimm_label(topo_mod_t *, tnode_t *, topo_version_t,
1284557a2a1Srobj     nvlist_t *, nvlist_t **);
1292cb5535aSrobj extern int g4_dimm_label(topo_mod_t *, tnode_t *, topo_version_t, nvlist_t *,
1302cb5535aSrobj     nvlist_t **);
1312cb5535aSrobj 
132918a0d8aSrobj extern int g12f_dimm_label(topo_mod_t *, tnode_t *, topo_version_t, nvlist_t *,
133918a0d8aSrobj     nvlist_t **);
134918a0d8aSrobj 
1354557a2a1Srobj extern int simple_chip_label(topo_mod_t *, tnode_t *, topo_version_t,
1364557a2a1Srobj     nvlist_t *, nvlist_t **);
1374557a2a1Srobj extern int g4_chip_label(topo_mod_t *, tnode_t *, topo_version_t,
1384557a2a1Srobj     nvlist_t *, nvlist_t **);
1392cb5535aSrobj extern int a4fplus_chip_label(topo_mod_t *, tnode_t *, topo_version_t,
1402cb5535aSrobj     nvlist_t *, nvlist_t **);
1415108f83cSrobj extern int simple_cs_label_mp(topo_mod_t *, tnode_t *, topo_version_t,
1425108f83cSrobj     nvlist_t *, nvlist_t **);
1432cb5535aSrobj extern int get_dimm_serial(topo_mod_t *, tnode_t *, topo_version_t, nvlist_t *,
1442cb5535aSrobj     nvlist_t **);
14564d1d4abSAdrian Frost extern int fsb2_chip_label(topo_mod_t *, tnode_t *, topo_version_t,
14664d1d4abSAdrian Frost     nvlist_t *, nvlist_t **);
1472cb5535aSrobj 
14820c794b3Sgavinm /*
14920c794b3Sgavinm  * Support functions of chip_subr.c
15020c794b3Sgavinm  */
15120c794b3Sgavinm extern void whinge(topo_mod_t *, int *, const char *, ...);
15220c794b3Sgavinm extern int nvprop_add(topo_mod_t *, nvpair_t *, const char *, tnode_t *);
153e4b86885SCheng Sean Ye extern int add_nvlist_strprop(topo_mod_t *, tnode_t *, nvlist_t *,
15420c794b3Sgavinm     const char *, const char *, const char **);
155e4b86885SCheng Sean Ye extern int add_nvlist_longprop(topo_mod_t *, tnode_t *, nvlist_t *,
15620c794b3Sgavinm     const char *, const char *, int32_t *);
157e4b86885SCheng Sean Ye extern int add_nvlist_longprops(topo_mod_t *, tnode_t *, nvlist_t *,
15820c794b3Sgavinm     const char *, int32_t *, ...);
15920c794b3Sgavinm extern int mkrsrc(topo_mod_t *, tnode_t *, const char *, int,
16020c794b3Sgavinm     nvlist_t *, nvlist_t **);
16120c794b3Sgavinm extern nvlist_t *cpu_fmri_create(topo_mod_t *, uint32_t, char *, uint8_t);
162e4b86885SCheng Sean Ye extern boolean_t is_xpv();
163*d0caeb89SRobert Mustacchi extern void get_chip_kstat_strs(topo_mod_t *, kstat_ctl_t *, int32_t, char **,
164*d0caeb89SRobert Mustacchi     char **);
165e4b86885SCheng Sean Ye 
166e4b86885SCheng Sean Ye /*
167e4b86885SCheng Sean Ye  * topo methods
168e4b86885SCheng Sean Ye  */
16920c794b3Sgavinm extern int mem_asru_compute(topo_mod_t *, tnode_t *, topo_version_t,
17020c794b3Sgavinm     nvlist_t *, nvlist_t **);
1712cb5535aSrobj extern int rank_fmri_present(topo_mod_t *, tnode_t *, topo_version_t,
1722cb5535aSrobj     nvlist_t *, nvlist_t **);
17325c6ff4bSstephh extern int rank_fmri_replaced(topo_mod_t *, tnode_t *, topo_version_t,
17425c6ff4bSstephh     nvlist_t *, nvlist_t **);
175e4b86885SCheng Sean Ye extern int retire_strands(topo_mod_t *, tnode_t *, topo_version_t,
176e4b86885SCheng Sean Ye     nvlist_t *, nvlist_t **);
177e4b86885SCheng Sean Ye extern int unretire_strands(topo_mod_t *, tnode_t *, topo_version_t,
178e4b86885SCheng Sean Ye     nvlist_t *, nvlist_t **);
179e4b86885SCheng Sean Ye extern int service_state_strands(topo_mod_t *, tnode_t *, topo_version_t,
180e4b86885SCheng Sean Ye     nvlist_t *, nvlist_t **);
181e4b86885SCheng Sean Ye extern int unusable_strands(topo_mod_t *, tnode_t *, topo_version_t,
182e4b86885SCheng Sean Ye     nvlist_t *, nvlist_t **);
183e4b86885SCheng Sean Ye extern int ntv_page_retire(topo_mod_t *, tnode_t *, topo_version_t,
184e4b86885SCheng Sean Ye     nvlist_t *, nvlist_t **);
185e4b86885SCheng Sean Ye extern int ntv_page_service_state(topo_mod_t *, tnode_t *, topo_version_t,
186e4b86885SCheng Sean Ye     nvlist_t *, nvlist_t **);
187e4b86885SCheng Sean Ye extern int ntv_page_unretire(topo_mod_t *, tnode_t *, topo_version_t,
188e4b86885SCheng Sean Ye     nvlist_t *, nvlist_t **);
189e4b86885SCheng Sean Ye extern int ntv_page_unusable(topo_mod_t *, tnode_t *, topo_version_t,
190e4b86885SCheng Sean Ye     nvlist_t *, nvlist_t **);
1912a613b59SRobert Mustacchi extern int chip_fmri_replaced(topo_mod_t *, tnode_t *, topo_version_t,
1922a613b59SRobert Mustacchi     nvlist_t *, nvlist_t **);
193e4b86885SCheng Sean Ye 
19420c794b3Sgavinm extern int mem_asru_create(topo_mod_t *, nvlist_t *, nvlist_t **);
19520c794b3Sgavinm 
19620c794b3Sgavinm /*
19720c794b3Sgavinm  * Prototypes for chip_amd.c
19820c794b3Sgavinm  */
1998031591dSSrihari Venkatesan extern void amd_mc_create(topo_mod_t *, uint16_t, tnode_t *, const char *,
2008031591dSSrihari Venkatesan     nvlist_t *, int32_t, int32_t, int, int, int *);
20120c794b3Sgavinm 
20220c794b3Sgavinm /*
20320c794b3Sgavinm  * Prototypes for chip_intel.c
20420c794b3Sgavinm  */
20520c794b3Sgavinm extern int mc_offchip_open(void);
20620c794b3Sgavinm extern int mc_offchip_create(topo_mod_t *, tnode_t *, const char *, nvlist_t *);
207074bb90dSTom Pothier extern void onchip_mc_create(topo_mod_t *, uint16_t, tnode_t *,
208074bb90dSTom Pothier     const char *, nvlist_t *);
20920c794b3Sgavinm 
2102cb5535aSrobj extern char *get_fmtstr(topo_mod_t *, nvlist_t *);
2112cb5535aSrobj extern int store_prop_val(topo_mod_t *, char *, char *, nvlist_t **out);
2122cb5535aSrobj 
213074bb90dSTom Pothier /*
214074bb90dSTom Pothier  * Prototypes for chip_smbios.c
215074bb90dSTom Pothier  */
216074bb90dSTom Pothier 
217074bb90dSTom Pothier extern int init_chip_smbios(topo_mod_t *);
218074bb90dSTom Pothier extern int chip_status_smbios_get(topo_mod_t *, id_t);
219074bb90dSTom Pothier extern int chip_fru_smbios_get(topo_mod_t *, id_t);
220074bb90dSTom Pothier extern const char *chip_label_smbios_get(topo_mod_t *, tnode_t *, id_t, char *);
221074bb90dSTom Pothier extern const char *chip_serial_smbios_get(topo_mod_t *, id_t);
222074bb90dSTom Pothier extern const char *chip_part_smbios_get(topo_mod_t *, id_t);
223074bb90dSTom Pothier extern const char *chip_rev_smbios_get(topo_mod_t *, id_t);
224efd31e1dSTrang Do extern id_t memnode_to_smbiosid(topo_mod_t *, uint16_t, const char *,
225efd31e1dSTrang Do     uint64_t, void *);
226074bb90dSTom Pothier 
227f2dbfd32SRobert Mustacchi /*
228f2dbfd32SRobert Mustacchi  * Prototypes for chip_temp.c
229f2dbfd32SRobert Mustacchi  */
230f2dbfd32SRobert Mustacchi extern int chip_create_chip_temp_sensor(topo_mod_t *, tnode_t *);
231f2dbfd32SRobert Mustacchi extern int chip_create_core_temp_sensor(topo_mod_t *, tnode_t *);
232074bb90dSTom Pothier 
2337aec1d6eScindi #ifdef __cplusplus
2347aec1d6eScindi }
2357aec1d6eScindi #endif
2367aec1d6eScindi 
2377aec1d6eScindi #endif /* _CHIP_H */
238