2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * CDDL HEADER START
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * The contents of this file are subject to the terms of the
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * Common Development and Distribution License (the "License").
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * You may not use this file except in compliance with the License.
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * See the License for the specific language governing permissions
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * and limitations under the License.
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * When distributing Covered Code, include this CDDL HEADER in each
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * If applicable, add the following below this CDDL HEADER, with the
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * fields enclosed by brackets "[]" replaced with your own identifying
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * information: Portions Copyright [yyyy] [name of copyright owner]
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * CDDL HEADER END
c3c82186300a3bf11cfdda43b1cca3cd6b333629Srihari Venkatesan * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * Use is subject to license terms.
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * The following table maps DIMM manufacturer names to a JEDEC ID as sourced
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * from JEDEC publication JEP106W. This is (obviously) a sparse table which
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * only contains entries for manufacturers whose DIMM's have been qualified
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * for use on Sun platforms.
2cb5535af222653abf2eba5c180ded4a7b85d8b6robjipmi_serial_lookup(topo_mod_t *mod, char *ipmi_tag, char *buf)
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj topo_mod_dprintf(mod, "ipmi_serial_lookup() called\n");
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj topo_mod_dprintf(mod, "Looking up FRU data for %s ...\n", ipmi_tag);
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj if ((fru_loc = ipmi_sdr_lookup_fru(hdl, (const char *)ipmi_tag))
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj topo_mod_dprintf(mod, "Failed to lookup %s (%s)\n", ipmi_tag,
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj topo_mod_dprintf(mod, "Failed to read FRU data (%s)\n",
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj topo_mod_dprintf(mod, "Parsing product info area ...\n");
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj if (ipmi_fru_parse_product(hdl, fru_data, &prod_info) < 0) {
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj topo_mod_dprintf(mod, "Failed to read FRU product info (%s)\n",
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj serial_len = strnlen(prod_info.ifpi_product_serial, FRU_INFO_MAXLEN);
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * Newer ILOM software that has the fix for CR 6607996 will have
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * an 18-character serial number that has been synthesized using
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * the recipe from the Sun SPD JEDEC DIMM specification. If we
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * find an 18-character then we'll simply use it, as-is, and
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj return (0);
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * Older ILOM software that DOESN'T have the fix for CR 6607996 will
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * only provide the 8 character manufacturer serial number.
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * However, if for some reason the product info area doesn't have the
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * serial information or if the serial isn't 8 characters (we may
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * encounter SP's that don't populate the serial field or are buggy and
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * populate it with garbage), then we'll stop right now and just set the
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * buf to an empty string.
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj return (0);
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * What follows is a very crude adaptation of the recipe from the
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * Sun SPD JEDEC DIMM specification for synthesizing globally unique
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * serial numbers from the 8 character manufacturer serial number.
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * The Sun serial number takes the following form:
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * jjjjllyywwssssssss
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * The components are:
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * yyyy: JEDEC ID in hex (2 byte manufacture ID, 2 byte continuation
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * ll: The memory module's manufacturing location.
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * yyww: The module's manufacturing date (2-digit year/2-digit week)
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * ssssssss: The 8 character maufacturer serial number
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * First we need to normalize the manufacturer name we pulled out of
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * the FRU product info area. Our normalization algorithm is fairly
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * - convert all alpha chars to uppercase
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * - convert non-alphanumeric characters to a single space
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * We use the normalized name to lookup the JEDEC ID from a static
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * table. If the FRU area didn't have a manufacturer name or if the ID
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * lookup fails we'll set jjjj to 0000.
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj topo_mod_dprintf(mod, "Normalized Manufacturer Name \"%s\"\n",
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj for (i = 0; i < JEDEC_TBL_SZ; i++)
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj if (strcmp(prod_info.ifpi_manuf_name, jedec_tbl[i][0]) == 0) {
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * The manufacturing location and date is not available via IPMI on
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * Sun platforms, so we simply set these six digits to zeros.
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * Finally, we just copy the 8 character product serial straight over
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj * and then NULL terminate the string.
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj (void) memcpy((buf+10), prod_info.ifpi_product_serial, 8);
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj return (0);
2cb5535af222653abf2eba5c180ded4a7b85d8b6robj/* ARGSUSED */
2cb5535af222653abf2eba5c180ded4a7b85d8b6robjget_dimm_serial(topo_mod_t *mod, tnode_t *node, topo_version_t vers,
88045cff0aae4ed8823cd0989168e8f56927f83eRobert Johnston char **entity_refs, fru_serial[FRU_INFO_MAXLEN];
88045cff0aae4ed8823cd0989168e8f56927f83eRobert Johnston if (topo_prop_get_string_array(node, TOPO_PGROUP_IPMI, "entity_ref",
88045cff0aae4ed8823cd0989168e8f56927f83eRobert Johnston topo_mod_dprintf(mod, "%s: Failed to lookup entity_ref property"
88045cff0aae4ed8823cd0989168e8f56927f83eRobert Johnston for (i = 0; i < nelems; i++) {
88045cff0aae4ed8823cd0989168e8f56927f83eRobert Johnston if (ipmi_serial_lookup(mod, entity_refs[i], fru_serial) == 0) {
88045cff0aae4ed8823cd0989168e8f56927f83eRobert Johnston topo_mod_dprintf(mod, "Failed to lookup serial for "
c3c82186300a3bf11cfdda43b1cca3cd6b333629Srihari Venkatesan if (store_prop_val(mod, fru_serial, "serial", out) != 0) {
c3c82186300a3bf11cfdda43b1cca3cd6b333629Srihari Venkatesan topo_mod_dprintf(mod, "Failed to set serial\n");
c3c82186300a3bf11cfdda43b1cca3cd6b333629Srihari Venkatesan /* topo errno already set */
88045cff0aae4ed8823cd0989168e8f56927f83eRobert Johnston for (i = 0; i < nelems; i++)
88045cff0aae4ed8823cd0989168e8f56927f83eRobert Johnston topo_mod_free(mod, entity_refs, (nelems * sizeof (char *)));