xref: /illumos-gate/usr/src/uts/common/sys/dacf.h (revision fafb665d)
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 /*
307c478bd9Sstevel@tonic-gate  * Device autoconfiguration framework (dacf)
317c478bd9Sstevel@tonic-gate  */
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
347c478bd9Sstevel@tonic-gate extern "C" {
357c478bd9Sstevel@tonic-gate #endif
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #include <sys/types.h>
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #define	DACF_MODREV_1		1	/* interface version # */
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate typedef void* dacf_arghdl_t;
427c478bd9Sstevel@tonic-gate typedef void* dacf_infohdl_t;
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate typedef enum {
457c478bd9Sstevel@tonic-gate 	DACF_OPID_ERROR = -1,
467c478bd9Sstevel@tonic-gate 	DACF_OPID_END = 0,		/* mark end of array of dacf_op's */
477c478bd9Sstevel@tonic-gate 	DACF_OPID_POSTATTACH = 1,	/* operate after a driver attaches */
487c478bd9Sstevel@tonic-gate 	DACF_OPID_PREDETACH = 2		/* operate before a driver detaches */
497c478bd9Sstevel@tonic-gate } dacf_opid_t;
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate #define	DACF_NUM_OPIDS 2
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate typedef struct dacf_op {
547c478bd9Sstevel@tonic-gate 	dacf_opid_t op_id;		/* operation id */
557c478bd9Sstevel@tonic-gate 	int (*op_func)(dacf_infohdl_t, dacf_arghdl_t, int);
567c478bd9Sstevel@tonic-gate } dacf_op_t;
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate typedef struct dacf_opset {
597c478bd9Sstevel@tonic-gate 	char *opset_name;		/* name of this op-set */
607c478bd9Sstevel@tonic-gate 	dacf_op_t *opset_ops;		/* null-terminated array of ops */
617c478bd9Sstevel@tonic-gate } dacf_opset_t;
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate struct dacfsw {
647c478bd9Sstevel@tonic-gate 	int		dacf_rev;	/* dacf interface revision #	*/
657c478bd9Sstevel@tonic-gate 	dacf_opset_t	*dacf_opsets;	/* op-sets in this module	*/
667c478bd9Sstevel@tonic-gate };
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate extern struct dacfsw kmod_dacfsw;	/* kernel provided module */
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate /*
717c478bd9Sstevel@tonic-gate  * DACF client interface
727c478bd9Sstevel@tonic-gate  */
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate const char *dacf_minor_name(dacf_infohdl_t);
757c478bd9Sstevel@tonic-gate minor_t dacf_minor_number(dacf_infohdl_t);
76*d62bc4baSyz147064 dev_t dacf_get_dev(dacf_infohdl_t);
777c478bd9Sstevel@tonic-gate const char *dacf_driver_name(dacf_infohdl_t);
787c478bd9Sstevel@tonic-gate dev_info_t *dacf_devinfo_node(dacf_infohdl_t);
797c478bd9Sstevel@tonic-gate const char *dacf_get_arg(dacf_arghdl_t, char *);
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate void dacf_store_info(dacf_infohdl_t, void *);
827c478bd9Sstevel@tonic-gate void *dacf_retrieve_info(dacf_infohdl_t);
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate struct vnode *dacf_makevp(dacf_infohdl_t);
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate /*
877c478bd9Sstevel@tonic-gate  * Error codes for configuration operations
887c478bd9Sstevel@tonic-gate  */
897c478bd9Sstevel@tonic-gate #define	DACF_SUCCESS		0
907c478bd9Sstevel@tonic-gate #define	DACF_FAILURE		-1
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate #ifdef __cplusplus
937c478bd9Sstevel@tonic-gate }
947c478bd9Sstevel@tonic-gate #endif
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate #endif /* _DACF_H */
97