xref: /titanic_51/usr/src/uts/sun4u/montecarlo/sys/hscimpl.h (revision 03831d35f7499c87d51205817c93e9a8d42c4bae)
1*03831d35Sstevel /*
2*03831d35Sstevel  * CDDL HEADER START
3*03831d35Sstevel  *
4*03831d35Sstevel  * The contents of this file are subject to the terms of the
5*03831d35Sstevel  * Common Development and Distribution License, Version 1.0 only
6*03831d35Sstevel  * (the "License").  You may not use this file except in compliance
7*03831d35Sstevel  * with the License.
8*03831d35Sstevel  *
9*03831d35Sstevel  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*03831d35Sstevel  * or http://www.opensolaris.org/os/licensing.
11*03831d35Sstevel  * See the License for the specific language governing permissions
12*03831d35Sstevel  * and limitations under the License.
13*03831d35Sstevel  *
14*03831d35Sstevel  * When distributing Covered Code, include this CDDL HEADER in each
15*03831d35Sstevel  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*03831d35Sstevel  * If applicable, add the following below this CDDL HEADER, with the
17*03831d35Sstevel  * fields enclosed by brackets "[]" replaced with your own identifying
18*03831d35Sstevel  * information: Portions Copyright [yyyy] [name of copyright owner]
19*03831d35Sstevel  *
20*03831d35Sstevel  * CDDL HEADER END
21*03831d35Sstevel  */
22*03831d35Sstevel /*
23*03831d35Sstevel  * Copyright (c) 1999-2000 by Sun Microsystems, Inc.
24*03831d35Sstevel  * All rights reserved.
25*03831d35Sstevel  */
26*03831d35Sstevel 
27*03831d35Sstevel #ifndef _MONTECARLO_SYS_HSCIMPL_H
28*03831d35Sstevel #define	_MONTECARLO_SYS_HSCIMPL_H
29*03831d35Sstevel 
30*03831d35Sstevel #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*03831d35Sstevel 
32*03831d35Sstevel #ifdef	__cplusplus
33*03831d35Sstevel extern "C" {
34*03831d35Sstevel #endif
35*03831d35Sstevel 
36*03831d35Sstevel #include <sys/types.h>
37*03831d35Sstevel #include <sys/hotplug/hpctrl.h>
38*03831d35Sstevel 
39*03831d35Sstevel /*
40*03831d35Sstevel  * Flag values
41*03831d35Sstevel  */
42*03831d35Sstevel #define	HSC_ENABLED		0x1	/* if not enabled, slot unmanaged */
43*03831d35Sstevel #define	HSC_AUTOCFG		0x2	/* if set, ENUM# events will be sent */
44*03831d35Sstevel #define	HSC_REGISTERED		HSC_ENABLED
45*03831d35Sstevel #define	HSC_ALARM_CARD_PRES	0x4	/* Alarm Card on this slot */
46*03831d35Sstevel #define	HSC_BOARD_TYPE_HS	0x8
47*03831d35Sstevel #define	HSC_BOARD_TYPE_UNKNOWN	0x10
48*03831d35Sstevel #define	HSC_SLOT_ENABLED	0x20
49*03831d35Sstevel #define	HSC_SLOT_BAD_STATE	0x40	/* Surprise Removal on this slot */
50*03831d35Sstevel #define	HSC_ENUM_FAILED		0x80	/* Could not Enumerate this slot */
51*03831d35Sstevel #define	HSC_SCB_HOTSWAPPED	0x100	/* slot status change due to SCB swap */
52*03831d35Sstevel #define	HSC_HOTSWAP_MODE_BASIC	0
53*03831d35Sstevel #define	HSC_HOTSWAP_MODE_FULL	1
54*03831d35Sstevel 
55*03831d35Sstevel 
56*03831d35Sstevel typedef struct hsc_slot_state {
57*03831d35Sstevel 	int		pslotnum;
58*03831d35Sstevel 	int		state;
59*03831d35Sstevel } hsc_slot_state_t;
60*03831d35Sstevel 
61*03831d35Sstevel typedef struct hsc_slot_table {
62*03831d35Sstevel 	char	nexus[128];
63*03831d35Sstevel 	int	pci_devno;
64*03831d35Sstevel 	int	pslotnum;
65*03831d35Sstevel 	int	ga;
66*03831d35Sstevel } hsc_slot_table_t;
67*03831d35Sstevel 
68*03831d35Sstevel typedef struct hsc_prom_slot_table {
69*03831d35Sstevel 	int	phandle;
70*03831d35Sstevel 	int	pci_devno;
71*03831d35Sstevel 	int	pslotnum;
72*03831d35Sstevel 	int	ga;
73*03831d35Sstevel } hsc_prom_slot_table_t;
74*03831d35Sstevel 
75*03831d35Sstevel typedef struct hsc_state {
76*03831d35Sstevel 	int		instance;
77*03831d35Sstevel 	int		state;
78*03831d35Sstevel 	dev_info_t	*dip;
79*03831d35Sstevel 	void		*scsb_handle;
80*03831d35Sstevel 	struct hsc_slot	*hsp_last;	/* last board plugged in. */
81*03831d35Sstevel 	hsc_slot_table_t *slot_table_prop;
82*03831d35Sstevel 	int		slot_table_size;
83*03831d35Sstevel 	int		hsc_intr_counter;
84*03831d35Sstevel 	kmutex_t	hsc_mutex;
85*03831d35Sstevel 	ddi_iblock_cookie_t enum_iblock;
86*03831d35Sstevel 	boolean_t	regDone;
87*03831d35Sstevel 	int		n_registered_occupants;
88*03831d35Sstevel 	int	hotswap_mode;
89*03831d35Sstevel } hsc_state_t;
90*03831d35Sstevel 
91*03831d35Sstevel /*
92*03831d35Sstevel  * This struct describes a HS slot known to us. It maintains
93*03831d35Sstevel  * all the state associated with the slot.
94*03831d35Sstevel  * Slots are placed on a linked list.
95*03831d35Sstevel  */
96*03831d35Sstevel typedef struct hsc_slot {
97*03831d35Sstevel 	struct hsc_slot		*hs_next;
98*03831d35Sstevel 
99*03831d35Sstevel 	void			*hs_hpchandle; /* HPC (scsb) handle */
100*03831d35Sstevel 
101*03831d35Sstevel 	/*
102*03831d35Sstevel 	 * The hs_slot_number identifies the plysical slot.
103*03831d35Sstevel 	 * It should match with the documentation.
104*03831d35Sstevel 	 */
105*03831d35Sstevel 	int			hs_slot_number;
106*03831d35Sstevel 
107*03831d35Sstevel 	hpc_slot_info_t		hs_info;
108*03831d35Sstevel 
109*03831d35Sstevel 	hpc_board_type_t	hs_board_type;
110*03831d35Sstevel 	/*
111*03831d35Sstevel 	 * We only have 2 LEDs/slot on MonteCarlo, so we map them
112*03831d35Sstevel 	 * to the ACTIVE and FAULT ones.
113*03831d35Sstevel 	 * ACTIVE will be set when a board is in the slot, and has
114*03831d35Sstevel 	 * been configured.
115*03831d35Sstevel 	 */
116*03831d35Sstevel 	hpc_led_state_t		hs_active_led_state;
117*03831d35Sstevel 	hpc_led_state_t		hs_fault_led_state;
118*03831d35Sstevel 
119*03831d35Sstevel 	/*
120*03831d35Sstevel 	 * hs_slot_handle is useful for supporting ENUM#
121*03831d35Sstevel 	 * (when we need to inform the nexus of the event).
122*03831d35Sstevel 	 */
123*03831d35Sstevel 	hpc_slot_t		hs_slot_handle;
124*03831d35Sstevel 
125*03831d35Sstevel 	uint_t			hs_flags;
126*03831d35Sstevel 
127*03831d35Sstevel 	boolean_t		hs_board_configured;
128*03831d35Sstevel 	boolean_t		hs_board_configuring;
129*03831d35Sstevel 	boolean_t		hs_board_unconfiguring;
130*03831d35Sstevel 	boolean_t		hs_board_healthy;
131*03831d35Sstevel 
132*03831d35Sstevel 	/*
133*03831d35Sstevel 	 * The hs_slot_state is useful for HW-connection control
134*03831d35Sstevel 	 */
135*03831d35Sstevel 	hpc_slot_state_t	hs_slot_state;
136*03831d35Sstevel 	hsc_state_t		*hsc;	/* pointer to our controller device */
137*03831d35Sstevel } hsc_slot_t;
138*03831d35Sstevel 
139*03831d35Sstevel /* state values in our control structure */
140*03831d35Sstevel #define	HSC_ENUM_ENABLED	1
141*03831d35Sstevel #define	HSC_ATTACHED		2
142*03831d35Sstevel #define	HSC_SCB_CONNECTED	4
143*03831d35Sstevel 
144*03831d35Sstevel #ifdef	__cplusplus
145*03831d35Sstevel }
146*03831d35Sstevel #endif
147*03831d35Sstevel 
148*03831d35Sstevel #endif	/* _MONTECARLO_SYS_HSCIMPL_H */
149