summaryrefslogtreecommitdiff
path: root/src/soc
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc')
-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 = {