coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
usb4.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #include <acpi/acpigen.h>
4 #include <acpi/acpi_device.h>
5 #include <device/device.h>
6 #include <device/pci.h>
7 #include <device/pci_def.h>
8 #include <device/pci_ids.h>
9 #include <intelblocks/tcss.h>
10 #include <soc/pci_devs.h>
11 
12 #define INTEL_TBT_IMR_VALID_UUID "C44D002F-69F9-4E7D-A904-A7BAABDF43F7"
13 #define INTEL_TBT_WAKE_SUPPORTED_UUID "6C501103-C189-4296-BA72-9BF5A26EBE5D"
14 
15 #if CONFIG(HAVE_ACPI_TABLES)
16 static const char *tbt_dma_acpi_name(const struct device *dev)
17 {
18  switch (dev->path.pci.devfn) {
19  case SA_DEVFN_TCSS_DMA0:
20  return "TDM0";
21  case SA_DEVFN_TCSS_DMA1:
22  return "TDM1";
23  default:
24  return NULL;
25  }
26 }
27 
28 static void tbt_dma_fill_ssdt(const struct device *dev)
29 {
30  struct acpi_dp *dsd, *pkg;
31 
33  return;
34 
36 
37  dsd = acpi_dp_new_table("_DSD");
38 
39  /* Indicate that device has valid IMR. */
41  acpi_dp_add_integer(pkg, "IMR_VALID", 1);
42  acpi_dp_add_package(dsd, pkg);
43 
44  /* Indicate that device is wake capable. */
46  acpi_dp_add_integer(pkg, "WAKE_SUPPORTED", 1);
47 
48  acpi_dp_add_package(dsd, pkg);
49  acpi_dp_write(dsd);
50 
51  acpigen_pop_len(); /* Scope */
52 }
53 #endif
54 
55 static const unsigned short pci_device_ids[] = {
65  0
66 };
67 
68 static struct device_operations usb4_dev_ops = {
70  .set_resources = pci_dev_set_resources,
71  .enable_resources = pci_dev_enable_resources,
72  .scan_bus = scan_generic_bus,
73  .ops_pci = &pci_dev_ops_pci,
74 #if CONFIG(HAVE_ACPI_TABLES)
75  .acpi_name = tbt_dma_acpi_name,
76  .acpi_fill_ssdt = tbt_dma_fill_ssdt,
77 #endif
78 };
79 
80 static const struct pci_driver usb4_driver __pci_driver = {
81  .ops = &usb4_dev_ops,
82  .vendor = PCI_VID_INTEL,
83  .devices = pci_device_ids,
84 };
struct acpi_dp * acpi_dp_add_package(struct acpi_dp *dp, struct acpi_dp *package)
Definition: device.c:1036
const char * acpi_device_path(const struct device *dev)
Definition: device.c:144
struct acpi_dp * acpi_dp_add_integer(struct acpi_dp *dp, const char *name, uint64_t value)
Definition: device.c:977
void acpi_dp_write(struct acpi_dp *table)
Definition: device.c:898
struct acpi_dp * acpi_dp_new_table(const char *name)
Definition: device.c:930
void acpigen_pop_len(void)
Definition: acpigen.c:37
void acpigen_write_scope(const char *name)
Definition: acpigen.c:326
const struct soc_tcss_ops tcss_ops
Definition: tcss.c:5
void pci_dev_enable_resources(struct device *dev)
Definition: pci_device.c:721
void pci_dev_read_resources(struct device *dev)
Definition: pci_device.c:534
struct pci_operations pci_dev_ops_pci
Default device operation for PCI devices.
Definition: pci_device.c:911
void pci_dev_set_resources(struct device *dev)
Definition: pci_device.c:691
#define PCI_DID_INTEL_MTL_P_TBT_DMA1
Definition: pci_ids.h:4339
#define PCI_DID_INTEL_TGL_TBT_DMA1
Definition: pci_ids.h:4326
#define PCI_DID_INTEL_TGL_TBT_DMA0
Definition: pci_ids.h:4325
#define PCI_DID_INTEL_TGL_H_TBT_DMA1
Definition: pci_ids.h:4328
#define PCI_DID_INTEL_TGL_H_TBT_DMA0
Definition: pci_ids.h:4327
#define PCI_DID_INTEL_MTL_M_TBT_DMA0
Definition: pci_ids.h:4337
#define PCI_DID_INTEL_MTL_P_TBT_DMA0
Definition: pci_ids.h:4338
#define PCI_VID_INTEL
Definition: pci_ids.h:2157
#define PCI_DID_INTEL_ADL_TBT_DMA1
Definition: pci_ids.h:4330
#define PCI_DID_INTEL_ADL_TBT_DMA0
Definition: pci_ids.h:4329
void scan_generic_bus(struct device *bus)
Definition: root_device.c:52
#define SA_DEVFN_TCSS_DMA0
Definition: pci_devs.h:72
#define SA_DEVFN_TCSS_DMA1
Definition: pci_devs.h:73
#define NULL
Definition: stddef.h:19
void(* read_resources)(struct device *dev)
Definition: device.h:39
struct pci_path pci
Definition: path.h:116
Definition: device.h:107
struct device_path path
Definition: device.h:115
unsigned int devfn
Definition: path.h:54
bool(* valid_tbt_auth)(void)
Definition: tcss.h:142
#define INTEL_TBT_WAKE_SUPPORTED_UUID
Definition: usb4.c:13
static const struct pci_driver usb4_driver __pci_driver
Definition: usb4.c:80
static const unsigned short pci_device_ids[]
Definition: usb4.c:55
#define INTEL_TBT_IMR_VALID_UUID
Definition: usb4.c:12
static struct device_operations usb4_dev_ops
Definition: usb4.c:68