mb/google/brya/var/orisa: Update Type C DisplayPort HPD Configuration
[coreboot2.git] / src / acpi / acpigen_pci.c
blob3edf0d0342490cf2f45a47f77fc1b1569d235bd2
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <acpi/acpigen.h>
4 #include <acpi/acpigen_pci.h>
5 #include <assert.h>
6 #include <device/device.h>
7 #include <device/pci_def.h>
8 #include <device/pci_type.h>
9 #include <types.h>
11 void acpigen_write_ADR_pci_devfn(pci_devfn_t devfn)
14 * _ADR for PCI Bus is encoded as follows:
15 * [63:32] - unused
16 * [31:16] - device #
17 * [15:0] - function #
19 acpigen_write_ADR(PCI_SLOT(devfn) << 16 | PCI_FUNC(devfn));
22 void acpigen_write_ADR_pci_device(const struct device *dev)
24 assert(dev->path.type == DEVICE_PATH_PCI);
25 acpigen_write_ADR_pci_devfn(dev->path.pci.devfn);
28 void acpigen_write_PRT_GSI_entry(unsigned int pci_dev, unsigned int acpi_pin, unsigned int gsi)
30 acpigen_write_package(4);
31 acpigen_write_dword((pci_dev << 16) | 0xffff);
32 acpigen_write_byte(acpi_pin);
34 /* Source */
35 acpigen_write_byte(0);
37 /* Source Index */
38 acpigen_write_dword(gsi);
40 acpigen_pop_len(); /* Package */
43 void acpigen_write_PRT_source_entry(unsigned int pci_dev, unsigned int acpi_pin,
44 const char *source_path, unsigned int index)
46 acpigen_write_package(4);
47 acpigen_write_dword((pci_dev << 16) | 0xffff);
48 acpigen_write_byte(acpi_pin);
50 /* Source */
51 acpigen_emit_namestring(source_path);
53 /* Source Index */
54 acpigen_write_dword(index);
56 acpigen_pop_len(); /* Package */