Patrick Georgi submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Angel Pons: Looks good to me, approved
arch/x86/smbios: Let SMBIOS type 9 be able to write slot ID

The slot ID can be passed in from the function caller but
parsing slot ID from devicetree is not yet supported and
would still be 0.

Add Slot ID in SMBIOS type 9 for Delta Lake.

Tested=Execute "dmidecode -t 9" to verify.

Signed-off-by: JingleHsuWiwynn <jingle_hsu@wiwynn.com>
Change-Id: I9bf2e3b1232637a25ee595d08f8fbbc2283fcd5d
Reviewed-on: https://review.coreboot.org/c/coreboot/+/49917
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
---
M src/arch/x86/smbios.c
M src/include/smbios.h
M src/mainboard/ocp/deltalake/ramstage.c
3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/arch/x86/smbios.c b/src/arch/x86/smbios.c
index a48cf43..9b47ff6 100644
--- a/src/arch/x86/smbios.c
+++ b/src/arch/x86/smbios.c
@@ -930,7 +930,7 @@
const enum slot_data_bus_bandwidth bandwidth,
const enum misc_slot_usage usage,
const enum misc_slot_length length,
- u8 slot_char1, u8 slot_char2, u8 bus, u8 dev_func)
+ const u16 id, u8 slot_char1, u8 slot_char2, u8 bus, u8 dev_func)
{
struct smbios_type9 *t = (struct smbios_type9 *)*current;
int len = sizeof(struct smbios_type9);
@@ -942,6 +942,7 @@
t->slot_designation = smbios_add_string(t->eos, name ? name : "SLOT");
t->slot_type = type;
/* TODO add slot_id supoort, will be "_SUN" for ACPI devices */
+ t->slot_id = id;
t->slot_data_bus_width = bandwidth;
t->current_usage = usage;
t->slot_length = length;
@@ -1272,6 +1273,7 @@
bandwidth,
usage,
length,
+ 0,
1,
0,
dev->bus->secondary,
diff --git a/src/include/smbios.h b/src/include/smbios.h
index 694e091..e5e5df5 100644
--- a/src/include/smbios.h
+++ b/src/include/smbios.h
@@ -20,7 +20,7 @@
const enum slot_data_bus_bandwidth bandwidth,
const enum misc_slot_usage usage,
const enum misc_slot_length length,
- u8 slot_char1, u8 slot_char2, u8 bus, u8 dev_func);
+ const u16 id, u8 slot_char1, u8 slot_char2, u8 bus, u8 dev_func);
enum smbios_bmc_interface_type;
int smbios_write_type38(unsigned long *current, int *handle,
const enum smbios_bmc_interface_type interface_type,
diff --git a/src/mainboard/ocp/deltalake/ramstage.c b/src/mainboard/ocp/deltalake/ramstage.c
index 211ba0f..50a87e9 100644
--- a/src/mainboard/ocp/deltalake/ramstage.c
+++ b/src/mainboard/ocp/deltalake/ramstage.c
@@ -83,6 +83,7 @@
const char *slot_designator;
} slot_info;

+/* Array index + 1 would be used as Slot ID */
slot_info slotinfo[] = {
{CSTACK, SlotTypePciExpressGen3X4, SlotDataBusWidth4X, 0xE8, "SSD1_M2_Data_Drive"},
{PSTACK1, SlotTypePciExpressGen3X4, SlotDataBusWidth4X, 0x10, "SSD0_M2_Boot_Drive"},
@@ -265,12 +266,14 @@
if (sltcap & PCI_EXP_SLTCAP_HPC)
characteristics_2 |= SMBIOS_SLOT_HOTPLUG;

+ const uint16_t slot_id = index + 1;
length += smbios_write_type9(current, handle,
slotinfo[index].slot_designator,
slotinfo[index].slot_type,
slotinfo[index].slot_data_bus_width,
slot_usage,
slot_length,
+ slot_id,
characteristics_1,
characteristics_2,
stack_busnos[slotinfo[index].stack],

To view, visit change 49917. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I9bf2e3b1232637a25ee595d08f8fbbc2283fcd5d
Gerrit-Change-Number: 49917
Gerrit-PatchSet: 8
Gerrit-Owner: Jingle Hsu <jingle_hsu@wiwynn.com>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Anjaneya "Reddy" Chagam <anjaneya.chagam@intel.com>
Gerrit-Reviewer: Johnny Lin <Johnny_Lin@wiwynn.com>
Gerrit-Reviewer: Jonathan Zhang <jonzhang@fb.com>
Gerrit-Reviewer: Marc Jones <marc@marcjonesconsulting.com>
Gerrit-Reviewer: Morgan Jang <Morgan_Jang@wiwynn.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi@google.com>
Gerrit-Reviewer: Patrick Rudolph <siro@das-labor.org>
Gerrit-Reviewer: Tim Chu <Tim.Chu@quantatw.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Patrick Rudolph
Gerrit-MessageType: merged