Print this page
7127 remove -Wno-missing-braces from Makefile.uts
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/io/nulldriver.c
+++ new/usr/src/uts/common/io/nulldriver.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 25
26 26 /*
27 27 * nulldriver - null device driver
28 28 *
29 29 * The nulldriver is used to associate a solaris driver with a specific
30 30 * device without enabling external device access.
31 31 *
32 32 * The driver can be used to:
33 33 *
34 34 * o Prevent external access to specific devices/hardware by associating a
35 35 * high-precedence 'compatible' binding, including a path-oriented alias,
36 36 * with nulldriver.
37 37 *
38 38 * o Enable a nexus bus_config implementation to perform dynamic child
39 39 * discovery by creating a child 'probe' devinfo node, bound to
40 40 * nulldriver, at the specific child @unit-addresses associated with
41 41 * discovery. With a nulldriver bound 'probe' node, nexus driver
42 42 * bus_config discovery code can use the same devinfo node oriented
43 43 * transport services for both discovery and normal-operation: which
44 44 * is a significant simplification. While nulldriver prevents external
45 45 * device access, a nexus driver can still internally use the transport
46 46 * services.
47 47 *
48 48 * A scsi(4) example of this type of use is SCSA enumeration services
49 49 * issuing a scsi REPORT_LUN command to a lun-0 'probe' node bound to
50 50 * nulldriver in order to discover all luns supported by a target.
51 51 */
52 52
53 53 #include <sys/modctl.h>
54 54 #include <sys/conf.h>
55 55 #include <sys/ddi.h>
56 56 #include <sys/sunddi.h>
57 57 #include <sys/cmn_err.h>
58 58
59 59 static int nulldriver_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
60 60 static int nulldriver_probe(dev_info_t *);
61 61 static int nulldriver_attach(dev_info_t *, ddi_attach_cmd_t);
62 62 static int nulldriver_detach(dev_info_t *, ddi_detach_cmd_t);
63 63
64 64 static struct cb_ops nulldriver_cb_ops = {
65 65 nodev, /* open */
66 66 nodev, /* close */
67 67 nodev, /* strategy */
68 68 nodev, /* print */
69 69 nodev, /* dump */
70 70 nodev, /* read */
71 71 nodev, /* write */
72 72 nodev, /* ioctl */
73 73 nodev, /* devmap */
74 74 nodev, /* mmap */
75 75 nodev, /* segmap */
76 76 nochpoll, /* poll */
77 77 ddi_prop_op, /* cb_prop_op */
78 78 0, /* streamtab */
79 79 D_MP | D_NEW | D_HOTPLUG /* Driver compatibility flag */
80 80 };
81 81
82 82 static struct dev_ops nulldriver_dev_ops = {
83 83 DEVO_REV, /* devo_rev, */
84 84 0, /* refcnt */
85 85 nulldriver_getinfo, /* info */
86 86 nodev, /* identify */
87 87 nulldriver_probe, /* probe */
88 88 nulldriver_attach, /* attach */
89 89 nulldriver_detach, /* detach */
90 90 nodev, /* reset */
91 91 &nulldriver_cb_ops, /* driver operations */
↓ open down ↓ |
91 lines elided |
↑ open up ↑ |
92 92 (struct bus_ops *)0, /* bus operations */
93 93 NULL, /* power */
94 94 ddi_quiesce_not_needed, /* quiesce */
95 95 };
96 96
97 97 static struct modldrv modldrv = {
98 98 &mod_driverops, "nulldriver 1.1", &nulldriver_dev_ops
99 99 };
100 100
101 101 static struct modlinkage modlinkage = {
102 - MODREV_1, &modldrv, NULL
102 + MODREV_1, { &modldrv, NULL }
103 103 };
104 104
105 105 int
106 106 _init(void)
107 107 {
108 108 return (mod_install(&modlinkage));
109 109 }
110 110
111 111 int
112 112 _fini(void)
113 113 {
114 114 return (mod_remove(&modlinkage));
115 115 }
116 116
117 117 int
118 118 _info(struct modinfo *modinfop)
119 119 {
120 120 return (mod_info(&modlinkage, modinfop));
121 121 }
122 122
123 123 /*ARGSUSED*/
124 124 static int
125 125 nulldriver_getinfo(dev_info_t *dip, ddi_info_cmd_t infocmd,
126 126 void *arg, void **result)
127 127 {
128 128 return (DDI_FAILURE);
129 129 }
130 130
131 131 /*ARGSUSED*/
132 132 static int
133 133 nulldriver_probe(dev_info_t *dip)
134 134 {
135 135 /*
136 136 * We want to succeed probe so that the node gets assigned a unit
137 137 * address "@addr".
138 138 */
139 139 if (ddi_dev_is_sid(dip) == DDI_SUCCESS)
140 140 return (DDI_PROBE_DONTCARE);
141 141 return (DDI_PROBE_DONTCARE);
142 142 }
143 143
144 144 /*
145 145 * nulldriver_attach()
146 146 * attach(9e) entrypoint.
147 147 */
148 148 /* ARGSUSED */
149 149 static int
150 150 nulldriver_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
151 151 {
152 152 switch (cmd) {
153 153 case DDI_ATTACH:
154 154 case DDI_RESUME:
155 155 return (DDI_SUCCESS);
156 156
157 157 case DDI_PM_RESUME:
158 158 default:
159 159 return (DDI_FAILURE);
160 160 }
161 161 }
162 162
163 163 /*
164 164 * nulldriver_detach()
165 165 * detach(9E) entrypoint
166 166 */
167 167 /* ARGSUSED */
168 168 static int
169 169 nulldriver_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
170 170 {
171 171 switch (cmd) {
172 172 case DDI_DETACH:
173 173 case DDI_SUSPEND:
174 174 return (DDI_SUCCESS);
175 175
176 176 case DDI_PM_SUSPEND:
177 177 default:
178 178 return (DDI_FAILURE);
179 179 }
180 180 }
↓ open down ↓ |
68 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX