lib: remove unused libnvfru
[unleashed/lotheac.git] / include / sys / dacf_impl.h
blob0d30ae061cd4414012260602f7b521b0f2c4b22e
1 /*
2 * CDDL HEADER START
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.
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.
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]
20 * CDDL HEADER END
23 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _DACF_IMPL_H
28 #define _DACF_IMPL_H
31 * Implementation-Private definitions for Device autoconfiguration (dacf)
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
38 #include <sys/types.h>
39 #include <sys/dacf.h>
41 typedef struct dacf_module {
42 char *dm_name; /* module name */
43 krwlock_t dm_lock; /* module lock */
44 int dm_loaded; /* whether dm_opsets is valid */
45 dacf_opset_t *dm_opsets; /* null-terminated array of op-sets */
46 } dacf_module_t;
49 #define DACF_RULE_HASHSIZE 8
50 #define DACF_MODULE_HASHSIZE 8
51 #define DACF_INFO_HASHSIZE 16
54 * Flags to dacf_process_rsrvs
56 #define DACF_PROC_INVOKE 0x0001
57 #define DACF_PROC_RELE 0x0002
59 typedef enum dacf_devspec {
60 DACF_DS_ERROR = -1, /* error state */
61 DACF_DS_MIN_NT = 1, /* match minor node-type */
62 DACF_DS_DRV_MNAME = 2, /* match driver minor name */
63 DACF_DS_DEV_PATH = 3 /* match device path */
64 } dacf_devspec_t;
66 #define DACF_NUM_DEVSPECS 3
68 typedef struct dacf_arg {
69 char *arg_name; /* operation argument name */
70 char *arg_val; /* operation argument value */
71 struct dacf_arg *arg_next; /* next arg in chain */
72 } dacf_arg_t;
74 typedef struct dacf_rule {
75 char *r_devspec_data; /* the dev-spec data to match against */
76 char *r_module; /* module implementing the operation */
77 char *r_opset; /* opset in module that impls. op */
78 dacf_opid_t r_opid; /* operation id for this rule */
79 uint_t r_opts; /* reserved for options */
80 uint_t r_refs; /* reference count */
81 dacf_arg_t *r_args; /* linked list of operation arguments */
82 } dacf_rule_t;
84 typedef struct dacf_rsrvlist {
85 dacf_rule_t *rsrv_rule; /* the rule being reserved for later */
86 dacf_infohdl_t rsrv_ihdl;
87 int rsrv_result; /* retval of the last invoke */
88 struct dacf_rsrvlist *rsrv_next;
89 } dacf_rsrvlist_t;
91 #ifdef _KERNEL
93 extern kmutex_t dacf_lock;
95 int dacf_module_register(char *, struct dacfsw *);
96 int dacf_module_unregister(char *);
98 int dacf_arg_insert(dacf_arg_t **, char *, char *);
99 void dacf_arglist_delete(dacf_arg_t **);
101 void dacf_init(void);
102 int read_dacf_binding_file(char *);
103 void dacf_clear_rules(void);
105 dacf_devspec_t dacf_get_devspec(char *);
106 const char *dacf_devspec_to_str(dacf_devspec_t);
108 dacf_opid_t dacf_get_op(char *);
109 const char *dacf_opid_to_str(dacf_opid_t);
111 int dacf_getopt(char *, uint_t *);
113 int dacf_rule_insert(dacf_devspec_t, char *, char *, char *,
114 dacf_opid_t, uint_t, dacf_arg_t *);
115 void dacf_rule_hold(dacf_rule_t *);
116 void dacf_rule_rele(dacf_rule_t *);
118 struct ddi_minor_data;
119 void dacf_rsrv_make(dacf_rsrvlist_t *, dacf_rule_t *, void *,
120 dacf_rsrvlist_t **);
121 void dacf_process_rsrvs(dacf_rsrvlist_t **, dacf_opid_t, int);
122 void dacf_clr_rsrvs(dev_info_t *, dacf_opid_t);
124 dacf_rule_t *dacf_match(dacf_opid_t, dacf_devspec_t, void *);
127 * Failure codes from dacf_op_invoke, assigned to dacf_rsrvlist_t.rsrv_result
129 #define DACF_ERR_MOD_NOTFOUND -1
130 #define DACF_ERR_OPSET_NOTFOUND -2
131 #define DACF_ERR_OP_NOTFOUND -3
132 #define DACF_ERR_OP_FAILED -4
134 int dacf_op_invoke(dacf_rule_t *, dacf_infohdl_t, int);
137 * Debugging support
139 #define DACF_DBG_MSGS 0x00000001
140 #define DACF_DBG_DEVI 0x00000002
142 extern int dacfdebug;
146 * dacf client support: definitions pertaining to the various kernel hooks
147 * that utilize the dacf framework
150 void dacfc_match_create_minor(char *, char *, dev_info_t *,
151 struct ddi_minor_data *, int);
153 int dacfc_postattach(dev_info_t *);
154 int dacfc_predetach(dev_info_t *);
156 #endif /* _KERNEL */
158 #ifdef __cplusplus
160 #endif
162 #endif /* _DACF_IMPL_H */