5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
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.
12 *
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]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * The MDESC picl plugin serves 2 different functionalities.
29 * --The first is to look up certain CPU properties in the MDESC an to add
30 * these properties in the already created CPU PICL nodes in the /platform
31 * section of the tree.
32 * --The second functionality is to create a /disk_discovery section of the
33 * PICL tree which will have a disk node created for each disk node in the
34 * machine description.
35 */
36
37 #include "mdescplugin.h"
38 #include <libnvpair.h>
39
40 #pragma init(mdescplugin_register) /* place in .init section */
41
42 picl_nodehdl_t root_node;
43 md_t *mdp;
44 mde_cookie_t rootnode;
203
204 /*ARGSUSED*/
205 static void
206 mdesc_ev_completion_handler(char *ename, void *earg, size_t size)
207 {
208 free(earg);
209 }
210
211 static void
212 signal_devtree(void)
213 {
214 nvlist_t *nvl;
215 char *packed_nvl;
216 size_t nvl_size;
217 int status;
218
219 if (nvlist_alloc(&nvl, NV_UNIQUE_NAME_TYPE, NULL) != 0)
220 return;
221
222 /*
223 * Right now (Aug. 2007) snowbird is the only other platform
224 * which uses this event. Since that's a sun4u platform and
225 * this is sun4v we do not have to worry about possible confusion
226 * or interference between the two by grabbing this event for
227 * our own use here. This event is consumed by the devtree
228 * plug-in. The event signals the plug-in to re-run its
229 * cpu initialization function, which will cause it to add
230 * additional information to the cpu devtree nodes (particularly,
231 * the administrative state of the cpus.)
232 */
233 if (nvlist_add_string(nvl, PICLEVENTARG_EVENT_NAME,
234 PICLEVENT_CPU_STATE_CHANGE) != 0) {
235 free(nvl);
236 return;
237 }
238
239 /*
240 * The devtree plug-in needs to see a devfs path argument for
241 * any event it considers. We supply one here which is essentially
242 * a dummy since it is not processed by the devtree plug-in for
243 * this event.
244 */
245 if (nvlist_add_string(nvl, PICLEVENTARG_DEVFS_PATH, "/cpu") != 0) {
246 free(nvl);
247 return;
|
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
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.
12 *
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]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 *
26 * Copyright 2019 Peter Tribble.
27 */
28
29 /*
30 * The MDESC picl plugin serves 2 different functionalities.
31 * --The first is to look up certain CPU properties in the MDESC an to add
32 * these properties in the already created CPU PICL nodes in the /platform
33 * section of the tree.
34 * --The second functionality is to create a /disk_discovery section of the
35 * PICL tree which will have a disk node created for each disk node in the
36 * machine description.
37 */
38
39 #include "mdescplugin.h"
40 #include <libnvpair.h>
41
42 #pragma init(mdescplugin_register) /* place in .init section */
43
44 picl_nodehdl_t root_node;
45 md_t *mdp;
46 mde_cookie_t rootnode;
205
206 /*ARGSUSED*/
207 static void
208 mdesc_ev_completion_handler(char *ename, void *earg, size_t size)
209 {
210 free(earg);
211 }
212
213 static void
214 signal_devtree(void)
215 {
216 nvlist_t *nvl;
217 char *packed_nvl;
218 size_t nvl_size;
219 int status;
220
221 if (nvlist_alloc(&nvl, NV_UNIQUE_NAME_TYPE, NULL) != 0)
222 return;
223
224 /*
225 * This event is consumed by the devtree
226 * plug-in. The event signals the plug-in to re-run its
227 * cpu initialization function, which will cause it to add
228 * additional information to the cpu devtree nodes (particularly,
229 * the administrative state of the cpus.)
230 */
231 if (nvlist_add_string(nvl, PICLEVENTARG_EVENT_NAME,
232 PICLEVENT_CPU_STATE_CHANGE) != 0) {
233 free(nvl);
234 return;
235 }
236
237 /*
238 * The devtree plug-in needs to see a devfs path argument for
239 * any event it considers. We supply one here which is essentially
240 * a dummy since it is not processed by the devtree plug-in for
241 * this event.
242 */
243 if (nvlist_add_string(nvl, PICLEVENTARG_DEVFS_PATH, "/cpu") != 0) {
244 free(nvl);
245 return;
|