xref: /titanic_51/usr/src/uts/common/sys/ndi_impldefs.h (revision 56d930ae56e5cfc2442f5214a7b2c47f08a2b920)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SYS_NDI_IMPLDEFS_H
27 #define	_SYS_NDI_IMPLDEFS_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <sys/types.h>
32 #include <sys/param.h>
33 #include <sys/t_lock.h>
34 #include <sys/ddipropdefs.h>
35 #include <sys/devops.h>
36 #include <sys/autoconf.h>
37 #include <sys/mutex.h>
38 #include <vm/page.h>
39 #include <sys/ddi_impldefs.h>
40 
41 #ifdef	__cplusplus
42 extern "C" {
43 #endif
44 
45 /* event handle for callback management */
46 struct ndi_event_hdl {
47 	dev_info_t		*ndi_evthdl_dip;
48 
49 	/*
50 	 * mutex that protect the handle and event defs
51 	 */
52 	kmutex_t		ndi_evthdl_mutex;
53 
54 	/*
55 	 * mutex that just protects the callback list
56 	 */
57 	kmutex_t		ndi_evthdl_cb_mutex;
58 
59 	ddi_iblock_cookie_t	ndi_evthdl_iblock_cookie;
60 
61 	uint_t			ndi_evthdl_high_plevels;
62 	uint_t			ndi_evthdl_other_plevels;
63 
64 	uint_t			ndi_evthdl_n_events;
65 	ndi_event_cookie_t 	*ndi_evthdl_cookie_list;
66 	ndi_event_hdl_t 	ndi_next_hdl;
67 };
68 
69 /* prototypes needed by sunndi.c */
70 int ddi_prop_fm_encode_bytes(prop_handle_t *, void *data, uint_t);
71 
72 int ddi_prop_fm_encode_ints(prop_handle_t *, void *data, uint_t);
73 
74 int ddi_prop_fm_encode_int64(prop_handle_t *, void *data, uint_t);
75 
76 int ddi_prop_int64_op(prop_handle_t *, uint_t, int64_t *);
77 
78 int ddi_prop_update_common(dev_t, dev_info_t *, int, char *, void *, uint_t,
79     int (*)(prop_handle_t *, void *, uint_t));
80 
81 int ddi_prop_lookup_common(dev_t, dev_info_t *, uint_t, char *, void *,
82     uint_t *, int (*)(prop_handle_t *, void *, uint_t *));
83 
84 int ddi_prop_remove_common(dev_t, dev_info_t *, char *, int);
85 void ddi_prop_remove_all_common(dev_info_t *, int);
86 
87 int ddi_prop_fm_encode_string(prop_handle_t *, void *, uint_t);
88 
89 int ddi_prop_fm_encode_strings(prop_handle_t *, void *, uint_t);
90 int ddi_prop_fm_decode_strings(prop_handle_t *, void *, uint_t *);
91 
92 /*
93  * Internal configuration routines
94  */
95 int i_ndi_config_node(dev_info_t *, ddi_node_state_t, uint_t);
96 int i_ndi_unconfig_node(dev_info_t *, ddi_node_state_t, uint_t);
97 
98 /*
99  * Obsolete interface, no longer used, to be removed.
100  * Retained only for driver compatibility.
101  */
102 void i_ndi_block_device_tree_changes(uint_t *);		/* obsolete */
103 void i_ndi_allow_device_tree_changes(uint_t);		/* obsolete */
104 
105 /*
106  * ndi_dev_is_auto_assigned_node: Return non-zero if the nodeid in dev
107  * has been auto-assigned by the framework and should be auto-freed.
108  * (Intended for use by the framework only.)
109  */
110 int i_ndi_dev_is_auto_assigned_node(dev_info_t *);
111 
112 /*
113  * Get and set nodeclass and node attributes.
114  * (Intended for ddi framework use only.)
115  */
116 ddi_node_class_t i_ndi_get_node_class(dev_info_t *);
117 void i_ndi_set_node_class(dev_info_t *, ddi_node_class_t);
118 
119 int i_ndi_get_node_attributes(dev_info_t *);
120 void i_ndi_set_node_attributes(dev_info_t *, int);
121 
122 /*
123  * Set nodeid .. not generally advisable.
124  * (Intended for the ddi framework use only.)
125  */
126 void i_ndi_set_nodeid(dev_info_t *, int);
127 
128 /*
129  * Make driver.conf children.
130  * (Intended for the ddi framework use only.)
131  */
132 int i_ndi_make_spec_children(dev_info_t *, uint_t);
133 
134 #ifdef	__cplusplus
135 }
136 #endif
137 
138 #endif	/* _SYS_NDI_IMPLDEFS_H */
139