xref: /onnv-gate/usr/src/lib/fm/topo/modules/i86pc/chip/chip.h (revision 12832:f4172e28e09f)
11414Scindi /*
21414Scindi  * CDDL HEADER START
31414Scindi  *
41414Scindi  * The contents of this file are subject to the terms of the
52869Sgavinm  * Common Development and Distribution License (the "License").
62869Sgavinm  * You may not use this file except in compliance with the License.
71414Scindi  *
81414Scindi  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
91414Scindi  * or http://www.opensolaris.org/os/licensing.
101414Scindi  * See the License for the specific language governing permissions
111414Scindi  * and limitations under the License.
121414Scindi  *
131414Scindi  * When distributing Covered Code, include this CDDL HEADER in each
141414Scindi  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
151414Scindi  * If applicable, add the following below this CDDL HEADER, with the
161414Scindi  * fields enclosed by brackets "[]" replaced with your own identifying
171414Scindi  * information: Portions Copyright [yyyy] [name of copyright owner]
181414Scindi  *
191414Scindi  * CDDL HEADER END
201414Scindi  */
211414Scindi /*
22*12832STrang.Do@Sun.COM  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
231414Scindi  */
241414Scindi 
251414Scindi #ifndef _CHIP_H
261414Scindi #define	_CHIP_H
271414Scindi 
281414Scindi #include <kstat.h>
291414Scindi #include <libnvpair.h>
301414Scindi #include <fm/libtopo.h>
315254Sgavinm #include <fm/topo_mod.h>
321414Scindi 
331414Scindi #ifdef __cplusplus
341414Scindi extern "C" {
351414Scindi #endif
361414Scindi 
371414Scindi #define	CHIP_VERSION		TOPO_VERSION
381414Scindi 
3910942STom.Pothier@Sun.COM /* Below should match the definitions in x86pi_impl.h */
4010942STom.Pothier@Sun.COM #define	X86PI_FULL		1
4110942STom.Pothier@Sun.COM #define	X86PI_NONE		2
4210942STom.Pothier@Sun.COM 
4310942STom.Pothier@Sun.COM /*
4410942STom.Pothier@Sun.COM  * FM_AWARE_SMBIOS means SMBIOS meets FMA needs
4510942STom.Pothier@Sun.COM  * X86PI_FULL is defined as 1 in x86pi.so
4610942STom.Pothier@Sun.COM  * And passed from x86pi.so to chip.so as module
4710942STom.Pothier@Sun.COM  * private data
4810942STom.Pothier@Sun.COM  */
4910942STom.Pothier@Sun.COM #define	FM_AWARE_SMBIOS(mod)	\
5010942STom.Pothier@Sun.COM 	(topo_mod_getspecific(mod) != NULL && \
5110942STom.Pothier@Sun.COM 	    (*(int *)topo_mod_getspecific(mod) == X86PI_FULL))
5210942STom.Pothier@Sun.COM #define	IGNORE_ID	0xFFFF
5310942STom.Pothier@Sun.COM 
5410947SSrihari.Venkatesan@Sun.COM /*
5510947SSrihari.Venkatesan@Sun.COM  * These definitions are for the Tree Nodes
5610947SSrihari.Venkatesan@Sun.COM  * in the FM Topology
5710947SSrihari.Venkatesan@Sun.COM  */
587532SSean.Ye@Sun.COM #define	CHIP_NODE_NAME		"chip"
597532SSean.Ye@Sun.COM #define	CORE_NODE_NAME		"core"
607532SSean.Ye@Sun.COM #define	STRAND_NODE_NAME	"strand"
617532SSean.Ye@Sun.COM #define	MCT_NODE_NAME		"memory-controller"
627532SSean.Ye@Sun.COM #define	CHAN_NODE_NAME		"dram-channel"
637532SSean.Ye@Sun.COM #define	CS_NODE_NAME		"chip-select"
647532SSean.Ye@Sun.COM #define	DIMM_NODE_NAME		"dimm"
657532SSean.Ye@Sun.COM #define	RANK_NODE_NAME		"rank"
661414Scindi 
673323Scindi #define	PGNAME(prefix)	(prefix##_NODE_NAME "-properties")
681414Scindi 
691414Scindi /*
703323Scindi  * chip-properties
711414Scindi  */
727532SSean.Ye@Sun.COM #define	CHIP_VENDOR_ID		"vendor_id"
737532SSean.Ye@Sun.COM #define	CHIP_FAMILY		"family"
747532SSean.Ye@Sun.COM #define	CHIP_MODEL		"model"
757532SSean.Ye@Sun.COM #define	CHIP_STEPPING		"stepping"
767532SSean.Ye@Sun.COM #define	CHIP_NCORE		"ncore_per_chip"
771414Scindi 
783323Scindi /*
7910947SSrihari.Venkatesan@Sun.COM  * memory-controller-properties
8010947SSrihari.Venkatesan@Sun.COM  * check usr/src/uts/i86pc/os/cpuid.c to understand more
8110947SSrihari.Venkatesan@Sun.COM  * on procnodeid values for AMD & Intel
8210947SSrihari.Venkatesan@Sun.COM  */
8310947SSrihari.Venkatesan@Sun.COM #define	MCT_PROCNODE_ID		"procnodeid"
8410947SSrihari.Venkatesan@Sun.COM 
8510947SSrihari.Venkatesan@Sun.COM /*
867532SSean.Ye@Sun.COM  * core-properties
873323Scindi  */
887532SSean.Ye@Sun.COM #define	CORE_CHIP_ID		"chip_id"
8910947SSrihari.Venkatesan@Sun.COM #define	CORE_PROCNODE_ID	"procnodeid"
907532SSean.Ye@Sun.COM 
917532SSean.Ye@Sun.COM /*
927532SSean.Ye@Sun.COM  * strand-properties
937532SSean.Ye@Sun.COM  */
947532SSean.Ye@Sun.COM #define	STRAND_CHIP_ID		"chip_id"
9510947SSrihari.Venkatesan@Sun.COM #define	STRAND_PROCNODE_ID	"procnodeid"
967532SSean.Ye@Sun.COM #define	STRAND_CORE_ID		"core_id"
977532SSean.Ye@Sun.COM #define	STRAND_PKG_CORE_ID	"pkg_core_id"
987532SSean.Ye@Sun.COM #define	STRAND_CPU_ID		"cpuid"
993323Scindi 
1005068Srobj /*
1015068Srobj  * label property methods
1025068Srobj  */
1035068Srobj #define	SIMPLE_DIMM_LBL		"simple_dimm_label"
1045068Srobj #define	SIMPLE_DIMM_LBL_MP	"simple_dimm_label_mp"
1055068Srobj #define	SEQ_DIMM_LBL		"seq_dimm_label"
1066292Srobj #define	G4_DIMM_LBL		"g4_dimm_label"
1076360Srobj #define	G12F_DIMM_LBL		"g12f_dimm_label"
1085068Srobj #define	SIMPLE_CHIP_LBL		"simple_chip_label"
1095068Srobj #define	G4_CHIP_LBL		"g4_chip_label"
1106292Srobj #define	A4FPLUS_CHIP_LBL	"a4fplus_chip_label"
1115590Srobj #define	SIMPLE_CS_LBL_MP	"simple_cs_label_mp"
1128055SAdrian.Frost@Sun.COM #define	FSB2_CHIP_LBL		"fsb2_chip_label"
1135068Srobj 
1146292Srobj /*
1156292Srobj  * DIMM serial number property methods
1166292Srobj  */
1176292Srobj #define	GET_DIMM_SERIAL		"get_dimm_serial"
1186292Srobj 
1195068Srobj extern int simple_dimm_label(topo_mod_t *, tnode_t *, topo_version_t,
1205068Srobj     nvlist_t *, nvlist_t **);
1215068Srobj extern int simple_dimm_label_mp(topo_mod_t *, tnode_t *, topo_version_t,
1225068Srobj     nvlist_t *, nvlist_t **);
1235068Srobj extern int seq_dimm_label(topo_mod_t *, tnode_t *, topo_version_t,
1245068Srobj     nvlist_t *, nvlist_t **);
1256292Srobj extern int g4_dimm_label(topo_mod_t *, tnode_t *, topo_version_t, nvlist_t *,
1266292Srobj     nvlist_t **);
1276292Srobj 
1286360Srobj extern int g12f_dimm_label(topo_mod_t *, tnode_t *, topo_version_t, nvlist_t *,
1296360Srobj     nvlist_t **);
1306360Srobj 
1315068Srobj extern int simple_chip_label(topo_mod_t *, tnode_t *, topo_version_t,
1325068Srobj     nvlist_t *, nvlist_t **);
1335068Srobj extern int g4_chip_label(topo_mod_t *, tnode_t *, topo_version_t,
1345068Srobj     nvlist_t *, nvlist_t **);
1356292Srobj extern int a4fplus_chip_label(topo_mod_t *, tnode_t *, topo_version_t,
1366292Srobj     nvlist_t *, nvlist_t **);
1375590Srobj extern int simple_cs_label_mp(topo_mod_t *, tnode_t *, topo_version_t,
1385590Srobj     nvlist_t *, nvlist_t **);
1396292Srobj extern int get_dimm_serial(topo_mod_t *, tnode_t *, topo_version_t, nvlist_t *,
1406292Srobj     nvlist_t **);
1418055SAdrian.Frost@Sun.COM extern int fsb2_chip_label(topo_mod_t *, tnode_t *, topo_version_t,
1428055SAdrian.Frost@Sun.COM     nvlist_t *, nvlist_t **);
1436292Srobj 
1445254Sgavinm /*
1455254Sgavinm  * Support functions of chip_subr.c
1465254Sgavinm  */
1475254Sgavinm extern void whinge(topo_mod_t *, int *, const char *, ...);
1485254Sgavinm extern int nvprop_add(topo_mod_t *, nvpair_t *, const char *, tnode_t *);
1497532SSean.Ye@Sun.COM extern int add_nvlist_strprop(topo_mod_t *, tnode_t *, nvlist_t *,
1505254Sgavinm     const char *, const char *, const char **);
1517532SSean.Ye@Sun.COM extern int add_nvlist_longprop(topo_mod_t *, tnode_t *, nvlist_t *,
1525254Sgavinm     const char *, const char *, int32_t *);
1537532SSean.Ye@Sun.COM extern int add_nvlist_longprops(topo_mod_t *, tnode_t *, nvlist_t *,
1545254Sgavinm     const char *, int32_t *, ...);
1555254Sgavinm extern int mkrsrc(topo_mod_t *, tnode_t *, const char *, int,
1565254Sgavinm     nvlist_t *, nvlist_t **);
1575254Sgavinm extern nvlist_t *cpu_fmri_create(topo_mod_t *, uint32_t, char *, uint8_t);
1587532SSean.Ye@Sun.COM extern boolean_t is_xpv();
1597532SSean.Ye@Sun.COM 
1607532SSean.Ye@Sun.COM /*
1617532SSean.Ye@Sun.COM  * topo methods
1627532SSean.Ye@Sun.COM  */
1635254Sgavinm extern int mem_asru_compute(topo_mod_t *, tnode_t *, topo_version_t,
1645254Sgavinm     nvlist_t *, nvlist_t **);
1656292Srobj extern int rank_fmri_present(topo_mod_t *, tnode_t *, topo_version_t,
1666292Srobj     nvlist_t *, nvlist_t **);
1677275Sstephh extern int rank_fmri_replaced(topo_mod_t *, tnode_t *, topo_version_t,
1687275Sstephh     nvlist_t *, nvlist_t **);
1697532SSean.Ye@Sun.COM extern int retire_strands(topo_mod_t *, tnode_t *, topo_version_t,
1707532SSean.Ye@Sun.COM     nvlist_t *, nvlist_t **);
1717532SSean.Ye@Sun.COM extern int unretire_strands(topo_mod_t *, tnode_t *, topo_version_t,
1727532SSean.Ye@Sun.COM     nvlist_t *, nvlist_t **);
1737532SSean.Ye@Sun.COM extern int service_state_strands(topo_mod_t *, tnode_t *, topo_version_t,
1747532SSean.Ye@Sun.COM     nvlist_t *, nvlist_t **);
1757532SSean.Ye@Sun.COM extern int unusable_strands(topo_mod_t *, tnode_t *, topo_version_t,
1767532SSean.Ye@Sun.COM     nvlist_t *, nvlist_t **);
1777532SSean.Ye@Sun.COM extern int ntv_page_retire(topo_mod_t *, tnode_t *, topo_version_t,
1787532SSean.Ye@Sun.COM     nvlist_t *, nvlist_t **);
1797532SSean.Ye@Sun.COM extern int ntv_page_service_state(topo_mod_t *, tnode_t *, topo_version_t,
1807532SSean.Ye@Sun.COM     nvlist_t *, nvlist_t **);
1817532SSean.Ye@Sun.COM extern int ntv_page_unretire(topo_mod_t *, tnode_t *, topo_version_t,
1827532SSean.Ye@Sun.COM     nvlist_t *, nvlist_t **);
1837532SSean.Ye@Sun.COM extern int ntv_page_unusable(topo_mod_t *, tnode_t *, topo_version_t,
1847532SSean.Ye@Sun.COM     nvlist_t *, nvlist_t **);
1857532SSean.Ye@Sun.COM 
1865254Sgavinm extern int mem_asru_create(topo_mod_t *, nvlist_t *, nvlist_t **);
1875254Sgavinm 
1885254Sgavinm /*
1895254Sgavinm  * Prototypes for chip_amd.c
1905254Sgavinm  */
19110947SSrihari.Venkatesan@Sun.COM extern void amd_mc_create(topo_mod_t *, uint16_t, tnode_t *, const char *,
19210947SSrihari.Venkatesan@Sun.COM     nvlist_t *, int32_t, int32_t, int, int, int *);
1935254Sgavinm 
1945254Sgavinm /*
1955254Sgavinm  * Prototypes for chip_intel.c
1965254Sgavinm  */
1975254Sgavinm extern int mc_offchip_open(void);
1985254Sgavinm extern int mc_offchip_create(topo_mod_t *, tnode_t *, const char *, nvlist_t *);
19910942STom.Pothier@Sun.COM extern void onchip_mc_create(topo_mod_t *, uint16_t, tnode_t *,
20010942STom.Pothier@Sun.COM     const char *, nvlist_t *);
2015254Sgavinm 
2026292Srobj extern char *get_fmtstr(topo_mod_t *, nvlist_t *);
2036292Srobj extern int store_prop_val(topo_mod_t *, char *, char *, nvlist_t **out);
2046292Srobj 
20510942STom.Pothier@Sun.COM /*
20610942STom.Pothier@Sun.COM  * Prototypes for chip_smbios.c
20710942STom.Pothier@Sun.COM  */
20810942STom.Pothier@Sun.COM 
20910942STom.Pothier@Sun.COM extern int init_chip_smbios(topo_mod_t *);
21010942STom.Pothier@Sun.COM extern int chip_status_smbios_get(topo_mod_t *, id_t);
21110942STom.Pothier@Sun.COM extern int chip_fru_smbios_get(topo_mod_t *, id_t);
21210942STom.Pothier@Sun.COM extern const char *chip_label_smbios_get(topo_mod_t *, tnode_t *, id_t, char *);
21310942STom.Pothier@Sun.COM extern const char *chip_serial_smbios_get(topo_mod_t *, id_t);
21410942STom.Pothier@Sun.COM extern const char *chip_part_smbios_get(topo_mod_t *, id_t);
21510942STom.Pothier@Sun.COM extern const char *chip_rev_smbios_get(topo_mod_t *, id_t);
216*12832STrang.Do@Sun.COM extern id_t memnode_to_smbiosid(topo_mod_t *, uint16_t, const char *,
217*12832STrang.Do@Sun.COM     uint64_t, void *);
21810942STom.Pothier@Sun.COM 
21910942STom.Pothier@Sun.COM 
2201414Scindi #ifdef __cplusplus
2211414Scindi }
2221414Scindi #endif
2231414Scindi 
2241414Scindi #endif /* _CHIP_H */
225