xref: /titanic_50/usr/src/uts/common/sys/ddi_impldefs.h (revision 733a5356058ae0150a67d61f0ad8e5260d2acae3)
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 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_DDI_IMPLDEFS_H
28 #define	_SYS_DDI_IMPLDEFS_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/types.h>
33 #include <sys/param.h>
34 #include <sys/t_lock.h>
35 #include <sys/ddipropdefs.h>
36 #include <sys/devops.h>
37 #include <sys/autoconf.h>
38 #include <sys/mutex.h>
39 #include <vm/page.h>
40 #include <sys/dacf_impl.h>
41 #include <sys/ndifm.h>
42 #include <sys/epm.h>
43 #include <sys/ddidmareq.h>
44 #include <sys/ddi_intr.h>
45 #include <sys/ddi_isa.h>
46 
47 #ifdef	__cplusplus
48 extern "C" {
49 #endif
50 
51 /*
52  * The device id implementation has been switched to be based on properties.
53  * For compatibility with di_devid libdevinfo interface the following
54  * must be defined:
55  */
56 #define	DEVID_COMPATIBILITY	((ddi_devid_t)-1)
57 
58 /*
59  * Definitions for node class.
60  * DDI_NC_PROM: a node with a nodeid that may be used in a promif call.
61  * DDI_NC_PSEUDO: a software created node with a software assigned nodeid.
62  */
63 typedef enum {
64 	DDI_NC_PROM = 0,
65 	DDI_NC_PSEUDO
66 } ddi_node_class_t;
67 
68 /*
69  * dev_info: 	The main device information structure this is intended to be
70  *		opaque to drivers and drivers should use ddi functions to
71  *		access *all* driver accessible fields.
72  *
73  * devi_parent_data includes property lists (interrupts, registers, etc.)
74  * devi_driver_data includes whatever the driver wants to place there.
75  */
76 struct devinfo_audit;
77 
78 struct dev_info  {
79 
80 	struct dev_info *devi_parent;	/* my parent node in tree	*/
81 	struct dev_info *devi_child;	/* my child list head		*/
82 	struct dev_info *devi_sibling;	/* next element on my level	*/
83 
84 	char	*devi_binding_name;	/* name used to bind driver	*/
85 
86 	char	*devi_addr;		/* address part of name		*/
87 
88 	int	devi_nodeid;		/* device nodeid		*/
89 	int	devi_instance;		/* device instance number	*/
90 
91 	struct dev_ops *devi_ops;	/* driver operations		*/
92 
93 	void	*devi_parent_data;	/* parent private data		*/
94 	void	*devi_driver_data;	/* driver private data		*/
95 
96 	ddi_prop_t *devi_drv_prop_ptr;	/* head of driver prop list */
97 	ddi_prop_t *devi_sys_prop_ptr;	/* head of system prop list */
98 
99 	struct ddi_minor_data *devi_minor;	/* head of minor list */
100 	struct dev_info *devi_next;	/* Next instance of this device */
101 	kmutex_t devi_lock;		/* Protects per-devinfo data */
102 
103 	/* logical parents for busop primitives	 */
104 
105 	struct dev_info *devi_bus_map_fault;	/* bus_map_fault parent	 */
106 	struct dev_info *devi_bus_dma_map;	/* bus_dma_map parent	 */
107 	struct dev_info *devi_bus_dma_allochdl; /* bus_dma_newhdl parent */
108 	struct dev_info *devi_bus_dma_freehdl;  /* bus_dma_freehdl parent */
109 	struct dev_info *devi_bus_dma_bindhdl;  /* bus_dma_bindhdl parent */
110 	struct dev_info *devi_bus_dma_unbindhdl; /* bus_dma_unbindhdl parent */
111 	struct dev_info *devi_bus_dma_flush;    /* bus_dma_flush parent	 */
112 	struct dev_info *devi_bus_dma_win;	/* bus_dma_win parent	 */
113 	struct dev_info *devi_bus_dma_ctl;	/* bus_dma_ctl parent	 */
114 	struct dev_info	*devi_bus_ctl;		/* bus_ctl parent	 */
115 
116 	ddi_prop_t *devi_hw_prop_ptr;		/* head of hw prop list */
117 
118 	char	*devi_node_name;		/* The 'name' of the node */
119 	char	*devi_compat_names;		/* A list of driver names */
120 	size_t	devi_compat_length;		/* Size of compat_names */
121 
122 	int (*devi_bus_dma_bindfunc)(dev_info_t *, dev_info_t *,
123 	    ddi_dma_handle_t, struct ddi_dma_req *, ddi_dma_cookie_t *,
124 	    uint_t *);
125 	int (*devi_bus_dma_unbindfunc)(dev_info_t *, dev_info_t *,
126 	    ddi_dma_handle_t);
127 
128 #ifdef	DEVID_COMPATIBILITY
129 	ddi_devid_t	devi_devid;		/* registered device id */
130 #endif	/* DEVID_COMPATIBILITY */
131 	/*
132 	 * power management entries
133 	 * components exist even if the device is not currently power managed
134 	 */
135 	struct pm_info *devi_pm_info;		/* 0 => dev not power managed */
136 	uint_t		devi_pm_flags;		/* pm flags */
137 	int		devi_pm_num_components;	/* number of components */
138 	size_t		devi_pm_comp_size;	/* size of devi_components */
139 	struct pm_component *devi_pm_components; /* array of pm components */
140 	struct dev_info *devi_pm_ppm;		/* ppm attached to this one */
141 	void		*devi_pm_ppm_private;	/* for use by ppm driver */
142 	int		devi_pm_dev_thresh;	/* "device" threshold */
143 	uint_t		devi_pm_kidsupcnt;	/* # of kids powered up */
144 	struct pm_scan	*devi_pm_scan;		/* pm scan info */
145 	uint_t		devi_pm_noinvolpm;	/* # of descendents no-invol */
146 	uint_t		devi_pm_volpmd;		/* # of voluntarily pm'ed */
147 	kmutex_t	devi_pm_lock;		/* pm lock for state */
148 	kmutex_t	devi_pm_busy_lock;	/* for component busy count */
149 
150 	uint_t		devi_state;		/* device/bus state flags */
151 						/* see below for definitions */
152 	kcondvar_t	devi_cv;		/* cv */
153 	int		devi_ref;		/* reference count */
154 
155 	dacf_rsrvlist_t *devi_dacf_tasks;	/* dacf reservation queue */
156 
157 	ddi_node_class_t devi_node_class;	/* Node class */
158 	int		devi_node_attributes;	/* Node attributes: See below */
159 
160 	char		*devi_device_class;
161 
162 	/*
163 	 * New mpxio kernel hooks entries
164 	 */
165 	int		devi_mdi_component;	/* mpxio component type */
166 	void		*devi_mdi_client;	/* mpxio client information */
167 	void		*devi_mdi_xhci;		/* vhci/phci info */
168 
169 	ddi_prop_list_t	*devi_global_prop_list;	/* driver global properties */
170 	major_t		devi_major;		/* driver major number */
171 	ddi_node_state_t devi_node_state;	/* state of node */
172 	uint_t		devi_flags;		/* configuration flags */
173 	int		devi_circular;		/* for recursive operations */
174 	void		*devi_busy_thread;	/* thread operating on node */
175 	void		*devi_taskq;		/* hotplug taskq */
176 
177 	/* device driver statistical and audit info */
178 	struct devinfo_audit *devi_audit;		/* last state change */
179 
180 	/*
181 	 * FMA support for resource caches and error handlers
182 	 */
183 	struct i_ddi_fmhdl	*devi_fmhdl;
184 
185 	uint_t		devi_cpr_flags;
186 
187 	/* For interrupt support */
188 	devinfo_intr_t		*devi_intr_p;
189 
190 	void		*devi_nex_pm;		/* nexus PM private */
191 };
192 
193 #define	DEVI(dev_info_type)	((struct dev_info *)(dev_info_type))
194 
195 /*
196  * NB: The 'name' field, for compatibility with old code (both existing
197  * device drivers and userland code), is now defined as the name used
198  * to bind the node to a device driver, and not the device node name.
199  * If the device node name does not define a binding to a device driver,
200  * and the framework uses a different algorithm to create the binding to
201  * the driver, the node name and binding name will be different.
202  *
203  * Note that this implies that the node name plus instance number does
204  * NOT create a unique driver id; only the binding name plus instance
205  * number creates a unique driver id.
206  *
207  * New code should not use 'devi_name'; use 'devi_binding_name' or
208  * 'devi_node_name' and/or the routines that access those fields.
209  */
210 
211 #define	devi_name devi_binding_name
212 
213 /*
214  * DDI_CF1, DDI_CF2 and DDI_DRV_UNLOADED are obsolete. They are kept
215  * around to allow legacy drivers to to compile.
216  */
217 #define	DDI_CF1(devi)		(DEVI(devi)->devi_addr != NULL)
218 #define	DDI_CF2(devi)		(DEVI(devi)->devi_ops != NULL)
219 #define	DDI_DRV_UNLOADED(devi)	(DEVI(devi)->devi_ops == &mod_nodev_ops)
220 
221 /*
222  * The device node state (devi_state) contains information regarding
223  * the state of the device (Online/Offline/Down).  For bus nexus
224  * devices, the device state also contains state information regarding
225  * the state of the bus represented by this nexus node.
226  *
227  * Device state information is stored in bits [0-7], bus state in bits
228  * [8-15].
229  *
230  */
231 #define	DEVI_DEVICE_OFFLINE	0x00000001
232 #define	DEVI_DEVICE_DOWN	0x00000002
233 #define	DEVI_DEVICE_DEGRADED	0x00000004
234 #define	DEVI_DEVICE_REMOVED	0x00000008 /* hardware removed */
235 #define	DEVI_BUS_QUIESCED	0x00000100
236 #define	DEVI_BUS_DOWN		0x00000200
237 #define	DEVI_NDI_CONFIG		0x00000400 /* perform config when attaching */
238 
239 #define	DEVI_S_ATTACHING	0x00010000
240 #define	DEVI_S_DETACHING	0x00020000
241 #define	DEVI_S_ONLINING		0x00040000
242 #define	DEVI_S_OFFLINING	0x00080000
243 
244 #define	DEVI_S_INVOKING_DACF	0x00100000 /* busy invoking a dacf task */
245 
246 #define	DEVI_S_UNBOUND		0x00200000
247 #define	DEVI_S_MD_UPDATE	0x00400000
248 #define	DEVI_S_REPORT		0x08000000 /* report status change */
249 
250 #define	DEVI_S_EVADD		0x10000000 /* state of devfs event */
251 #define	DEVI_S_EVREMOVE		0x20000000 /* state of devfs event */
252 #define	DEVI_S_NEED_RESET	0x40000000 /* devo_reset should be called */
253 
254 #define	DEVI_BUSY		0x1	/* busy configuring children */
255 #define	DEVI_MADE_CHILDREN	0x2	/* children made from specs */
256 #define	DEVI_ATTACHED_CHILDREN	0x4	/* attached all existing children */
257 #define	DEVI_BRANCH_HELD	0x8	/* branch rooted at this dip held */
258 #define	DEVI_NO_BIND		0x10	/* prevent driver binding */
259 #define	DEVI_REGISTERED_DEVID	0x20	/* device registered a devid */
260 
261 #define	DEVI_VHCI_NODE(dip)	\
262 	(DEVI(dip)->devi_node_attributes & DDI_VHCI_NODE)
263 
264 #define	DEVI_BUSY_CHANGING(dip)	(DEVI(dip)->devi_flags & DEVI_BUSY)
265 
266 #define	DEVI_BUSY_OWNED(dip)	\
267 	(((DEVI(dip))->devi_flags & DEVI_BUSY) && \
268 	((DEVI(dip))->devi_busy_thread == curthread))
269 
270 #define	DEVI_IS_DEVICE_OFFLINE(dip) \
271 	((DEVI((dip))->devi_state & DEVI_DEVICE_OFFLINE) == DEVI_DEVICE_OFFLINE)
272 
273 #define	DEVI_SET_DEVICE_ONLINE(dip) \
274 	{ if (i_ddi_node_state(dip) != DS_READY) \
275 		(DEVI((dip))->devi_state |= DEVI_S_REPORT); \
276 	(DEVI((dip))->devi_state &= \
277 	~(DEVI_DEVICE_OFFLINE | DEVI_DEVICE_DEGRADED | DEVI_DEVICE_DOWN)); }
278 
279 #define	DEVI_SET_DEVICE_OFFLINE(dip) \
280 	{ (DEVI((dip))->devi_state |= DEVI_S_REPORT); \
281 	(DEVI((dip))->devi_state |= DEVI_DEVICE_OFFLINE); }
282 
283 #define	DEVI_IS_DEVICE_DOWN(dip) \
284 	((DEVI((dip))->devi_state & DEVI_DEVICE_DOWN) == DEVI_DEVICE_DOWN)
285 
286 #define	DEVI_SET_DEVICE_DOWN(dip) \
287 	{ (DEVI((dip))->devi_state |= DEVI_S_REPORT); \
288 	(DEVI((dip))->devi_state |= DEVI_DEVICE_DOWN); }
289 
290 #define	DEVI_IS_DEVICE_DEGRADED(dip) \
291 	((DEVI((dip))->devi_state & (DEVI_DEVICE_DEGRADED|DEVI_DEVICE_DOWN)) \
292 		== DEVI_DEVICE_DEGRADED)
293 
294 #define	DEVI_SET_DEVICE_DEGRADED(dip) \
295 	{ (DEVI((dip))->devi_state |= DEVI_S_REPORT); \
296 	(DEVI((dip))->devi_state |= DEVI_DEVICE_DEGRADED); }
297 
298 #define	DEVI_SET_DEVICE_UP(dip) \
299 	{ (DEVI((dip))->devi_state |= DEVI_S_REPORT); \
300 	(DEVI((dip))->devi_state &= ~(DEVI_DEVICE_DEGRADED|DEVI_DEVICE_DOWN)); }
301 
302 #define	DEVI_IS_DEVICE_REMOVED(dip) \
303 	((DEVI((dip))->devi_state & DEVI_DEVICE_REMOVED) == DEVI_DEVICE_REMOVED)
304 
305 #define	DEVI_SET_DEVICE_REMOVED(dip) \
306 	{ (DEVI((dip))->devi_state |= DEVI_DEVICE_REMOVED); }
307 
308 #define	DEVI_SET_DEVICE_REINSERTED(dip) \
309 	{ (DEVI((dip))->devi_state &= ~DEVI_DEVICE_REMOVED); }
310 
311 #define	DEVI_IS_BUS_QUIESCED(dip) \
312 	((DEVI((dip))->devi_state & DEVI_BUS_QUIESCED) == DEVI_BUS_QUIESCED)
313 
314 #define	DEVI_SET_BUS_ACTIVE(dip) \
315 	{ (DEVI((dip))->devi_state |= DEVI_S_REPORT); \
316 	(DEVI((dip))->devi_state &= ~DEVI_BUS_QUIESCED); }
317 
318 #define	DEVI_SET_BUS_QUIESCE(dip) \
319 	{ (DEVI((dip))->devi_state |= DEVI_S_REPORT); \
320 	(DEVI((dip))->devi_state |= DEVI_BUS_QUIESCED); }
321 
322 #define	DEVI_IS_BUS_DOWN(dip) \
323 	((DEVI((dip))->devi_state & DEVI_BUS_DOWN) == DEVI_BUS_DOWN)
324 
325 #define	DEVI_SET_BUS_UP(dip) \
326 	{ (DEVI((dip))->devi_state |= DEVI_S_REPORT); \
327 	(DEVI((dip))->devi_state &= ~DEVI_BUS_DOWN); }
328 
329 #define	DEVI_SET_BUS_DOWN(dip) \
330 	{ (DEVI((dip))->devi_state |= DEVI_S_REPORT); \
331 	(DEVI((dip))->devi_state |= DEVI_BUS_DOWN); }
332 
333 /* node needs status change report */
334 #define	DEVI_NEED_REPORT(dip) \
335 	((DEVI((dip))->devi_state & DEVI_S_REPORT) == DEVI_S_REPORT)
336 
337 #define	DEVI_REPORT_DONE(dip) \
338 	(DEVI((dip))->devi_state &= ~DEVI_S_REPORT)
339 
340 /* do an NDI_CONFIG for its children */
341 #define	DEVI_NEED_NDI_CONFIG(dip) \
342 	((DEVI((dip))->devi_state & DEVI_NDI_CONFIG) == DEVI_NDI_CONFIG)
343 
344 #define	DEVI_SET_NDI_CONFIG(dip) \
345 	(DEVI((dip))->devi_state |= DEVI_NDI_CONFIG)
346 
347 #define	DEVI_CLR_NDI_CONFIG(dip) \
348 	(DEVI((dip))->devi_state &= ~DEVI_NDI_CONFIG)
349 
350 /* attaching or detaching state */
351 #define	DEVI_SET_ATTACHING(dip) \
352 	(DEVI((dip))->devi_state |= DEVI_S_ATTACHING)
353 
354 #define	DEVI_CLR_ATTACHING(dip) \
355 	(DEVI((dip))->devi_state &= ~DEVI_S_ATTACHING)
356 
357 #define	DEVI_IS_ATTACHING(dip) \
358 	((DEVI((dip))->devi_state & DEVI_S_ATTACHING) == DEVI_S_ATTACHING)
359 
360 #define	DEVI_SET_DETACHING(dip) \
361 	(DEVI((dip))->devi_state |= DEVI_S_DETACHING)
362 
363 #define	DEVI_CLR_DETACHING(dip) \
364 	(DEVI((dip))->devi_state &= ~DEVI_S_DETACHING)
365 
366 #define	DEVI_IS_DETACHING(dip) \
367 	((DEVI((dip))->devi_state & DEVI_S_DETACHING) == DEVI_S_DETACHING)
368 
369 /* onlining or offlining state */
370 #define	DEVI_SET_ONLINING(dip) \
371 	(DEVI((dip))->devi_state |= DEVI_S_ONLINING)
372 
373 #define	DEVI_CLR_ONLINING(dip) \
374 	(DEVI((dip))->devi_state &= ~DEVI_S_ONLINING)
375 
376 #define	DEVI_IS_ONLINING(dip) \
377 	((DEVI((dip))->devi_state & DEVI_S_ONLINING) == DEVI_S_ONLINING)
378 
379 #define	DEVI_SET_OFFLINING(dip) \
380 	(DEVI((dip))->devi_state |= DEVI_S_OFFLINING)
381 
382 #define	DEVI_CLR_OFFLINING(dip) \
383 	(DEVI((dip))->devi_state &= ~DEVI_S_OFFLINING)
384 
385 #define	DEVI_IS_OFFLINING(dip) \
386 	((DEVI((dip))->devi_state & DEVI_S_OFFLINING) == DEVI_S_OFFLINING)
387 
388 #define	DEVI_IS_IN_RECONFIG(dip) \
389 	(DEVI((dip))->devi_state & (DEVI_S_OFFLINING | DEVI_S_ONLINING))
390 
391 /* busy invoking a dacf task against this node */
392 #define	DEVI_IS_INVOKING_DACF(dip) \
393 	((DEVI((dip))->devi_state & DEVI_S_INVOKING_DACF) \
394 		== DEVI_S_INVOKING_DACF)
395 
396 #define	DEVI_SET_INVOKING_DACF(dip) \
397 	(DEVI((dip))->devi_state |= DEVI_S_INVOKING_DACF)
398 
399 #define	DEVI_CLR_INVOKING_DACF(dip) \
400 	(DEVI((dip))->devi_state &= ~DEVI_S_INVOKING_DACF)
401 
402 #define	DEVI_SET_EVADD(dip) \
403 	(DEVI((dip))->devi_state &= ~DEVI_S_EVREMOVE); \
404 	(DEVI((dip))->devi_state |= DEVI_S_EVADD);
405 
406 #define	DEVI_SET_EVREMOVE(dip) \
407 	(DEVI((dip))->devi_state &= ~DEVI_S_EVADD); \
408 	(DEVI((dip))->devi_state |= DEVI_S_EVREMOVE);
409 
410 #define	DEVI_SET_EVUNINIT(dip) \
411 	(DEVI((dip))->devi_state &= ~(DEVI_S_EVADD | DEVI_S_EVREMOVE))
412 
413 #define	DEVI_EVADD(dip) \
414 	(DEVI((dip))->devi_state & DEVI_S_EVADD)
415 
416 #define	DEVI_EVREMOVE(dip) \
417 	(DEVI((dip))->devi_state & DEVI_S_EVREMOVE)
418 
419 /* need to call the devo_reset entry point for this device at shutdown */
420 #define	DEVI_NEED_RESET(dip) \
421 	((DEVI((dip))->devi_state & DEVI_S_NEED_RESET) \
422 		== DEVI_S_NEED_RESET)
423 
424 #define	DEVI_SET_NEED_RESET(dip) \
425 	(DEVI((dip))->devi_state |= DEVI_S_NEED_RESET)
426 
427 #define	DEVI_CLR_NEED_RESET(dip) \
428 	(DEVI((dip))->devi_state &= ~DEVI_S_NEED_RESET)
429 
430 
431 void i_devi_enter(dev_info_t *, uint_t s_mask, uint_t w_mask, int has_lock);
432 void i_devi_exit(dev_info_t *, uint_t c_mask, int has_lock);
433 
434 char *i_ddi_devi_class(dev_info_t *);
435 int i_ddi_set_devi_class(dev_info_t *, char *, int);
436 
437 /*
438  * This structure represents one piece of bus space occupied by a given
439  * device. It is used in an array for devices with multiple address windows.
440  */
441 struct regspec {
442 	uint_t regspec_bustype;		/* cookie for bus type it's on */
443 	uint_t regspec_addr;		/* address of reg relative to bus */
444 	uint_t regspec_size;		/* size of this register set */
445 };
446 
447 /*
448  * This structure represents one piece of nexus bus space.
449  * It is used in an array for nexi with multiple bus spaces
450  * to define the childs offsets in the parents bus space.
451  */
452 struct rangespec {
453 	uint_t rng_cbustype;		/* Child's address, hi order */
454 	uint_t rng_coffset;		/* Child's address, lo order */
455 	uint_t rng_bustype;		/* Parent's address, hi order */
456 	uint_t rng_offset;		/* Parent's address, lo order */
457 	uint_t rng_size;		/* size of space for this entry */
458 };
459 
460 #ifdef _KERNEL
461 
462 typedef enum {
463 	DDI_PRE = 0,
464 	DDI_POST = 1
465 } ddi_pre_post_t;
466 
467 /*
468  * This structure represents notification of a child attach event
469  * These could both be the same if attach/detach commands were in the
470  * same name space.
471  * Note that the target dip is passed as an arg already.
472  */
473 struct attachspec {
474 	ddi_attach_cmd_t cmd;	/* type of event */
475 	ddi_pre_post_t	when;	/* one of DDI_PRE or DDI_POST */
476 	dev_info_t	*pdip;	/* parent of attaching node */
477 	int		result;	/* result of attach op (post command only) */
478 };
479 
480 /*
481  * This structure represents notification of a child detach event
482  * Note that the target dip is passed as an arg already.
483  */
484 struct detachspec {
485 	ddi_detach_cmd_t cmd;	/* type of event */
486 	ddi_pre_post_t	when;	/* one of DDI_PRE or DDI_POST */
487 	dev_info_t	*pdip;	/* parent of detaching node */
488 	int		result;	/* result of detach op (post command only) */
489 };
490 
491 #endif /* _KERNEL */
492 
493 typedef enum {
494 	DDM_MINOR = 0,
495 	DDM_ALIAS,
496 	DDM_DEFAULT,
497 	DDM_INTERNAL_PATH
498 } ddi_minor_type;
499 
500 /* implementation flags for driver specified device access control */
501 #define	DM_NO_FSPERM	0x1
502 
503 struct devplcy;
504 
505 struct ddi_minor {
506 	char		*name;		/* name of node */
507 	dev_t		dev;		/* device number */
508 	int		spec_type;	/* block or char */
509 	int		flags;		/* access flags */
510 	char		*node_type;	/* block, byte, serial, network */
511 	struct devplcy	*node_priv;	/* privilege for this minor */
512 	mode_t		priv_mode;	/* default apparent privilege mode */
513 };
514 
515 /*
516  * devi_node_attributes contains node attributes private to the
517  * ddi implementation. As a consumer, do not use these bit definitions
518  * directly, use the ndi functions that check for the existence of the
519  * specific node attributes.
520  *
521  * DDI_PERSISTENT indicates a 'persistent' node; one that is not
522  * automatically freed by the framework if the driver is unloaded
523  * or the driver fails to attach to this node.
524  *
525  * DDI_AUTO_ASSIGNED_NODEID indicates that the nodeid was auto-assigned
526  * by the framework and should be auto-freed if the node is removed.
527  *
528  * DDI_VHCI_NODE indicates that the node type is VHCI. This flag
529  * must be set by ndi_devi_config_vhci() routine only.
530  */
531 #define	DDI_PERSISTENT			0x01
532 #define	DDI_AUTO_ASSIGNED_NODEID	0x02
533 #define	DDI_VHCI_NODE			0x04
534 
535 /*
536  * The ddi_minor_data structure gets filled in by ddi_create_minor_node.
537  * It then gets attached to the devinfo node as a property.
538  */
539 struct ddi_minor_data {
540 	struct ddi_minor_data *next;	/* next one in the chain */
541 	dev_info_t	*dip;		/* pointer to devinfo node */
542 	ddi_minor_type	type;		/* Following data type */
543 	struct ddi_minor d_minor;	/* Actual minor node data */
544 };
545 
546 #define	ddm_name	d_minor.name
547 #define	ddm_dev		d_minor.dev
548 #define	ddm_flags	d_minor.flags
549 #define	ddm_spec_type	d_minor.spec_type
550 #define	ddm_node_type	d_minor.node_type
551 #define	ddm_node_priv	d_minor.node_priv
552 #define	ddm_priv_mode	d_minor.priv_mode
553 
554 /*
555  * parent private data structure contains register, interrupt, property
556  * and range information.
557  */
558 struct ddi_parent_private_data {
559 	int par_nreg;			/* number of regs */
560 	struct regspec *par_reg;	/* array of regs */
561 	int par_nintr;			/* number of interrupts */
562 	struct intrspec *par_intr;	/* array of possible interrupts */
563 	int par_nrng;			/* number of ranges */
564 	struct rangespec *par_rng;	/* array of ranges */
565 };
566 #define	DEVI_PD(d)	\
567 	((struct ddi_parent_private_data *)DEVI((d))->devi_parent_data)
568 
569 #define	sparc_pd_getnreg(dev)		(DEVI_PD(dev)->par_nreg)
570 #define	sparc_pd_getnintr(dev)		(DEVI_PD(dev)->par_nintr)
571 #define	sparc_pd_getnrng(dev)		(DEVI_PD(dev)->par_nrng)
572 #define	sparc_pd_getreg(dev, n)		(&DEVI_PD(dev)->par_reg[(n)])
573 #define	sparc_pd_getintr(dev, n)	(&DEVI_PD(dev)->par_intr[(n)])
574 #define	sparc_pd_getrng(dev, n)		(&DEVI_PD(dev)->par_rng[(n)])
575 
576 /*
577  * This data structure is entirely private to the soft state allocator.
578  */
579 struct i_ddi_soft_state {
580 	void		**array;	/* the array of pointers */
581 	kmutex_t	lock;	/* serialize access to this struct */
582 	size_t		size;	/* how many bytes per state struct */
583 	size_t		n_items;	/* how many structs herein */
584 	struct i_ddi_soft_state *next;	/* 'dirty' elements */
585 };
586 
587 /*
588  * Solaris DDI DMA implementation structure and function definitions.
589  *
590  * Note: no callers of DDI functions must depend upon data structures
591  * declared below. They are not guaranteed to remain constant.
592  */
593 
594 /*
595  * Implementation DMA mapping structure.
596  *
597  * The publicly visible ddi_dma_req structure is filled
598  * in by a caller that wishes to map a memory object
599  * for DMA. Internal to this implementation of the public
600  * DDI DMA functions this request structure is put together
601  * with bus nexus specific functions that have additional
602  * information and constraints as to how to go about doing
603  * the requested mapping function
604  *
605  * In this implementation, some of the information from the
606  * original requester is retained throughout the lifetime
607  * of the I/O mapping being active.
608  */
609 
610 /*
611  * This is the implementation specific description
612  * of how we've mapped an object for DMA.
613  */
614 #if defined(__sparc)
615 typedef struct ddi_dma_impl {
616 	/*
617 	 * DMA mapping information
618 	 */
619 	ulong_t	dmai_mapping;	/* mapping cookie */
620 
621 	/*
622 	 * Size of the current mapping, in bytes.
623 	 *
624 	 * Note that this is distinct from the size of the object being mapped
625 	 * for DVMA. We might have only a portion of the object mapped at any
626 	 * given point in time.
627 	 */
628 	uint_t	dmai_size;
629 
630 	/*
631 	 * Offset, in bytes, into object that is currently mapped.
632 	 */
633 	off_t	dmai_offset;
634 
635 	/*
636 	 * Information gathered from the original DMA mapping
637 	 * request and saved for the lifetime of the mapping.
638 	 */
639 	uint_t		dmai_minxfer;
640 	uint_t		dmai_burstsizes;
641 	uint_t		dmai_ndvmapages;
642 	uint_t		dmai_pool;	/* cached DVMA space */
643 	uint_t		dmai_rflags;	/* requester's flags + ours */
644 	uint_t		dmai_inuse;	/* active handle? */
645 	uint_t		dmai_nwin;
646 	uint_t		dmai_winsize;
647 	caddr_t		dmai_nexus_private;
648 	void		*dmai_iopte;
649 	uint_t		*dmai_sbi;
650 	void		*dmai_minfo;	/* random mapping information */
651 	dev_info_t	*dmai_rdip;	/* original requester's dev_info_t */
652 	ddi_dma_obj_t	dmai_object;	/* requester's object */
653 	ddi_dma_attr_t	dmai_attr;	/* DMA attributes */
654 	ddi_dma_cookie_t *dmai_cookie;	/* pointer to first DMA cookie */
655 
656 	int		(*dmai_fault_check)(struct ddi_dma_impl *handle);
657 	void		(*dmai_fault_notify)(struct ddi_dma_impl *handle);
658 	int		dmai_fault;
659 	ndi_err_t	dmai_error;
660 
661 } ddi_dma_impl_t;
662 
663 #elif defined(__x86)
664 
665 #define	DMAMI_KVADR		0x05
666 #define	DMAMI_UVADR		0x09
667 #define	DMAMI_PAGES		0x0b
668 #define	DMAI_SOMEMORE_COOKIES	4
669 
670 typedef struct ddi_dma_impl {
671 
672 	ulong_t	dmai_kmsize;
673 
674 	ddi_dma_cookie_t *dmai_additionalcookiep;
675 
676 	struct impl_dma_segment *dmai_hds;	/* head of list of segments */
677 
678 	struct impl_dma_segment *dmai_wins;	/* ptr to first segment of */
679 						/* current window */
680 
681 	caddr_t		dmai_ibufp;	/* intermediate buffer address */
682 	uint64_t	dmai_segmentsize;
683 	ulong_t		dmai_ibfsz;	/* intermediate buffer size */
684 
685 	caddr_t		dmai_kaddr;	/* kernel addr for page mapping */
686 
687 	/*
688 	 * Information gathered from the original dma mapping
689 	 * request and saved for the lifetime of the mapping.
690 	 */
691 	uint_t		dmai_minxfer;
692 	uint_t		dmai_burstsizes;
693 	uint_t		dmai_rflags;	/* requester's flags + ours */
694 	uint_t		dmai_inuse;
695 	int		dmai_nwin;
696 	void		*dmai_segp;
697 	void		*dmai_minfo;	/* random mapping information */
698 	dev_info_t	*dmai_rdip;	/* original requester's dev_info_t */
699 	ddi_dma_obj_t	dmai_object;	/* requester's object */
700 
701 	/*
702 	 * mctl function addr for express processing
703 	 */
704 	int		(*dmai_mctl)(dev_info_t *, dev_info_t *,
705 	    ddi_dma_handle_t, enum ddi_dma_ctlops, off_t *, size_t *,
706 	    caddr_t *, uint_t);
707 
708 	ddi_dma_attr_t	dmai_attr;	/* DMA attributes */
709 	ddi_dma_cookie_t *dmai_cookie;
710 
711 	int		(*dmai_fault_check)(struct ddi_dma_impl *handle);
712 	void		(*dmai_fault_notify)(struct ddi_dma_impl *handle);
713 	int		dmai_fault;
714 	ndi_err_t	dmai_error;
715 
716 } ddi_dma_impl_t;
717 
718 #else
719 #error "struct ddi_dma_impl not defined for this architecture"
720 #endif  /* defined(__sparc) */
721 
722 /*
723  * For now DMA segments share state with the DMA handle
724  */
725 typedef ddi_dma_impl_t ddi_dma_seg_impl_t;
726 
727 /*
728  * These flags use reserved bits from the dma request flags.
729  *
730  * A note about the DMP_NOSYNC flags: the root nexus will
731  * set these as it sees best. If an intermediate nexus
732  * actually needs these operations, then during the unwind
733  * from the call to ddi_dma_bind, the nexus driver *must*
734  * clear the appropriate flag(s). This is because, as an
735  * optimization, ddi_dma_sync(9F) looks at these flags before
736  * deciding to spend the time going back up the tree.
737  */
738 
739 #define	_DMCM1	DDI_DMA_RDWR|DDI_DMA_REDZONE|DDI_DMA_PARTIAL
740 #define	_DMCM2	DDI_DMA_CONSISTENT|DMP_VMEREQ
741 #define	DMP_DDIFLAGS	(_DMCM1|_DMCM2)
742 #define	DMP_SHADOW	0x20
743 #define	DMP_LKIOPB	0x40
744 #define	DMP_LKSYSV	0x80
745 #define	DMP_IOCACHE	0x100
746 #define	DMP_USEHAT	0x200
747 #define	DMP_PHYSADDR	0x400
748 #define	DMP_INVALID	0x800
749 #define	DMP_NOLIMIT	0x1000
750 #define	DMP_VMEREQ	0x10000000
751 #define	DMP_BYPASSNEXUS	0x20000000
752 #define	DMP_NODEVSYNC	0x40000000
753 #define	DMP_NOCPUSYNC	0x80000000
754 #define	DMP_NOSYNC	(DMP_NODEVSYNC|DMP_NOCPUSYNC)
755 
756 /*
757  * In order to complete a device to device mapping that
758  * has percolated as high as an IU nexus (gone that high
759  * because the DMA request is a VADDR type), we define
760  * structure to use with the DDI_CTLOPS_DMAPMAPC request
761  * that re-traverses the request tree to finish the
762  * DMA 'mapping' for a device.
763  */
764 struct dma_phys_mapc {
765 	struct ddi_dma_req *dma_req;	/* original request */
766 	ddi_dma_impl_t *mp;		/* current handle, or none */
767 	int nptes;			/* number of ptes */
768 	void *ptes;			/* ptes already read */
769 };
770 
771 /*
772  * Implementation DMA segment structure.
773  *
774  * This is a superset of the ddi_dma_cookie structure that describes
775  * one of the physical memory segments into which the memory object
776  * was broken up.
777  */
778 #if defined(__x86)
779 typedef struct impl_dma_segment {
780 	struct impl_dma_segment	*dmais_link;	/* to next segment */
781 	struct ddi_dma_impl	*dmais_hndl;	/* to dma handle */
782 	ddi_dma_cookie_t	*dmais_cookie;
783 	union {
784 		struct impl_dma_segment	*_dmais_nex;	/* to 1st seg of */
785 							/* next window */
786 		struct impl_dma_segment	*_dmais_cur;	/* to 1st seg of */
787 							/* this window */
788 	} _win;
789 	ulong_t		dmais_ofst;		/* 32-bit offset */
790 	union {
791 		caddr_t		_dmais_va;	/* 32-bit virtual address */
792 		page_t		*_dmais_pp;	/* page pointer */
793 	} _vdmu;
794 	union {
795 		uint64_t 	_dmais_lpd;	/* 64-bit physical address */
796 		uint32_t 	_dmais_pd;	/* 32-bit physical address */
797 		ushort_t	_dmais_pw[2];   /* 2x16-bit address */
798 		caddr_t		_dmais_kva;	/* pio kernel virtual address */
799 	} _pdmu;
800 	ulong_t		dmais_size;		/* size of cookie in bytes */
801 	ushort_t	dmais_flags;		/* bus specific flag bits */
802 	ushort_t	dmais_xxx;		/* unused filler */
803 } impl_dma_segment_t;
804 #endif	/* __x86 */
805 
806 /*
807  * flags
808  */
809 #define	DMAIS_NEEDINTBUF	0x0100
810 #define	DMAIS_COMPLEMENT	0x0200
811 #define	DMAIS_NOMERGE		DMAIS_NEEDINTBUF | DMAIS_COMPLEMENT
812 #define	DMAIS_MAPPAGE		0x0400
813 #define	DMAIS_PAGEPTR		0x0800
814 #define	DMAIS_WINSTRT		0x1000	/* this segment is window start */
815 #define	DMAIS_WINUIB		0x2000	/* window uses intermediate buffers */
816 #define	DMAIS_WINEND		0x8000	/* this segment is window end */
817 
818 #define	MAXCALLBACK		20
819 
820 /*
821  * Callback definitions
822  */
823 struct ddi_callback {
824 	struct ddi_callback 	*c_nfree;
825 	struct ddi_callback 	*c_nlist;
826 	int			(*c_call)();
827 	int			c_count;
828 	caddr_t			c_arg;
829 	size_t			c_size;
830 };
831 
832 
833 /*
834  * Device id - Internal definition.
835  */
836 #define	DEVID_MAGIC_MSB		0x69
837 #define	DEVID_MAGIC_LSB		0x64
838 #define	DEVID_REV_MSB		0x00
839 #define	DEVID_REV_LSB		0x01
840 #define	DEVID_HINT_SIZE		4
841 
842 typedef struct impl_devid {
843 	uchar_t	did_magic_hi;			/* device id magic # (msb) */
844 	uchar_t	did_magic_lo;			/* device id magic # (lsb) */
845 	uchar_t	did_rev_hi;			/* device id revision # (msb) */
846 	uchar_t	did_rev_lo;			/* device id revision # (lsb) */
847 	uchar_t	did_type_hi;			/* device id type (msb) */
848 	uchar_t	did_type_lo;			/* device id type (lsb) */
849 	uchar_t	did_len_hi;			/* length of devid data (msb) */
850 	uchar_t	did_len_lo;			/* length of devid data (lsb) */
851 	char	did_driver[DEVID_HINT_SIZE];	/* driver name - HINT */
852 	char	did_id[1];			/* start of device id data */
853 } impl_devid_t;
854 
855 #define	DEVID_GETTYPE(devid)		((ushort_t) \
856 					    (((devid)->did_type_hi << NBBY) + \
857 					    (devid)->did_type_lo))
858 
859 #define	DEVID_FORMTYPE(devid, type)	(devid)->did_type_hi = hibyte((type)); \
860 					(devid)->did_type_lo = lobyte((type));
861 
862 #define	DEVID_GETLEN(devid)		((ushort_t) \
863 					    (((devid)->did_len_hi << NBBY) + \
864 					    (devid)->did_len_lo))
865 
866 #define	DEVID_FORMLEN(devid, len)	(devid)->did_len_hi = hibyte((len)); \
867 					(devid)->did_len_lo = lobyte((len));
868 
869 /*
870  * Per PSARC/1995/352, a binary devid contains fields for <magic number>,
871  * <revision>, <driver_hint>, <type>, <id_length>, and the <id> itself.
872  * This proposal would encode the binary devid into a string consisting
873  * of "<magic><revision>,<driver_hint>@<type><id>" as indicated below
874  * (<id_length> is rederived from the length of the string
875  * representation of the <id>):
876  *
877  *	<magic>		->"id"
878  *
879  *	<rev>		->"%d"	// "0" -> type of DEVID_NONE  "id0"
880  *				// NOTE: PSARC/1995/352 <revision> is "1".
881  *				// NOTE: support limited to 10 revisions
882  *				//	in current implementation
883  *
884  *	<driver_hint>	->"%s"	// "sd"/"ssd"
885  *				// NOTE: driver names limited to 4
886  *				//	characters for <revision> "1"
887  *
888  *	<type>		->'w' |	// DEVID_SCSI3_WWN	<hex_id>
889  *			'W' |	// DEVID_SCSI3_WWN	<ascii_id>
890  *			't' |	// DEVID_SCSI3_VPD_T10	<hex_id>
891  *			'T' |	// DEVID_SCSI3_VPD_T10	<ascii_id>
892  *			'x' |	// DEVID_SCSI3_VPD_EUI	<hex_id>
893  *			'X' |	// DEVID_SCSI3_VPD_EUI	<ascii_id>
894  *			'n' |	// DEVID_SCSI3_VPD_NAA	<hex_id>
895  *			'N' |	// DEVID_SCSI3_VPD_NAA	<ascii_id>
896  *			's' |	// DEVID_SCSI_SERIAL	<hex_id>
897  *			'S' |	// DEVID_SCSI_SERIAL	<ascii_id>
898  *			'f' |	// DEVID_FAB		<hex_id>
899  *			'F' |	// DEVID_FAB		<ascii_id>
900  *			'e' |	// DEVID_ENCAP		<hex_id>
901  *			'E' |	// DEVID_ENCAP		<ascii_id>
902  *			'a' |	// DEVID_ATA_SERIAL	<hex_id>
903  *			'A' |	// DEVID_ATA_SERIAL	<ascii_id>
904  *			'u' |	// unknown		<hex_id>
905  *			'U'	// unknown		<ascii_id>
906  *                		// NOTE: lower case -> <hex_id>
907  *				//       upper case -> <ascii_id>
908  *				// NOTE: this covers all types currently
909  *				// 	defined for <revision> 1.
910  *				// NOTE: a <type> can be added
911  *				//	without changing the <revision>.
912  *
913  *	<id>		-> <ascii_id> |	// <type> is upper case
914  *			<hex_id>	// <type> is lower case
915  *
916  *	<ascii_id>	// only if all bytes of binary <id> field
917  *			// are in the set:
918  *			//	[A-Z][a-z][0-9]+-.= and space and 0x00
919  *			// the encoded form is:
920  *			//	[A-Z][a-z][0-9]+-.= and _     and ~
921  *			//          NOTE: ' ' <=> '_', 0x00 <=> '~'
922  *			// these sets are chosen to avoid shell
923  *			// and conflicts with DDI node names.
924  *
925  *	<hex_id>	// if not <ascii_id>; each byte of binary
926  *			// <id> maps a to 2 digit ascii hex
927  *			// representation in the string.
928  *
929  * This encoding provides a meaningful correlation between the /devices
930  * path and the devid string where possible.
931  *
932  *   Fibre:
933  *	sbus@6,0/SUNW,socal@d,10000/sf@1,0/ssd@w21000020370bb488,0:c,raw
934  *      id1,ssd@w20000020370bb488:c,raw
935  *
936  *   Copper:
937  *	sbus@7,0/SUNW,fas@3,8800000/sd@a,0:c
938  *      id1,sd@SIBM_____1XY210__________:c
939  */
940 /* determine if a byte of an id meets ASCII representation requirements */
941 #define	DEVID_IDBYTE_ISASCII(b)		(				\
942 	(((b) >= 'a') && ((b) <= 'z')) ||				\
943 	(((b) >= 'A') && ((b) <= 'Z')) ||				\
944 	(((b) >= '0') && ((b) <= '9')) ||				\
945 	(b == '+') || (b == '-') || (b == '.') || (b == '=') ||		\
946 	(b == ' ') || (b == 0x00))
947 
948 /* set type to lower case to indicate that the did_id field is ascii */
949 #define	DEVID_TYPE_SETASCII(c)	(c - 0x20)	/* 'a' -> 'A' */
950 
951 /* determine from type if did_id field is binary or ascii */
952 #define	DEVID_TYPE_ISASCII(c)	(((c) >= 'A') && ((c) <= 'Z'))
953 
954 /* convert type field from binary to ascii */
955 #define	DEVID_TYPE_BINTOASCII(b)	(				\
956 	((b) == DEVID_SCSI3_WWN)	? 'w' :				\
957 	((b) == DEVID_SCSI3_VPD_T10)	? 't' :				\
958 	((b) == DEVID_SCSI3_VPD_EUI)	? 'x' :				\
959 	((b) == DEVID_SCSI3_VPD_NAA)	? 'n' :				\
960 	((b) == DEVID_SCSI_SERIAL)	? 's' :				\
961 	((b) == DEVID_FAB)		? 'f' :				\
962 	((b) == DEVID_ENCAP)		? 'e' :				\
963 	((b) == DEVID_ATA_SERIAL)	? 'a' :				\
964 	'u')						/* unknown */
965 
966 /* convert type field from ascii to binary */
967 #define	DEVID_TYPE_ASCIITOBIN(c)	(				\
968 	(((c) == 'w') || ((c) == 'W'))	? DEVID_SCSI3_WWN :		\
969 	(((c) == 't') || ((c) == 'T'))	? DEVID_SCSI3_VPD_T10 :		\
970 	(((c) == 'x') || ((c) == 'X'))	? DEVID_SCSI3_VPD_EUI :		\
971 	(((c) == 'n') || ((c) == 'N'))	? DEVID_SCSI3_VPD_NAA :		\
972 	(((c) == 's') || ((c) == 'S'))	? DEVID_SCSI_SERIAL :		\
973 	(((c) == 'f') || ((c) == 'F'))	? DEVID_FAB :			\
974 	(((c) == 'e') || ((c) == 'E'))	? DEVID_ENCAP :			\
975 	(((c) == 'a') || ((c) == 'A'))	? DEVID_ATA_SERIAL :		\
976 	DEVID_MAXTYPE +1)				/* unknown */
977 
978 /* determine if the type should be forced to hex encoding (non-ascii) */
979 #define	DEVID_TYPE_BIN_FORCEHEX(b) (	\
980 	((b) == DEVID_SCSI3_WWN) ||	\
981 	((b) == DEVID_SCSI3_VPD_EUI) ||	\
982 	((b) == DEVID_SCSI3_VPD_NAA) ||	\
983 	((b) == DEVID_FAB))
984 
985 /* determine if the type is from a scsi3 vpd */
986 #define	IS_DEVID_SCSI3_VPD_TYPE(b) (	\
987 	((b) == DEVID_SCSI3_VPD_T10) ||	\
988 	((b) == DEVID_SCSI3_VPD_EUI) ||	\
989 	((b) == DEVID_SCSI3_VPD_NAA))
990 
991 /* convert rev field from binary to ascii (only supports 10 revs) */
992 #define	DEVID_REV_BINTOASCII(b) (b + '0')
993 
994 /* convert rev field from ascii to binary (only supports 10 revs) */
995 #define	DEVID_REV_ASCIITOBIN(c) (c - '0')
996 
997 /* name of devid property */
998 #define	DEVID_PROP_NAME	"devid"
999 
1000 /*
1001  * prop_name used by pci_{save,restore}_config_regs()
1002  */
1003 #define	SAVED_CONFIG_REGS "pci-config-regs"
1004 #define	SAVED_CONFIG_REGS_MASK "pcie-config-regs-mask"
1005 #define	SAVED_CONFIG_REGS_CAPINFO "pci-cap-info"
1006 
1007 typedef struct pci_config_header_state {
1008 	uint16_t	chs_command;
1009 	uint8_t		chs_cache_line_size;
1010 	uint8_t		chs_latency_timer;
1011 	uint8_t		chs_header_type;
1012 	uint8_t		chs_sec_latency_timer;
1013 	uint8_t		chs_bridge_control;
1014 	uint32_t	chs_base0;
1015 	uint32_t	chs_base1;
1016 	uint32_t	chs_base2;
1017 	uint32_t	chs_base3;
1018 	uint32_t	chs_base4;
1019 	uint32_t	chs_base5;
1020 } pci_config_header_state_t;
1021 
1022 #ifdef _KERNEL
1023 
1024 typedef struct pci_cap_save_desc {
1025 	uint16_t	cap_offset;
1026 	uint16_t	cap_id;
1027 	uint32_t	cap_nregs;
1028 } pci_cap_save_desc_t;
1029 
1030 typedef struct pci_cap_entry {
1031 	uint16_t		cap_id;
1032 	uint32_t		cap_ndwords;
1033 	uint32_t (*cap_save_func)(ddi_acc_handle_t confhdl, uint16_t cap_ptr,
1034 	    uint32_t *regbuf, uint32_t ndwords);
1035 } pci_cap_entry_t;
1036 
1037 #endif /* _KERNEL */
1038 
1039 #ifdef	__cplusplus
1040 }
1041 #endif
1042 
1043 #endif	/* _SYS_DDI_IMPLDEFS_H */
1044