xref: /titanic_51/usr/src/uts/common/sys/dacf.h (revision d62bc4badc1c1f1549c961cfb8b420e650e1272b)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*d62bc4baSyz147064  * Common Development and Distribution License (the "License").
6*d62bc4baSyz147064  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*d62bc4baSyz147064  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_DACF_H
277c478bd9Sstevel@tonic-gate #define	_DACF_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate /*
327c478bd9Sstevel@tonic-gate  * Device autoconfiguration framework (dacf)
337c478bd9Sstevel@tonic-gate  */
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
367c478bd9Sstevel@tonic-gate extern "C" {
377c478bd9Sstevel@tonic-gate #endif
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #include <sys/types.h>
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #define	DACF_MODREV_1		1	/* interface version # */
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate typedef void* dacf_arghdl_t;
447c478bd9Sstevel@tonic-gate typedef void* dacf_infohdl_t;
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate typedef enum {
477c478bd9Sstevel@tonic-gate 	DACF_OPID_ERROR = -1,
487c478bd9Sstevel@tonic-gate 	DACF_OPID_END = 0,		/* mark end of array of dacf_op's */
497c478bd9Sstevel@tonic-gate 	DACF_OPID_POSTATTACH = 1,	/* operate after a driver attaches */
507c478bd9Sstevel@tonic-gate 	DACF_OPID_PREDETACH = 2		/* operate before a driver detaches */
517c478bd9Sstevel@tonic-gate } dacf_opid_t;
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate #define	DACF_NUM_OPIDS 2
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate typedef struct dacf_op {
567c478bd9Sstevel@tonic-gate 	dacf_opid_t op_id;		/* operation id */
577c478bd9Sstevel@tonic-gate 	int (*op_func)(dacf_infohdl_t, dacf_arghdl_t, int);
587c478bd9Sstevel@tonic-gate } dacf_op_t;
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate typedef struct dacf_opset {
617c478bd9Sstevel@tonic-gate 	char *opset_name;		/* name of this op-set */
627c478bd9Sstevel@tonic-gate 	dacf_op_t *opset_ops;		/* null-terminated array of ops */
637c478bd9Sstevel@tonic-gate } dacf_opset_t;
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate struct dacfsw {
667c478bd9Sstevel@tonic-gate 	int		dacf_rev;	/* dacf interface revision #	*/
677c478bd9Sstevel@tonic-gate 	dacf_opset_t	*dacf_opsets;	/* op-sets in this module	*/
687c478bd9Sstevel@tonic-gate };
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate extern struct dacfsw kmod_dacfsw;	/* kernel provided module */
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate /*
737c478bd9Sstevel@tonic-gate  * DACF client interface
747c478bd9Sstevel@tonic-gate  */
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate const char *dacf_minor_name(dacf_infohdl_t);
777c478bd9Sstevel@tonic-gate minor_t dacf_minor_number(dacf_infohdl_t);
78*d62bc4baSyz147064 dev_t dacf_get_dev(dacf_infohdl_t);
797c478bd9Sstevel@tonic-gate const char *dacf_driver_name(dacf_infohdl_t);
807c478bd9Sstevel@tonic-gate dev_info_t *dacf_devinfo_node(dacf_infohdl_t);
817c478bd9Sstevel@tonic-gate const char *dacf_get_arg(dacf_arghdl_t, char *);
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate void dacf_store_info(dacf_infohdl_t, void *);
847c478bd9Sstevel@tonic-gate void *dacf_retrieve_info(dacf_infohdl_t);
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate struct vnode *dacf_makevp(dacf_infohdl_t);
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate /*
897c478bd9Sstevel@tonic-gate  * Error codes for configuration operations
907c478bd9Sstevel@tonic-gate  */
917c478bd9Sstevel@tonic-gate #define	DACF_SUCCESS		0
927c478bd9Sstevel@tonic-gate #define	DACF_FAILURE		-1
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate #ifdef __cplusplus
957c478bd9Sstevel@tonic-gate }
967c478bd9Sstevel@tonic-gate #endif
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate #endif /* _DACF_H */
99