xref: /titanic_41/usr/src/uts/common/sys/dacf.h (revision d29b2c4438482eb00488be49a1f5d6835f455546)
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 1999-2002 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_DACF_H
28 #define	_DACF_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * Device autoconfiguration framework (dacf)
34  */
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 #include <sys/types.h>
41 
42 #define	DACF_MODREV_1		1	/* interface version # */
43 
44 typedef void* dacf_arghdl_t;
45 typedef void* dacf_infohdl_t;
46 
47 typedef enum {
48 	DACF_OPID_ERROR = -1,
49 	DACF_OPID_END = 0,		/* mark end of array of dacf_op's */
50 	DACF_OPID_POSTATTACH = 1,	/* operate after a driver attaches */
51 	DACF_OPID_PREDETACH = 2		/* operate before a driver detaches */
52 } dacf_opid_t;
53 
54 #define	DACF_NUM_OPIDS 2
55 
56 typedef struct dacf_op {
57 	dacf_opid_t op_id;		/* operation id */
58 	int (*op_func)(dacf_infohdl_t, dacf_arghdl_t, int);
59 } dacf_op_t;
60 
61 typedef struct dacf_opset {
62 	char *opset_name;		/* name of this op-set */
63 	dacf_op_t *opset_ops;		/* null-terminated array of ops */
64 } dacf_opset_t;
65 
66 struct dacfsw {
67 	int		dacf_rev;	/* dacf interface revision #	*/
68 	dacf_opset_t	*dacf_opsets;	/* op-sets in this module	*/
69 };
70 
71 extern struct dacfsw kmod_dacfsw;	/* kernel provided module */
72 
73 /*
74  * DACF client interface
75  */
76 
77 const char *dacf_minor_name(dacf_infohdl_t);
78 minor_t dacf_minor_number(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