sd: remove 'ssd' driver support
[unleashed/tickless.git] / usr / src / lib / scsi / plugins / ses / libses / common / libses.c
blob28b1b80f602900019e577c0f6707cfd353bf8bc5
1 /*
2 * CDDL HEADER START
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]
19 * CDDL HEADER END
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 #include <scsi/libses.h>
30 #include <scsi/libses_plugin.h>
32 #include "libses_impl.h"
34 /*ARGSUSED*/
35 static int
36 libses_parse_node(ses_plugin_t *sp, ses_node_t *np)
38 nvlist_t *lid;
39 nvlist_t *props;
40 uint64_t id, type;
41 char csn[17];
42 const char *name;
43 int nverr;
45 props = ses_node_props(np);
47 if (nvlist_lookup_uint64(props, SES_PROP_ELEMENT_TYPE,
48 &type) == 0 &&
49 (name = ses_element_type_name(type)) != NULL) {
51 * Add a standard human-readable name for the element type.
53 SES_NV_ADD(string, nverr, props,
54 LIBSES_PROP_ELEMENT_TYPE_NAME, name);
57 if (ses_node_type(np) != SES_NODE_ENCLOSURE)
58 return (0);
61 * The only thing we do for all targets is fill in the default chassis
62 * number from the enclosure logical ID.
64 if (nvlist_lookup_nvlist(props, SES_EN_PROP_LID, &lid) != 0)
65 return (0);
67 VERIFY(nvlist_lookup_uint64(lid, SPC3_NAA_INT, &id) == 0);
69 (void) snprintf(csn, sizeof (csn), "%llx", id);
70 SES_NV_ADD(string, nverr, props, LIBSES_EN_PROP_CSN, csn);
72 return (0);
75 int
76 _ses_init(ses_plugin_t *sp)
78 ses_plugin_config_t config = {
79 .spc_node_parse = libses_parse_node
82 return (ses_plugin_register(sp, LIBSES_PLUGIN_VERSION,
83 &config) != 0);
87 * libses must be loaded after ses2.
89 int
90 _ses_priority(void)
92 return (1);