summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorRaul E Rangel <rrangel@chromium.org>2018-04-11 10:58:14 -0600
committerMartin Roth <martinroth@google.com>2018-04-12 15:21:45 +0000
commit99f54a60bf27dc8f31d79a30f09f94b83856ef00 (patch)
tree9771ccf627da39acd4e7c7bc4c78b2d8c893389e /src/arch
parente96df83583d94ab8cddaa9f8ed8977067336712a (diff)
include/memory_info.h: Change serial number field from 5 bytes to 4
dimm_info.serial had a strange contract. The SPD spec defines a 4 byte serial number. dimm_info.serial required a 4 character ascii string with a null terminator. This change makes the serial field so it matches the SPD spec. smbios.c will then translate the byte array into hex and set it on the smbios table. There were only two callers that set the serial number: * haswell/raminit.c: already does a memcpy(serial, spd->serial, 4), so it already matches the new contract. * amd_late_init.c: Previously copied the last 4 characters. Requires decoding the serial number into a byte array. google/cyan/spd/spd.c: This could be updated to pass the serial number, but it uses a hard coded spd.bin. Testing this on grunt, dmidecode now shows the full serial number: Serial Number: 00000000 BUG=b:65403853 TEST=tested on grunt Change-Id: Ifc58ad9ea4cdd2abe06a170a39b1f32680e7b299 Signed-off-by: Raul E Rangel <rrangel@chromium.org> Reviewed-on: https://review.coreboot.org/25343 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/x86/smbios.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/arch/x86/smbios.c b/src/arch/x86/smbios.c
index 7e776373c4..bb4bc1abd1 100644
--- a/src/arch/x86/smbios.c
+++ b/src/arch/x86/smbios.c
@@ -254,6 +254,19 @@ static void smbios_fill_dimm_part_number(const char *part_number,
}
}
+/* Encodes the SPD serial number into hex */
+static void smbios_fill_dimm_serial_number(const struct dimm_info *dimm,
+ struct smbios_type17 *t)
+{
+ char serial[9];
+
+ snprintf(serial, sizeof(serial), "%02hhx%02hhx%02hhx%02hhx",
+ dimm->serial[0], dimm->serial[1], dimm->serial[2],
+ dimm->serial[3]);
+
+ t->serial_number = smbios_add_string(t->eos, serial);
+}
+
static int create_smbios_type17_for_dimm(struct dimm_info *dimm,
unsigned long *current, int *handle)
{
@@ -293,13 +306,7 @@ static int create_smbios_type17_for_dimm(struct dimm_info *dimm,
}
smbios_fill_dimm_manufacturer_from_id(dimm->mod_id, t);
- /* put '\0' in the end of data */
- dimm->serial[DIMM_INFO_SERIAL_SIZE - 1] = '\0';
- if (dimm->serial[0] == 0)
- t->serial_number = smbios_add_string(t->eos, "None");
- else
- t->serial_number = smbios_add_string(t->eos,
- (const char *)dimm->serial);
+ smbios_fill_dimm_serial_number(dimm, t);
snprintf(locator, sizeof(locator), "Channel-%d-DIMM-%d",
dimm->channel_num, dimm->dimm_num);