Elyes Haouas has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/71660 )
Change subject: spd.h: Move enum ddr4_module_type to ddr4.h ......................................................................
spd.h: Move enum ddr4_module_type to ddr4.h
Move specific enum ddr4_module_type to <device/dram/ddr4.h>.
Change-Id: I4701af23af280055cea2795a3dd835243e7a4b47 Signed-off-by: Elyes Haouas ehaouas@noos.fr --- M src/device/dram/ddr4.c M src/device/dram/spd.c M src/include/device/dram/ddr4.h M src/include/spd.h M src/mainboard/scaleway/tagada/ramstage.c M tests/lib/dimm_info_util-test.c 6 files changed, 30 insertions(+), 48 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/60/71660/1
diff --git a/src/device/dram/ddr4.c b/src/device/dram/ddr4.c index 050857e..3b261a2 100644 --- a/src/device/dram/ddr4.c +++ b/src/device/dram/ddr4.c @@ -272,25 +272,7 @@ dimm->dimm_num = slot; memcpy(dimm->module_part_number, info->part_number, SPD_DDR4_PART_LEN); dimm->mod_id = info->manufacturer_id; - - switch (info->dimm_type) { - case SPD_DDR4_DIMM_TYPE_SO_DIMM: - dimm->mod_type = DDR4_SPD_SODIMM; - break; - case SPD_DDR4_DIMM_TYPE_72B_SO_RDIMM: - dimm->mod_type = DDR4_SPD_72B_SO_RDIMM; - break; - case SPD_DDR4_DIMM_TYPE_UDIMM: - dimm->mod_type = DDR4_SPD_UDIMM; - break; - case SPD_DDR4_DIMM_TYPE_RDIMM: - dimm->mod_type = DDR4_SPD_RDIMM; - break; - default: - dimm->mod_type = SPD_UNDEFINED; - break; - } - + dimm->mod_type = info->dimm_type; dimm->bus_width = info->bus_width; memcpy(dimm->serial, info->serial_number, MIN(sizeof(dimm->serial), sizeof(info->serial_number))); diff --git a/src/device/dram/spd.c b/src/device/dram/spd.c index cfaf86f..4eec47b 100644 --- a/src/device/dram/spd.c +++ b/src/device/dram/spd.c @@ -2,6 +2,7 @@
#include <device/dram/ddr2.h> #include <device/dram/ddr3.h> +#include <device/dram/ddr4.h> #include <device/dram/spd.h> #include <spd.h> #include <stddef.h> @@ -106,22 +107,22 @@ } }
-static void convert_ddr4_module_type_to_spd_info(enum ddr4_module_type module_type, +static void convert_ddr4_module_type_to_spd_info(enum spd_dimm_type_ddr4 module_type, struct spd_info *info) { switch (module_type) { - case DDR4_SPD_RDIMM: - case DDR4_SPD_MINI_RDIMM: + case SPD_DDR4_DIMM_TYPE_RDIMM: + case SPD_DDR4_DIMM_TYPE_MINI_RDIMM: info->form_factor = MEMORY_FORMFACTOR_RIMM; info->type_detail = MEMORY_TYPE_DETAIL_REGISTERED; break; - case DDR4_SPD_UDIMM: - case DDR4_SPD_MINI_UDIMM: + case SPD_DDR4_DIMM_TYPE_UDIMM: + case SPD_DDR4_DIMM_TYPE_MINI_UDIMM: info->form_factor = MEMORY_FORMFACTOR_DIMM; info->type_detail = MEMORY_TYPE_DETAIL_UNBUFFERED; break; - case DDR4_SPD_SODIMM: - case DDR4_SPD_72B_SO_UDIMM: + case SPD_DDR4_DIMM_TYPE_SO_DIMM: + case SPD_DDR4_DIMM_TYPE_72B_SO_RDIMM: info->form_factor = MEMORY_FORMFACTOR_SODIMM; info->type_detail = MEMORY_TYPE_DETAIL_UNKNOWN; break; diff --git a/src/include/device/dram/ddr4.h b/src/include/device/dram/ddr4.h index ee7a1ea..d9c4f22 100644 --- a/src/include/device/dram/ddr4.h +++ b/src/include/device/dram/ddr4.h @@ -21,10 +21,7 @@ #define SPD_DDR4_PART_OFF 329 #define SPD_DDR4_PART_LEN 20
-/* - * Module type (byte 3, bits 3:0) of SPD - * This definition is specific to DDR4. DDR2/3 SPDs have a different structure. - */ +/* Byte 3 [3:0]: DDR4 Module type information */ enum spd_dimm_type_ddr4 { SPD_DDR4_DIMM_TYPE_EXTENDED = 0x0, SPD_DDR4_DIMM_TYPE_RDIMM = 0x1, diff --git a/src/include/spd.h b/src/include/spd.h index 2fe9f96..9dc10aa 100644 --- a/src/include/spd.h +++ b/src/include/spd.h @@ -201,20 +201,6 @@ #define SPD_ECC_8BIT (1<<3) #define SPD_ECC_8BIT_LP5_DDR5 (1<<4)
-/* Byte 3 [3:0]: DDR4 Module type information */ -enum ddr4_module_type { - DDR4_SPD_RDIMM = 0x01, - DDR4_SPD_UDIMM = 0x02, - DDR4_SPD_SODIMM = 0x03, - DDR4_SPD_LRDIMM = 0x04, - DDR4_SPD_MINI_RDIMM = 0x05, - DDR4_SPD_MINI_UDIMM = 0x06, - DDR4_SPD_72B_SO_RDIMM = 0x08, - DDR4_SPD_72B_SO_UDIMM = 0x09, - DDR4_SPD_16B_SO_DIMM = 0x0c, - DDR4_SPD_32B_SO_RDIMM = 0x0d, -}; - enum ddr5_module_type { DDR5_SPD_RDIMM = 0x01, DDR5_SPD_UDIMM = 0x02, diff --git a/src/mainboard/scaleway/tagada/ramstage.c b/src/mainboard/scaleway/tagada/ramstage.c index bb0a385..ca91b32 100644 --- a/src/mainboard/scaleway/tagada/ramstage.c +++ b/src/mainboard/scaleway/tagada/ramstage.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */
+#include <device/dram/ddr4.h> #include <string.h> #include <fsp/api.h> #include <soc/ramstage.h> @@ -83,5 +84,5 @@ int channel, int dimm, int index) { /* Mainboard only has DDR4 DIMM slots */ - mem_info->dimm[index].mod_type = DDR4_SPD_UDIMM; + mem_info->dimm[index].mod_type = SPD_DDR4_DIMM_TYPE_UDIMM; } diff --git a/tests/lib/dimm_info_util-test.c b/tests/lib/dimm_info_util-test.c index 43fe6c9..9615077 100644 --- a/tests/lib/dimm_info_util-test.c +++ b/tests/lib/dimm_info_util-test.c @@ -2,6 +2,7 @@
#include <device/dram/ddr2.h> #include <device/dram/ddr3.h> +#include <device/dram/ddr4.h> #include <dimm_info_util.h> #include <spd.h> #include <tests/test.h> @@ -156,9 +157,11 @@ }, { .memory_type = MEMORY_TYPE_DDR4, - .udimm_allowed = {DDR4_SPD_UDIMM, DDR4_SPD_MINI_UDIMM}, - .rdimm_allowed = {DDR4_SPD_RDIMM, DDR4_SPD_MINI_RDIMM}, - .expected_module_type = DDR4_SPD_SODIMM, + .udimm_allowed = {SPD_DDR4_DIMM_TYPE_UDIMM, + SPD_DDR4_DIMM_TYPE_MINI_UDIMM}, + .rdimm_allowed = {SPD_DDR4_DIMM_TYPE_RDIMM, + SPD_DDR4_DIMM_TYPE_MINI_RDIMM}, + .expected_module_type = SPD_DDR4_DIMM_TYPE_SO_DIMM, }, {.memory_type = MEMORY_TYPE_DDR5, .udimm_allowed = {DDR5_SPD_UDIMM, DDR5_SPD_MINI_UDIMM},