xref: /titanic_50/usr/src/uts/common/sys/ndi_impldefs.h (revision 9512fe850e98fdd448c638ca63fdd92a8a510255)
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 1998-2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_NDI_IMPLDEFS_H
28 #define	_SYS_NDI_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/ddi_impldefs.h>
41 
42 #ifdef	__cplusplus
43 extern "C" {
44 #endif
45 
46 /* event handle for callback management */
47 struct ndi_event_hdl {
48 	dev_info_t		*ndi_evthdl_dip;
49 
50 	/*
51 	 * mutex that protect the handle and event defs
52 	 */
53 	kmutex_t		ndi_evthdl_mutex;
54 
55 	/*
56 	 * mutex that just protects the callback list
57 	 */
58 	kmutex_t		ndi_evthdl_cb_mutex;
59 
60 	ddi_iblock_cookie_t	ndi_evthdl_iblock_cookie;
61 
62 	uint_t			ndi_evthdl_high_plevels;
63 	uint_t			ndi_evthdl_other_plevels;
64 
65 	uint_t			ndi_evthdl_n_events;
66 	ndi_event_cookie_t 	*ndi_evthdl_cookie_list;
67 	ndi_event_hdl_t 	ndi_next_hdl;
68 };
69 
70 /* prototypes needed by sunndi.c */
71 int ddi_prop_fm_encode_bytes(prop_handle_t *, void *data, uint_t);
72 
73 int ddi_prop_fm_encode_ints(prop_handle_t *, void *data, uint_t);
74 
75 int ddi_prop_fm_encode_int64(prop_handle_t *, void *data, uint_t);
76 
77 int ddi_prop_int64_op(prop_handle_t *, uint_t, int64_t *);
78 
79 int ddi_prop_update_common(dev_t, dev_info_t *, int, char *, void *, uint_t,
80     int (*)(prop_handle_t *, void *, uint_t));
81 
82 int ddi_prop_lookup_common(dev_t, dev_info_t *, uint_t, char *, void *,
83     uint_t *, int (*)(prop_handle_t *, void *, uint_t *));
84 
85 int ddi_prop_remove_common(dev_t, dev_info_t *, char *, int);
86 void ddi_prop_remove_all_common(dev_info_t *, int);
87 
88 int ddi_prop_fm_encode_string(prop_handle_t *, void *, uint_t);
89 
90 int ddi_prop_fm_encode_strings(prop_handle_t *, void *, uint_t);
91 int ddi_prop_fm_decode_strings(prop_handle_t *, void *, uint_t *);
92 
93 /*
94  * Internal configuration routines
95  */
96 int i_ndi_config_node(dev_info_t *, ddi_node_state_t, uint_t);
97 int i_ndi_unconfig_node(dev_info_t *, ddi_node_state_t, uint_t);
98 
99 /*
100  * Obsolete interface, no longer used, to be removed.
101  * Retained only for driver compatibility.
102  */
103 void i_ndi_block_device_tree_changes(uint_t *);		/* obsolete */
104 void i_ndi_allow_device_tree_changes(uint_t);		/* obsolete */
105 
106 /*
107  * ndi_dev_is_auto_assigned_node: Return non-zero if the nodeid in dev
108  * has been auto-assigned by the framework and should be auto-freed.
109  * (Intended for use by the framework only.)
110  */
111 int i_ndi_dev_is_auto_assigned_node(dev_info_t *);
112 
113 /*
114  * Get and set nodeclass and node attributes.
115  * (Intended for ddi framework use only.)
116  */
117 ddi_node_class_t i_ndi_get_node_class(dev_info_t *);
118 void i_ndi_set_node_class(dev_info_t *, ddi_node_class_t);
119 
120 int i_ndi_get_node_attributes(dev_info_t *);
121 void i_ndi_set_node_attributes(dev_info_t *, int);
122 
123 /*
124  * Set nodeid .. not generally advisable.
125  * (Intended for the ddi framework use only.)
126  */
127 void i_ndi_set_nodeid(dev_info_t *, int);
128 
129 #ifdef	__cplusplus
130 }
131 #endif
132 
133 #endif	/* _SYS_NDI_IMPLDEFS_H */
134