coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
acpigen_pci.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
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>
10 
12 {
13  /*
14  * _ADR for PCI Bus is encoded as follows:
15  * [63:32] - unused
16  * [31:16] - device #
17  * [15:0] - function #
18  */
19  acpigen_write_ADR(PCI_SLOT(devfn) << 16 | PCI_FUNC(devfn));
20 }
21 
22 void acpigen_write_ADR_pci_device(const struct device *dev)
23 {
26 }
27 
28 void acpigen_write_PRT_GSI_entry(unsigned int pci_dev, unsigned int acpi_pin, unsigned int gsi)
29 {
31  acpigen_write_dword((pci_dev << 16) | 0xffff);
32  acpigen_write_byte(acpi_pin);
33 
34  /* Source */
36 
37  /* Source Index */
39 
40  acpigen_pop_len(); /* Package */
41 }
42 
43 void acpigen_write_PRT_source_entry(unsigned int pci_dev, unsigned int acpi_pin,
44  const char *source_path, unsigned int index)
45 {
47  acpigen_write_dword((pci_dev << 16) | 0xffff);
48  acpigen_write_byte(acpi_pin);
49 
50  /* Source */
51  acpigen_emit_namestring(source_path);
52 
53  /* Source Index */
54  acpigen_write_dword(index);
55 
56  acpigen_pop_len(); /* Package */
57 }
void acpigen_write_dword(unsigned int data)
Definition: acpigen.c:108
void acpigen_write_ADR(uint64_t adr)
Definition: acpigen.c:2122
void acpigen_emit_namestring(const char *namepath)
Definition: acpigen.c:275
void acpigen_pop_len(void)
Definition: acpigen.c:37
char * acpigen_write_package(int nr_el)
Definition: acpigen.c:86
void acpigen_write_byte(unsigned int data)
Definition: acpigen.c:96
void acpigen_write_ADR_pci_devfn(pci_devfn_t devfn)
Definition: acpigen_pci.c:11
void acpigen_write_PRT_GSI_entry(unsigned int pci_dev, unsigned int acpi_pin, unsigned int gsi)
Definition: acpigen_pci.c:28
void acpigen_write_ADR_pci_device(const struct device *dev)
Definition: acpigen_pci.c:22
void acpigen_write_PRT_source_entry(unsigned int pci_dev, unsigned int acpi_pin, const char *source_path, unsigned int index)
Definition: acpigen_pci.c:43
#define pci_dev
#define assert(statement)
Definition: assert.h:74
@ DEVICE_PATH_PCI
Definition: path.h:9
#define PCI_FUNC(devfn)
Definition: pci_def.h:550
#define PCI_SLOT(devfn)
Definition: pci_def.h:549
u32 pci_devfn_t
Definition: pci_type.h:8
struct pci_path pci
Definition: path.h:116
enum device_path_type type
Definition: path.h:114
Definition: device.h:107
struct device_path path
Definition: device.h:115
unsigned int devfn
Definition: path.h:54