mb/ibm/sbp1: Improve SMBIOS type 17 entries

Add bank locator and slot existance to the mainboard code.

TEST: Verified on Linux that all slots show in dmidecode -t 17.

Change-Id: I4ced36e26368d3f99a7341cb55a8deb118b2d1a4
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/76677
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
diff --git a/src/mainboard/ibm/sbp1/ramstage.c b/src/mainboard/ibm/sbp1/ramstage.c
index 63481aa..78db8c9 100644
--- a/src/mainboard/ibm/sbp1/ramstage.c
+++ b/src/mainboard/ibm/sbp1/ramstage.c
@@ -11,6 +11,21 @@
 	gpio_configure_pads(gpio_table, ARRAY_SIZE(gpio_table));
 }
 
+void smbios_fill_dimm_locator(const struct dimm_info *dimm, struct smbios_type17 *t)
+{
+	const u8 so = dimm->soc_num;
+	const u8 ch = dimm->channel_num;
+	const u8 mm = dimm->dimm_num;
+
+	char dev_loc[10] = { "\x00" };
+	snprintf(dev_loc, sizeof(dev_loc), "DIMM C%u%c%u", so, 'A' + ch, mm);
+	t->device_locator = smbios_add_string(t->eos, dev_loc);
+
+	char bnk_loc[10] = { "\x00" };
+	snprintf(bnk_loc, sizeof(bnk_loc), "BANK C%u%c%u", so, 'A' + ch, mm);
+	t->bank_locator = smbios_add_string(t->eos, bnk_loc);
+}
+
 static void finalize_boot(void *unused)
 {
 	printk(BIOS_DEBUG, "FM_BIOS_POST_CMPLT_N cleared.\n");
diff --git a/src/mainboard/ibm/sbp1/romstage.c b/src/mainboard/ibm/sbp1/romstage.c
index afb1cf5..5e29e3c 100644
--- a/src/mainboard/ibm/sbp1/romstage.c
+++ b/src/mainboard/ibm/sbp1/romstage.c
@@ -2,6 +2,7 @@
 
 #include <console/console.h>
 #include <soc/romstage.h>
+#include <soc/ddr.h>
 #include <defs_cxl.h>
 #include <hob_iiouds.h>
 
@@ -347,3 +348,15 @@
 	sktbmp[3] = BIT(1) | BIT(4);
 	mainboard_config_iio(mupd);
 }
+
+bool mainboard_dimm_slot_exists(uint8_t socket, uint8_t channel, uint8_t dimm)
+{
+	if (socket >= CONFIG_MAX_SOCKET)
+		return false;
+	if (channel >= 8)
+		return false;
+	if (dimm >= 2)
+		return false;
+
+	return true;
+}