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>
This commit is contained in:
David Milosevic 2022-10-20 16:47:48 +02:00 committed by Felix Held
parent 6be82a4cd8
commit 0f5b87cf95
1 changed files with 28 additions and 0 deletions

View File

@ -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[] = {