From e44fe6a39effe9a227fee193a03c616075d5d462 Mon Sep 17 00:00:00 2001 From: Jincheng Li Date: Tue, 25 Jun 2024 15:24:59 +0800 Subject: soc/intel/xeon_sp/gnr: Add dimm_slot configuration Add sample DIMM slot configuration table for avenuecity CRB and beechnutcity CRB. This table will be used to fill SMBIOS type 17 table. TEST=Boot on intel/avenuecity CRB It will help to update Locator, Bank Locator and Asset Tag with the value described in dimm_slot_config_table Change-Id: I53556c02eb75204994a1bcb42eccb940e83bd532 Signed-off-by: Jincheng Li Signed-off-by: Shuo Liu Reviewed-on: https://review.coreboot.org/c/coreboot/+/83326 Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- src/mainboard/intel/avenuecity_crb/Makefile.mk | 2 ++ .../intel/avenuecity_crb/config/dimm_slot.c | 18 +++++++++++++ src/mainboard/intel/avenuecity_crb/ramstage.c | 31 ++++++++++++++++++++++ src/mainboard/intel/avenuecity_crb/romstage.c | 10 ++++++- 4 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 src/mainboard/intel/avenuecity_crb/config/dimm_slot.c (limited to 'src/mainboard/intel/avenuecity_crb') diff --git a/src/mainboard/intel/avenuecity_crb/Makefile.mk b/src/mainboard/intel/avenuecity_crb/Makefile.mk index 2e1a74a45a..cfff6d3851 100644 --- a/src/mainboard/intel/avenuecity_crb/Makefile.mk +++ b/src/mainboard/intel/avenuecity_crb/Makefile.mk @@ -2,5 +2,7 @@ bootblock-y += bootblock.c romstage-y += romstage.c +romstage-y += config/dimm_slot.c romstage-y += config/iio.c +ramstage-y += config/dimm_slot.c ramstage-y += ramstage.c diff --git a/src/mainboard/intel/avenuecity_crb/config/dimm_slot.c b/src/mainboard/intel/avenuecity_crb/config/dimm_slot.c new file mode 100644 index 0000000000..00d5e13df4 --- /dev/null +++ b/src/mainboard/intel/avenuecity_crb/config/dimm_slot.c @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include + +/* + * TODO: add the rest of DIMM slots + */ +static const struct dimm_slot_config dimm_slot_config_table[] = { + /* socket, channel, dimm, dev_locator, bank_locator, asset_tag */ + {0, 0, 0, "CPU0_DIMM_A1", "BANK 0", "CPU0_DIMM_A1_AssetTag"}, +}; + +const struct dimm_slot_config *get_dimm_slot_config_table(int *size) +{ + *size = ARRAY_SIZE(dimm_slot_config_table); + return dimm_slot_config_table; +} diff --git a/src/mainboard/intel/avenuecity_crb/ramstage.c b/src/mainboard/intel/avenuecity_crb/ramstage.c index a09016d461..37d7d731dd 100644 --- a/src/mainboard/intel/avenuecity_crb/ramstage.c +++ b/src/mainboard/intel/avenuecity_crb/ramstage.c @@ -1,8 +1,39 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include #include void mainboard_silicon_init_params(FSPS_UPD *params) { } + +void smbios_fill_dimm_locator(const struct dimm_info *dimm, struct smbios_type17 *t) +{ + int size; + const struct dimm_slot_config *dimm_slot_config_table = get_dimm_slot_config_table(&size); + + for (int i = 0; i < size; i++) { + if (DIMM_SLOT_EQUAL(dimm_slot_config_table[i], + dimm->soc_num, dimm->channel_num, dimm->dimm_num)) { + const char *locator = dimm_slot_config_table[i].dev_locator; + t->device_locator = smbios_add_string(t->eos, locator); + locator = dimm_slot_config_table[i].bank_locator; + t->bank_locator = smbios_add_string(t->eos, locator); + } + } +} + +void smbios_fill_dimm_asset_tag(const struct dimm_info *dimm, struct smbios_type17 *t) +{ + int size; + const struct dimm_slot_config *dimm_slot_config_table = get_dimm_slot_config_table(&size); + + for (int i = 0; i < size; i++) { + if (DIMM_SLOT_EQUAL(dimm_slot_config_table[i], + dimm->soc_num, dimm->channel_num, dimm->dimm_num)) { + const char *asset_tag = dimm_slot_config_table[i].asset_tag; + t->asset_tag = smbios_add_string(t->eos, asset_tag); + } + } +} diff --git a/src/mainboard/intel/avenuecity_crb/romstage.c b/src/mainboard/intel/avenuecity_crb/romstage.c index f0e67af21e..446d4e2be7 100644 --- a/src/mainboard/intel/avenuecity_crb/romstage.c +++ b/src/mainboard/intel/avenuecity_crb/romstage.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -43,6 +44,13 @@ void mainboard_memory_init_params(FSPM_UPD *mupd) bool mainboard_dimm_slot_exists(uint8_t socket, uint8_t channel, uint8_t dimm) { - //TODO: not implemented yet + int size; + const struct dimm_slot_config *dimm_slot_config_table = get_dimm_slot_config_table(&size); + + for (int i = 0; i < size; i++) { + if (DIMM_SLOT_EQUAL(dimm_slot_config_table[i], socket, channel, dimm)) + return true; + } + return false; } -- cgit v1.2.3