Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/68632 )
Change subject: mb/prodrive/atlas: add unique DIMM locators in smbios type17 ......................................................................
mb/prodrive/atlas: add unique DIMM locators in smbios type17
This patch adds unique device-locators, bank-locators and asset-tags to the smbios type17 tables by making use of a DIMMs controller-ID. This way we avoid name clashes when, for example, two DIMMs share the same channel-ID and DIMM-ID but have a distinct controller-ID.
Signed-off-by: David Milosevic David.Milosevic@9elements.com Change-Id: I8aef79faa43f2475485f581c675ee152e580f678 Reviewed-on: https://review.coreboot.org/c/coreboot/+/68632 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Lean Sheng Tan sheng.tan@9elements.com --- M src/mainboard/prodrive/atlas/mainboard.c 1 file changed, 47 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Lean Sheng Tan: Looks good to me, approved
diff --git a/src/mainboard/prodrive/atlas/mainboard.c b/src/mainboard/prodrive/atlas/mainboard.c index 59c7cb7c..227e30a 100644 --- a/src/mainboard/prodrive/atlas/mainboard.c +++ b/src/mainboard/prodrive/atlas/mainboard.c @@ -5,9 +5,37 @@ #include <stdint.h> #include <gpio.h> #include <arch/io.h> +#include <string.h> +#include <smbios.h>
#include "gpio.h"
+void smbios_fill_dimm_locator(const struct dimm_info *dimm, struct smbios_type17 *t) +{ + const u8 mc = dimm->ctrlr_num; + const u8 ch = dimm->channel_num; + const u8 mm = dimm->dimm_num; + + char dev_loc[40] = { "\x00" }; + snprintf(dev_loc, sizeof(dev_loc), "SO-DIMM %c%u", 'A' + mc, mm); + t->device_locator = smbios_add_string(t->eos, dev_loc); + + char bnk_loc[40] = { "\x00" }; + snprintf(bnk_loc, sizeof(bnk_loc), "BANK-%u-%u-%u", mc, ch, mm); + t->bank_locator = smbios_add_string(t->eos, bnk_loc); +} + +void smbios_fill_dimm_asset_tag(const struct dimm_info *dimm, struct smbios_type17 *t) +{ + const u8 mc = dimm->ctrlr_num; + const u8 ch = dimm->channel_num; + const u8 mm = dimm->dimm_num; + + char tag[40] = { "\x00" }; + snprintf(tag, sizeof(tag), "MC-%u-CH-%u-DIMM-%u", mc, ch, mm); + t->asset_tag = smbios_add_string(t->eos, tag); +} + static uint8_t get_hsid(void) { const gpio_t hsid_gpios[] = {