xref: /onnv-gate/usr/src/uts/common/sys/sunldi.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_SUNLDI_H
28*0Sstevel@tonic-gate #define	_SYS_SUNLDI_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #include <sys/modctl.h>
33*0Sstevel@tonic-gate #include <sys/stream.h>
34*0Sstevel@tonic-gate #include <sys/open.h>
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate /*
37*0Sstevel@tonic-gate  * DDI interfaces for Layered driver support.
38*0Sstevel@tonic-gate  */
39*0Sstevel@tonic-gate 
40*0Sstevel@tonic-gate #ifdef	__cplusplus
41*0Sstevel@tonic-gate extern "C" {
42*0Sstevel@tonic-gate #endif
43*0Sstevel@tonic-gate 
44*0Sstevel@tonic-gate #ifdef	_KERNEL
45*0Sstevel@tonic-gate 
46*0Sstevel@tonic-gate 
47*0Sstevel@tonic-gate /*
48*0Sstevel@tonic-gate  * Opaque layered driver data structures.
49*0Sstevel@tonic-gate  *
50*0Sstevel@tonic-gate  * The contents of these data structures are private to this
51*0Sstevel@tonic-gate  * implementation of Solaris and are subject to change at any
52*0Sstevel@tonic-gate  * time without notice.
53*0Sstevel@tonic-gate  *
54*0Sstevel@tonic-gate  * Applications and drivers accessing the contents of these structures
55*0Sstevel@tonic-gate  * directly will fail to run on future releases.
56*0Sstevel@tonic-gate  */
57*0Sstevel@tonic-gate typedef struct __ldi_ident		*ldi_ident_t;
58*0Sstevel@tonic-gate 
59*0Sstevel@tonic-gate typedef struct __ldi_handle		*ldi_handle_t;
60*0Sstevel@tonic-gate 
61*0Sstevel@tonic-gate typedef struct __ldi_callback_id	*ldi_callback_id_t;
62*0Sstevel@tonic-gate 
63*0Sstevel@tonic-gate /*
64*0Sstevel@tonic-gate  * LDI Ident manipulation functions
65*0Sstevel@tonic-gate  */
66*0Sstevel@tonic-gate extern ldi_ident_t ldi_ident_from_anon(void);
67*0Sstevel@tonic-gate 
68*0Sstevel@tonic-gate extern int ldi_ident_from_mod(struct modlinkage *, ldi_ident_t *);
69*0Sstevel@tonic-gate extern int ldi_ident_from_major(major_t major, ldi_ident_t *);
70*0Sstevel@tonic-gate extern int ldi_ident_from_dip(dev_info_t *dip, ldi_ident_t *);
71*0Sstevel@tonic-gate extern int ldi_ident_from_dev(dev_t, ldi_ident_t *);
72*0Sstevel@tonic-gate extern int ldi_ident_from_stream(struct queue *, ldi_ident_t *);
73*0Sstevel@tonic-gate extern void ldi_ident_release(ldi_ident_t);
74*0Sstevel@tonic-gate 
75*0Sstevel@tonic-gate 
76*0Sstevel@tonic-gate /*
77*0Sstevel@tonic-gate  * LDI Handle manipulation functions
78*0Sstevel@tonic-gate  */
79*0Sstevel@tonic-gate extern int ldi_open_by_dev(dev_t *, int, int, cred_t *,
80*0Sstevel@tonic-gate     ldi_handle_t *, ldi_ident_t);
81*0Sstevel@tonic-gate extern int ldi_open_by_name(char *, int, cred_t *,
82*0Sstevel@tonic-gate     ldi_handle_t *, ldi_ident_t);
83*0Sstevel@tonic-gate extern int ldi_open_by_devid(ddi_devid_t, char *, int, cred_t *,
84*0Sstevel@tonic-gate     ldi_handle_t *, ldi_ident_t);
85*0Sstevel@tonic-gate 
86*0Sstevel@tonic-gate extern int ldi_close(ldi_handle_t, int flag, cred_t *);
87*0Sstevel@tonic-gate 
88*0Sstevel@tonic-gate extern int ldi_read(ldi_handle_t, struct uio *, cred_t *);
89*0Sstevel@tonic-gate extern int ldi_write(ldi_handle_t, struct uio *, cred_t *);
90*0Sstevel@tonic-gate extern int ldi_ioctl(ldi_handle_t, int, intptr_t, int, cred_t *, int *);
91*0Sstevel@tonic-gate extern int ldi_poll(ldi_handle_t, short, int, short *, struct pollhead **);
92*0Sstevel@tonic-gate extern int ldi_get_size(ldi_handle_t, uint64_t *);
93*0Sstevel@tonic-gate extern int ldi_prop_op(ldi_handle_t, ddi_prop_op_t, int,
94*0Sstevel@tonic-gate     char *, caddr_t, int *);
95*0Sstevel@tonic-gate 
96*0Sstevel@tonic-gate extern int ldi_get_eventcookie(ldi_handle_t, char *,
97*0Sstevel@tonic-gate     ddi_eventcookie_t *);
98*0Sstevel@tonic-gate extern int ldi_add_event_handler(ldi_handle_t, ddi_eventcookie_t,
99*0Sstevel@tonic-gate     void (*handler)(ldi_handle_t, ddi_eventcookie_t, void *, void *),
100*0Sstevel@tonic-gate     void *, ldi_callback_id_t *);
101*0Sstevel@tonic-gate extern int ldi_remove_event_handler(ldi_handle_t, ldi_callback_id_t);
102*0Sstevel@tonic-gate 
103*0Sstevel@tonic-gate extern int ldi_strategy(ldi_handle_t, struct buf *);
104*0Sstevel@tonic-gate extern int ldi_dump(ldi_handle_t, caddr_t, daddr_t, int);
105*0Sstevel@tonic-gate extern int ldi_devmap(ldi_handle_t, devmap_cookie_t, offset_t,
106*0Sstevel@tonic-gate     size_t, size_t *, uint_t);
107*0Sstevel@tonic-gate extern int ldi_aread(ldi_handle_t, struct aio_req *, cred_t *);
108*0Sstevel@tonic-gate extern int ldi_awrite(ldi_handle_t, struct aio_req *, cred_t *);
109*0Sstevel@tonic-gate 
110*0Sstevel@tonic-gate extern int ldi_putmsg(ldi_handle_t, mblk_t *);
111*0Sstevel@tonic-gate extern int ldi_getmsg(ldi_handle_t, mblk_t **, timestruc_t *);
112*0Sstevel@tonic-gate 
113*0Sstevel@tonic-gate extern int ldi_prop_lookup_int_array(ldi_handle_t lh,
114*0Sstevel@tonic-gate     uint_t flags, char *name, int **data, uint_t *nelements);
115*0Sstevel@tonic-gate extern int ldi_prop_lookup_int64_array(ldi_handle_t lh,
116*0Sstevel@tonic-gate     uint_t flags, char *name, int64_t **data, uint_t *nelements);
117*0Sstevel@tonic-gate extern int ldi_prop_lookup_string_array(ldi_handle_t lh,
118*0Sstevel@tonic-gate     uint_t flags, char *name, char ***data, uint_t *nelements);
119*0Sstevel@tonic-gate extern int ldi_prop_lookup_string(ldi_handle_t lh,
120*0Sstevel@tonic-gate     uint_t flags, char *name, char **data);
121*0Sstevel@tonic-gate extern int ldi_prop_lookup_byte_array(ldi_handle_t lh,
122*0Sstevel@tonic-gate     uint_t flags, char *name, uchar_t **data, uint_t *nelements);
123*0Sstevel@tonic-gate extern int ldi_prop_get_int(ldi_handle_t lh,
124*0Sstevel@tonic-gate     uint_t flags, char *name, int defvalue);
125*0Sstevel@tonic-gate extern int64_t ldi_prop_get_int64(ldi_handle_t lh,
126*0Sstevel@tonic-gate     uint_t flags, char *name, int64_t defvalue);
127*0Sstevel@tonic-gate extern int ldi_prop_exists(ldi_handle_t lh,
128*0Sstevel@tonic-gate     uint_t flags, char *name);
129*0Sstevel@tonic-gate 
130*0Sstevel@tonic-gate extern int ldi_get_dev(ldi_handle_t, dev_t *);
131*0Sstevel@tonic-gate extern int ldi_get_otyp(ldi_handle_t, int *);
132*0Sstevel@tonic-gate extern int ldi_get_devid(ldi_handle_t, ddi_devid_t *);
133*0Sstevel@tonic-gate extern int ldi_get_minor_name(ldi_handle_t, char **);
134*0Sstevel@tonic-gate 
135*0Sstevel@tonic-gate 
136*0Sstevel@tonic-gate #endif	/* _KERNEL */
137*0Sstevel@tonic-gate 
138*0Sstevel@tonic-gate #ifdef	__cplusplus
139*0Sstevel@tonic-gate }
140*0Sstevel@tonic-gate #endif
141*0Sstevel@tonic-gate 
142*0Sstevel@tonic-gate #endif	/* _SYS_SUNLDI_H */
143