diff options
author | Jincheng Li <jincheng.li@intel.com> | 2024-06-25 15:24:59 +0800 |
---|---|---|
committer | Lean Sheng Tan <sheng.tan@9elements.com> | 2024-07-26 11:04:54 +0000 |
commit | e44fe6a39effe9a227fee193a03c616075d5d462 (patch) | |
tree | de011c17703e2d5d078c473042833438400f517f /src/mainboard | |
parent | 871f93549d3076433ba9d95a55dd16ab411907a6 (diff) |
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 <jincheng.li@intel.com>
Signed-off-by: Shuo Liu <shuo.liu@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83326
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/mainboard')
-rw-r--r-- | src/mainboard/intel/avenuecity_crb/Makefile.mk | 2 | ||||
-rw-r--r-- | src/mainboard/intel/avenuecity_crb/config/dimm_slot.c | 18 | ||||
-rw-r--r-- | src/mainboard/intel/avenuecity_crb/ramstage.c | 31 | ||||
-rw-r--r-- | src/mainboard/intel/avenuecity_crb/romstage.c | 10 | ||||
-rw-r--r-- | src/mainboard/intel/beechnutcity_crb/Makefile.mk | 2 | ||||
-rw-r--r-- | src/mainboard/intel/beechnutcity_crb/config/dimm_slot.c | 18 | ||||
-rw-r--r-- | src/mainboard/intel/beechnutcity_crb/ramstage.c | 31 | ||||
-rw-r--r-- | src/mainboard/intel/beechnutcity_crb/romstage.c | 10 |
8 files changed, 120 insertions, 2 deletions
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 <commonlib/helpers.h> +#include <soc/dimm_slot.h> + +/* + * 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 <soc/dimm_slot.h> #include <soc/ramstage.h> 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 <fmap_config.h> #include <device/device.h> #include <soc/ddr.h> +#include <soc/dimm_slot.h> #include <soc/iio.h> #include <soc/romstage.h> @@ -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; } diff --git a/src/mainboard/intel/beechnutcity_crb/Makefile.mk b/src/mainboard/intel/beechnutcity_crb/Makefile.mk index 2e1a74a45a..cfff6d3851 100644 --- a/src/mainboard/intel/beechnutcity_crb/Makefile.mk +++ b/src/mainboard/intel/beechnutcity_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/beechnutcity_crb/config/dimm_slot.c b/src/mainboard/intel/beechnutcity_crb/config/dimm_slot.c new file mode 100644 index 0000000000..00d5e13df4 --- /dev/null +++ b/src/mainboard/intel/beechnutcity_crb/config/dimm_slot.c @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <commonlib/helpers.h> +#include <soc/dimm_slot.h> + +/* + * 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/beechnutcity_crb/ramstage.c b/src/mainboard/intel/beechnutcity_crb/ramstage.c index a09016d461..37d7d731dd 100644 --- a/src/mainboard/intel/beechnutcity_crb/ramstage.c +++ b/src/mainboard/intel/beechnutcity_crb/ramstage.c @@ -1,8 +1,39 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include <soc/dimm_slot.h> #include <soc/ramstage.h> 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/beechnutcity_crb/romstage.c b/src/mainboard/intel/beechnutcity_crb/romstage.c index f0e67af21e..446d4e2be7 100644 --- a/src/mainboard/intel/beechnutcity_crb/romstage.c +++ b/src/mainboard/intel/beechnutcity_crb/romstage.c @@ -7,6 +7,7 @@ #include <fmap_config.h> #include <device/device.h> #include <soc/ddr.h> +#include <soc/dimm_slot.h> #include <soc/iio.h> #include <soc/romstage.h> @@ -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; } |