4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
28 #include <sys/types.h>
29 #include <sys/errno.h>
32 #include <sys/sunddi.h>
35 * Configuration information
38 static int options_info(dev_info_t
*dip
, ddi_info_cmd_t infocmd
, void *arg
,
40 static int options_attach(dev_info_t
*devi
, ddi_attach_cmd_t cmd
);
41 static int options_detach(dev_info_t
*devi
, ddi_detach_cmd_t cmd
);
42 static dev_info_t
*options_devi
;
44 struct dev_ops options_ops
= {
46 DEVO_REV
, /* devo_rev, */
48 options_info
, /* info */
49 nulldev
, /* identify */
51 options_attach
, /* attach */
52 options_detach
, /* detach */
54 NULL
, /* driver operations */
55 NULL
, /* bus operations */
57 ddi_quiesce_not_needed
, /* quiesce */
62 * Autoload Data and Autoload Entry
65 #include <sys/modctl.h>
67 extern struct mod_ops mod_driverops
;
68 static struct modldrv modldrv
= {
69 &mod_driverops
, /* Type of module. This one is a driver */
70 "options driver", /* Name of the module. */
71 &options_ops
, /* driver ops */
74 static struct modlinkage modlinkage
= {
75 MODREV_1
, (void *)&modldrv
79 * This is the driver initialization routine.
85 return (mod_install(&modlinkage
));
96 struct modinfo
*modinfop
;
98 return (mod_info(&modlinkage
, modinfop
));
103 options_info(dev_info_t
*dip
, ddi_info_cmd_t infocmd
, void *arg
, void **result
)
108 case DDI_INFO_DEVT2DEVINFO
:
109 if (options_devi
== NULL
) {
112 *result
= (void *) options_devi
;
116 case DDI_INFO_DEVT2INSTANCE
:
127 options_attach(dev_info_t
*devi
, ddi_attach_cmd_t cmd
)
132 return (DDI_SUCCESS
);
135 return (DDI_SUCCESS
);
138 return (DDI_FAILURE
);
144 options_detach(dev_info_t
*devi
, ddi_detach_cmd_t cmd
)
148 return (DDI_SUCCESS
);
152 return (DDI_FAILURE
);