| 1 |
|
| 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 |
|
| 11 |
void acpigen_write_ADR_pci_devfn(pci_devfn_t devfn) |
| 12 |
{ |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 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 |
{ |
| 24 |
assert(dev->path.type == DEVICE_PATH_PCI); |
| 25 |
acpigen_write_ADR_pci_devfn(dev->path.pci.devfn); |
| 26 |
} |
| 27 |
|
| 28 |
void acpigen_write_PRT_GSI_entry(unsigned int pci_dev, unsigned int acpi_pin, unsigned int gsi) |
| 29 |
{ |
| 30 |
acpigen_write_package(4); |
| 31 |
acpigen_write_dword((pci_dev << 16) | 0xffff); |
| 32 |
acpigen_write_byte(acpi_pin); |
| 33 |
|
| 34 |
|
| 35 |
acpigen_write_byte(0); |
| 36 |
|
| 37 |
|
| 38 |
acpigen_write_dword(gsi); |
| 39 |
|
| 40 |
acpigen_pop_len(); |
| 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 |
{ |
| 46 |
acpigen_write_package(4); |
| 47 |
acpigen_write_dword((pci_dev << 16) | 0xffff); |
| 48 |
acpigen_write_byte(acpi_pin); |
| 49 |
|
| 50 |
|
| 51 |
acpigen_emit_namestring(source_path); |
| 52 |
|
| 53 |
|
| 54 |
acpigen_write_dword(index); |
| 55 |
|
| 56 |
acpigen_pop_len(); |
| 57 |
} |