mb/google/ocelot: implement variant_memory_sku()

Ocelot uses the CHROMEOS_DRAM_PART_NUMBER_IN_CBI Kconfig option
because the hardware does not have DRAM ID straps, but this option was
designed for boards that would only ever have a single memory option.

In order to support multiple memory parts, we need to create a table
that maps memory part number to DRAM id so that we can select the
correct SPD for the memory, and then override the variant_memory_sku()
routine so that we can determine and return the correct DRAM id for
the memory part number specified in the CBI.

BUG=b:443646405
TEST=Change DRAM part number in CBI to "H58G66BK7BX067", reboot ocelot
and verify the AP boot logs show that the SPD index = 1.

Change-Id: I18ba6c4891c6053f40e99dcde8a06b9efc1d95f4
Signed-off-by: Nick Vaccaro <nvaccaro@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/89183
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Appukuttan V K <appukuttan.vk@intel.com>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
This commit is contained in:
Nick Vaccaro 2025-09-15 11:04:12 -07:00
commit 289c01e6fb
3 changed files with 37 additions and 1 deletions

View file

@ -4,6 +4,7 @@ bootblock-y += gpio.c
romstage-y += gpio.c
romstage-y += memory.c
romstage-$(CONFIG_FW_CONFIG) += fw_config.c
romstage-$(CONFIG_CHROMEOS_DRAM_PART_NUMBER_IN_CBI) += part_num_to_dram_id.c
ramstage-y += gpio.c
romstage-$(CONFIG_FW_CONFIG) += variant.c
ramstage-$(CONFIG_FW_CONFIG) += variant.c

View file

@ -82,7 +82,7 @@ const struct mb_cfg *variant_memory_params(void)
void variant_get_spd_info(struct mem_spd *spd_info)
{
uint32_t id = board_id() & BOARD_ID_MASK;
spd_info->cbfs_index = 0;
spd_info->cbfs_index = variant_memory_sku();
switch (id) {
case BOARD_ID_DDR5:

View file

@ -0,0 +1,35 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <baseboard/variants.h>
struct part_num_spd_index {
const char part_num[DIMM_INFO_PART_NUMBER_SIZE];
int spd_index;
};
static const struct part_num_spd_index part_number_map[] = {
{ "H58G56BK8BX068", 0 },
{ "H58G66BK7BX067", 1 },
{ "H58G66BK8BX067", 2 },
{ "H58GE6AK8BX104", 3 },
{ "H58G66CK8BX147", 2 },
};
int variant_memory_sku(void)
{
int index;
size_t num_elements = ARRAY_SIZE(part_number_map);
const char *part_num = mainboard_get_dram_part_num();
if (part_num == NULL)
die("No part number in CBI, halting boot.\n");
for (index = 0; index < num_elements; index++) {
if (!strcmp(part_num, part_number_map[index].part_num))
/* exact match found */
return part_number_map[index].spd_index;
}
/* We didn't find a match for part_num, halt boot */
die("No part number found looking for %s, halting boot.\n", part_num);
}