soc/intel/alderlake/acpi: Add Kconfig options for SCM and FCM

Software Connection Manager doesn't work with Linux 5.13 or later,
resulting in TBT ports timing out. Not advertising this results
in Firmware Connection Manager being used and TBT works
correctly.

Add Kconfig options to chose between SCM (Software Connection
Manager) and FCM (Firmware Connection Manager). FCM is primary, as
it's more compatible save for ChromeOS devices as ChromeOS uses
SCM.

Linux patch:
torvalds/linux@c6da62a
c6da62a219d028de10f2e22e93a34c7ee2b88d03

Tested with StarBook Mk VI (i7-1260P).

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Change-Id: Iac31d37c0873f41f7b14e1051fe214466d1ebdd8
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64561
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
diff --git a/src/device/Kconfig b/src/device/Kconfig
index d0cce77..1ff14a6 100644
--- a/src/device/Kconfig
+++ b/src/device/Kconfig
@@ -726,6 +726,30 @@
 
 endif # PCIEXP_PLUGIN_SUPPORT
 
+choice
+	prompt "Connection Manager"
+	default FIRMWARE_CONNECTION_MANAGER
+	help
+	  Software Connection Manager doesn't work with Linux 5.13 or later,
+	  resulting in TBT ports timing out. Firmware Connection Manager works
+	  correctly.
+
+	  Linux patch:
+	    torvalds/linux@c6da62a
+	    c6da62a219d028de10f2e22e93a34c7ee2b88d03
+
+config FIRMWARE_CONNECTION_MANAGER
+	bool "Firmware Connection Manager"
+	help
+	  Disable SCM so that FCM can be used
+
+config SOFTWARE_CONNECTION_MANAGER
+	bool "Software Connection Manager"
+	help
+	  Enable SCM so it's used instead of FCM.
+
+endchoice
+
 config EARLY_PCI_BRIDGE
 	bool "Early PCI bridge"
 	depends on PCI
diff --git a/src/soc/intel/alderlake/Kconfig b/src/soc/intel/alderlake/Kconfig
index 9d950a7..1b2f695 100644
--- a/src/soc/intel/alderlake/Kconfig
+++ b/src/soc/intel/alderlake/Kconfig
@@ -426,6 +426,9 @@
 	help
 	  Enables ACPI entry to provide silicon type information to IPU kernel driver.
 
+config SOFTWARE_CONNECTION_MANAGER
+	default y if CHROMEOS
+
 config ALDERLAKE_ENABLE_SOC_WORKAROUND
 	bool
 	default y
diff --git a/src/soc/intel/alderlake/acpi/tcss.asl b/src/soc/intel/alderlake/acpi/tcss.asl
index 826c607..9edaf771 100644
--- a/src/soc/intel/alderlake/acpi/tcss.asl
+++ b/src/soc/intel/alderlake/acpi/tcss.asl
@@ -161,6 +161,12 @@
 				CDW1 |= UNRECOGNIZED_REVISION
 			}
 			Return (Arg3)
+#if CONFIG(SOFTWARE_CONNECTION_MANAGER)
+		/*
+		 * Software Connection Manager doesn't work with Linux 5.13 or later and
+		 * results in TBT ports timing out. Not advertising this results in
+		 * Firmware Connection Manager being used and TBT works correctly.
+		 */
 		} ElseIf (Arg0 == ToUUID("23A0D13A-26AB-486C-9C5F-0FFA525A575A")) {
 			/*
 			 * Operating System Capabilities for USB4
@@ -192,6 +198,7 @@
 				INTER_DOMAIN_USB4_INTERNET_PROTOCOL
 			CDW3 = Local0
 			Return (Arg3)
+#endif
 		} Else {
 			CDW1 |= UNRECOGNIZED_UUID
 			Return (Arg3)
diff --git a/src/soc/intel/meteorlake/Kconfig b/src/soc/intel/meteorlake/Kconfig
index a612846..7f9b941 100644
--- a/src/soc/intel/meteorlake/Kconfig
+++ b/src/soc/intel/meteorlake/Kconfig
@@ -325,6 +325,9 @@
 	int
 	default 16
 
+config SOFTWARE_CONNECTION_MANAGER
+	default y if CHROMEOS
+
 config SOC_INTEL_GFX_FRAMEBUFFER_OFFSET
 	hex
 	default 0x800000
diff --git a/src/soc/intel/meteorlake/acpi/tcss.asl b/src/soc/intel/meteorlake/acpi/tcss.asl
index 6635d08..c136048 100644
--- a/src/soc/intel/meteorlake/acpi/tcss.asl
+++ b/src/soc/intel/meteorlake/acpi/tcss.asl
@@ -155,6 +155,12 @@
 				CDW1 |= UNRECOGNIZED_REVISION
 			}
 			Return (Arg3)
+#if CONFIG(SOFTWARE_CONNECTION_MANAGER)
+		/*
+		 * Software Connection Manager doesn't work with Linux 5.13 or later and
+		 * results in TBT ports timing out. Not advertising this results in
+		 * Firmware Connection Manager being used and TBT works correctly.
+		 */
 		} ElseIf (Arg0 == ToUUID("23A0D13A-26AB-486C-9C5F-0FFA525A575A")) {
 			/*
 			 * Operating System Capabilities for USB4
@@ -186,6 +192,7 @@
 				INTER_DOMAIN_USB4_INTERNET_PROTOCOL
 			CDW3 = Local0
 			Return (Arg3)
+#endif
 		} Else {
 			CDW1 |= UNRECOGNIZED_UUID
 			Return (Arg3)
diff --git a/src/soc/intel/tigerlake/Kconfig b/src/soc/intel/tigerlake/Kconfig
index bcf4a82..288bb39 100644
--- a/src/soc/intel/tigerlake/Kconfig
+++ b/src/soc/intel/tigerlake/Kconfig
@@ -295,6 +295,9 @@
 	int
 	default 16
 
+config SOFTWARE_CONNECTION_MANAGER
+	default y if CHROMEOS
+
 # Intel recommends reserving the following resources per USB4 root port,
 # from TGL BIOS Spec (doc #611569) Revision 0.7.6 Section 7.2.5.1.5
 # - 42 buses
diff --git a/src/soc/intel/tigerlake/acpi/tcss.asl b/src/soc/intel/tigerlake/acpi/tcss.asl
index b24a9e6..08b3480 100644
--- a/src/soc/intel/tigerlake/acpi/tcss.asl
+++ b/src/soc/intel/tigerlake/acpi/tcss.asl
@@ -161,7 +161,7 @@
 				CDW1 |= UNRECOGNIZED_REVISION
 			}
 			Return (Arg3)
-#if CONFIG(CHROMEOS)
+#if CONFIG(SOFTWARE_CONNECTION_MANAGER)
 		/*
 		 * Software Connection Manager doesn't work with Linux 5.13 or later and
 		 * results in TBT ports timing out. Not advertising this results in