xref: /titanic_51/usr/src/uts/common/sys/dacf.h (revision d583b39bfb4e2571d3e41097c5c357ffe353ad45)
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 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_DACF_H
27 #define	_DACF_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * Device autoconfiguration framework (dacf)
33  */
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 #include <sys/types.h>
40 
41 #define	DACF_MODREV_1		1	/* interface version # */
42 
43 typedef void* dacf_arghdl_t;
44 typedef void* dacf_infohdl_t;
45 
46 typedef enum {
47 	DACF_OPID_ERROR = -1,
48 	DACF_OPID_END = 0,		/* mark end of array of dacf_op's */
49 	DACF_OPID_POSTATTACH = 1,	/* operate after a driver attaches */
50 	DACF_OPID_PREDETACH = 2		/* operate before a driver detaches */
51 } dacf_opid_t;
52 
53 #define	DACF_NUM_OPIDS 2
54 
55 typedef struct dacf_op {
56 	dacf_opid_t op_id;		/* operation id */
57 	int (*op_func)(dacf_infohdl_t, dacf_arghdl_t, int);
58 } dacf_op_t;
59 
60 typedef struct dacf_opset {
61 	char *opset_name;		/* name of this op-set */
62 	dacf_op_t *opset_ops;		/* null-terminated array of ops */
63 } dacf_opset_t;
64 
65 struct dacfsw {
66 	int		dacf_rev;	/* dacf interface revision #	*/
67 	dacf_opset_t	*dacf_opsets;	/* op-sets in this module	*/
68 };
69 
70 extern struct dacfsw kmod_dacfsw;	/* kernel provided module */
71 
72 /*
73  * DACF client interface
74  */
75 
76 const char *dacf_minor_name(dacf_infohdl_t);
77 minor_t dacf_minor_number(dacf_infohdl_t);
78 dev_t dacf_get_dev(dacf_infohdl_t);
79 const char *dacf_driver_name(dacf_infohdl_t);
80 dev_info_t *dacf_devinfo_node(dacf_infohdl_t);
81 const char *dacf_get_arg(dacf_arghdl_t, char *);
82 
83 void dacf_store_info(dacf_infohdl_t, void *);
84 void *dacf_retrieve_info(dacf_infohdl_t);
85 
86 struct vnode *dacf_makevp(dacf_infohdl_t);
87 
88 /*
89  * Error codes for configuration operations
90  */
91 #define	DACF_SUCCESS		0
92 #define	DACF_FAILURE		-1
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif /* _DACF_H */
99