Print this page
remove support for non-ANSI compilation
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/hotplug/hpctrl.h
+++ new/usr/src/uts/common/sys/hotplug/hpctrl.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
↓ open down ↓ |
12 lines elided |
↑ open up ↑ |
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22 /*
23 + * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24 + *
23 25 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 26 * Use is subject to license terms.
25 27 */
26 28
27 29 #ifndef _SYS_HOTPLUG_HPCTRL_H
28 30 #define _SYS_HOTPLUG_HPCTRL_H
29 31
30 -#pragma ident "%Z%%M% %I% %E% SMI"
31 -
32 32 /*
33 33 * ****************************************************************
34 34 * Hot Plug Controller interfaces for PCI and CompactPCI platforms.
35 35 * ****************************************************************
36 36 */
37 37 #include <sys/types.h>
38 38
39 39 #ifdef __cplusplus
40 40 extern "C" {
41 41 #endif
42 42
43 43 /*
44 44 * Type definition for slot handle. This is an opaque pointer
45 45 * created by the HPS framework.
46 46 */
47 47 typedef void *hpc_slot_t;
48 48
49 49 #define HPC_SLOT_OPS_VERSION 0
50 50
51 51 /*
52 52 * slot operations structure definition.
53 53 *
54 54 * Function Description
55 55 * -------- -----------
56 56 * xxx_op_connect CONNECT the slot to the bus to enable
57 57 * access to the adapter.
58 58 * xxx_op_disconnect DISCONNECT the slot from the bus. For PCI,
59 59 * this disables the power to the slot.
60 60 * xxx_op_insert Prepare the slot for card insertion. This
61 61 * may not be applicable for all bus types.
62 62 * xxx_op_remove Prepare the slot for card removal. This
63 63 * may not be applicable for all bus types.
64 64 * xxx_op_control Perform misc. commands to control the
65 65 * LEDs, get status information, etc.
66 66 */
67 67 typedef struct hpc_slot_ops {
68 68 int hpc_version; /* HPC_SLOT_OPS_VERSION */
69 69 int (*hpc_op_connect)(caddr_t ops_arg, hpc_slot_t slot_hdl,
70 70 void *data, uint_t flags);
71 71 int (*hpc_op_disconnect)(caddr_t ops_arg, hpc_slot_t slot_hdl,
72 72 void *data, uint_t flags);
73 73 int (*hpc_op_insert)(caddr_t ops_arg, hpc_slot_t slot_hdl,
74 74 void *data, uint_t flags);
75 75 int (*hpc_op_remove)(caddr_t ops_arg, hpc_slot_t slot_hdl,
76 76 void *data, uint_t flags);
77 77 int (*hpc_op_control)(caddr_t ops_arg, hpc_slot_t slot_hdl,
78 78 int request, caddr_t arg);
79 79 } hpc_slot_ops_t;
80 80
81 81 #define HPC_SLOT_INFO_VERSION 1
82 82 #define PCI_SLOT_NAME_LEN 256
83 83 /*
84 84 * Slot information structure.
85 85 */
86 86 typedef struct hpc_slot_info {
87 87 uint16_t version; /* HPC_SLOT_INFO_VERSION */
88 88 uint16_t slot_type; /* slot type: PCI, ... */
89 89 uint16_t slot_flags;
90 90 union {
91 91 /* pci bus slot */
92 92 struct pci_slot_info {
93 93 uint16_t device_number; /* PCI device number */
94 94 uint16_t slot_capabilities; /* 64bit, etc. */
95 95 char slot_logical_name[PCI_SLOT_NAME_LEN];
96 96 } pci;
97 97 struct sbd_slot_info {
98 98 int slot_num;
99 99 } sbd;
100 100 /* other bus types go here... */
101 101 } slot;
102 102 } hpc_slot_info_t;
103 103
104 104 /* short names for bus specific fields in hpc_slot_info structure */
105 105 #define pci_dev_num slot.pci.device_number
106 106 #define pci_slot_name slot.pci.slot_logical_name
107 107 #define pci_slot_capabilities slot.pci.slot_capabilities
108 108
109 109 #define sbd_slot_num slot.sbd.slot_num
110 110
111 111 /* slot_type definitions */
112 112 #define HPC_SLOT_TYPE_PCI 0x1 /* PCI bus slot */
113 113 #define HPC_SLOT_TYPE_CPCI 0x2 /* Compact PCI bus slot */
114 114 #define HPC_SLOT_TYPE_SBD 0x3 /* System bus slot */
115 115 #define HPC_SLOT_TYPE_PCIE 0x4 /* PCI Express slot */
116 116
117 117 /* bit definitions in slot_capabilities field for PCI or cPCI bus slots */
118 118 #define HPC_SLOT_64BITS 0x0001 /* slot is a 64bit slot */
119 119 #define HPC_SLOT_TEST 0x0002 /* testing capability on the slot */
120 120
121 121 /* slot_flags definitions */
122 122 #define HPC_SLOT_NO_AUTO_ENABLE 0x1 /* No auto-enable on registration */
123 123 #define HPC_SLOT_CREATE_DEVLINK 0x2 /* create device link under /dev/cfg */
124 124
125 125 /*
126 126 * xxx_op_control command definitions.
127 127 *
128 128 * Command (request) arg Descritpion
129 129 * ----------------- --- -----------
130 130 * HPC_CTRL_GET_LED_STATE hpc_led_info * Get state of an LED.
131 131 * HPC_CTRL_SET_LED_STATE hpc_led_info * Set state of an LED.
132 132 * HPC_CTRL_GET_SLOT_STATE hpc_slot_state_t * Get the slot state.
133 133 * HPC_CTRL_DEV_CONFIGURED NULL Board is configured.
134 134 * HPC_CTRL_DEV_UNCONFIGURED NULL Board is unconfigured.
135 135 * HPC_CTRL_DEV_CONFIG_FAILURE NULL Board Configuration Failed
136 136 * HPC_CTRL_DEV_UNCONFIG_FAILURE NULL Board Unconfiguration Failed
137 137 * HPC_CTRL_GET_BOARD_TYPE hpc_board_type_t * Get board type info.
138 138 * HPC_CTRL_DISABLE_AUTOCFG NULL Disable auto config-
139 139 * uration for this slot.
140 140 * HPC_CTRL_ENABLE_AUTOCFG NULL Enable auto config-
141 141 * uration for this slot.
142 142 * HPC_CTRL_DISABLE_SLOT NULL Disable the slot for
143 143 * hot plug operations.
144 144 * HPC_CTRL_ENABLE_SLOT NULL ReEnable the slot for
145 145 * hot plug operations.
146 146 */
147 147 #define HPC_CTRL_GET_LED_STATE 0x1
148 148 #define HPC_CTRL_SET_LED_STATE 0x2
149 149 #define HPC_CTRL_GET_SLOT_STATE 0x3
150 150 #define HPC_CTRL_DEV_CONFIGURED 0x4
151 151 #define HPC_CTRL_DEV_UNCONFIGURED 0x5
152 152 #define HPC_CTRL_GET_BOARD_TYPE 0x6
153 153 #define HPC_CTRL_DISABLE_AUTOCFG 0x7
154 154 #define HPC_CTRL_ENABLE_AUTOCFG 0x8
155 155 #define HPC_CTRL_DISABLE_SLOT 0x9
156 156 #define HPC_CTRL_ENABLE_SLOT 0xa
157 157 #define HPC_CTRL_DISABLE_ENUM 0xb
158 158 #define HPC_CTRL_ENABLE_ENUM 0xc
159 159 #define HPC_CTRL_DEV_CONFIG_FAILURE 0xd
160 160 #define HPC_CTRL_DEV_UNCONFIG_FAILURE 0xe
161 161 #define HPC_CTRL_DEV_CONFIG_START 0xf
162 162 #define HPC_CTRL_DEV_UNCONFIG_START 0x10
163 163
164 164 /*
165 165 * type definitions for led information.
166 166 *
167 167 * Note: ATTN/ACTIVE leds are platform specific and they may not be
168 168 * available on all platforms.
169 169 */
170 170 typedef enum { HPC_FAULT_LED, HPC_POWER_LED, HPC_ATTN_LED,
171 171 HPC_ACTIVE_LED} hpc_led_t;
172 172
173 173 typedef enum { HPC_LED_OFF, HPC_LED_ON, HPC_LED_BLINK } hpc_led_state_t;
174 174
175 175 typedef struct hpc_led_info {
176 176 hpc_led_t led; /* led id: HPC_POWER_LED, HPC_FAULT_LED, ... */
177 177 hpc_led_state_t state; /* led state: HPC_LED_ON, HPC_LED_OFF, ... */
178 178 } hpc_led_info_t;
179 179
180 180 /*
181 181 * type definition for slot state.
182 182 *
183 183 * HPC_SLOT_EMPTY Slot has no card present.
184 184 * HPC_SLOT_CONNECTED Card is present in the slot and it is
185 185 * connected to the bus.
186 186 * HPC_SLOT_DISCONNECTED Card is present in the slot and it is
187 187 * disconnected from the bus.
188 188 * HPC_SLOT_UNKNOWN If the HPC driver can not figure out
189 189 * the receptacle state. This is possible
190 190 * on Compact PCI Hot Swap platform.
191 191 */
192 192 typedef enum { HPC_SLOT_EMPTY, HPC_SLOT_DISCONNECTED,
193 193 HPC_SLOT_CONNECTED, HPC_SLOT_UNKNOWN } hpc_slot_state_t;
194 194
195 195 /*
196 196 * type definition for board type.
197 197 *
198 198 * HPC_BOARD_UNKNOWN Board is either not present or unknown.
199 199 * HPC_BOARD_PCI_HOTPLUG PCI or PCIe adapter.
200 200 * HPC_BOARD_CPCI_NON_HS Non Hot Swap cPCI board.
201 201 * HPC_BOARD_CPCI_BASIC_HS Basic Hot Swap cPCI board.
202 202 * HPC_BOARD_CPCI_FULL_HS Full Hot Swap cPCI board.
203 203 * HPC_BOARD_CPCI_HS Indicates if HSC driver can not determine
204 204 * the type of Hot Swap board.
205 205 */
206 206 typedef enum { HPC_BOARD_UNKNOWN, HPC_BOARD_PCI_HOTPLUG,
207 207 HPC_BOARD_CPCI_NON_HS, HPC_BOARD_CPCI_BASIC_HS,
208 208 HPC_BOARD_CPCI_FULL_HS, HPC_BOARD_CPCI_HS } hpc_board_type_t;
209 209
210 210 /*
211 211 * Event type definitions (for hpc_event_notify() interface).
212 212 *
213 213 * Event Descritpion
214 214 * ----- -----------
215 215 * HPC_EVENT_SLOT_INSERTION Card is inserted in the slot.
216 216 * HPC_EVENT_SLOT_REMOVAL Card is removed from the slot.
217 217 * HPC_EVENT_SLOT_POWER_ON Slot is powered ON.
218 218 * HPC_EVENT_SLOT_POWER_OFF Slot is powered OFF.
219 219 * HPC_EVENT_SLOT_LATCH_OPEN LATCH on the slot is open.
220 220 * HPC_EVENT_SLOT_LATCH_SHUT LATCH on the slot is shut.
221 221 * HPC_EVENT_SLOT_ENUM ENUM# signal is generated on the bus
222 222 * and it may be generated from this slot.
223 223 * HPC_EVENT_SLOT_NOT_HEALTHY HEALTHY# signal is lost on this slot.
224 224 * HPC_EVENT_SLOT_HEALTHY_OK HEALTHY# signal on this slot is OK now.
225 225 * HPC_EVENT_SLOT_CONFIGURE Configure the occupant in the slot.
226 226 * HPC_EVENT_SLOT_UNCONFIGURE Unconfigure the occupant in the slot.
227 227 */
228 228 #define HPC_EVENT_SLOT_INSERTION 0x00000001
229 229 #define HPC_EVENT_SLOT_REMOVAL 0x00000002
230 230 #define HPC_EVENT_SLOT_POWER_ON 0x00000004
231 231 #define HPC_EVENT_SLOT_POWER_OFF 0x00000008
232 232 #define HPC_EVENT_SLOT_LATCH_OPEN 0x00000010
233 233 #define HPC_EVENT_SLOT_LATCH_SHUT 0x00000020
234 234 #define HPC_EVENT_SLOT_ENUM 0x00000040
235 235 #define HPC_EVENT_SLOT_NOT_HEALTHY 0x00000080
236 236 #define HPC_EVENT_SLOT_HEALTHY_OK 0x00000100
237 237 #define HPC_EVENT_SLOT_CONFIGURE 0x00000200
238 238 #define HPC_EVENT_SLOT_UNCONFIGURE 0x00000400
239 239 #define HPC_EVENT_SLOT_BLUE_LED_ON 0x00000800
240 240 #define HPC_EVENT_SLOT_BLUE_LED_OFF 0x00001000
241 241 #define HPC_EVENT_CLEAR_ENUM 0x00002000
242 242 #define HPC_EVENT_PROCESS_ENUM 0x00004000
243 243 #define HPC_EVENT_ENABLE_ENUM 0x00008000
244 244 #define HPC_EVENT_DISABLE_ENUM 0x00010000
245 245 #define HPC_EVENT_BUS_ENUM HPC_EVENT_SLOT_ENUM
246 246 #define HPC_EVENT_SLOT_ATTN 0x00020000
247 247 #define HPC_EVENT_SLOT_POWER_FAULT 0x00040000
248 248
249 249 /*
250 250 * return values for errors from HPS framework interfaces.
251 251 */
252 252 #define HPC_SUCCESS 0x0
253 253 #define HPC_ERR_INVALID 0x1 /* invalid arguments */
254 254 #define HPC_ERR_SLOT_NOTREGISTERED 0x2 /* slot is not registered */
255 255 #define HPC_ERR_SLOT_DUPLICATE 0x3 /* slot is already registered */
256 256 #define HPC_ERR_BUS_NOTREGISTERED 0x4 /* slot is not registered */
257 257 #define HPC_ERR_BUS_DUPLICATE 0x5 /* slot is already registered */
258 258 #define HPC_ERR_NOTSUPPORTED 0x6 /* operation not supported */
259 259 #define HPC_ERR_FAILED 0x7 /* operation failed */
260 260
261 261 /* return values for event notifications */
262 262 #define HPC_EVENT_CLAIMED 0x10 /* HPC event is claimed */
↓ open down ↓ |
221 lines elided |
↑ open up ↑ |
263 263 #define HPC_EVENT_UNCLAIMED -1 /* HPC event is not claimed */
264 264
265 265 /* definitions for slot (un)registration events */
266 266 #define HPC_SLOT_ONLINE 1 /* slot is registered */
267 267 #define HPC_SLOT_OFFLINE 2 /* slot is unregistered */
268 268
269 269 /*
270 270 * function prototype definitions for interfaces between HPC driver
271 271 * and Hot Plug Services framework.
272 272 */
273 -#ifdef __STDC__
274 273 extern int hpc_slot_register(dev_info_t *dip, char *bus_path,
275 274 hpc_slot_info_t *slot_info, hpc_slot_t *slot_hdl,
276 275 hpc_slot_ops_t *slot_ops, caddr_t ops_arg, uint_t flags);
277 276 extern int hpc_slot_unregister(hpc_slot_t *slot_hdl);
278 277 extern struct hpc_slot_ops *hpc_alloc_slot_ops(int sleepflag);
279 278 extern void hpc_free_slot_ops(hpc_slot_ops_t *ops);
280 279 extern int hpc_slot_event_notify(hpc_slot_t slot_hdl, uint_t event,
281 280 uint_t flags);
282 281 extern boolean_t hpc_bus_registered(hpc_slot_t slot_hdl);
283 -#else
284 -extern int hpc_slot_register();
285 -extern int hpc_slot_unregister();
286 -extern struct hpc_slot_ops *hpc_alloc_slot_ops();
287 -extern void hpc_free_slot_ops();
288 -extern int hpc_slot_event_notify();
289 -extern boolean_t hpc_bus_registered();
290 -#endif /* __STDC__ */
291 282
292 283 /*
293 284 * *****************************************************************
294 285 * Implementation specific data structures and definitons. These are
295 286 * the private interfaces between cfgadm plug-in and the PCI nexus
296 287 * driver.
297 288 * *****************************************************************
298 289 */
299 290
300 291 /*
301 292 * Data structure used for DEVCTL_AP_CONTROL ioctl on the AP.
302 293 */
303 294 struct hpc_control_data {
304 295 uint_t cmd; /* HPC_CTRL_* command */
305 296 void *data; /* pointer to data that is exchanged */
306 297 };
307 298
308 299 struct hpc_control32_data {
309 300 uint_t cmd; /* HPC_CTRL_* command */
310 301 caddr32_t data; /* pointer to data that is exchanged */
311 302 };
312 303
313 304 /* misc. control commands for DEVCTL_AP_CONTROL ioctl interface */
314 305 #define HPC_CTRL_GET_SLOT_INFO 0x100
315 306 #define HPC_CTRL_GET_CARD_INFO 0x101
316 307
317 308 /* card information structure to get data from the PCI config header */
318 309 typedef struct hpc_card_info {
319 310 uint8_t prog_class; /* PCI_CONF_PROGCLASS byte */
320 311 uint8_t base_class; /* PCI_CONF_BASCLASS byte */
321 312 uint8_t sub_class; /* PCI_CONF_SUBCLASS byte */
322 313 uint8_t header_type; /* PCI_CONF_HEADER byte */
323 314 } hpc_card_info_t;
324 315
325 316 /* Slot occupant information structure */
326 317 #define HPC_MAX_OCCUPANTS 128
327 318 typedef struct hpc_occupant_info {
328 319 int i;
329 320 char *id[HPC_MAX_OCCUPANTS];
330 321 } hpc_occupant_info_t;
331 322
332 323 #ifdef __cplusplus
333 324 }
334 325 #endif
335 326
336 327 #endif /* _SYS_HOTPLUG_HPCTRL_H */
↓ open down ↓ |
36 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX