chip_serial.c revision 88045cff0aae4ed8823cd0989168e8f56927f83e
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * CDDL HEADER START
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * The contents of this file are subject to the terms of the
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Common Development and Distribution License (the "License").
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * You may not use this file except in compliance with the License.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * See the License for the specific language governing permissions
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * and limitations under the License.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * When distributing Covered Code, include this CDDL HEADER in each
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * If applicable, add the following below this CDDL HEADER, with the
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * fields enclosed by brackets "[]" replaced with your own identifying
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * information: Portions Copyright [yyyy] [name of copyright owner]
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * CDDL HEADER END
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Use is subject to license terms.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * The following table maps DIMM manufacturer names to a JEDEC ID as sourced
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * from JEDEC publication JEP106W. This is (obviously) a sparse table which
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * only contains entries for manufacturers whose DIMM's have been qualified
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * for use on Sun platforms.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Fosteripmi_serial_lookup(topo_mod_t *mod, char *ipmi_tag, char *buf)
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster topo_mod_dprintf(mod, "ipmi_serial_lookup() called\n");
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster topo_mod_dprintf(mod, "Failed to get IPMI handle\n");
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster topo_mod_dprintf(mod, "Looking up FRU data for %s ...\n", ipmi_tag);
882df6887ad52745d38d9bf0d92b3ac6f7703126Peter Major if ((fru_loc = ipmi_sdr_lookup_fru(hdl, (const char *)ipmi_tag))
882df6887ad52745d38d9bf0d92b3ac6f7703126Peter Major topo_mod_dprintf(mod, "Failed to lookup %s (%s)\n", ipmi_tag,
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster return (topo_mod_seterrno(mod, EMOD_NVL_INVAL));
882df6887ad52745d38d9bf0d92b3ac6f7703126Peter Major topo_mod_dprintf(mod, "Reading FRU data ...\n");
882df6887ad52745d38d9bf0d92b3ac6f7703126Peter Major if (ipmi_fru_read(hdl, fru_loc, &fru_data) < 0) {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster topo_mod_dprintf(mod, "Failed to read FRU data (%s)\n",
882df6887ad52745d38d9bf0d92b3ac6f7703126Peter Major return (topo_mod_seterrno(mod, EMOD_NVL_INVAL));
882df6887ad52745d38d9bf0d92b3ac6f7703126Peter Major topo_mod_dprintf(mod, "Parsing product info area ...\n");
882df6887ad52745d38d9bf0d92b3ac6f7703126Peter Major if (ipmi_fru_parse_product(hdl, fru_data, &prod_info) < 0) {
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster topo_mod_dprintf(mod, "Failed to read FRU product info (%s)\n",
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster return (topo_mod_seterrno(mod, EMOD_NVL_INVAL));
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster topo_mod_dprintf(mod, "FRU Product Serial: %s\n",
882df6887ad52745d38d9bf0d92b3ac6f7703126Peter Major topo_mod_dprintf(mod, "Manufacturer Name: \"%s\"\n",
882df6887ad52745d38d9bf0d92b3ac6f7703126Peter Major serial_len = strnlen(prod_info.ifpi_product_serial, FRU_INFO_MAXLEN);
882df6887ad52745d38d9bf0d92b3ac6f7703126Peter Major * Newer ILOM software that has the fix for CR 6607996 will have
882df6887ad52745d38d9bf0d92b3ac6f7703126Peter Major * an 18-character serial number that has been synthesized using
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * the recipe from the Sun SPD JEDEC DIMM specification. If we
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * find an 18-character then we'll simply use it, as-is, and
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster (void) memcpy(buf, prod_info.ifpi_product_serial, 18);
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Older ILOM software that DOESN'T have the fix for CR 6607996 will
882df6887ad52745d38d9bf0d92b3ac6f7703126Peter Major * only provide the 8 character manufacturer serial number.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * However, if for some reason the product info area doesn't have the
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * serial information or if the serial isn't 8 characters (we may
882df6887ad52745d38d9bf0d92b3ac6f7703126Peter Major * encounter SP's that don't populate the serial field or are buggy and
882df6887ad52745d38d9bf0d92b3ac6f7703126Peter Major * populate it with garbage), then we'll stop right now and just set the
882df6887ad52745d38d9bf0d92b3ac6f7703126Peter Major * buf to an empty string.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * What follows is a very crude adaptation of the recipe from the
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Sun SPD JEDEC DIMM specification for synthesizing globally unique
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * serial numbers from the 8 character manufacturer serial number.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * The Sun serial number takes the following form:
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * jjjjllyywwssssssss
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * The components are:
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * yyyy: JEDEC ID in hex (2 byte manufacture ID, 2 byte continuation
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * ll: The memory module's manufacturing location.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * yyww: The module's manufacturing date (2-digit year/2-digit week)
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * ssssssss: The 8 character maufacturer serial number
for (i = 0; i < JEDEC_TBL_SZ; i++)
if (found_id)
for (i = 0; i < nelems; i++) {
if (! found_serial)
for (i = 0; i < nelems; i++)
return (rv);