dacf_impl.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _DACF_IMPL_H
#define _DACF_IMPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Implementation-Private definitions for Device autoconfiguration (dacf)
*/
#ifdef __cplusplus
extern "C" {
#endif
typedef struct dacf_module {
char *dm_name; /* module name */
int dm_loaded; /* whether dm_opsets is valid */
#define DACF_RULE_HASHSIZE 8
#define DACF_MODULE_HASHSIZE 8
#define DACF_INFO_HASHSIZE 16
/*
* Flags to dacf_process_rsrvs
*/
#define DACF_PROC_INVOKE 0x0001
#define DACF_PROC_RELE 0x0002
typedef enum dacf_devspec {
#define DACF_NUM_DEVSPECS 3
typedef struct dacf_arg {
char *arg_name; /* operation argument name */
char *arg_val; /* operation argument value */
} dacf_arg_t;
typedef struct dacf_rule {
char *r_devspec_data; /* the dev-spec data to match against */
char *r_module; /* module implementing the operation */
char *r_opset; /* opset in module that impls. op */
} dacf_rule_t;
typedef struct dacf_rsrvlist {
int rsrv_result; /* retval of the last invoke */
struct dacf_rsrvlist *rsrv_next;
#ifdef _KERNEL
int dacf_module_register(char *, struct dacfsw *);
int dacf_module_unregister(char *);
int dacf_arg_insert(dacf_arg_t **, char *, char *);
void dacf_arglist_delete(dacf_arg_t **);
void dacf_init(void);
int read_dacf_binding_file(char *);
void dacf_clear_rules(void);
dacf_devspec_t dacf_get_devspec(char *);
const char *dacf_devspec_to_str(dacf_devspec_t);
dacf_opid_t dacf_get_op(char *);
const char *dacf_opid_to_str(dacf_opid_t);
int dacf_getopt(char *, uint_t *);
int dacf_rule_insert(dacf_devspec_t, char *, char *, char *,
void dacf_rule_hold(dacf_rule_t *);
void dacf_rule_rele(dacf_rule_t *);
struct ddi_minor_data;
dacf_rsrvlist_t **);
/*
* Failure codes from dacf_op_invoke, assigned to dacf_rsrvlist_t.rsrv_result
*/
#define DACF_ERR_MOD_NOTFOUND -1
#define DACF_ERR_OPSET_NOTFOUND -2
#define DACF_ERR_OP_NOTFOUND -3
#define DACF_ERR_OP_FAILED -4
/*
* Debugging support
*/
#define DACF_DBG_MSGS 0x00000001
#define DACF_DBG_DEVI 0x00000002
extern int dacfdebug;
/*
* dacf client support: definitions pertaining to the various kernel hooks
* that utilize the dacf framework
*/
void dacfc_match_create_minor(char *, char *, dev_info_t *,
struct ddi_minor_data *, int);
int dacfc_postattach(dev_info_t *);
int dacfc_predetach(dev_info_t *);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _DACF_IMPL_H */