summaryrefslogtreecommitdiffstats
path: root/src/include/memory_info.h
diff options
context:
space:
mode:
authorRichard Spiegel <richard.spiegel@silverbackltd.com>2018-02-22 10:03:39 -0700
committerPatrick Georgi <pgeorgi@google.com>2018-02-26 15:06:58 +0000
commitbd654805933f70ed77e5a03921c31262d9347cc6 (patch)
treec247fd21c86e4660868b55528578ad4025a88a2c /src/include/memory_info.h
parent99fd08d324c6a6da4149f95f9d78da0fc769c289 (diff)
downloadcoreboot-bd654805933f70ed77e5a03921c31262d9347cc6.tar.gz
coreboot-bd654805933f70ed77e5a03921c31262d9347cc6.tar.bz2
coreboot-bd654805933f70ed77e5a03921c31262d9347cc6.zip
src/arch/x86/smbios.c: Fix type 17 part number
Some DIMMs have invalid strings when it comes to device part number (bytes 0x149-0x15c). From DDR4 SPD specs it should be ASCIIZ with unused space filled with white spaces (ASCII 0x20). Byte 20 should be 0 (ASCIIZ), all others should be ASCII. Create a test that detects invalid strings and replace invalid characters with *. If a replacement was made the output string then must be <Invalid (replaced string)>. BUG=b:73122207 TEST=Build, boot and record serial output for kahlee while injecting different strings to dmi17->PartNumber. Use code to examine SMBIOS, while testing different valid and invalid strings. Remove string injection before committing. Change-Id: Iead2a4cb14ff28d263d7214111b637e62ebd2921 Signed-off-by: Richard Spiegel <richard.spiegel@silverbackltd.com> Reviewed-on: https://review.coreboot.org/23844 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'src/include/memory_info.h')
-rw-r--r--src/include/memory_info.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/include/memory_info.h b/src/include/memory_info.h
index 8569ee493a7c..a1b3553a7775 100644
--- a/src/include/memory_info.h
+++ b/src/include/memory_info.h
@@ -19,6 +19,10 @@
#include <stdint.h>
#include <compiler.h>
+#define DIMM_INFO_SERIAL_SIZE 5
+#define DIMM_INFO_PART_NUMBER_SIZE 19
+#define DIMM_INFO_TOTAL 8 /* Maximum num of dimm is 8 */
+
/*
* If this table is filled and put in CBMEM,
* then these info in CBMEM will be used to generate smbios type 17 table
@@ -31,10 +35,10 @@ struct dimm_info {
uint8_t channel_num;
uint8_t dimm_num;
uint8_t bank_locator;
- /* The 5th byte is '\0' for the end of string */
- uint8_t serial[5];
- /* The 19th byte is '\0' for the end of string */
- uint8_t module_part_number[19];
+ /* The last byte is '\0' for the end of string */
+ uint8_t serial[DIMM_INFO_SERIAL_SIZE];
+ /* The last byte is '\0' for the end of string */
+ uint8_t module_part_number[DIMM_INFO_PART_NUMBER_SIZE];
uint16_t mod_id;
uint8_t mod_type;
uint8_t bus_width;
@@ -42,8 +46,7 @@ struct dimm_info {
struct memory_info {
uint8_t dimm_cnt;
- /* Maximum num of dimm is 8 */
- struct dimm_info dimm[8];
+ struct dimm_info dimm[DIMM_INFO_TOTAL];
} __packed;
#endif