vc/amd/opensil/*/mpio: add IFTYPE_UNUSED mpio_type enum element

Add IFTYPE_UNUSED as first element to the mpio_type enum. This allows
checking if the type was set in the devicetree, since the default will
now be IFTYPE_UNUSED. If the type is set to IFTYPE_UNUSED although the
corresponding PCI device function, a warning is printed and the PCI
device function is disabled.

Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I85e2589c021b4f05662369fd551146b6f2fa0ad4
Reviewed-on: https://review.coreboot.org/c/coreboot/+/81339
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/src/vendorcode/amd/opensil/genoa_poc/mpio/chip.c b/src/vendorcode/amd/opensil/genoa_poc/mpio/chip.c
index 61233a9..2d32ca5 100644
--- a/src/vendorcode/amd/opensil/genoa_poc/mpio/chip.c
+++ b/src/vendorcode/amd/opensil/genoa_poc/mpio/chip.c
@@ -134,6 +134,14 @@
 	printk(BIOS_DEBUG, "Setting MPIO port for domain 0x%x, PCI %d:%d\n",
 	       domain, PCI_SLOT(devfn), PCI_FUNC(devfn));
 
+	if (config->type == IFTYPE_UNUSED) {
+		if (is_dev_enabled(dev)) {
+			printk(BIOS_WARNING, "Unused MPIO engine, disabling PCI device.\n");
+			dev->enabled = false;
+		}
+		return;
+	}
+
 	if (config->bmc) {
 		setup_bmc_lanes(config->start_lane, 0); // TODO support multiple sockets
 		return;
diff --git a/src/vendorcode/amd/opensil/genoa_poc/mpio/chip.h b/src/vendorcode/amd/opensil/genoa_poc/mpio/chip.h
index deb4038..4a78ef5 100644
--- a/src/vendorcode/amd/opensil/genoa_poc/mpio/chip.h
+++ b/src/vendorcode/amd/opensil/genoa_poc/mpio/chip.h
@@ -17,6 +17,7 @@
  */
 
 enum mpio_type {
+	IFTYPE_UNUSED,
 	IFTYPE_PCIE,
 	IFTYPE_SATA,
 };
diff --git a/src/vendorcode/amd/opensil/stub/mpio/chip.h b/src/vendorcode/amd/opensil/stub/mpio/chip.h
index f2fb5da..96f60be 100644
--- a/src/vendorcode/amd/opensil/stub/mpio/chip.h
+++ b/src/vendorcode/amd/opensil/stub/mpio/chip.h
@@ -3,6 +3,7 @@
 #include <types.h>
 
 enum mpio_engine_type {
+	IFTYPE_UNUSED,
 	IFTYPE_PCIE,
 	IFTYPE_SATA,
 };