Print this page
7127 remove -Wno-missing-braces from Makefile.uts
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/intel/io/cpunex.c
+++ new/usr/src/uts/intel/io/cpunex.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 /*
28 28 * CPU nexus driver
29 29 */
30 30
31 31 #include <sys/types.h>
32 32 #include <sys/param.h>
33 33 #include <sys/conf.h>
34 34 #include <sys/devops.h>
35 35 #include <sys/modctl.h>
36 36 #include <sys/cmn_err.h>
37 37 #include <sys/ddi.h>
38 38 #include <sys/sunddi.h>
39 39 #include <sys/sunndi.h>
40 40
41 41 static int cpunex_attach(dev_info_t *, ddi_attach_cmd_t);
42 42 static int cpunex_detach(dev_info_t *, ddi_detach_cmd_t);
43 43 static int cpunex_bus_ctl(dev_info_t *, dev_info_t *, ddi_ctl_enum_t,
44 44 void *, void *);
45 45
46 46 static struct bus_ops cpunex_bus_ops = {
47 47 BUSO_REV,
48 48 nullbusmap,
49 49 NULL,
50 50 NULL,
51 51 NULL,
52 52 i_ddi_map_fault,
53 53 ddi_no_dma_map,
54 54 ddi_no_dma_allochdl,
55 55 ddi_no_dma_freehdl,
56 56 ddi_no_dma_bindhdl,
57 57 ddi_no_dma_unbindhdl,
58 58 ddi_no_dma_flush,
59 59 ddi_no_dma_win,
60 60 ddi_no_dma_mctl,
61 61 cpunex_bus_ctl,
62 62 ddi_bus_prop_op,
63 63 };
64 64
65 65 static struct dev_ops cpunex_ops = {
66 66 DEVO_REV,
67 67 0,
68 68 ddi_no_info,
69 69 nulldev,
70 70 nulldev,
71 71 cpunex_attach,
72 72 cpunex_detach,
73 73 nodev,
74 74 NULL,
75 75 &cpunex_bus_ops,
76 76 NULL,
77 77 ddi_quiesce_not_needed, /* quiesce */
↓ open down ↓ |
77 lines elided |
↑ open up ↑ |
78 78 };
79 79
80 80 static struct modldrv modldrv = {
81 81 &mod_driverops,
82 82 "cpu nexus driver",
83 83 &cpunex_ops
84 84 };
85 85
86 86 static struct modlinkage modlinkage = {
87 87 MODREV_1,
88 - &modldrv,
89 - NULL
88 + { &modldrv, NULL }
90 89 };
91 90
92 91 /*
93 92 * cpunex_bus_ctl()
94 93 * This routine implements nexus bus ctl operations. Of importance are
95 94 * DDI_CTLOPS_REPORTDEV, DDI_CTLOPS_INITCHILD, DDI_CTLOPS_UNINITCHILD
96 95 * and DDI_CTLOPS_POWER. For DDI_CTLOPS_INITCHILD, it tries to lookup
97 96 * reg property on the child node and builds and sets the name.
98 97 */
99 98 static int
100 99 cpunex_bus_ctl(dev_info_t *dip, dev_info_t *rdip, ddi_ctl_enum_t op, void *arg,
101 100 void *result)
102 101 {
103 102 switch (op) {
104 103 case DDI_CTLOPS_REPORTDEV: {
105 104 dev_info_t *pdip = ddi_get_parent(rdip);
106 105 cmn_err(CE_CONT, "?%s%d at %s%d",
107 106 ddi_node_name(rdip), ddi_get_instance(rdip),
108 107 ddi_node_name(pdip), ddi_get_instance(pdip));
109 108 return (DDI_SUCCESS);
110 109 }
111 110
112 111 case DDI_CTLOPS_INITCHILD: {
113 112 dev_info_t *cdip = (dev_info_t *)arg;
114 113 int i;
115 114 char caddr[MAXNAMELEN];
116 115
117 116 i = ddi_prop_get_int(DDI_DEV_T_ANY, cdip,
118 117 DDI_PROP_DONTPASS, "reg", -1);
119 118
120 119 if (i == -1) {
121 120 cmn_err(CE_NOTE, "!%s(%d): \"reg\" property "
122 121 "not found", ddi_node_name(cdip),
123 122 ddi_get_instance(cdip));
124 123 return (DDI_NOT_WELL_FORMED);
125 124 }
126 125
127 126 (void) sprintf(caddr, "%d", i);
128 127 ddi_set_name_addr(cdip, caddr);
129 128
130 129 return (DDI_SUCCESS);
131 130 }
132 131
133 132 case DDI_CTLOPS_UNINITCHILD: {
134 133 ddi_prop_remove_all((dev_info_t *)arg);
135 134 ddi_set_name_addr((dev_info_t *)arg, NULL);
136 135 return (DDI_SUCCESS);
137 136 }
138 137
139 138 default: {
140 139 return (ddi_ctlops(dip, rdip, op, arg, result));
141 140 }
142 141 }
143 142 }
144 143
145 144 /*ARGSUSED*/
146 145 static int
147 146 cpunex_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
148 147 {
149 148 switch (cmd) {
150 149 case DDI_ATTACH:
151 150 case DDI_RESUME:
152 151 break;
153 152 default:
154 153 return (DDI_FAILURE);
155 154 }
156 155
157 156 return (DDI_SUCCESS);
158 157 }
159 158
160 159 /*ARGSUSED*/
161 160 static int
162 161 cpunex_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
163 162 {
164 163 switch (cmd) {
165 164 case DDI_DETACH:
166 165 case DDI_SUSPEND:
167 166 break;
168 167 default:
169 168 return (DDI_FAILURE);
170 169 }
171 170
172 171 return (DDI_SUCCESS);
173 172 }
174 173
175 174 int
176 175 _init(void)
177 176 {
178 177 int error;
179 178
180 179 error = mod_install(&modlinkage);
181 180 return (error);
182 181 }
183 182
184 183 int
185 184 _fini(void)
186 185 {
187 186 int error;
188 187
189 188 error = mod_remove(&modlinkage);
190 189 return (error);
191 190 }
192 191
193 192 int
194 193 _info(struct modinfo *modinfop)
195 194 {
196 195 return (mod_info(&modlinkage, modinfop));
197 196 }
↓ open down ↓ |
98 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX