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