summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@google.com>2020-08-28 18:09:56 +0000
committerTim Wawrzynczak <twawrzynczak@chromium.org>2020-10-14 02:54:58 +0000
commitd6331e0884ceb6a17f7fd446b287b7cb5e50fcc1 (patch)
treeca8778fb8c6e265de93b3803c9872f01efba064a /src
parent950305de0a21d4505e45229d25eb576c687554a1 (diff)
soc/intel/common/block: Add common support for USB4/Thunderbolt
This common intel driver will add the requried ACPI _DSD entries for enabled USB4/Thunderbolt ports' DMA devices the SSDT instead of using hardcoded values in the DSDT. Change-Id: Ic4a58202d4569cf092ea21a4a83a3af6c42ce9d0 Signed-off-by: Duncan Laurie <dlaurie@google.com> Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/44916 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/soc/intel/common/block/usb4/usb4.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/soc/intel/common/block/usb4/usb4.c b/src/soc/intel/common/block/usb4/usb4.c
index a0afc20f5b..7c545f6043 100644
--- a/src/soc/intel/common/block/usb4/usb4.c
+++ b/src/soc/intel/common/block/usb4/usb4.c
@@ -1,8 +1,55 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
+#include <acpi/acpigen.h>
+#include <acpi/acpi_device.h>
#include <device/device.h>
#include <device/pci.h>
+#include <device/pci_def.h>
#include <device/pci_ids.h>
+#include <soc/pci_devs.h>
+
+#define INTEL_TBT_IMR_VALID_UUID "C44D002F-69F9-4E7D-A904-A7BAABDF43F7"
+#define INTEL_TBT_WAKE_SUPPORTED_UUID "6C501103-C189-4296-BA72-9BF5A26EBE5D"
+
+#if CONFIG(HAVE_ACPI_TABLES)
+static const char *tbt_dma_acpi_name(const struct device *dev)
+{
+ switch (dev->path.pci.devfn) {
+ case SA_DEV_TCSS_DMA0:
+ return "TDM0";
+ case SA_DEV_TCSS_DMA1:
+ return "TDM1";
+ default:
+ return NULL;
+ }
+}
+
+static void tbt_dma_fill_ssdt(const struct device *dev)
+{
+ struct acpi_dp *dsd, *pkg;
+
+ if (!dev->enabled)
+ return;
+
+ acpigen_write_scope(acpi_device_path(dev));
+
+ dsd = acpi_dp_new_table("_DSD");
+
+ /* Indicate that device has valid IMR. */
+ pkg = acpi_dp_new_table(INTEL_TBT_IMR_VALID_UUID);
+ acpi_dp_add_integer(pkg, "IMR_VALID", 1);
+ acpi_dp_add_package(dsd, pkg);
+
+ /* Indicate that device is wake capable. */
+ pkg = acpi_dp_new_table(INTEL_TBT_WAKE_SUPPORTED_UUID);
+ acpi_dp_add_integer(pkg, "WAKE_SUPPORTED", 1);
+
+ acpi_dp_add_package(dsd, pkg);
+ acpi_dp_write(dsd);
+
+ acpigen_pop_len(); /* Scope */
+}
+#endif
static const unsigned short pci_device_ids[] = {
PCI_DEVICE_ID_INTEL_TGL_TBT_DMA0,
@@ -16,6 +63,10 @@ static struct device_operations usb4_dev_ops = {
.enable_resources = pci_dev_enable_resources,
.scan_bus = scan_generic_bus,
.ops_pci = &pci_dev_ops_pci,
+#if CONFIG(HAVE_ACPI_TABLES)
+ .acpi_name = tbt_dma_acpi_name,
+ .acpi_fill_ssdt = tbt_dma_fill_ssdt,
+#endif
};
static const struct pci_driver usb4_driver __pci_driver = {