xref: /onnv-gate/usr/src/uts/common/sys/sunndi.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 2004 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef	_SYS_SUNNDI_H
28*0Sstevel@tonic-gate #define	_SYS_SUNNDI_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate /*
33*0Sstevel@tonic-gate  * Sun Specific NDI definitions
34*0Sstevel@tonic-gate  */
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate 
37*0Sstevel@tonic-gate #include <sys/esunddi.h>
38*0Sstevel@tonic-gate #include <sys/sunddi.h>
39*0Sstevel@tonic-gate #include <sys/obpdefs.h>
40*0Sstevel@tonic-gate 
41*0Sstevel@tonic-gate #ifdef	__cplusplus
42*0Sstevel@tonic-gate extern "C" {
43*0Sstevel@tonic-gate #endif
44*0Sstevel@tonic-gate 
45*0Sstevel@tonic-gate #ifdef _KERNEL
46*0Sstevel@tonic-gate 
47*0Sstevel@tonic-gate #define	NDI_SUCCESS	DDI_SUCCESS	/* successful return */
48*0Sstevel@tonic-gate #define	NDI_FAILURE	DDI_FAILURE	/* unsuccessful return */
49*0Sstevel@tonic-gate #define	NDI_NOMEM	-2	/* failed to allocate resources */
50*0Sstevel@tonic-gate #define	NDI_BADHANDLE	-3	/* bad handle passed to in function */
51*0Sstevel@tonic-gate #define	NDI_FAULT	-4	/* fault during copyin/copyout */
52*0Sstevel@tonic-gate #define	NDI_BUSY	-5	/* device busy - could not offline */
53*0Sstevel@tonic-gate #define	NDI_UNBOUND	-6	/* device not bound to a driver */
54*0Sstevel@tonic-gate 
55*0Sstevel@tonic-gate /*
56*0Sstevel@tonic-gate  * Property functions:   See also, ddipropdefs.h.
57*0Sstevel@tonic-gate  *			In general, the underlying driver MUST be held
58*0Sstevel@tonic-gate  *			to call it's property functions.
59*0Sstevel@tonic-gate  */
60*0Sstevel@tonic-gate 
61*0Sstevel@tonic-gate /*
62*0Sstevel@tonic-gate  * Used to create boolean properties
63*0Sstevel@tonic-gate  */
64*0Sstevel@tonic-gate int
65*0Sstevel@tonic-gate ndi_prop_create_boolean(dev_t match_dev, dev_info_t *dip, char *name);
66*0Sstevel@tonic-gate 
67*0Sstevel@tonic-gate /*
68*0Sstevel@tonic-gate  * Used to create, modify, and lookup integer properties
69*0Sstevel@tonic-gate  */
70*0Sstevel@tonic-gate int
71*0Sstevel@tonic-gate ndi_prop_update_int(dev_t match_dev, dev_info_t *dip, char *name, int data);
72*0Sstevel@tonic-gate 
73*0Sstevel@tonic-gate int
74*0Sstevel@tonic-gate ndi_prop_update_int_array(dev_t match_dev, dev_info_t *dip, char *name,
75*0Sstevel@tonic-gate     int *data, uint_t nelements);
76*0Sstevel@tonic-gate 
77*0Sstevel@tonic-gate int
78*0Sstevel@tonic-gate ndi_prop_update_int64(dev_t match_dev, dev_info_t *dip, char *name,
79*0Sstevel@tonic-gate     int64_t data);
80*0Sstevel@tonic-gate 
81*0Sstevel@tonic-gate int
82*0Sstevel@tonic-gate ndi_prop_update_int64_array(dev_t match_dev, dev_info_t *dip, char *name,
83*0Sstevel@tonic-gate     int64_t *data, uint_t nelements);
84*0Sstevel@tonic-gate 
85*0Sstevel@tonic-gate /*
86*0Sstevel@tonic-gate  * Used to create, modify, and lookup string properties
87*0Sstevel@tonic-gate  */
88*0Sstevel@tonic-gate int
89*0Sstevel@tonic-gate ndi_prop_update_string(dev_t match_dev, dev_info_t *dip, char *name,
90*0Sstevel@tonic-gate     char *data);
91*0Sstevel@tonic-gate 
92*0Sstevel@tonic-gate int
93*0Sstevel@tonic-gate ndi_prop_update_string_array(dev_t match_dev, dev_info_t *dip,
94*0Sstevel@tonic-gate     char *name, char **data, uint_t nelements);
95*0Sstevel@tonic-gate 
96*0Sstevel@tonic-gate /*
97*0Sstevel@tonic-gate  * Used to create, modify, and lookup byte properties
98*0Sstevel@tonic-gate  */
99*0Sstevel@tonic-gate int
100*0Sstevel@tonic-gate ndi_prop_update_byte_array(dev_t match_dev, dev_info_t *dip,
101*0Sstevel@tonic-gate     char *name, uchar_t *data, uint_t nelements);
102*0Sstevel@tonic-gate 
103*0Sstevel@tonic-gate /*
104*0Sstevel@tonic-gate  * Used to remove properties
105*0Sstevel@tonic-gate  */
106*0Sstevel@tonic-gate int
107*0Sstevel@tonic-gate ndi_prop_remove(dev_t dev, dev_info_t *dip, char *name);
108*0Sstevel@tonic-gate 
109*0Sstevel@tonic-gate void
110*0Sstevel@tonic-gate ndi_prop_remove_all(dev_info_t *dip);
111*0Sstevel@tonic-gate 
112*0Sstevel@tonic-gate /*
113*0Sstevel@tonic-gate  * Nexus Driver Functions
114*0Sstevel@tonic-gate  */
115*0Sstevel@tonic-gate /*
116*0Sstevel@tonic-gate  * Allocate and initialize a new dev_info structure.
117*0Sstevel@tonic-gate  * This routine will often be called at interrupt time by a nexus in
118*0Sstevel@tonic-gate  * response to a hotplug event, therefore memory allocations are
119*0Sstevel@tonic-gate  * not allowed to sleep.
120*0Sstevel@tonic-gate  */
121*0Sstevel@tonic-gate int
122*0Sstevel@tonic-gate ndi_devi_alloc(dev_info_t *parent, char *node_name, dnode_t nodeid,
123*0Sstevel@tonic-gate     dev_info_t **ret_dip);
124*0Sstevel@tonic-gate 
125*0Sstevel@tonic-gate void
126*0Sstevel@tonic-gate ndi_devi_alloc_sleep(dev_info_t *parent, char *node_name, dnode_t nodeid,
127*0Sstevel@tonic-gate     dev_info_t **ret_dip);
128*0Sstevel@tonic-gate 
129*0Sstevel@tonic-gate /*
130*0Sstevel@tonic-gate  * Remove an initialized (but not yet attached) dev_info
131*0Sstevel@tonic-gate  * node from it's parent.
132*0Sstevel@tonic-gate  */
133*0Sstevel@tonic-gate int
134*0Sstevel@tonic-gate ndi_devi_free(dev_info_t *dip);
135*0Sstevel@tonic-gate 
136*0Sstevel@tonic-gate /* devinfo locking: use DEVI_BUSY_OWNED in ASSERTs to verify */
137*0Sstevel@tonic-gate void ndi_devi_enter(dev_info_t *dip, int *circ);
138*0Sstevel@tonic-gate void ndi_devi_exit(dev_info_t *dip, int circ);
139*0Sstevel@tonic-gate int ndi_devi_tryenter(dev_info_t *dip, int *circ);
140*0Sstevel@tonic-gate 
141*0Sstevel@tonic-gate /* devinfo ref counting */
142*0Sstevel@tonic-gate void ndi_hold_devi(dev_info_t *dip);
143*0Sstevel@tonic-gate void ndi_rele_devi(dev_info_t *dip);
144*0Sstevel@tonic-gate 
145*0Sstevel@tonic-gate /* driver ref counting */
146*0Sstevel@tonic-gate struct dev_ops *ndi_hold_driver(dev_info_t *dip);
147*0Sstevel@tonic-gate void ndi_rele_driver(dev_info_t *dip);
148*0Sstevel@tonic-gate 
149*0Sstevel@tonic-gate /*
150*0Sstevel@tonic-gate  * Change the node name
151*0Sstevel@tonic-gate  */
152*0Sstevel@tonic-gate int
153*0Sstevel@tonic-gate ndi_devi_set_nodename(dev_info_t *dip, char *name, int flags);
154*0Sstevel@tonic-gate 
155*0Sstevel@tonic-gate /*
156*0Sstevel@tonic-gate  * Place the devinfo in the DS_BOUND state,
157*0Sstevel@tonic-gate  * binding a driver to the device
158*0Sstevel@tonic-gate  *
159*0Sstevel@tonic-gate  * Flags:
160*0Sstevel@tonic-gate  *	all flags are ignored.
161*0Sstevel@tonic-gate  */
162*0Sstevel@tonic-gate int
163*0Sstevel@tonic-gate ndi_devi_bind_driver(dev_info_t *dip, uint_t flags);
164*0Sstevel@tonic-gate 
165*0Sstevel@tonic-gate /*
166*0Sstevel@tonic-gate  * Asynchronous version of ndi_devi_bind_driver, callable from
167*0Sstevel@tonic-gate  * interrupt context. The dip must be a persistent node.
168*0Sstevel@tonic-gate  */
169*0Sstevel@tonic-gate int
170*0Sstevel@tonic-gate ndi_devi_bind_driver_async(dev_info_t *dip, uint_t flags);
171*0Sstevel@tonic-gate 
172*0Sstevel@tonic-gate /*
173*0Sstevel@tonic-gate  * Return devctl state of the child addressed by "name@addr".
174*0Sstevel@tonic-gate  * For use by a driver's DEVCTL_DEVICE_GETSTATE handler.
175*0Sstevel@tonic-gate  */
176*0Sstevel@tonic-gate int
177*0Sstevel@tonic-gate ndi_devctl_device_getstate(dev_info_t *parent, struct devctl_iocdata *dcp,
178*0Sstevel@tonic-gate 	uint_t *state);
179*0Sstevel@tonic-gate 
180*0Sstevel@tonic-gate /*
181*0Sstevel@tonic-gate  * Transition the child addressed by "name@addr" to the online state.
182*0Sstevel@tonic-gate  * For use by a driver's DEVCTL_DEVICE_ONLINE handler.
183*0Sstevel@tonic-gate  */
184*0Sstevel@tonic-gate int
185*0Sstevel@tonic-gate ndi_devctl_device_online(dev_info_t *dip, struct devctl_iocdata *dcp,
186*0Sstevel@tonic-gate 	uint_t flags);
187*0Sstevel@tonic-gate 
188*0Sstevel@tonic-gate /*
189*0Sstevel@tonic-gate  * Transition the child addressed by "name@addr" to the offline state.
190*0Sstevel@tonic-gate  * For use by a driver's DEVCTL_DEVICE_OFFLINE handler.
191*0Sstevel@tonic-gate  */
192*0Sstevel@tonic-gate int
193*0Sstevel@tonic-gate ndi_devctl_device_offline(dev_info_t *dip, struct devctl_iocdata *dcp,
194*0Sstevel@tonic-gate 	uint_t flags);
195*0Sstevel@tonic-gate 
196*0Sstevel@tonic-gate /*
197*0Sstevel@tonic-gate  * Remove the child addressed by name@addr.
198*0Sstevel@tonic-gate  * For use by a driver's DEVCTL_DEVICE_REMOVE handler.
199*0Sstevel@tonic-gate  */
200*0Sstevel@tonic-gate int
201*0Sstevel@tonic-gate ndi_devctl_device_remove(dev_info_t *dip, struct devctl_iocdata *dcp,
202*0Sstevel@tonic-gate 	uint_t flags);
203*0Sstevel@tonic-gate 
204*0Sstevel@tonic-gate /*
205*0Sstevel@tonic-gate  * Bus get state
206*0Sstevel@tonic-gate  * For use by a driver's DEVCTL_BUS_GETSTATE handler.
207*0Sstevel@tonic-gate  */
208*0Sstevel@tonic-gate int
209*0Sstevel@tonic-gate ndi_devctl_bus_getstate(dev_info_t *dip, struct devctl_iocdata *dcp,
210*0Sstevel@tonic-gate 	uint_t *state);
211*0Sstevel@tonic-gate 
212*0Sstevel@tonic-gate /*
213*0Sstevel@tonic-gate  * Place the devinfo in the ONLINE state
214*0Sstevel@tonic-gate  */
215*0Sstevel@tonic-gate int
216*0Sstevel@tonic-gate ndi_devi_online(dev_info_t *dip, uint_t flags);
217*0Sstevel@tonic-gate 
218*0Sstevel@tonic-gate /*
219*0Sstevel@tonic-gate  * Generic devctl ioctl handler
220*0Sstevel@tonic-gate  */
221*0Sstevel@tonic-gate int
222*0Sstevel@tonic-gate ndi_devctl_ioctl(dev_info_t *dip, int cmd, intptr_t arg, int mode,
223*0Sstevel@tonic-gate 	uint_t flags);
224*0Sstevel@tonic-gate 
225*0Sstevel@tonic-gate /*
226*0Sstevel@tonic-gate  * Asynchronous version of ndi_devi_online, callable from interrupt
227*0Sstevel@tonic-gate  * context. The dip must be a persistent node.
228*0Sstevel@tonic-gate  */
229*0Sstevel@tonic-gate int
230*0Sstevel@tonic-gate ndi_devi_online_async(dev_info_t *dip, uint_t flags);
231*0Sstevel@tonic-gate 
232*0Sstevel@tonic-gate 
233*0Sstevel@tonic-gate /*
234*0Sstevel@tonic-gate  * Configure children of a nexus node.
235*0Sstevel@tonic-gate  *
236*0Sstevel@tonic-gate  * Flags:
237*0Sstevel@tonic-gate  *	NDI_ONLINE_ATTACH - Attach driver to devinfo node when placing
238*0Sstevel@tonic-gate  *			    the device Online.
239*0Sstevel@tonic-gate  *	NDI_CONFIG - Recursively configure children if child is nexus node
240*0Sstevel@tonic-gate  */
241*0Sstevel@tonic-gate int
242*0Sstevel@tonic-gate ndi_devi_config(dev_info_t *dip, int flags);
243*0Sstevel@tonic-gate 
244*0Sstevel@tonic-gate int
245*0Sstevel@tonic-gate ndi_devi_config_driver(dev_info_t *dip, int flags, major_t major);
246*0Sstevel@tonic-gate 
247*0Sstevel@tonic-gate int
248*0Sstevel@tonic-gate ndi_devi_config_one(dev_info_t *dip, char *devnm, dev_info_t **dipp, int flags);
249*0Sstevel@tonic-gate 
250*0Sstevel@tonic-gate /*
251*0Sstevel@tonic-gate  * Unconfigure children of a nexus node.
252*0Sstevel@tonic-gate  *
253*0Sstevel@tonic-gate  * Flags:
254*0Sstevel@tonic-gate  *	NDI_DEVI_REMOVE - Remove child devinfo nodes
255*0Sstevel@tonic-gate  *
256*0Sstevel@tonic-gate  *	NDI_UNCONFIG - Put child devinfo nodes to uninitialized state,
257*0Sstevel@tonic-gate  *			release resources held by child nodes.
258*0Sstevel@tonic-gate  */
259*0Sstevel@tonic-gate int
260*0Sstevel@tonic-gate ndi_devi_unconfig(dev_info_t *dip, int flags);
261*0Sstevel@tonic-gate 
262*0Sstevel@tonic-gate int
263*0Sstevel@tonic-gate e_ddi_devi_unconfig(dev_info_t *dip, dev_info_t **dipp, int flags);
264*0Sstevel@tonic-gate 
265*0Sstevel@tonic-gate int
266*0Sstevel@tonic-gate ndi_devi_unconfig_one(dev_info_t *dip, char *devnm, dev_info_t **dipp,
267*0Sstevel@tonic-gate     int flags);
268*0Sstevel@tonic-gate 
269*0Sstevel@tonic-gate int
270*0Sstevel@tonic-gate ndi_devi_unconfig_driver(dev_info_t *dip, int flags, major_t major);
271*0Sstevel@tonic-gate 
272*0Sstevel@tonic-gate /*
273*0Sstevel@tonic-gate  * Take a device node "Offline".
274*0Sstevel@tonic-gate  *
275*0Sstevel@tonic-gate  * Offline means to detach the device instance from the bound
276*0Sstevel@tonic-gate  * driver and setting the devinfo state to prevent deferred attach
277*0Sstevel@tonic-gate  * from re-attaching the device instance.
278*0Sstevel@tonic-gate  *
279*0Sstevel@tonic-gate  * Flags:
280*0Sstevel@tonic-gate  *	NDI_DEVI_REMOVE	- Remove the node from the devinfo tree after
281*0Sstevel@tonic-gate  *			  first taking it Offline.
282*0Sstevel@tonic-gate  */
283*0Sstevel@tonic-gate 
284*0Sstevel@tonic-gate #define	NDI_DEVI_REMOVE		0x00001 /* remove after unconfig */
285*0Sstevel@tonic-gate #define	NDI_ONLINE_ATTACH	0x00002 /* online/attach after config */
286*0Sstevel@tonic-gate #define	NDI_MDI_FALLBACK	0x00004 /* Leadville to fallback to phci */
287*0Sstevel@tonic-gate #define	NDI_CONFIG		0x00008 /* recursively config descendants */
288*0Sstevel@tonic-gate #define	NDI_UNCONFIG		0x00010 /* unconfig to uninitialized state */
289*0Sstevel@tonic-gate #define	NDI_DEVI_BIND		0x00020 /* transition to DS_BOUND state */
290*0Sstevel@tonic-gate #define	NDI_DEVI_PERSIST	0x00040 /* do not config offlined nodes */
291*0Sstevel@tonic-gate #define	NDI_PROMNAME		0x00080 /* name comes from prom */
292*0Sstevel@tonic-gate #define	NDI_DEVFS_CLEAN		0x01000 /* clean up dv_nodes only, no detach */
293*0Sstevel@tonic-gate #define	NDI_AUTODETACH		0x02000 /* moduninstall daemon */
294*0Sstevel@tonic-gate #define	NDI_NO_EVENT		0x04000 /* don't devfs add/remove events */
295*0Sstevel@tonic-gate #define	NDI_DEVI_DEBUG		0x08000 /* turn on observability */
296*0Sstevel@tonic-gate #define	NDI_CONFIG_REPROBE	0x10000 /* force a reprobe (deferred attach) */
297*0Sstevel@tonic-gate #define	NDI_DEVI_ONLINE		0x20000 /* force offlined device to online */
298*0Sstevel@tonic-gate #define	NDI_DEVI_OFFLINE	0x40000 /* set detached device to offline */
299*0Sstevel@tonic-gate #define	NDI_POST_EVENT		0x80000 /* Post NDI events before remove */
300*0Sstevel@tonic-gate #define	NDI_BRANCH_EVENT_OP	0x1000000 /* branch op needing a branch event */
301*0Sstevel@tonic-gate #define	NDI_NO_EVENT_STATE_CHNG	0x2000000 /* don't change the event state */
302*0Sstevel@tonic-gate #define	NDI_DRV_CONF_REPROBE	0x4000000 /* reprobe conf-enum'd nodes only */
303*0Sstevel@tonic-gate #define	NDI_DETACH_DRIVER	0x8000000 /* performing driver_detach */
304*0Sstevel@tonic-gate 
305*0Sstevel@tonic-gate /* ndi interface flag values */
306*0Sstevel@tonic-gate #define	NDI_SLEEP		0x000000
307*0Sstevel@tonic-gate #define	NDI_NOSLEEP		0x100000
308*0Sstevel@tonic-gate #define	NDI_EVENT_NOPASS	0x200000 /* do not pass event req up the tree */
309*0Sstevel@tonic-gate 
310*0Sstevel@tonic-gate int
311*0Sstevel@tonic-gate ndi_devi_offline(dev_info_t *dip, uint_t flags);
312*0Sstevel@tonic-gate 
313*0Sstevel@tonic-gate /*
314*0Sstevel@tonic-gate  * Find the child dev_info node of parent nexus 'p' whose name
315*0Sstevel@tonic-gate  * matches "cname"@"caddr".  Use ndi_devi_findchild() instead.
316*0Sstevel@tonic-gate  */
317*0Sstevel@tonic-gate dev_info_t *
318*0Sstevel@tonic-gate ndi_devi_find(dev_info_t *p, char *cname, char *caddr);
319*0Sstevel@tonic-gate 
320*0Sstevel@tonic-gate /*
321*0Sstevel@tonic-gate  * Find the child dev_info node of parent nexus 'p' whose name
322*0Sstevel@tonic-gate  * matches device name "name"@"addr".
323*0Sstevel@tonic-gate  */
324*0Sstevel@tonic-gate dev_info_t *
325*0Sstevel@tonic-gate ndi_devi_findchild(dev_info_t *p, char *devname);
326*0Sstevel@tonic-gate 
327*0Sstevel@tonic-gate /*
328*0Sstevel@tonic-gate  * generate debug msg via NDI_DEVI_DEBUG flag
329*0Sstevel@tonic-gate  */
330*0Sstevel@tonic-gate #define	NDI_DEBUG(flags, args)	\
331*0Sstevel@tonic-gate 	if (flags & NDI_DEVI_DEBUG) cmn_err args
332*0Sstevel@tonic-gate 
333*0Sstevel@tonic-gate /*
334*0Sstevel@tonic-gate  * Copy in the devctl IOCTL data structure and the strings referenced
335*0Sstevel@tonic-gate  * by the structure.
336*0Sstevel@tonic-gate  *
337*0Sstevel@tonic-gate  * Convenience functions for use by nexus drivers as part of the
338*0Sstevel@tonic-gate  * implementation of devctl IOCTL handling.
339*0Sstevel@tonic-gate  */
340*0Sstevel@tonic-gate int
341*0Sstevel@tonic-gate ndi_dc_allochdl(void *iocarg, struct devctl_iocdata **rdcp);
342*0Sstevel@tonic-gate 
343*0Sstevel@tonic-gate void
344*0Sstevel@tonic-gate ndi_dc_freehdl(struct devctl_iocdata *dcp);
345*0Sstevel@tonic-gate 
346*0Sstevel@tonic-gate char *
347*0Sstevel@tonic-gate ndi_dc_getpath(struct devctl_iocdata *dcp);
348*0Sstevel@tonic-gate 
349*0Sstevel@tonic-gate char *
350*0Sstevel@tonic-gate ndi_dc_getname(struct devctl_iocdata *dcp);
351*0Sstevel@tonic-gate 
352*0Sstevel@tonic-gate char *
353*0Sstevel@tonic-gate ndi_dc_getaddr(struct devctl_iocdata *dcp);
354*0Sstevel@tonic-gate 
355*0Sstevel@tonic-gate nvlist_t *
356*0Sstevel@tonic-gate ndi_dc_get_ap_data(struct devctl_iocdata *dcp);
357*0Sstevel@tonic-gate 
358*0Sstevel@tonic-gate char *
359*0Sstevel@tonic-gate ndi_dc_getminorname(struct devctl_iocdata *dcp);
360*0Sstevel@tonic-gate 
361*0Sstevel@tonic-gate int
362*0Sstevel@tonic-gate ndi_dc_return_dev_state(dev_info_t *dip, struct devctl_iocdata *dcp);
363*0Sstevel@tonic-gate 
364*0Sstevel@tonic-gate int
365*0Sstevel@tonic-gate ndi_dc_return_ap_state(devctl_ap_state_t *ap, struct devctl_iocdata *dcp);
366*0Sstevel@tonic-gate 
367*0Sstevel@tonic-gate int
368*0Sstevel@tonic-gate ndi_dc_return_bus_state(dev_info_t *dip, struct devctl_iocdata *dcp);
369*0Sstevel@tonic-gate 
370*0Sstevel@tonic-gate int
371*0Sstevel@tonic-gate ndi_dc_devi_create(struct devctl_iocdata *dcp, dev_info_t *pdip, int flags,
372*0Sstevel@tonic-gate     dev_info_t **rdip);
373*0Sstevel@tonic-gate 
374*0Sstevel@tonic-gate int
375*0Sstevel@tonic-gate ndi_get_bus_state(dev_info_t *dip, uint_t *rstate);
376*0Sstevel@tonic-gate 
377*0Sstevel@tonic-gate int
378*0Sstevel@tonic-gate ndi_set_bus_state(dev_info_t *dip, uint_t state);
379*0Sstevel@tonic-gate 
380*0Sstevel@tonic-gate /*
381*0Sstevel@tonic-gate  * Post an event notification up the device tree hierarchy to the
382*0Sstevel@tonic-gate  * parent nexus, until claimed by a bus nexus driver or the top
383*0Sstevel@tonic-gate  * of the dev_info tree is reached.
384*0Sstevel@tonic-gate  */
385*0Sstevel@tonic-gate int
386*0Sstevel@tonic-gate ndi_post_event(dev_info_t *dip, dev_info_t *rdip, ddi_eventcookie_t eventhdl,
387*0Sstevel@tonic-gate     void *impl_data);
388*0Sstevel@tonic-gate 
389*0Sstevel@tonic-gate /*
390*0Sstevel@tonic-gate  * Called by the NDI Event Framework to deliver a registration request to the
391*0Sstevel@tonic-gate  * appropriate bus nexus driver.
392*0Sstevel@tonic-gate  */
393*0Sstevel@tonic-gate int
394*0Sstevel@tonic-gate ndi_busop_add_eventcall(dev_info_t *dip, dev_info_t *rdip,
395*0Sstevel@tonic-gate     ddi_eventcookie_t eventhdl, void (*callback)(), void *arg,
396*0Sstevel@tonic-gate     ddi_callback_id_t *cb_id);
397*0Sstevel@tonic-gate 
398*0Sstevel@tonic-gate /*
399*0Sstevel@tonic-gate  * Called by the NDI Event Framework to deliver an unregister request to the
400*0Sstevel@tonic-gate  * appropriate bus nexus driver.
401*0Sstevel@tonic-gate  */
402*0Sstevel@tonic-gate int
403*0Sstevel@tonic-gate ndi_busop_remove_eventcall(dev_info_t *ddip, ddi_callback_id_t id);
404*0Sstevel@tonic-gate 
405*0Sstevel@tonic-gate /*
406*0Sstevel@tonic-gate  * Called by the NDI Event Framework and/or a bus nexus driver's
407*0Sstevel@tonic-gate  * implementation of the (*bus_get_eventcookie)() interface up the device tree
408*0Sstevel@tonic-gate  * hierarchy, until claimed by a bus nexus driver or the top of the dev_info
409*0Sstevel@tonic-gate  * tree is reached.  The NDI Event Framework will skip nexus drivers which are
410*0Sstevel@tonic-gate  * not configured to handle NDI events.
411*0Sstevel@tonic-gate  */
412*0Sstevel@tonic-gate int
413*0Sstevel@tonic-gate ndi_busop_get_eventcookie(dev_info_t *dip, dev_info_t *rdip, char *name,
414*0Sstevel@tonic-gate     ddi_eventcookie_t *event_cookiep);
415*0Sstevel@tonic-gate 
416*0Sstevel@tonic-gate /*
417*0Sstevel@tonic-gate  * ndi event callback support routines:
418*0Sstevel@tonic-gate  *
419*0Sstevel@tonic-gate  * these functions require an opaque ndi event handle
420*0Sstevel@tonic-gate  */
421*0Sstevel@tonic-gate typedef struct ndi_event_hdl *ndi_event_hdl_t;
422*0Sstevel@tonic-gate 
423*0Sstevel@tonic-gate /*
424*0Sstevel@tonic-gate  * structure for maintaining each registered callback
425*0Sstevel@tonic-gate  */
426*0Sstevel@tonic-gate typedef struct ndi_event_callbacks {
427*0Sstevel@tonic-gate 	struct ndi_event_callbacks *ndi_evtcb_next;
428*0Sstevel@tonic-gate 	struct ndi_event_callbacks *ndi_evtcb_prev;
429*0Sstevel@tonic-gate 	dev_info_t	*ndi_evtcb_dip;
430*0Sstevel@tonic-gate 	char		*devname; /* name of device defining this callback */
431*0Sstevel@tonic-gate 	void		(*ndi_evtcb_callback)();
432*0Sstevel@tonic-gate 	void		*ndi_evtcb_arg;
433*0Sstevel@tonic-gate 	ddi_eventcookie_t	ndi_evtcb_cookie;
434*0Sstevel@tonic-gate } ndi_event_callbacks_t;
435*0Sstevel@tonic-gate 
436*0Sstevel@tonic-gate /*
437*0Sstevel@tonic-gate  * a nexus driver defines events that it can support using the
438*0Sstevel@tonic-gate  * following structure
439*0Sstevel@tonic-gate  */
440*0Sstevel@tonic-gate typedef struct ndi_event_definition {
441*0Sstevel@tonic-gate 	int			ndi_event_tag;
442*0Sstevel@tonic-gate 	char			*ndi_event_name;
443*0Sstevel@tonic-gate 	ddi_plevel_t		ndi_event_plevel;
444*0Sstevel@tonic-gate 	uint_t			ndi_event_attributes;
445*0Sstevel@tonic-gate } ndi_event_definition_t;
446*0Sstevel@tonic-gate 
447*0Sstevel@tonic-gate typedef struct ndi_event_cookie {
448*0Sstevel@tonic-gate 	ndi_event_definition_t 	*definition;	/* Event Description */
449*0Sstevel@tonic-gate 	dev_info_t		*ddip;		/* Devi defining this event */
450*0Sstevel@tonic-gate 	ndi_event_callbacks_t	*callback_list; /* Cb's reg'd to w/ this evt */
451*0Sstevel@tonic-gate 	struct ndi_event_cookie *next_cookie; 	/* Next cookie def'd in hdl */
452*0Sstevel@tonic-gate } ndi_event_cookie_t;
453*0Sstevel@tonic-gate 
454*0Sstevel@tonic-gate 
455*0Sstevel@tonic-gate #define	NDI_EVENT(cookie) ((struct ndi_event_cookie *)(void *)(cookie))
456*0Sstevel@tonic-gate #define	NDI_EVENT_NAME(cookie) (NDI_EVENT(cookie)->definition->ndi_event_name)
457*0Sstevel@tonic-gate #define	NDI_EVENT_TAG(cookie) (NDI_EVENT(cookie)->definition->ndi_event_tag)
458*0Sstevel@tonic-gate #define	NDI_EVENT_ATTRIBUTES(cookie) \
459*0Sstevel@tonic-gate 	(NDI_EVENT(cookie)->definition->ndi_event_attributes)
460*0Sstevel@tonic-gate #define	NDI_EVENT_PLEVEL(cookie) \
461*0Sstevel@tonic-gate 	(NDI_EVENT(cookie)->definition->ndi_event_plevel)
462*0Sstevel@tonic-gate #define	NDI_EVENT_DDIP(cookie) (NDI_EVENT(cookie)->ddip)
463*0Sstevel@tonic-gate 
464*0Sstevel@tonic-gate /* ndi_event_attributes */
465*0Sstevel@tonic-gate #define	NDI_EVENT_POST_TO_ALL	0x0 /* broadcast: post to all handlers */
466*0Sstevel@tonic-gate #define	NDI_EVENT_POST_TO_TGT	0x1 /* call only specific child's hdlr */
467*0Sstevel@tonic-gate 
468*0Sstevel@tonic-gate typedef struct ndi_event_set {
469*0Sstevel@tonic-gate 	ushort_t		ndi_events_version;
470*0Sstevel@tonic-gate 	ushort_t		ndi_n_events;
471*0Sstevel@tonic-gate 	ndi_event_definition_t	*ndi_event_defs;
472*0Sstevel@tonic-gate } ndi_event_set_t;
473*0Sstevel@tonic-gate 
474*0Sstevel@tonic-gate 
475*0Sstevel@tonic-gate #define	NDI_EVENTS_REV0			0
476*0Sstevel@tonic-gate #define	NDI_EVENTS_REV1			1
477*0Sstevel@tonic-gate 
478*0Sstevel@tonic-gate /*
479*0Sstevel@tonic-gate  * allocate an ndi event handle
480*0Sstevel@tonic-gate  */
481*0Sstevel@tonic-gate int
482*0Sstevel@tonic-gate ndi_event_alloc_hdl(dev_info_t *dip, ddi_iblock_cookie_t cookie,
483*0Sstevel@tonic-gate 	ndi_event_hdl_t *ndi_event_hdl, uint_t flag);
484*0Sstevel@tonic-gate 
485*0Sstevel@tonic-gate /*
486*0Sstevel@tonic-gate  * free the ndi event handle
487*0Sstevel@tonic-gate  */
488*0Sstevel@tonic-gate int
489*0Sstevel@tonic-gate ndi_event_free_hdl(ndi_event_hdl_t handle);
490*0Sstevel@tonic-gate 
491*0Sstevel@tonic-gate /*
492*0Sstevel@tonic-gate  * bind or unbind a set of events to/from the event handle
493*0Sstevel@tonic-gate  */
494*0Sstevel@tonic-gate int
495*0Sstevel@tonic-gate ndi_event_bind_set(ndi_event_hdl_t	handle,
496*0Sstevel@tonic-gate 	ndi_event_set_t		*ndi_event_set,
497*0Sstevel@tonic-gate 	uint_t			flag);
498*0Sstevel@tonic-gate 
499*0Sstevel@tonic-gate int
500*0Sstevel@tonic-gate ndi_event_unbind_set(ndi_event_hdl_t	handle,
501*0Sstevel@tonic-gate 	ndi_event_set_t		*ndi_event_set,
502*0Sstevel@tonic-gate 	uint_t			flag);
503*0Sstevel@tonic-gate 
504*0Sstevel@tonic-gate /*
505*0Sstevel@tonic-gate  * get an event cookie
506*0Sstevel@tonic-gate  */
507*0Sstevel@tonic-gate int
508*0Sstevel@tonic-gate ndi_event_retrieve_cookie(ndi_event_hdl_t 	handle,
509*0Sstevel@tonic-gate 	dev_info_t		*child_dip,
510*0Sstevel@tonic-gate 	char			*eventname,
511*0Sstevel@tonic-gate 	ddi_eventcookie_t	*cookiep,
512*0Sstevel@tonic-gate 	uint_t			flag);
513*0Sstevel@tonic-gate 
514*0Sstevel@tonic-gate /*
515*0Sstevel@tonic-gate  * add an event callback info to the ndi event handle
516*0Sstevel@tonic-gate  */
517*0Sstevel@tonic-gate int
518*0Sstevel@tonic-gate ndi_event_add_callback(ndi_event_hdl_t 	handle,
519*0Sstevel@tonic-gate 	dev_info_t		*child_dip,
520*0Sstevel@tonic-gate 	ddi_eventcookie_t	cookie,
521*0Sstevel@tonic-gate 	void			(*event_callback)
522*0Sstevel@tonic-gate 					(dev_info_t *,
523*0Sstevel@tonic-gate 					ddi_eventcookie_t,
524*0Sstevel@tonic-gate 					void *arg,
525*0Sstevel@tonic-gate 					void *impldata),
526*0Sstevel@tonic-gate 	void			*arg,
527*0Sstevel@tonic-gate 	uint_t			flag,
528*0Sstevel@tonic-gate 	ddi_callback_id_t *cb_id);
529*0Sstevel@tonic-gate 
530*0Sstevel@tonic-gate /*
531*0Sstevel@tonic-gate  * remove an event callback registration from the ndi event handle
532*0Sstevel@tonic-gate  */
533*0Sstevel@tonic-gate int
534*0Sstevel@tonic-gate ndi_event_remove_callback(ndi_event_hdl_t handle, ddi_callback_id_t id);
535*0Sstevel@tonic-gate 
536*0Sstevel@tonic-gate /*
537*0Sstevel@tonic-gate  * perform callbacks for a specified cookie
538*0Sstevel@tonic-gate  */
539*0Sstevel@tonic-gate int
540*0Sstevel@tonic-gate ndi_event_run_callbacks(ndi_event_hdl_t	handle, dev_info_t *child_dip,
541*0Sstevel@tonic-gate     ddi_eventcookie_t cookie, void *bus_impldata);
542*0Sstevel@tonic-gate 
543*0Sstevel@tonic-gate /*
544*0Sstevel@tonic-gate  * do callback for just one child_dip, regardless of attributes
545*0Sstevel@tonic-gate  */
546*0Sstevel@tonic-gate int ndi_event_do_callback(ndi_event_hdl_t handle, dev_info_t *child_dip,
547*0Sstevel@tonic-gate 	ddi_eventcookie_t cookie, void *bus_impldata);
548*0Sstevel@tonic-gate 
549*0Sstevel@tonic-gate /*
550*0Sstevel@tonic-gate  * ndi_event_tag_to_cookie: utility function to find an event cookie
551*0Sstevel@tonic-gate  * given an event tag
552*0Sstevel@tonic-gate  */
553*0Sstevel@tonic-gate ddi_eventcookie_t
554*0Sstevel@tonic-gate ndi_event_tag_to_cookie(ndi_event_hdl_t handle, int event_tag);
555*0Sstevel@tonic-gate 
556*0Sstevel@tonic-gate /*
557*0Sstevel@tonic-gate  * ndi_event_cookie_to_tag: utility function to find an event tag
558*0Sstevel@tonic-gate  * given an event_cookie
559*0Sstevel@tonic-gate  */
560*0Sstevel@tonic-gate int
561*0Sstevel@tonic-gate ndi_event_cookie_to_tag(ndi_event_hdl_t handle,
562*0Sstevel@tonic-gate 	ddi_eventcookie_t cookie);
563*0Sstevel@tonic-gate 
564*0Sstevel@tonic-gate /*
565*0Sstevel@tonic-gate  * ndi_event_cookie_to_name: utility function to find an event
566*0Sstevel@tonic-gate  * name given an event_cookie
567*0Sstevel@tonic-gate  */
568*0Sstevel@tonic-gate char *
569*0Sstevel@tonic-gate ndi_event_cookie_to_name(ndi_event_hdl_t handle,
570*0Sstevel@tonic-gate 	ddi_eventcookie_t cookie);
571*0Sstevel@tonic-gate 
572*0Sstevel@tonic-gate /*
573*0Sstevel@tonic-gate  * ndi_event_tag_to_name: utility function to find an event
574*0Sstevel@tonic-gate  * name given an event_tag
575*0Sstevel@tonic-gate  */
576*0Sstevel@tonic-gate char *
577*0Sstevel@tonic-gate ndi_event_tag_to_name(ndi_event_hdl_t 	handle, int event_tag);
578*0Sstevel@tonic-gate 
579*0Sstevel@tonic-gate dev_info_t *
580*0Sstevel@tonic-gate ndi_devi_config_vhci(char *, int);
581*0Sstevel@tonic-gate 
582*0Sstevel@tonic-gate #ifdef DEBUG
583*0Sstevel@tonic-gate /*
584*0Sstevel@tonic-gate  * ndi_event_dump_hdl: debug functionality used to display event handle
585*0Sstevel@tonic-gate  */
586*0Sstevel@tonic-gate void
587*0Sstevel@tonic-gate ndi_event_dump_hdl(struct ndi_event_hdl *hdl, char *location);
588*0Sstevel@tonic-gate #endif
589*0Sstevel@tonic-gate 
590*0Sstevel@tonic-gate /*
591*0Sstevel@tonic-gate  * Default busop bus_config helper functions
592*0Sstevel@tonic-gate  */
593*0Sstevel@tonic-gate int
594*0Sstevel@tonic-gate ndi_busop_bus_config(dev_info_t *pdip, uint_t flags, ddi_bus_config_op_t op,
595*0Sstevel@tonic-gate     void *arg, dev_info_t **child, clock_t reset_delay);
596*0Sstevel@tonic-gate 
597*0Sstevel@tonic-gate int
598*0Sstevel@tonic-gate ndi_busop_bus_unconfig(dev_info_t *dip, uint_t flags, ddi_bus_config_op_t op,
599*0Sstevel@tonic-gate     void *arg);
600*0Sstevel@tonic-gate 
601*0Sstevel@tonic-gate 
602*0Sstevel@tonic-gate /*
603*0Sstevel@tonic-gate  * Bus Resource allocation structures and function prototypes exported
604*0Sstevel@tonic-gate  * by busra module
605*0Sstevel@tonic-gate  */
606*0Sstevel@tonic-gate 
607*0Sstevel@tonic-gate /* structure for specifying a request */
608*0Sstevel@tonic-gate typedef struct ndi_ra_request {
609*0Sstevel@tonic-gate 	uint_t		ra_flags;	/* General flags		*/
610*0Sstevel@tonic-gate 					/* see bit definitions below	*/
611*0Sstevel@tonic-gate 
612*0Sstevel@tonic-gate 	uint64_t	ra_len;		/* Requested allocation length	*/
613*0Sstevel@tonic-gate 
614*0Sstevel@tonic-gate 	uint64_t	ra_addr;	/* Specific base address requested */
615*0Sstevel@tonic-gate 
616*0Sstevel@tonic-gate 	uint64_t	ra_boundbase;	/* Base address of the area for	*/
617*0Sstevel@tonic-gate 					/* the allocated resource to be	*/
618*0Sstevel@tonic-gate 					/* restricted to		*/
619*0Sstevel@tonic-gate 
620*0Sstevel@tonic-gate 	uint64_t	ra_boundlen;	/* Length of the area, starting	*/
621*0Sstevel@tonic-gate 					/* from ra_boundbase, for the 	*/
622*0Sstevel@tonic-gate 					/* allocated resource to be	*/
623*0Sstevel@tonic-gate 					/* restricted to.    		*/
624*0Sstevel@tonic-gate 
625*0Sstevel@tonic-gate 	uint64_t	ra_align_mask;	/* Alignment mask used for	*/
626*0Sstevel@tonic-gate 					/* allocated base address	*/
627*0Sstevel@tonic-gate } ndi_ra_request_t;
628*0Sstevel@tonic-gate 
629*0Sstevel@tonic-gate 
630*0Sstevel@tonic-gate /* ra_flags bit definitions */
631*0Sstevel@tonic-gate #define	NDI_RA_ALIGN_SIZE	0x0001	/* Set the alignment of the	*/
632*0Sstevel@tonic-gate 					/* allocated resource address	*/
633*0Sstevel@tonic-gate 					/* according to the ra_len	*/
634*0Sstevel@tonic-gate 					/* value (alignment mask will	*/
635*0Sstevel@tonic-gate 					/* be (ra_len - 1)). Value of	*/
636*0Sstevel@tonic-gate 					/* ra_len has to be power of 2.	*/
637*0Sstevel@tonic-gate 					/* If this flag is set, value of */
638*0Sstevel@tonic-gate 					/* ra_align_mask will be ignored. */
639*0Sstevel@tonic-gate 
640*0Sstevel@tonic-gate 
641*0Sstevel@tonic-gate #define	NDI_RA_ALLOC_BOUNDED	0x0002	/* Indicates that the resource	*/
642*0Sstevel@tonic-gate 					/* should be restricted to the	*/
643*0Sstevel@tonic-gate 					/* area specified by ra_boundbase */
644*0Sstevel@tonic-gate 					/* and ra_boundlen */
645*0Sstevel@tonic-gate 
646*0Sstevel@tonic-gate #define	NDI_RA_ALLOC_SPECIFIED	0x0004	/* Indicates that a specific	*/
647*0Sstevel@tonic-gate 					/* address (ra_addr value) is	*/
648*0Sstevel@tonic-gate 					/* requested.			*/
649*0Sstevel@tonic-gate 
650*0Sstevel@tonic-gate #define	NDI_RA_ALLOC_PARTIAL_OK	0x0008  /* Indicates if requested size	*/
651*0Sstevel@tonic-gate 					/* (ra_len) chunk is not available */
652*0Sstevel@tonic-gate 					/* then allocate as big chunk as */
653*0Sstevel@tonic-gate 					/* possible which is less than or */
654*0Sstevel@tonic-gate 					/* equal to ra_len size. */
655*0Sstevel@tonic-gate 
656*0Sstevel@tonic-gate 
657*0Sstevel@tonic-gate /* return values specific to bus resource allocator */
658*0Sstevel@tonic-gate #define	NDI_RA_PARTIAL_REQ		-7
659*0Sstevel@tonic-gate 
660*0Sstevel@tonic-gate 
661*0Sstevel@tonic-gate 
662*0Sstevel@tonic-gate 
663*0Sstevel@tonic-gate /* Predefined types for generic type of resources */
664*0Sstevel@tonic-gate #define	NDI_RA_TYPE_MEM			"memory"
665*0Sstevel@tonic-gate #define	NDI_RA_TYPE_IO			"io"
666*0Sstevel@tonic-gate #define	NDI_RA_TYPE_PCI_BUSNUM		"pci_bus_number"
667*0Sstevel@tonic-gate #define	NDI_RA_TYPE_PCI_PREFETCH_MEM	"pci_prefetchable_memory"
668*0Sstevel@tonic-gate #define	NDI_RA_TYPE_INTR		"interrupt"
669*0Sstevel@tonic-gate 
670*0Sstevel@tonic-gate 
671*0Sstevel@tonic-gate 
672*0Sstevel@tonic-gate /* flag bit definition */
673*0Sstevel@tonic-gate #define	NDI_RA_PASS	0x0001		/* pass request up the dev tree */
674*0Sstevel@tonic-gate 
675*0Sstevel@tonic-gate 
676*0Sstevel@tonic-gate /*
677*0Sstevel@tonic-gate  * Prototype definitions for functions exported
678*0Sstevel@tonic-gate  */
679*0Sstevel@tonic-gate 
680*0Sstevel@tonic-gate int
681*0Sstevel@tonic-gate ndi_ra_map_setup(dev_info_t *dip, char *type);
682*0Sstevel@tonic-gate 
683*0Sstevel@tonic-gate int
684*0Sstevel@tonic-gate ndi_ra_map_destroy(dev_info_t *dip, char *type);
685*0Sstevel@tonic-gate 
686*0Sstevel@tonic-gate int
687*0Sstevel@tonic-gate ndi_ra_alloc(dev_info_t *dip, ndi_ra_request_t *req, uint64_t *basep,
688*0Sstevel@tonic-gate 	uint64_t *lenp, char *type, uint_t flag);
689*0Sstevel@tonic-gate 
690*0Sstevel@tonic-gate int
691*0Sstevel@tonic-gate ndi_ra_free(dev_info_t *dip, uint64_t base, uint64_t len, char *type,
692*0Sstevel@tonic-gate 	uint_t flag);
693*0Sstevel@tonic-gate 
694*0Sstevel@tonic-gate 
695*0Sstevel@tonic-gate /*
696*0Sstevel@tonic-gate  * ndi_dev_is_prom_node: Return non-zero if the node is a prom node
697*0Sstevel@tonic-gate  */
698*0Sstevel@tonic-gate int ndi_dev_is_prom_node(dev_info_t *);
699*0Sstevel@tonic-gate 
700*0Sstevel@tonic-gate /*
701*0Sstevel@tonic-gate  * ndi_dev_is_pseudo_node: Return non-zero if the node is a pseudo node.
702*0Sstevel@tonic-gate  * NB: all non-prom nodes are pseudo nodes.
703*0Sstevel@tonic-gate  * c.f. ndi_dev_is_persistent_node
704*0Sstevel@tonic-gate  */
705*0Sstevel@tonic-gate int ndi_dev_is_pseudo_node(dev_info_t *);
706*0Sstevel@tonic-gate 
707*0Sstevel@tonic-gate /*
708*0Sstevel@tonic-gate  * ndi_dev_is_persistent_node: Return non-zero if the node has the
709*0Sstevel@tonic-gate  * property of persistence.
710*0Sstevel@tonic-gate  */
711*0Sstevel@tonic-gate int ndi_dev_is_persistent_node(dev_info_t *);
712*0Sstevel@tonic-gate 
713*0Sstevel@tonic-gate /*
714*0Sstevel@tonic-gate  * Event posted when a fault is reported
715*0Sstevel@tonic-gate  */
716*0Sstevel@tonic-gate #define	DDI_DEVI_FAULT_EVENT	"DDI:DEVI_FAULT"
717*0Sstevel@tonic-gate 
718*0Sstevel@tonic-gate struct ddi_fault_event_data {
719*0Sstevel@tonic-gate 	dev_info_t		*f_dip;
720*0Sstevel@tonic-gate 	ddi_fault_impact_t	f_impact;
721*0Sstevel@tonic-gate 	ddi_fault_location_t	f_location;
722*0Sstevel@tonic-gate 	const char		*f_message;
723*0Sstevel@tonic-gate 	ddi_devstate_t		f_oldstate;
724*0Sstevel@tonic-gate };
725*0Sstevel@tonic-gate 
726*0Sstevel@tonic-gate /*
727*0Sstevel@tonic-gate  * Access handle/DMA handle fault flag setting/clearing functions for nexi
728*0Sstevel@tonic-gate  */
729*0Sstevel@tonic-gate void ndi_set_acc_fault(ddi_acc_handle_t ah);
730*0Sstevel@tonic-gate void ndi_clr_acc_fault(ddi_acc_handle_t ah);
731*0Sstevel@tonic-gate void ndi_set_dma_fault(ddi_dma_handle_t dh);
732*0Sstevel@tonic-gate void ndi_clr_dma_fault(ddi_dma_handle_t dh);
733*0Sstevel@tonic-gate 
734*0Sstevel@tonic-gate /* Driver.conf property merging */
735*0Sstevel@tonic-gate int ndi_merge_node(dev_info_t *, int (*)(dev_info_t *, char *, int));
736*0Sstevel@tonic-gate void ndi_merge_wildcard_node(dev_info_t *);
737*0Sstevel@tonic-gate 
738*0Sstevel@tonic-gate #endif	/* _KERNEL */
739*0Sstevel@tonic-gate 
740*0Sstevel@tonic-gate #ifdef	__cplusplus
741*0Sstevel@tonic-gate }
742*0Sstevel@tonic-gate #endif
743*0Sstevel@tonic-gate 
744*0Sstevel@tonic-gate #endif	/* _SYS_SUNNDI_H */
745