1*ac88567aSHyon Kim /*
2*ac88567aSHyon Kim  * CDDL HEADER START
3*ac88567aSHyon Kim  *
4*ac88567aSHyon Kim  * The contents of this file are subject to the terms of the
5*ac88567aSHyon Kim  * Common Development and Distribution License (the "License").
6*ac88567aSHyon Kim  * You may not use this file except in compliance with the License.
7*ac88567aSHyon Kim  *
8*ac88567aSHyon Kim  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*ac88567aSHyon Kim  * or http://www.opensolaris.org/os/licensing.
10*ac88567aSHyon Kim  * See the License for the specific language governing permissions
11*ac88567aSHyon Kim  * and limitations under the License.
12*ac88567aSHyon Kim  *
13*ac88567aSHyon Kim  * When distributing Covered Code, include this CDDL HEADER in each
14*ac88567aSHyon Kim  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*ac88567aSHyon Kim  * If applicable, add the following below this CDDL HEADER, with the
16*ac88567aSHyon Kim  * fields enclosed by brackets "[]" replaced with your own identifying
17*ac88567aSHyon Kim  * information: Portions Copyright [yyyy] [name of copyright owner]
18*ac88567aSHyon Kim  *
19*ac88567aSHyon Kim  * CDDL HEADER END
20*ac88567aSHyon Kim  */
21*ac88567aSHyon Kim 
22*ac88567aSHyon Kim /*
23*ac88567aSHyon Kim  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
24*ac88567aSHyon Kim  */
25*ac88567aSHyon Kim 
26*ac88567aSHyon Kim #include <sys/types.h>
27*ac88567aSHyon Kim #include <stddef.h>
28*ac88567aSHyon Kim #include <stdio.h>
29*ac88567aSHyon Kim #include <string.h>
30*ac88567aSHyon Kim #include <libnvpair.h>
31*ac88567aSHyon Kim 
32*ac88567aSHyon Kim #include <scsi/libses.h>
33*ac88567aSHyon Kim #include <scsi/libses_plugin.h>
34*ac88567aSHyon Kim #include <scsi/plugins/ses/vendor/sun.h>
35*ac88567aSHyon Kim #include <scsi/plugins/ses/vendor/sun_impl.h>
36*ac88567aSHyon Kim 
37*ac88567aSHyon Kim int
sun_fill_element_node(ses_plugin_t * sp,ses_node_t * np)38*ac88567aSHyon Kim sun_fill_element_node(ses_plugin_t *sp, ses_node_t *np)
39*ac88567aSHyon Kim {
40*ac88567aSHyon Kim 	ses_snap_t *snap = ses_node_snapshot(np);
41*ac88567aSHyon Kim 	nvlist_t *props = ses_node_props(np);
42*ac88567aSHyon Kim 	sun_fru_descr_impl_t *sfdip;
43*ac88567aSHyon Kim 	size_t len;
44*ac88567aSHyon Kim 	int err;
45*ac88567aSHyon Kim 
46*ac88567aSHyon Kim 	if ((sfdip = ses_plugin_page_lookup(sp, snap,
47*ac88567aSHyon Kim 	    SUN_DIAGPAGE_FRUID, np, &len)) != NULL) {
48*ac88567aSHyon Kim 		if ((err = sun_fruid_parse_common(sfdip, props)) != 0)
49*ac88567aSHyon Kim 			return (err);
50*ac88567aSHyon Kim 	}
51*ac88567aSHyon Kim 
52*ac88567aSHyon Kim 	return (0);
53*ac88567aSHyon Kim }
54