diff options
author | Sundeep Panicker <Sundeep.Panicker@Sun.COM> | 2009-09-14 10:21:57 -0700 |
---|---|---|
committer | Sundeep Panicker <Sundeep.Panicker@Sun.COM> | 2009-09-14 10:21:57 -0700 |
commit | 53dbcc5939527e6d5d52d814e51e364b5e8bb532 (patch) | |
tree | 91d911eccad1ecd16894d873e22b1d76c9a76db5 /usr/src/lib/scsi | |
parent | 836d28888aa06622108b415aae3a904e78ce852e (diff) | |
download | illumos-gate-53dbcc5939527e6d5d52d814e51e364b5e8bb532.tar.gz |
PSARC 2009/441 SES enumeration of subchassis
6865478 SES topo plugin should support subchassis
Diffstat (limited to 'usr/src/lib/scsi')
-rw-r--r-- | usr/src/lib/scsi/plugins/ses/SUN/common/sun_spms.c | 25 | ||||
-rw-r--r-- | usr/src/lib/scsi/plugins/ses/libses/common/libses.h | 10 |
2 files changed, 25 insertions, 10 deletions
diff --git a/usr/src/lib/scsi/plugins/ses/SUN/common/sun_spms.c b/usr/src/lib/scsi/plugins/ses/SUN/common/sun_spms.c index ce0762aaf8..995a71c47e 100644 --- a/usr/src/lib/scsi/plugins/ses/SUN/common/sun_spms.c +++ b/usr/src/lib/scsi/plugins/ses/SUN/common/sun_spms.c @@ -69,11 +69,12 @@ static int sun_parse_node(ses_plugin_t *sp, ses_node_t *np) { ses_sun_spms_vs_t *sfbp; - nvlist_t *encprops; + nvlist_t *encprops, *lid_nv; uint8_t *vsp; uint_t vsp_len; uint_t cid_off, cid_len; - char *csn; + uint64_t wwn; + char lid[17]; int nverr; if (ses_node_type(np) != SES_NODE_ENCLOSURE) @@ -90,6 +91,20 @@ sun_parse_node(ses_plugin_t *sp, ses_node_t *np) if (strncmp(sfbp->ssvs_spms_header, "SPMS", 4) != 0) return (0); + + /* + * NOTE - The following is a temporary mechanism to identify + * subchassis until SPMS defines a formal method to do so. + */ + if (nvlist_lookup_nvlist(encprops, SES_EN_PROP_LID, &lid_nv) != 0 || + nvlist_lookup_uint64(lid_nv, SPC3_NAA_INT, &wwn) != 0) + return (0); + + (void) snprintf(lid, sizeof (lid), "%llx", wwn); + + SES_NV_ADD(fixed_string, nverr, encprops, LIBSES_EN_PROP_SUBCHASSIS_ID, + lid, 16); + if (sfbp->ssvs_chassis_id_off < 96) return (0); @@ -109,12 +124,8 @@ sun_parse_node(ses_plugin_t *sp, ses_node_t *np) if (cid_off + cid_len > vsp_len) return (0); - csn = alloca((size_t)cid_len + 1); - csn[cid_len] = '\0'; - - bcopy((void *)(vsp + cid_off), csn, cid_len); SES_NV_ADD(fixed_string, nverr, encprops, LIBSES_EN_PROP_CSN, - csn, cid_len + 1); + (char *)(vsp + cid_off), cid_len); return (0); } diff --git a/usr/src/lib/scsi/plugins/ses/libses/common/libses.h b/usr/src/lib/scsi/plugins/ses/libses/common/libses.h index 0895550d4d..90984ea8b1 100644 --- a/usr/src/lib/scsi/plugins/ses/libses/common/libses.h +++ b/usr/src/lib/scsi/plugins/ses/libses/common/libses.h @@ -20,15 +20,13 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #ifndef _FRAMEWORK_LIBSES_H #define _FRAMEWORK_LIBSES_H -#pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif @@ -72,6 +70,12 @@ extern "C" { */ #define LIBSES_EN_PROP_INTERNAL "libses-internal" +/* + * This property identifies the subchassis id for those systems that + * support the concept of a subchassis. + */ +#define LIBSES_EN_PROP_SUBCHASSIS_ID "libses-subchassis-id" + #ifdef __cplusplus } #endif |