xref: /onnv-gate/usr/src/uts/sun4u/montecarlo/sys/mct_topology.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright (c) 1999, 2000 by Sun Microsystems, Inc.
24*0Sstevel@tonic-gate  * All rights reserved.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef	_MONTECARLO_SYS_MCT_TOPOLOGY_H
28*0Sstevel@tonic-gate #define	_MONTECARLO_SYS_MCT_TOPOLOGY_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #ifdef	__cplusplus
33*0Sstevel@tonic-gate extern "C" {
34*0Sstevel@tonic-gate #endif
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate /*
37*0Sstevel@tonic-gate  * mct_topology.h
38*0Sstevel@tonic-gate  * MonteCarlo / Tonga topology structures and types for the scsb driver
39*0Sstevel@tonic-gate  * and its kstat structure "env_topology", to be available to applications
40*0Sstevel@tonic-gate  * like envmond and snmp agents.
41*0Sstevel@tonic-gate  */
42*0Sstevel@tonic-gate /*
43*0Sstevel@tonic-gate  * SCB information also defined in scsb.h, which file is not available to
44*0Sstevel@tonic-gate  * applications.
45*0Sstevel@tonic-gate  */
46*0Sstevel@tonic-gate #define	SCB_P10_NOK_LED_REGS	4
47*0Sstevel@tonic-gate #define	SCB_P10_OK_LED_REGS	4
48*0Sstevel@tonic-gate #define	SCB_P10_BLINK_LED_REGS	2
49*0Sstevel@tonic-gate #define	SCB_P10_LED_REGS	10
50*0Sstevel@tonic-gate #define	SCB_P15_NOK_LED_REGS	3
51*0Sstevel@tonic-gate #define	SCB_P15_OK_LED_REGS	3
52*0Sstevel@tonic-gate #define	SCB_P15_BLINK_LED_REGS	3
53*0Sstevel@tonic-gate #define	SCB_P15_LED_REGS	9
54*0Sstevel@tonic-gate 
55*0Sstevel@tonic-gate /* Save this existing definition, but use it as the MAX */
56*0Sstevel@tonic-gate #define	SCSB_LEDDATA_REGISTERS	SCB_P10_LED_REGS
57*0Sstevel@tonic-gate 
58*0Sstevel@tonic-gate #define	MC_MAX_SLOTS		8	/* CPU, ALRM, cPCI Slots */
59*0Sstevel@tonic-gate #define	MC_MAX_FAN		2
60*0Sstevel@tonic-gate #define	MC_MAX_PDU		2
61*0Sstevel@tonic-gate #define	MC_MAX_PS		2
62*0Sstevel@tonic-gate #define	MC_MAX_DISK		3
63*0Sstevel@tonic-gate #define	MC_MAX_SCB		1
64*0Sstevel@tonic-gate #define	MC_MAX_AC		1
65*0Sstevel@tonic-gate #define	MC_MAX_CFTM		1
66*0Sstevel@tonic-gate #define	MC_MAX_CRTM		1
67*0Sstevel@tonic-gate #define	MC_MAX_PRTM		1
68*0Sstevel@tonic-gate 
69*0Sstevel@tonic-gate #define	TG_MAX_SLOTS		5	/* CPU, ALRM, cPCI Slots */
70*0Sstevel@tonic-gate #define	TG_MAX_FAN		2
71*0Sstevel@tonic-gate #define	TG_MAX_PS		1
72*0Sstevel@tonic-gate #define	TG_MAX_PDU		1
73*0Sstevel@tonic-gate #define	TG_MAX_DISK		1
74*0Sstevel@tonic-gate #define	TG_MAX_SCB		1
75*0Sstevel@tonic-gate #define	TG_MAX_AC		1
76*0Sstevel@tonic-gate #define	TG_MAX_CFTM		1
77*0Sstevel@tonic-gate #define	TG_MAX_CRTM		1
78*0Sstevel@tonic-gate #define	TG_MAX_PRTM		1
79*0Sstevel@tonic-gate 
80*0Sstevel@tonic-gate /*
81*0Sstevel@tonic-gate  * Maximum number of FRUs in MCT systems,
82*0Sstevel@tonic-gate  * used for sizeof fru_id_table[] and index check
83*0Sstevel@tonic-gate  */
84*0Sstevel@tonic-gate #define	MCT_MAX_FRUS		32
85*0Sstevel@tonic-gate 
86*0Sstevel@tonic-gate /*
87*0Sstevel@tonic-gate  * The I2C addresses of System I2C devices
88*0Sstevel@tonic-gate  * from "MonteCarlo: Programming Interface Specifications" Version 0.9
89*0Sstevel@tonic-gate  */
90*0Sstevel@tonic-gate #define	MCT_I2C_CPUPWR		0x72
91*0Sstevel@tonic-gate #define	MCT_I2C_FAN1		0x74
92*0Sstevel@tonic-gate #define	MCT_I2C_FAN2		0x76
93*0Sstevel@tonic-gate #define	MCT_I2C_FAN3		0x78
94*0Sstevel@tonic-gate #define	MCT_I2C_PS1		0x7c
95*0Sstevel@tonic-gate #define	MCT_I2C_PS2		0x7e
96*0Sstevel@tonic-gate #define	MCT_I2C_SCB		0x80
97*0Sstevel@tonic-gate #define	MCT_I2C_CPUTEMP		0x9e
98*0Sstevel@tonic-gate 
99*0Sstevel@tonic-gate /*
100*0Sstevel@tonic-gate  * CFG1_MPID masks
101*0Sstevel@tonic-gate  */
102*0Sstevel@tonic-gate #define	SCTRL_MPID_MASK			0xf
103*0Sstevel@tonic-gate #define	SCTRL_MPID_HALF			0x0
104*0Sstevel@tonic-gate #define	SCTRL_MPID_QUARTER		0x1
105*0Sstevel@tonic-gate #define	SCTRL_MPID_QUARTER_NODSK	0x3
106*0Sstevel@tonic-gate 
107*0Sstevel@tonic-gate /*
108*0Sstevel@tonic-gate  * Interrupt Event Codes
109*0Sstevel@tonic-gate  * Also used by "scsb" to locate fruid_table index,
110*0Sstevel@tonic-gate  * so the order is very important.
111*0Sstevel@tonic-gate  */
112*0Sstevel@tonic-gate #define	SCTRL_EVENT_NONE		0x0000
113*0Sstevel@tonic-gate #define	SCTRL_EVENT_SLOT1		0x00000001
114*0Sstevel@tonic-gate #define	SCTRL_EVENT_SLOT2		0x00000002
115*0Sstevel@tonic-gate #define	SCTRL_EVENT_SLOT3		0x00000004
116*0Sstevel@tonic-gate #define	SCTRL_EVENT_SLOT4		0x00000008
117*0Sstevel@tonic-gate #define	SCTRL_EVENT_SLOT5		0x00000010
118*0Sstevel@tonic-gate #define	SCTRL_EVENT_SLOT6		0x00000020
119*0Sstevel@tonic-gate #define	SCTRL_EVENT_SLOT7		0x00000040
120*0Sstevel@tonic-gate #define	SCTRL_EVENT_SLOT8		0x00000080
121*0Sstevel@tonic-gate #define	SCTRL_EVENT_SLOT9		0x00000100
122*0Sstevel@tonic-gate #define	SCTRL_EVENT_SLOT10		0x00000200
123*0Sstevel@tonic-gate #define	SCTRL_EVENT_PDU1		0x00000400
124*0Sstevel@tonic-gate #define	SCTRL_EVENT_PDU2		0x00000800
125*0Sstevel@tonic-gate #define	SCTRL_EVENT_PS1			0x00001000
126*0Sstevel@tonic-gate #define	SCTRL_EVENT_PS2			0x00002000
127*0Sstevel@tonic-gate #define	SCTRL_EVENT_DISK1		0x00004000
128*0Sstevel@tonic-gate #define	SCTRL_EVENT_DISK2		0x00008000
129*0Sstevel@tonic-gate #define	SCTRL_EVENT_DISK3		0x00010000
130*0Sstevel@tonic-gate #define	SCTRL_EVENT_FAN1		0x00020000
131*0Sstevel@tonic-gate #define	SCTRL_EVENT_FAN2		0x00040000
132*0Sstevel@tonic-gate #define	SCTRL_EVENT_FAN3		0x00080000
133*0Sstevel@tonic-gate #define	SCTRL_EVENT_ALARM		0x00100000
134*0Sstevel@tonic-gate #define	SCTRL_EVENT_SCB			0x00200000
135*0Sstevel@tonic-gate #define	SCTRL_EVENT_SSB			0x00400000
136*0Sstevel@tonic-gate #define	SCTRL_EVENT_CRTM		0x00800000
137*0Sstevel@tonic-gate #define	SCTRL_EVENT_CFTM		0x01000000
138*0Sstevel@tonic-gate #define	SCTRL_EVENT_PRTM		0x02000000
139*0Sstevel@tonic-gate #define	SCTRL_EVENT_PWRDWN		0x04000000
140*0Sstevel@tonic-gate #define	SCTRL_EVENT_REPLACE		0x08000000
141*0Sstevel@tonic-gate #define	SCTRL_EVENT_ALARM_INT		0x10000000
142*0Sstevel@tonic-gate #define	SCTRL_EVENT_ALARM_INSERTION	0x20000000
143*0Sstevel@tonic-gate #define	SCTRL_EVENT_ALARM_REMOVAL	0x40000000
144*0Sstevel@tonic-gate #define	SCTRL_EVENT_OTHER		0x80000000
145*0Sstevel@tonic-gate 
146*0Sstevel@tonic-gate 
147*0Sstevel@tonic-gate 
148*0Sstevel@tonic-gate typedef	uchar_t		topo_id_t;
149*0Sstevel@tonic-gate typedef	uchar_t		fru_id_t;
150*0Sstevel@tonic-gate typedef	uint16_t	fru_version_t;
151*0Sstevel@tonic-gate typedef	uint16_t	fru_max_t;
152*0Sstevel@tonic-gate typedef	uint16_t	scsb_unum_t;
153*0Sstevel@tonic-gate 
154*0Sstevel@tonic-gate typedef	enum {
155*0Sstevel@tonic-gate 	MCT_HEALTH_NA	= 0,
156*0Sstevel@tonic-gate 	MCT_HEALTH_OK	= 1,
157*0Sstevel@tonic-gate 	MCT_HEALTH_NOK	= 2
158*0Sstevel@tonic-gate } fru_health_t;
159*0Sstevel@tonic-gate 
160*0Sstevel@tonic-gate /*
161*0Sstevel@tonic-gate  * Known MC/Tg Slot occupants, and UNKN for unknown
162*0Sstevel@tonic-gate  * NOTE: the CTC occupant is the CFTM FRU type on MonteCarlo
163*0Sstevel@tonic-gate  */
164*0Sstevel@tonic-gate typedef enum {
165*0Sstevel@tonic-gate 	OC_UNKN	= 0,
166*0Sstevel@tonic-gate 	OC_CPU	= 1,
167*0Sstevel@tonic-gate 	OC_AC	= 2,
168*0Sstevel@tonic-gate 	OC_BHS	= 3,
169*0Sstevel@tonic-gate 	OC_FHS	= 4,
170*0Sstevel@tonic-gate 	OC_HAHS	= 5,
171*0Sstevel@tonic-gate 	OC_QFE	= 6,
172*0Sstevel@tonic-gate 	OC_FRCH	= 7,
173*0Sstevel@tonic-gate 	OC_COMBO = 8,
174*0Sstevel@tonic-gate 	OC_PMC	= 9,
175*0Sstevel@tonic-gate 	OC_ATM	= 10,
176*0Sstevel@tonic-gate 	OC_CTC	= 11
177*0Sstevel@tonic-gate } mct_slot_occupant_t;
178*0Sstevel@tonic-gate 
179*0Sstevel@tonic-gate typedef enum {
180*0Sstevel@tonic-gate 	SLOT	= 0,
181*0Sstevel@tonic-gate 	PDU	= 1,
182*0Sstevel@tonic-gate 	PS	= 2,
183*0Sstevel@tonic-gate 	DISK	= 3,
184*0Sstevel@tonic-gate 	FAN	= 4,
185*0Sstevel@tonic-gate 	ALARM	= 5,
186*0Sstevel@tonic-gate 	SCB	= 6,
187*0Sstevel@tonic-gate 	SSB	= 7,
188*0Sstevel@tonic-gate 	CFTM	= 8,
189*0Sstevel@tonic-gate 	CRTM	= 9,
190*0Sstevel@tonic-gate 	PRTM	= 10,
191*0Sstevel@tonic-gate 	MIDPLANE = 11
192*0Sstevel@tonic-gate } scsb_utype_t;
193*0Sstevel@tonic-gate 
194*0Sstevel@tonic-gate #define	SCSB_UNIT_TYPES		11	/* w/o MIDPLANE	*/
195*0Sstevel@tonic-gate 
196*0Sstevel@tonic-gate typedef enum scsb_fru_status {
197*0Sstevel@tonic-gate 	FRU_NOT_PRESENT,
198*0Sstevel@tonic-gate 	FRU_PRESENT,
199*0Sstevel@tonic-gate 	FRU_NOT_AVAILABLE
200*0Sstevel@tonic-gate } scsb_fru_status_t;
201*0Sstevel@tonic-gate 
202*0Sstevel@tonic-gate typedef enum {
203*0Sstevel@tonic-gate 	SWAP_NOT, SWAP_BASIC, SWAP_FULL, SWAP_HA
204*0Sstevel@tonic-gate } cpci_swap_type_t;
205*0Sstevel@tonic-gate 
206*0Sstevel@tonic-gate typedef struct fru_options {
207*0Sstevel@tonic-gate 	char			*board_name;
208*0Sstevel@tonic-gate 	cpci_swap_type_t	swap_type;
209*0Sstevel@tonic-gate 	struct fru_options	*next;
210*0Sstevel@tonic-gate } fru_options_t;
211*0Sstevel@tonic-gate 
212*0Sstevel@tonic-gate typedef struct fru_i2c_info {
213*0Sstevel@tonic-gate 	uchar_t		syscfg_reg;
214*0Sstevel@tonic-gate 	uchar_t		syscfg_bit;
215*0Sstevel@tonic-gate 	uchar_t		ledata_reg;
216*0Sstevel@tonic-gate 	uchar_t		ledata_bit;
217*0Sstevel@tonic-gate 	uchar_t		blink_reg;
218*0Sstevel@tonic-gate 	uchar_t		blink_bit;
219*0Sstevel@tonic-gate } fru_i2c_info_t;
220*0Sstevel@tonic-gate 
221*0Sstevel@tonic-gate typedef struct fru_info {
222*0Sstevel@tonic-gate 	scsb_fru_status_t fru_status;	/* FRU present status		*/
223*0Sstevel@tonic-gate 	scsb_unum_t	fru_unit;	/* FRU external unit number	*/
224*0Sstevel@tonic-gate 	scsb_utype_t	fru_type;	/* also an index to FRU lists	*/
225*0Sstevel@tonic-gate 	fru_id_t	fru_id;		/* I2C address, SCSIID, Slot Num */
226*0Sstevel@tonic-gate 	fru_version_t	fru_version;	/* version number where possible */
227*0Sstevel@tonic-gate 	fru_options_t	*type_list;	/* list of possible boards for slots */
228*0Sstevel@tonic-gate 	fru_i2c_info_t	*i2c_info;	/* for I2C devices		*/
229*0Sstevel@tonic-gate 	struct fru_info	*next;
230*0Sstevel@tonic-gate } fru_info_t;
231*0Sstevel@tonic-gate 
232*0Sstevel@tonic-gate struct system_info {
233*0Sstevel@tonic-gate 	fru_info_t	mid_plane;	/* one always present		*/
234*0Sstevel@tonic-gate 	fru_max_t	max_units[SCSB_UNIT_TYPES];
235*0Sstevel@tonic-gate 	fru_info_t	*fru_info_list[SCSB_UNIT_TYPES];
236*0Sstevel@tonic-gate };
237*0Sstevel@tonic-gate 
238*0Sstevel@tonic-gate /*
239*0Sstevel@tonic-gate  * scsb kstat types
240*0Sstevel@tonic-gate  */
241*0Sstevel@tonic-gate #define	SCSB_KS_LEDDATA		"scsb_leddata"
242*0Sstevel@tonic-gate #define	SCSB_KS_STATE		"scsb_state"
243*0Sstevel@tonic-gate #define	SCSB_KS_EVC_REGISTER	"scsb_evc_register"
244*0Sstevel@tonic-gate #define	SCSB_KS_TOPOLOGY	"env_topology"
245*0Sstevel@tonic-gate 
246*0Sstevel@tonic-gate typedef struct ks_fru_info {
247*0Sstevel@tonic-gate 	scsb_fru_status_t fru_status;	/* FRU presence/availability status  */
248*0Sstevel@tonic-gate 	scsb_unum_t	fru_unit;	/* FRU external unit number	*/
249*0Sstevel@tonic-gate 	scsb_utype_t	fru_type;	/* and occupant type for solts	*/
250*0Sstevel@tonic-gate 	fru_id_t	fru_id;		/* I2C address, SCSIID, Slot Num */
251*0Sstevel@tonic-gate 	fru_version_t	fru_version;	/* version number where possible */
252*0Sstevel@tonic-gate 	fru_health_t	fru_health;	/* From NOK LED, if available	*/
253*0Sstevel@tonic-gate } ks_fru_info_t;
254*0Sstevel@tonic-gate 
255*0Sstevel@tonic-gate typedef union scsb_leddata {
256*0Sstevel@tonic-gate 	uchar_t		scb_led_regs[SCSB_LEDDATA_REGISTERS];
257*0Sstevel@tonic-gate 	union {
258*0Sstevel@tonic-gate 		struct {
259*0Sstevel@tonic-gate 			uchar_t	nok_leds[SCB_P10_NOK_LED_REGS];
260*0Sstevel@tonic-gate 			uchar_t	 ok_leds[SCB_P10_OK_LED_REGS];
261*0Sstevel@tonic-gate 			uchar_t	blink_leds[SCB_P10_BLINK_LED_REGS];
262*0Sstevel@tonic-gate 		} p10;
263*0Sstevel@tonic-gate 		struct {
264*0Sstevel@tonic-gate 			uchar_t	nok_leds[SCB_P15_NOK_LED_REGS];
265*0Sstevel@tonic-gate 			uchar_t	 ok_leds[SCB_P15_OK_LED_REGS];
266*0Sstevel@tonic-gate 			uchar_t	blink_leds[SCB_P15_BLINK_LED_REGS];
267*0Sstevel@tonic-gate 		} p15;
268*0Sstevel@tonic-gate 	} leds;
269*0Sstevel@tonic-gate } scsb_ks_leddata_t;
270*0Sstevel@tonic-gate 
271*0Sstevel@tonic-gate typedef struct {
272*0Sstevel@tonic-gate 	uint8_t		scb_present;		/* SCB is present	  */
273*0Sstevel@tonic-gate 	uint8_t		ssb_present;		/* SSB is present	  */
274*0Sstevel@tonic-gate 	uint8_t		scsb_frozen;		/* SCB swap state	  */
275*0Sstevel@tonic-gate 	uint8_t		scsb_mode;		/* driver access mode	  */
276*0Sstevel@tonic-gate 	uint8_t		unused_1;
277*0Sstevel@tonic-gate 	uint8_t		unused_2;
278*0Sstevel@tonic-gate 	uint8_t		unused_3;
279*0Sstevel@tonic-gate 	uint8_t		unused_4;
280*0Sstevel@tonic-gate 	uint32_t	event_code;		/* event code bit map	  */
281*0Sstevel@tonic-gate } scsb_ks_state_t;
282*0Sstevel@tonic-gate 
283*0Sstevel@tonic-gate typedef struct {
284*0Sstevel@tonic-gate 	ks_fru_info_t	mid_plane;
285*0Sstevel@tonic-gate 	fru_max_t	max_units[SCSB_UNIT_TYPES];
286*0Sstevel@tonic-gate 	ks_fru_info_t	mct_slots[MC_MAX_SLOTS];
287*0Sstevel@tonic-gate 	ks_fru_info_t	mct_pdu[MC_MAX_PDU];
288*0Sstevel@tonic-gate 	ks_fru_info_t	mct_ps[MC_MAX_PS];
289*0Sstevel@tonic-gate 	ks_fru_info_t	mct_disk[MC_MAX_DISK];
290*0Sstevel@tonic-gate 	ks_fru_info_t	mct_fan[MC_MAX_FAN];
291*0Sstevel@tonic-gate 	ks_fru_info_t	mct_scb[MC_MAX_SCB];
292*0Sstevel@tonic-gate 	ks_fru_info_t	mct_ssb[MC_MAX_SCB];
293*0Sstevel@tonic-gate 	ks_fru_info_t	mct_alarm[MC_MAX_AC];
294*0Sstevel@tonic-gate 	ks_fru_info_t	mct_cftm[MC_MAX_CFTM];
295*0Sstevel@tonic-gate 	ks_fru_info_t	mct_crtm[MC_MAX_CRTM];
296*0Sstevel@tonic-gate 	ks_fru_info_t	mct_prtm[MC_MAX_PRTM];
297*0Sstevel@tonic-gate } mct_topology_t;
298*0Sstevel@tonic-gate 
299*0Sstevel@tonic-gate #ifdef	__cplusplus
300*0Sstevel@tonic-gate }
301*0Sstevel@tonic-gate #endif
302*0Sstevel@tonic-gate 
303*0Sstevel@tonic-gate #endif	/* _MONTECARLO_SYS_MCT_TOPOLOGY_H */
304