Duncan Laurie has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/44916 )
Change subject: soc/intel/common/block: Add common support for USB4/Thunderbolt ......................................................................
soc/intel/common/block: Add common support for USB4/Thunderbolt
This common intel driver will add the requried ACPI _DSD entries for USB4/Thunderbolt ports that are enabled into the SSDT instead of using hardcoded values in the DSDT.
Signed-off-by: Duncan Laurie dlaurie@google.com Change-Id: Ic4a58202d4569cf092ea21a4a83a3af6c42ce9d0 --- A src/soc/intel/common/block/usb4/Kconfig A src/soc/intel/common/block/usb4/Makefile.inc A src/soc/intel/common/block/usb4/usb4.c 3 files changed, 61 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/16/44916/1
diff --git a/src/soc/intel/common/block/usb4/Kconfig b/src/soc/intel/common/block/usb4/Kconfig new file mode 100644 index 0000000..f588b27 --- /dev/null +++ b/src/soc/intel/common/block/usb4/Kconfig @@ -0,0 +1,4 @@ +config SOC_INTEL_COMMON_BLOCK_USB4 + bool + help + Intel Processor common USB4/Thunderbolt support diff --git a/src/soc/intel/common/block/usb4/Makefile.inc b/src/soc/intel/common/block/usb4/Makefile.inc new file mode 100644 index 0000000..7dad4ba --- /dev/null +++ b/src/soc/intel/common/block/usb4/Makefile.inc @@ -0,0 +1 @@ +ramstage-$(CONFIG_SOC_INTEL_COMMON_BLOCK_USB4) += usb4.c diff --git a/src/soc/intel/common/block/usb4/usb4.c b/src/soc/intel/common/block/usb4/usb4.c new file mode 100644 index 0000000..b33d774 --- /dev/null +++ b/src/soc/intel/common/block/usb4/usb4.c @@ -0,0 +1,56 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <acpi/acpigen.h> +#include <acpi/acpi_device.h> +#include <device/pci.h> +#include <device/pci_def.h> +#include <device/pci_ids.h> + +#define INTEL_TBT_IMR_VALID_UUID "C44D002F-69F9-4E7D-A904-A7BAABDF43F7" +#define INTEL_TBT_WAKE_SUPPORTED_UUID "6C501103-C189-4296-BA72-9BF5A26EBE5D" + +static void usb4_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 */ +} + +static struct device_operations device_ops = { + .read_resources = pci_bus_read_resources, + .set_resources = pci_dev_set_resources, + .enable_resources = pci_bus_enable_resources, + .scan_bus = scan_static_bus, + .acpi_fill_ssdt = usb4_fill_ssdt, +}; + +static const unsigned short pcie_device_ids[] = { + PCI_DEVICE_ID_INTEL_TGL_TBT_DMA0, + PCI_DEVICE_ID_INTEL_TGL_TBT_DMA1, + 0 +}; + +static const struct pci_driver intel_usb4_driver __pci_driver = { + .ops = &device_ops, + .vendor = PCI_VENDOR_ID_INTEL, + .devices = pcie_device_ids, +};
Tim Wawrzynczak has uploaded a new patch set (#2) to the change originally created by Duncan Laurie. ( https://review.coreboot.org/c/coreboot/+/44916 )
Change subject: soc/intel/common/block: Add common support for USB4/Thunderbolt ......................................................................
soc/intel/common/block: Add common support for USB4/Thunderbolt
This common intel driver will add the requried ACPI _DSD entries for USB4/Thunderbolt ports that are enabled into the SSDT instead of using hardcoded values in the DSDT.
Change-Id: Ic4a58202d4569cf092ea21a4a83a3af6c42ce9d0 Signed-off-by: Duncan Laurie dlaurie@google.com --- A src/soc/intel/common/block/usb4/Kconfig A src/soc/intel/common/block/usb4/Makefile.inc A src/soc/intel/common/block/usb4/usb4.c 3 files changed, 61 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/16/44916/2
Nick Vaccaro has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44916 )
Change subject: soc/intel/common/block: Add common support for USB4/Thunderbolt ......................................................................
Patch Set 2: Code-Review+2
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44916 )
Change subject: soc/intel/common/block: Add common support for USB4/Thunderbolt ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44916/2/src/soc/intel/common/block/... File src/soc/intel/common/block/usb4/usb4.c:
https://review.coreboot.org/c/coreboot/+/44916/2/src/soc/intel/common/block/... PS2, Line 43: .acpi_fill_ssdt = usb4_fill_ssdt, We should probably add .acpi_name callback as well here instead of in the SoC .acpi_name?
Tim Wawrzynczak has uploaded a new patch set (#3) to the change originally created by Duncan Laurie. ( https://review.coreboot.org/c/coreboot/+/44916 )
Change subject: soc/intel/common/block: Add common support for USB4/Thunderbolt ......................................................................
soc/intel/common/block: Add common support for USB4/Thunderbolt
This common intel driver will add the requried ACPI _DSD entries for USB4/Thunderbolt ports that are enabled into the SSDT instead of using hardcoded values in the DSDT.
Change-Id: Ic4a58202d4569cf092ea21a4a83a3af6c42ce9d0 Signed-off-by: Duncan Laurie dlaurie@google.com --- A src/soc/intel/common/block/usb4/Kconfig A src/soc/intel/common/block/usb4/Makefile.inc A src/soc/intel/common/block/usb4/usb4.c 3 files changed, 82 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/16/44916/3
Tim Wawrzynczak has uploaded a new patch set (#4) to the change originally created by Duncan Laurie. ( https://review.coreboot.org/c/coreboot/+/44916 )
Change subject: soc/intel/common/block: Add common support for USB4/Thunderbolt ......................................................................
soc/intel/common/block: Add common support for USB4/Thunderbolt
This common intel driver will add the requried ACPI _DSD entries for USB4/Thunderbolt ports that are enabled into 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 --- M src/soc/intel/common/block/usb4/Kconfig M src/soc/intel/common/block/usb4/Makefile.inc M src/soc/intel/common/block/usb4/usb4.c M src/soc/intel/tigerlake/Kconfig 4 files changed, 70 insertions(+), 15 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/16/44916/4
Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44916 )
Change subject: soc/intel/common/block: Add common support for USB4/Thunderbolt ......................................................................
Patch Set 6:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44916/2/src/soc/intel/common/block/... File src/soc/intel/common/block/usb4/usb4.c:
https://review.coreboot.org/c/coreboot/+/44916/2/src/soc/intel/common/block/... PS2, Line 43: .acpi_fill_ssdt = usb4_fill_ssdt,
We should probably add .acpi_name callback as well here instead of in the SoC . […]
I'm fine with that.
Tim Wawrzynczak has uploaded a new patch set (#7) to the change originally created by Duncan Laurie. ( https://review.coreboot.org/c/coreboot/+/44916 )
Change subject: soc/intel/common/block: Add common support for USB4/Thunderbolt ......................................................................
soc/intel/common/block: Add common support for USB4/Thunderbolt
This common intel driver will add the requried ACPI _DSD entries for USB4/Thunderbolt ports that are enabled into 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 --- M src/soc/intel/common/block/usb4/Kconfig M src/soc/intel/common/block/usb4/Makefile.inc M src/soc/intel/common/block/usb4/usb4.c M src/soc/intel/tigerlake/Kconfig 4 files changed, 72 insertions(+), 15 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/16/44916/7
Tim Wawrzynczak has uploaded a new patch set (#8) to the change originally created by Duncan Laurie. ( https://review.coreboot.org/c/coreboot/+/44916 )
Change subject: soc/intel/common/block: Add common support for USB4/Thunderbolt ......................................................................
soc/intel/common/block: Add common support for USB4/Thunderbolt
This common intel driver will add the requried ACPI _DSD entries for USB4/Thunderbolt ports that are enabled into 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 --- M src/soc/intel/common/block/usb4/Kconfig M src/soc/intel/common/block/usb4/Makefile.inc M src/soc/intel/common/block/usb4/usb4.c M src/soc/intel/tigerlake/Kconfig 4 files changed, 62 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/16/44916/8
Tim Wawrzynczak has uploaded a new patch set (#9) to the change originally created by Duncan Laurie. ( https://review.coreboot.org/c/coreboot/+/44916 )
Change subject: soc/intel/common/block: Add common support for USB4/Thunderbolt ......................................................................
soc/intel/common/block: Add common support for USB4/Thunderbolt
This common intel driver will add the requried ACPI _DSD entries for USB4/Thunderbolt ports that are enabled into 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 --- M src/soc/intel/common/block/usb4/Kconfig M src/soc/intel/common/block/usb4/Makefile.inc M src/soc/intel/common/block/usb4/usb4.c 3 files changed, 60 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/16/44916/9
Tim Wawrzynczak has uploaded a new patch set (#10) to the change originally created by Duncan Laurie. ( https://review.coreboot.org/c/coreboot/+/44916 )
Change subject: soc/intel/common/block: Add common support for USB4/Thunderbolt ......................................................................
soc/intel/common/block: Add common support for USB4/Thunderbolt
This common intel driver will add the requried ACPI _DSD entries for USB4/Thunderbolt ports that are enabled into 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 --- M src/soc/intel/common/block/usb4/Kconfig M src/soc/intel/common/block/usb4/usb4.c 2 files changed, 52 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/16/44916/10
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44916 )
Change subject: soc/intel/common/block: Add common support for USB4/Thunderbolt ......................................................................
Patch Set 10: Code-Review+2
(4 comments)
https://review.coreboot.org/c/coreboot/+/44916/10//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/44916/10//COMMIT_MSG@10 PS10, Line 10: USB4/Thunderbolt ports DMA device for the USB4 router/controller?
https://review.coreboot.org/c/coreboot/+/44916/10/src/soc/intel/common/block... File src/soc/intel/common/block/usb4/Kconfig:
https://review.coreboot.org/c/coreboot/+/44916/10/src/soc/intel/common/block... PS10, Line 4: depends on HAVE_ACPI_TABLES Since the driver is doing more than just generating ACPI tables, this is probably not required?
https://review.coreboot.org/c/coreboot/+/44916/10/src/soc/intel/common/block... File src/soc/intel/common/block/usb4/usb4.c:
https://review.coreboot.org/c/coreboot/+/44916/10/src/soc/intel/common/block... PS10, Line 3: #include <device/device.h> Why was this dropped?
https://review.coreboot.org/c/coreboot/+/44916/10/src/soc/intel/common/block... PS10, Line 33: acpigen_write_scope(acpi_device_path(dev)); I know we probably still have some hard-coded references in DSDT, but eventually we should move the generation of device to this function as well (acpi_device_write_pci_dev(dev)).
Tim Wawrzynczak has uploaded a new patch set (#11) to the change originally created by Duncan Laurie. ( https://review.coreboot.org/c/coreboot/+/44916 )
Change subject: soc/intel/common/block: Add common support for USB4/Thunderbolt ......................................................................
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 --- M src/soc/intel/common/block/usb4/usb4.c 1 file changed, 51 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/16/44916/11
Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44916 )
Change subject: soc/intel/common/block: Add common support for USB4/Thunderbolt ......................................................................
Patch Set 11:
(4 comments)
https://review.coreboot.org/c/coreboot/+/44916/10//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/44916/10//COMMIT_MSG@10 PS10, Line 10: USB4/Thunderbolt ports
DMA device for the USB4 router/controller?
Done
https://review.coreboot.org/c/coreboot/+/44916/10/src/soc/intel/common/block... File src/soc/intel/common/block/usb4/Kconfig:
https://review.coreboot.org/c/coreboot/+/44916/10/src/soc/intel/common/block... PS10, Line 4: depends on HAVE_ACPI_TABLES
Since the driver is doing more than just generating ACPI tables, this is probably not required?
Done
https://review.coreboot.org/c/coreboot/+/44916/10/src/soc/intel/common/block... File src/soc/intel/common/block/usb4/usb4.c:
https://review.coreboot.org/c/coreboot/+/44916/10/src/soc/intel/common/block... PS10, Line 3: #include <device/device.h>
Why was this dropped?
Done
https://review.coreboot.org/c/coreboot/+/44916/10/src/soc/intel/common/block... PS10, Line 33: acpigen_write_scope(acpi_device_path(dev));
I know we probably still have some hard-coded references in DSDT, but eventually we should move the […]
On my todo list, we'll need it for other platforms too
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44916 )
Change subject: soc/intel/common/block: Add common support for USB4/Thunderbolt ......................................................................
Patch Set 11: Code-Review+2
Tim Wawrzynczak has submitted this change. ( https://review.coreboot.org/c/coreboot/+/44916 )
Change subject: soc/intel/common/block: Add common support for USB4/Thunderbolt ......................................................................
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 --- M src/soc/intel/common/block/usb4/usb4.c 1 file changed, 51 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Furquan Shaikh: Looks good to me, approved
diff --git a/src/soc/intel/common/block/usb4/usb4.c b/src/soc/intel/common/block/usb4/usb4.c index a0afc20..7c545f6 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 @@ .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 = {