xref: /aosp_15_r20/external/coreboot/src/soc/intel/common/block/dtt/dtt.c (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #include <acpi/acpigen.h>
4 #include <acpi/acpigen_pci.h>
5 #include <device/device.h>
6 #include <device/pci.h>
7 #include <device/pci_ids.h>
8 #include <intelblocks/acpi.h>
9 
10 static const unsigned short pci_device_ids[] = {
11 	PCI_DID_INTEL_RPL_DTT,
12 	PCI_DID_INTEL_MTL_DTT,
13 	PCI_DID_INTEL_CML_DTT,
14 	PCI_DID_INTEL_TGL_DTT,
15 	PCI_DID_INTEL_JSL_DTT,
16 	PCI_DID_INTEL_ADL_DTT,
17 	0
18 };
19 
dtt_acpi_fill_ssdt(const struct device * dev)20 static void dtt_acpi_fill_ssdt(const struct device *dev)
21 {
22 	/* Skip if DPTF driver in use since TCPU device will already exist */
23 	if (CONFIG(DRIVERS_INTEL_DPTF))
24 		return;
25 
26 	const char *scope = acpi_device_scope(dev);
27 
28 	if (!scope)
29 		return;
30 
31 	acpigen_write_scope(scope);
32 	acpigen_write_device(soc_acpi_name(dev));
33 	acpigen_write_ADR_pci_device(dev);
34 	acpigen_write_STA(acpi_device_status(dev));
35 	acpigen_pop_len(); /* Device */
36 	acpigen_pop_len(); /* Scope */
37 }
38 
39 static struct device_operations dptf_dev_ops = {
40 	.read_resources			= pci_dev_read_resources,
41 	.set_resources			= pci_dev_set_resources,
42 	.enable_resources		= pci_dev_enable_resources,
43 	.scan_bus			= scan_generic_bus,
44 	.ops_pci			= &pci_dev_ops_pci,
45 #if CONFIG(HAVE_ACPI_TABLES)
46 	.acpi_fill_ssdt			= dtt_acpi_fill_ssdt,
47 #endif
48 };
49 
50 static const struct pci_driver pch_dptf __pci_driver = {
51 	.ops				= &dptf_dev_ops,
52 	.vendor				= PCI_VID_INTEL,
53 	.devices			= pci_device_ids,
54 };
55