xref: /titanic_41/usr/src/cmd/fm/modules/sun4u/cpumem-diagnosis/cmd_opl.h (revision 78ed97a7b79b59ef2ef41f190c9be35c54d90119)
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 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _CMD_OPL_H
28 #define	_CMD_OPL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <cmd.h>
33 #include <cmd_cpu.h>
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 typedef struct opl_cpu {
40 	cmd_list_t oc_list;
41 	cmd_cpu_t *oc_cmd_cpu;
42 	uint32_t oc_cpuid;
43 } opl_cpu_t;
44 
45 extern cmd_evdisp_t cmd_oplinv_urg(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
46     const char *, cmd_errcl_t);
47 extern cmd_evdisp_t cmd_oplcre(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
48     const char *, cmd_errcl_t);
49 extern cmd_evdisp_t cmd_opltsb_ctx(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
50     const char *, cmd_errcl_t);
51 extern cmd_evdisp_t cmd_opltsbp(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
52     const char *, cmd_errcl_t);
53 extern cmd_evdisp_t cmd_oplpstate(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
54     const char *, cmd_errcl_t);
55 extern cmd_evdisp_t cmd_opltstate(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
56     const char *, cmd_errcl_t);
57 extern cmd_evdisp_t cmd_opliug_f(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
58     const char *, cmd_errcl_t);
59 extern cmd_evdisp_t cmd_opliug_r(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
60     const char *, cmd_errcl_t);
61 extern cmd_evdisp_t cmd_oplsdc(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
62     const char *, cmd_errcl_t);
63 extern cmd_evdisp_t cmd_oplwdt(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
64     const char *, cmd_errcl_t);
65 extern cmd_evdisp_t cmd_opldtlb(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
66     const char *, cmd_errcl_t);
67 extern cmd_evdisp_t cmd_oplitlb(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
68     const char *, cmd_errcl_t);
69 extern cmd_evdisp_t cmd_oplcore_err(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
70     const char *, cmd_errcl_t);
71 extern cmd_evdisp_t cmd_opldae(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
72     const char *, cmd_errcl_t);
73 extern cmd_evdisp_t cmd_opliae(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
74     const char *, cmd_errcl_t);
75 extern cmd_evdisp_t cmd_opluge(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
76     const char *, cmd_errcl_t);
77 extern cmd_evdisp_t cmd_oplmtlb(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
78     const char *, cmd_errcl_t);
79 extern cmd_evdisp_t cmd_opltlbp(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
80     const char *, cmd_errcl_t);
81 extern cmd_evdisp_t cmd_oplinv_sfsr(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
82     const char *, cmd_errcl_t);
83 extern cmd_evdisp_t cmd_opluecpu_detcpu(fmd_hdl_t *, fmd_event_t *,
84     nvlist_t *, const char *, cmd_errcl_t);
85 extern cmd_evdisp_t cmd_opluecpu_detio(fmd_hdl_t *, fmd_event_t *,
86     nvlist_t *, const char *, cmd_errcl_t);
87 
88 extern cmd_evdisp_t cmd_opl_mac_common(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
89     const char *, cmd_errcl_t);
90 extern cmd_evdisp_t cmd_opl_cpu_mem(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
91     const char *, cmd_errcl_t);
92 extern cmd_evdisp_t cmd_opl_io_mem(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
93     const char *, cmd_errcl_t);
94 
95 extern nvlist_t *opl_cpursrc_create(fmd_hdl_t *, uint32_t);
96 extern char *cmd_cpu_getfrustr_by_id(fmd_hdl_t *, uint32_t);
97 extern cmd_list_t *opl_cpulist_insert(fmd_hdl_t *, uint32_t, int);
98 extern void opl_cpulist_free(fmd_hdl_t *, cmd_list_t *);
99 extern uint8_t opl_avg(uint_t, uint_t);
100 
101 extern cmd_evdisp_t cmd_opl_ue_cpu(fmd_hdl_t *, fmd_event_t *,
102     const char *, const char *, cmd_ptrsubtype_t, cmd_cpu_t *, cmd_case_t *,
103     uint8_t);
104 
105 extern cmd_list_t *opl_cpulist_insert(fmd_hdl_t *, uint32_t, int);
106 extern int cmd_fmri_hc_set(fmd_hdl_t *, nvlist_t *, int, const nvlist_t *,
107     nvlist_t *, int, ...);
108 extern nvlist_t *opl_mem_fru_create(fmd_hdl_t *, nvlist_t *);
109 
110 extern cmd_list_t opl_cpu_list;
111 
112 #define	OPL_CHASSIS_DEFAULT	"0"
113 #define	OPL_CPU_FRU_FMRI_DC	FM_FMRI_SCHEME_HC":///" \
114     FM_FMRI_LEGACY_HC"=/CMU"
115 #define	OPL_CPU_FRU_FMRI_FF1	FM_FMRI_SCHEME_HC":///" \
116     FM_FMRI_LEGACY_HC"=/MBU_A/CPUM"
117 #define	OPL_CPU_FRU_FMRI_FF2	FM_FMRI_SCHEME_HC":///" \
118     FM_FMRI_LEGACY_HC"=/MBU_B/CPUM"
119 #define	OPL_CPU_FRU_FMRI_IKKAKU	FM_FMRI_SCHEME_HC":///" \
120     FM_FMRI_LEGACY_HC"=/MBU_A"
121 #define	STR_BUFLEN		32
122 #define	NPAIRS			5
123 
124 /*
125  * Mask for getting the fault address
126  * from  MARKEDID in UBC Memory UE
127  * Log Register (Oberon)
128  */
129 #define	UBC_UE_ADR_MASK		0x00007FFFFFFFFFFFULL
130 
131 /*
132  * To indicate if the CPU/IO handler is to be used.
133  */
134 #define	CMD_OPL_HDLR_CPU	1
135 #define	CMD_OPL_HDLR_IO		2
136 
137 /*
138  * Macors for dealing with "core", "chip"
139  * or "strand" related operations.
140  */
141 #define	IS_STRAND		0
142 #define	IS_CORE			1
143 #define	IS_CHIP			2
144 #define	STRAND_UPPER_BOUND	1
145 #define	CORE_UPPER_BOUND	3
146 
147 #define	COREID_SHIFT		1
148 #define	CHIPID_SHIFT		3
149 #define	STRAND_MASK		1
150 #define	CHIP_OR_CORE_MASK	3
151 
152 /*
153  * This is to reference the Oberon
154  * UBC memory UE log register payload.
155  */
156 #define	OBERON_UBC_MUE		"ubc-mue"
157 
158 #ifdef __cplusplus
159 }
160 #endif
161 
162 #endif /* _CMD_OPL_H */
163