xref: /onnv-gate/usr/src/uts/common/sys/dacf.h (revision 5895:f251acdd9bdc)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*5895Syz147064  * Common Development and Distribution License (the "License").
6*5895Syz147064  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*5895Syz147064  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_DACF_H
270Sstevel@tonic-gate #define	_DACF_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate /*
320Sstevel@tonic-gate  * Device autoconfiguration framework (dacf)
330Sstevel@tonic-gate  */
340Sstevel@tonic-gate 
350Sstevel@tonic-gate #ifdef	__cplusplus
360Sstevel@tonic-gate extern "C" {
370Sstevel@tonic-gate #endif
380Sstevel@tonic-gate 
390Sstevel@tonic-gate #include <sys/types.h>
400Sstevel@tonic-gate 
410Sstevel@tonic-gate #define	DACF_MODREV_1		1	/* interface version # */
420Sstevel@tonic-gate 
430Sstevel@tonic-gate typedef void* dacf_arghdl_t;
440Sstevel@tonic-gate typedef void* dacf_infohdl_t;
450Sstevel@tonic-gate 
460Sstevel@tonic-gate typedef enum {
470Sstevel@tonic-gate 	DACF_OPID_ERROR = -1,
480Sstevel@tonic-gate 	DACF_OPID_END = 0,		/* mark end of array of dacf_op's */
490Sstevel@tonic-gate 	DACF_OPID_POSTATTACH = 1,	/* operate after a driver attaches */
500Sstevel@tonic-gate 	DACF_OPID_PREDETACH = 2		/* operate before a driver detaches */
510Sstevel@tonic-gate } dacf_opid_t;
520Sstevel@tonic-gate 
530Sstevel@tonic-gate #define	DACF_NUM_OPIDS 2
540Sstevel@tonic-gate 
550Sstevel@tonic-gate typedef struct dacf_op {
560Sstevel@tonic-gate 	dacf_opid_t op_id;		/* operation id */
570Sstevel@tonic-gate 	int (*op_func)(dacf_infohdl_t, dacf_arghdl_t, int);
580Sstevel@tonic-gate } dacf_op_t;
590Sstevel@tonic-gate 
600Sstevel@tonic-gate typedef struct dacf_opset {
610Sstevel@tonic-gate 	char *opset_name;		/* name of this op-set */
620Sstevel@tonic-gate 	dacf_op_t *opset_ops;		/* null-terminated array of ops */
630Sstevel@tonic-gate } dacf_opset_t;
640Sstevel@tonic-gate 
650Sstevel@tonic-gate struct dacfsw {
660Sstevel@tonic-gate 	int		dacf_rev;	/* dacf interface revision #	*/
670Sstevel@tonic-gate 	dacf_opset_t	*dacf_opsets;	/* op-sets in this module	*/
680Sstevel@tonic-gate };
690Sstevel@tonic-gate 
700Sstevel@tonic-gate extern struct dacfsw kmod_dacfsw;	/* kernel provided module */
710Sstevel@tonic-gate 
720Sstevel@tonic-gate /*
730Sstevel@tonic-gate  * DACF client interface
740Sstevel@tonic-gate  */
750Sstevel@tonic-gate 
760Sstevel@tonic-gate const char *dacf_minor_name(dacf_infohdl_t);
770Sstevel@tonic-gate minor_t dacf_minor_number(dacf_infohdl_t);
78*5895Syz147064 dev_t dacf_get_dev(dacf_infohdl_t);
790Sstevel@tonic-gate const char *dacf_driver_name(dacf_infohdl_t);
800Sstevel@tonic-gate dev_info_t *dacf_devinfo_node(dacf_infohdl_t);
810Sstevel@tonic-gate const char *dacf_get_arg(dacf_arghdl_t, char *);
820Sstevel@tonic-gate 
830Sstevel@tonic-gate void dacf_store_info(dacf_infohdl_t, void *);
840Sstevel@tonic-gate void *dacf_retrieve_info(dacf_infohdl_t);
850Sstevel@tonic-gate 
860Sstevel@tonic-gate struct vnode *dacf_makevp(dacf_infohdl_t);
870Sstevel@tonic-gate 
880Sstevel@tonic-gate /*
890Sstevel@tonic-gate  * Error codes for configuration operations
900Sstevel@tonic-gate  */
910Sstevel@tonic-gate #define	DACF_SUCCESS		0
920Sstevel@tonic-gate #define	DACF_FAILURE		-1
930Sstevel@tonic-gate 
940Sstevel@tonic-gate #ifdef __cplusplus
950Sstevel@tonic-gate }
960Sstevel@tonic-gate #endif
970Sstevel@tonic-gate 
980Sstevel@tonic-gate #endif /* _DACF_H */
99