diff options
author | Raul E Rangel <rrangel@chromium.org> | 2018-04-11 10:58:14 -0600 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2018-04-12 15:21:45 +0000 |
commit | 99f54a60bf27dc8f31d79a30f09f94b83856ef00 (patch) | |
tree | 9771ccf627da39acd4e7c7bc4c78b2d8c893389e /src/soc/amd | |
parent | e96df83583d94ab8cddaa9f8ed8977067336712a (diff) | |
download | coreboot-99f54a60bf27dc8f31d79a30f09f94b83856ef00.tar.xz |
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/soc/amd')
-rw-r--r-- | src/soc/amd/common/block/pi/amd_late_init.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/src/soc/amd/common/block/pi/amd_late_init.c b/src/soc/amd/common/block/pi/amd_late_init.c index b0064a2f40..b410602694 100644 --- a/src/soc/amd/common/block/pi/amd_late_init.c +++ b/src/soc/amd/common/block/pi/amd_late_init.c @@ -22,6 +22,7 @@ #include <device/pci_ops.h> #include <dimm_info_util.h> #include <memory_info.h> +#include <lib.h> #include <amdblocks/agesawrapper.h> #include <amdblocks/agesawrapper_call.h> @@ -29,23 +30,10 @@ /** * Populate dimm_info using AGESA TYPE17_DMI_INFO. */ -static void transfer_memory_info(const TYPE17_DMI_INFO *dmi17, +static void transfer_memory_info(TYPE17_DMI_INFO *dmi17, struct dimm_info *dimm) { - size_t len, destlen; - uint32_t offset; - - - len = strnlen(dmi17->SerialNumber, sizeof(dmi17->SerialNumber)) + 1; - destlen = sizeof(dimm->serial); - - if (len > destlen) { - offset = len - destlen; - len = destlen; - } else - offset = 0; - - strncpy((char *)dimm->serial, &dmi17->SerialNumber[offset], len); + hexstrtobin(dmi17->SerialNumber, dimm->serial, sizeof(dimm->serial)); dimm->dimm_size = smbios_memory_size_to_mib(dmi17->MemorySize, dmi17->ExtSize); @@ -90,7 +78,7 @@ static void print_dimm_info(const struct dimm_info *dimm) " mod_id: %hu\n" " mod_type: 0x%hhx\n" " bus_width: %hhu\n" - " serial(%zu): %s\n" + " serial: %02hhx%02hhx%02hhx%02hhx\n" " module_part_number(%zu): %s\n", dimm->dimm_size, dimm->ddr_type, @@ -102,8 +90,10 @@ static void print_dimm_info(const struct dimm_info *dimm) dimm->mod_id, dimm->mod_type, dimm->bus_width, - strlen((char *) dimm->serial), - (char *) dimm->serial, + dimm->serial[0], + dimm->serial[1], + dimm->serial[2], + dimm->serial[3], strlen((char *) dimm->module_part_number), (char *) dimm->module_part_number ); |