Hung-Te Lin has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/43987 )
Change subject: mb/google/kukui: revise per-device memory mapping table ......................................................................
mb/google/kukui: revise per-device memory mapping table
In order to help identifying right DRAM info (especially in user space), we want to unify the mapping table and do the device-specific mapping by a virtual offset based on build config.
BUG=b:161768221,b:159301679 BRANCH=kukui TEST=emerge-jacuzzi coreboot
Change-Id: If89bf18c48d263deb79df3e7a60c33bec000d8a3 Signed-off-by: Hung-Te Lin hungte@chromium.org --- M src/mainboard/google/kukui/boardid.c M src/mainboard/google/kukui/sdram_configs.c M src/mainboard/google/kukui/sdram_params/Makefile.inc 3 files changed, 36 insertions(+), 33 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/87/43987/1
diff --git a/src/mainboard/google/kukui/boardid.c b/src/mainboard/google/kukui/boardid.c index c6865d1..2cd5648 100644 --- a/src/mainboard/google/kukui/boardid.c +++ b/src/mainboard/google/kukui/boardid.c @@ -110,7 +110,12 @@ { static uint32_t cached_ram_code = BOARD_ID_INIT;
- if (cached_ram_code == BOARD_ID_INIT) + if (cached_ram_code == BOARD_ID_INIT) { cached_ram_code = get_adc_index(RAM_ID_CHANNEL); + /* Model-specific offset - see sdram_configs.c for details. */ + if (CONFIG(BOARD_GOOGLE_BURNET) || + CONFIG(BOARD_GOOGLE_ESCHE)) + cached_ram_code += 0x10; + } return cached_ram_code; } diff --git a/src/mainboard/google/kukui/sdram_configs.c b/src/mainboard/google/kukui/sdram_configs.c index 7638853..8f3968e 100644 --- a/src/mainboard/google/kukui/sdram_configs.c +++ b/src/mainboard/google/kukui/sdram_configs.c @@ -5,23 +5,28 @@ #include <console/console.h> #include <soc/emi.h>
+/* + * The RAM_CODE ADC on Kukui can support only 12 different levels. Each model + * can create its own mapping if needed, with an offset (0x10, 0x20, ...) + * applied in ram_code(). + */ static const char *const sdram_configs[] = { -#if CONFIG(BOARD_GOOGLE_BURNET) - [1] = "sdram-lpddr4x-H9HCNNNCPMALHR-4GB", - [2] = "sdram-lpddr4x-MT53E1G32D4NQ-4GB", - [3] = "sdram-lpddr4x-K4UBE3D4AA-MGCL-4GB", - [4] = "sdram-lpddr4x-H9HCNNNCPMMLXR-NEE-4GB", -#else /* The default unified table */ - [1] = "sdram-lpddr4x-H9HCNNNCPMALHR-4GB", - [2] = "sdram-lpddr4x-MT53E1G32D4NQ-4GB", - [3] = "sdram-lpddr4x-KMDH6001DA-B422-4GB", - [4] = "sdram-lpddr4x-KMDP6001DA-B425-4GB", - [5] = "sdram-lpddr4x-MT29VZZZAD8DQKSL-4GB", - [6] = "sdram-lpddr4x-KMDV6001DA-B620-4GB", - [7] = "sdram-lpddr4x-SDADA4CR-128G-4GB", - [8] = "sdram-lpddr4x-K4UBE3D4AA-MGCL-4GB", - [10] = "sdram-lpddr4x-H9HCNNNCPMMLXR-NEE-4GB", -#endif + /* Standard table. */ + [0x01] = "sdram-lpddr4x-H9HCNNNCPMALHR-4GB", + [0x02] = "sdram-lpddr4x-MT53E1G32D4NQ-4GB", + [0x03] = "sdram-lpddr4x-KMDH6001DA-B422-4GB", + [0x04] = "sdram-lpddr4x-KMDP6001DA-B425-4GB", + [0x05] = "sdram-lpddr4x-MT29VZZZAD8DQKSL-4GB", + [0x06] = "sdram-lpddr4x-KMDV6001DA-B620-4GB", + [0x07] = "sdram-lpddr4x-SDADA4CR-128G-4GB", + [0x08] = "sdram-lpddr4x-K4UBE3D4AA-MGCL-4GB", + [0x0a] = "sdram-lpddr4x-H9HCNNNCPMMLXR-NEE-4GB", + + /* Table shared by Burnet and its variants, offset = 0x10 */ + [0x11] = "sdram-lpddr4x-H9HCNNNCPMALHR-4GB", + [0x12] = "sdram-lpddr4x-MT53E1G32D4NQ-4GB", + [0x13] = "sdram-lpddr4x-K4UBE3D4AA-MGCL-4GB", + [0x14] = "sdram-lpddr4x-H9HCNNNCPMMLXR-NEE-4GB", };
static struct sdram_params params; diff --git a/src/mainboard/google/kukui/sdram_params/Makefile.inc b/src/mainboard/google/kukui/sdram_params/Makefile.inc index 2b43519..4d4784a 100644 --- a/src/mainboard/google/kukui/sdram_params/Makefile.inc +++ b/src/mainboard/google/kukui/sdram_params/Makefile.inc @@ -1,20 +1,13 @@ sdram-params := -ifeq ($(CONFIG_BOARD_GOOGLE_BURNET),y) - sdram-params += sdram-lpddr4x-H9HCNNNCPMALHR-4GB - sdram-params += sdram-lpddr4x-MT53E1G32D4NQ-4GB - sdram-params += sdram-lpddr4x-K4UBE3D4AA-MGCL-4GB - sdram-params += sdram-lpddr4x-H9HCNNNCPMMLXR-NEE-4GB -else - sdram-params += sdram-lpddr4x-K4UBE3D4AA-MGCL-4GB - sdram-params += sdram-lpddr4x-H9HCNNNCPMALHR-4GB - sdram-params += sdram-lpddr4x-MT53E1G32D4NQ-4GB - sdram-params += sdram-lpddr4x-KMDH6001DA-B422-4GB - sdram-params += sdram-lpddr4x-KMDP6001DA-B425-4GB - sdram-params += sdram-lpddr4x-MT29VZZZAD8DQKSL-4GB - sdram-params += sdram-lpddr4x-KMDV6001DA-B620-4GB - sdram-params += sdram-lpddr4x-SDADA4CR-128G-4GB - sdram-params += sdram-lpddr4x-H9HCNNNCPMMLXR-NEE-4GB -endif +sdram-params += sdram-lpddr4x-H9HCNNNCPMALHR-4GB +sdram-params += sdram-lpddr4x-H9HCNNNCPMMLXR-NEE-4GB +sdram-params += sdram-lpddr4x-K4UBE3D4AA-MGCL-4GB +sdram-params += sdram-lpddr4x-KMDH6001DA-B422-4GB +sdram-params += sdram-lpddr4x-KMDP6001DA-B425-4GB +sdram-params += sdram-lpddr4x-KMDV6001DA-B620-4GB +sdram-params += sdram-lpddr4x-MT29VZZZAD8DQKSL-4GB +sdram-params += sdram-lpddr4x-MT53E1G32D4NQ-4GB +sdram-params += sdram-lpddr4x-SDADA4CR-128G-4GB
$(foreach params,$(sdram-params), \ $(eval cbfs-files-y += $(params)) \
Hello build bot (Jenkins), Patrick Georgi, Martin Roth, Yu-Ping Wu,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/43987
to look at the new patch set (#2).
Change subject: mb/google/kukui: revise per-device memory mapping table ......................................................................
mb/google/kukui: revise per-device memory mapping table
In order to help identifying right DRAM info (especially in user space), we want to unify the mapping table and do the device-specific mapping by a virtual offset based on build config.
BUG=b:161768221,b:159301679 BRANCH=kukui TEST=emerge-jacuzzi coreboot
Change-Id: If89bf18c48d263deb79df3e7a60c33bec000d8a3 Signed-off-by: Hung-Te Lin hungte@chromium.org --- M src/mainboard/google/kukui/Kconfig M src/mainboard/google/kukui/boardid.c M src/mainboard/google/kukui/sdram_configs.c M src/mainboard/google/kukui/sdram_params/Makefile.inc 4 files changed, 39 insertions(+), 33 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/87/43987/2
Jack Rosenthal has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/43987 )
Change subject: mb/google/kukui: revise per-device memory mapping table ......................................................................
Patch Set 2: Code-Review+1
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/43987 )
Change subject: mb/google/kukui: revise per-device memory mapping table ......................................................................
Patch Set 2: Code-Review+2
Hello build bot (Jenkins), Patrick Georgi, Martin Roth, Jack Rosenthal, Yu-Ping Wu,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/43987
to look at the new patch set (#3).
Change subject: mb/google/kukui: revise per-device memory mapping table ......................................................................
mb/google/kukui: revise per-device memory mapping table
In order to help identifying right DRAM info (especially in user space), we want to unify the mapping table and do the device-specific mapping by a virtual offset based on build config.
BUG=b:161768221,b:159301679 BRANCH=kukui TEST=emerge-jacuzzi coreboot
Change-Id: If89bf18c48d263deb79df3e7a60c33bec000d8a3 Signed-off-by: Hung-Te Lin hungte@chromium.org --- M src/mainboard/google/kukui/Kconfig M src/mainboard/google/kukui/boardid.c M src/mainboard/google/kukui/sdram_configs.c M src/mainboard/google/kukui/sdram_params/Makefile.inc 4 files changed, 47 insertions(+), 39 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/87/43987/3
Hello build bot (Jenkins), Patrick Georgi, Martin Roth, Jack Rosenthal, Yu-Ping Wu,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/43987
to look at the new patch set (#4).
Change subject: mb/google/kukui: revise per-device memory mapping table ......................................................................
mb/google/kukui: revise per-device memory mapping table
In order to help identifying right DRAM info (especially in user space), we want to unify the mapping table and do the device-specific mapping by a virtual offset based on build config.
BUG=b:161768221,b:159301679 BRANCH=kukui TEST=emerge-jacuzzi coreboot
Change-Id: If89bf18c48d263deb79df3e7a60c33bec000d8a3 Signed-off-by: Hung-Te Lin hungte@chromium.org --- M src/mainboard/google/kukui/Kconfig M src/mainboard/google/kukui/boardid.c M src/mainboard/google/kukui/sdram_configs.c M src/mainboard/google/kukui/sdram_params/Makefile.inc 4 files changed, 47 insertions(+), 39 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/87/43987/4
Hello build bot (Jenkins), Patrick Georgi, Martin Roth, Jack Rosenthal, Yu-Ping Wu,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/43987
to look at the new patch set (#5).
Change subject: mb/google/kukui: revise per-device memory mapping table ......................................................................
mb/google/kukui: revise per-device memory mapping table
In order to help identifying right DRAM info (especially in user space), we want to unify the mapping table and do the device-specific mapping by a virtual offset based on build config.
BUG=b:161768221,b:159301679 BRANCH=kukui TEST=emerge-jacuzzi coreboot
Change-Id: If89bf18c48d263deb79df3e7a60c33bec000d8a3 Signed-off-by: Hung-Te Lin hungte@chromium.org --- M src/mainboard/google/kukui/Kconfig M src/mainboard/google/kukui/boardid.c M src/mainboard/google/kukui/sdram_configs.c M src/mainboard/google/kukui/sdram_params/Makefile.inc 4 files changed, 49 insertions(+), 39 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/87/43987/5
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/43987 )
Change subject: mb/google/kukui: revise per-device memory mapping table ......................................................................
Patch Set 5:
Rebased
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/43987 )
Change subject: mb/google/kukui: revise per-device memory mapping table ......................................................................
Patch Set 5: Code-Review+2
Hung-Te Lin has submitted this change. ( https://review.coreboot.org/c/coreboot/+/43987 )
Change subject: mb/google/kukui: revise per-device memory mapping table ......................................................................
mb/google/kukui: revise per-device memory mapping table
In order to help identifying right DRAM info (especially in user space), we want to unify the mapping table and do the device-specific mapping by a virtual offset based on build config.
BUG=b:161768221,b:159301679 BRANCH=kukui TEST=emerge-jacuzzi coreboot
Change-Id: If89bf18c48d263deb79df3e7a60c33bec000d8a3 Signed-off-by: Hung-Te Lin hungte@chromium.org Reviewed-on: https://review.coreboot.org/c/coreboot/+/43987 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Yu-Ping Wu yupingso@google.com --- M src/mainboard/google/kukui/Kconfig M src/mainboard/google/kukui/boardid.c M src/mainboard/google/kukui/sdram_configs.c M src/mainboard/google/kukui/sdram_params/Makefile.inc 4 files changed, 49 insertions(+), 39 deletions(-)
Approvals: build bot (Jenkins): Verified Yu-Ping Wu: Looks good to me, approved
diff --git a/src/mainboard/google/kukui/Kconfig b/src/mainboard/google/kukui/Kconfig index e06e60f..01247ca 100644 --- a/src/mainboard/google/kukui/Kconfig +++ b/src/mainboard/google/kukui/Kconfig @@ -71,4 +71,9 @@ hex default 0x2
+config BOARD_SDRAM_TABLE_OFFSET + hex + default 0x10 if BOARD_GOOGLE_BURNET || BOARD_GOOGLE_ESCHE + default 0x0 + endif diff --git a/src/mainboard/google/kukui/boardid.c b/src/mainboard/google/kukui/boardid.c index c6865d1..548f36b 100644 --- a/src/mainboard/google/kukui/boardid.c +++ b/src/mainboard/google/kukui/boardid.c @@ -110,7 +110,10 @@ { static uint32_t cached_ram_code = BOARD_ID_INIT;
- if (cached_ram_code == BOARD_ID_INIT) + if (cached_ram_code == BOARD_ID_INIT) { cached_ram_code = get_adc_index(RAM_ID_CHANNEL); + /* Model-specific offset - see sdram_configs.c for details. */ + cached_ram_code += CONFIG_BOARD_SDRAM_TABLE_OFFSET; + } return cached_ram_code; } diff --git a/src/mainboard/google/kukui/sdram_configs.c b/src/mainboard/google/kukui/sdram_configs.c index 5bf6571..95306c7 100644 --- a/src/mainboard/google/kukui/sdram_configs.c +++ b/src/mainboard/google/kukui/sdram_configs.c @@ -5,24 +5,29 @@ #include <console/console.h> #include <soc/emi.h>
+/* + * The RAM_CODE ADC on Kukui can support only 12 different levels. Each model + * can create its own mapping if needed, with an offset (0x10, 0x20, ..., + * defined as CONFIG_BOARD_SDRAM_TABLE_OFFSET) applied in ram_code(). + */ static const char *const sdram_configs[] = { -#if CONFIG(BOARD_GOOGLE_BURNET) - [1] = "sdram-lpddr4x-H9HCNNNCPMALHR-4GB", - [2] = "sdram-lpddr4x-MT53E1G32D4NQ-4GB", - [3] = "sdram-lpddr4x-K4UBE3D4AA-MGCL-4GB", - [4] = "sdram-lpddr4x-H9HCNNNCPMMLXR-NEE-4GB", -#else /* The default unified table */ - [1] = "sdram-lpddr4x-H9HCNNNCPMALHR-4GB", - [2] = "sdram-lpddr4x-MT53E1G32D4NQ-4GB", - [3] = "sdram-lpddr4x-KMDH6001DA-B422-4GB", - [4] = "sdram-lpddr4x-KMDP6001DA-B425-4GB", - [5] = "sdram-lpddr4x-MT29VZZZAD8DQKSL-4GB", - [6] = "sdram-lpddr4x-KMDV6001DA-B620-4GB", - [7] = "sdram-lpddr4x-SDADA4CR-128G-4GB", - [8] = "sdram-lpddr4x-K4UBE3D4AA-MGCL-4GB", - [9] = "sdram-lpddr4x-MT53E2G32D4NQ-046-8GB", - [10] = "sdram-lpddr4x-H9HCNNNCPMMLXR-NEE-4GB", -#endif + /* Standard table. */ + [0x01] = "sdram-lpddr4x-H9HCNNNCPMALHR-4GB", + [0x02] = "sdram-lpddr4x-MT53E1G32D4NQ-4GB", + [0x03] = "sdram-lpddr4x-KMDH6001DA-B422-4GB", + [0x04] = "sdram-lpddr4x-KMDP6001DA-B425-4GB", + [0x05] = "sdram-lpddr4x-MT29VZZZAD8DQKSL-4GB", + [0x06] = "sdram-lpddr4x-KMDV6001DA-B620-4GB", + [0x07] = "sdram-lpddr4x-SDADA4CR-128G-4GB", + [0x08] = "sdram-lpddr4x-K4UBE3D4AA-MGCL-4GB", + [0x09] = "sdram-lpddr4x-MT53E2G32D4NQ-046-8GB", + [0x0a] = "sdram-lpddr4x-H9HCNNNCPMMLXR-NEE-4GB", + + /* Table shared by Burnet and its variants, offset = 0x10 */ + [0x11] = "sdram-lpddr4x-H9HCNNNCPMALHR-4GB", + [0x12] = "sdram-lpddr4x-MT53E1G32D4NQ-4GB", + [0x13] = "sdram-lpddr4x-K4UBE3D4AA-MGCL-4GB", + [0x14] = "sdram-lpddr4x-H9HCNNNCPMMLXR-NEE-4GB", };
static struct sdram_params params; @@ -30,11 +35,15 @@ const struct sdram_params *get_sdram_config(void) { uint32_t ramcode = ram_code(); + const char *name = NULL;
- if (ramcode >= ARRAY_SIZE(sdram_configs) || - cbfs_boot_load_file(sdram_configs[ramcode], ¶ms, sizeof(params), - CBFS_TYPE_STRUCT) != sizeof(params)) - die("Cannot load SDRAM parameter file!"); + if (ramcode < ARRAY_SIZE(sdram_configs)) + name = sdram_configs[ramcode]; + + if (!name || cbfs_boot_load_file(name, ¶ms, sizeof(params), + CBFS_TYPE_STRUCT) != sizeof(params)) + die("Cannot load SDRAM parameter file for RAM code %#02x: %s!", + ramcode, name ? name : "unknown");
return ¶ms; } diff --git a/src/mainboard/google/kukui/sdram_params/Makefile.inc b/src/mainboard/google/kukui/sdram_params/Makefile.inc index e8dc639..12019a2 100644 --- a/src/mainboard/google/kukui/sdram_params/Makefile.inc +++ b/src/mainboard/google/kukui/sdram_params/Makefile.inc @@ -1,21 +1,14 @@ sdram-params := -ifeq ($(CONFIG_BOARD_GOOGLE_BURNET),y) - sdram-params += sdram-lpddr4x-H9HCNNNCPMALHR-4GB - sdram-params += sdram-lpddr4x-MT53E1G32D4NQ-4GB - sdram-params += sdram-lpddr4x-K4UBE3D4AA-MGCL-4GB - sdram-params += sdram-lpddr4x-H9HCNNNCPMMLXR-NEE-4GB -else - sdram-params += sdram-lpddr4x-K4UBE3D4AA-MGCL-4GB - sdram-params += sdram-lpddr4x-H9HCNNNCPMALHR-4GB - sdram-params += sdram-lpddr4x-MT53E1G32D4NQ-4GB - sdram-params += sdram-lpddr4x-KMDH6001DA-B422-4GB - sdram-params += sdram-lpddr4x-KMDP6001DA-B425-4GB - sdram-params += sdram-lpddr4x-MT29VZZZAD8DQKSL-4GB - sdram-params += sdram-lpddr4x-KMDV6001DA-B620-4GB - sdram-params += sdram-lpddr4x-SDADA4CR-128G-4GB - sdram-params += sdram-lpddr4x-H9HCNNNCPMMLXR-NEE-4GB - sdram-params += sdram-lpddr4x-MT53E2G32D4NQ-046-8GB -endif +sdram-params += sdram-lpddr4x-H9HCNNNCPMALHR-4GB +sdram-params += sdram-lpddr4x-H9HCNNNCPMMLXR-NEE-4GB +sdram-params += sdram-lpddr4x-K4UBE3D4AA-MGCL-4GB +sdram-params += sdram-lpddr4x-KMDH6001DA-B422-4GB +sdram-params += sdram-lpddr4x-KMDP6001DA-B425-4GB +sdram-params += sdram-lpddr4x-KMDV6001DA-B620-4GB +sdram-params += sdram-lpddr4x-MT29VZZZAD8DQKSL-4GB +sdram-params += sdram-lpddr4x-MT53E1G32D4NQ-4GB +sdram-params += sdram-lpddr4x-MT53E2G32D4NQ-046-8GB +sdram-params += sdram-lpddr4x-SDADA4CR-128G-4GB
$(foreach params,$(sdram-params), \ $(eval cbfs-files-y += $(params)) \