From 0f5b87cf95992ffddb9bc9bd08ee4d6af046bd92 Mon Sep 17 00:00:00 2001 From: David Milosevic Date: Thu, 20 Oct 2022 16:47:48 +0200 Subject: [PATCH] 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 Change-Id: I8aef79faa43f2475485f581c675ee152e580f678 Reviewed-on: https://review.coreboot.org/c/coreboot/+/68632 Tested-by: build bot (Jenkins) Reviewed-by: Lean Sheng Tan --- src/mainboard/prodrive/atlas/mainboard.c | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/mainboard/prodrive/atlas/mainboard.c b/src/mainboard/prodrive/atlas/mainboard.c index 59c7cb7c3b..227e30a3c4 100644 --- a/src/mainboard/prodrive/atlas/mainboard.c +++ b/src/mainboard/prodrive/atlas/mainboard.c @@ -5,9 +5,37 @@ #include #include #include +#include +#include #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[] = {