6#ifndef ZEPHYR_INCLUDE_DRIVERS_ACPI_H_
7#define ZEPHYR_INCLUDE_DRIVERS_ACPI_H_
8#include <acpica/source/include/acpi.h>
11#define ACPI_RES_INVALID ACPI_RESOURCE_TYPE_MAX
13#define ACPI_DRHD_FLAG_INCLUDE_PCI_ALL BIT(0)
14#define ACPI_DMAR_FLAG_INTR_REMAP BIT(0)
15#define ACPI_DMAR_FLAG_X2APIC_OPT_OUT BIT(1)
16#define ACPI_DMAR_FLAG_DMA_CTRL_PLATFORM_OPT_IN BIT(2)
18#define ACPI_MMIO_GET(res) (res)->reg_base[0].mmio
19#define ACPI_IO_GET(res) (res)->reg_base[0].port
20#define ACPI_RESOURCE_SIZE_GET(res) (res)->reg_base[0].length
21#define ACPI_RESOURCE_TYPE_GET(res) (res)->reg_base[0].type
23#define ACPI_MULTI_MMIO_GET(res, idx) (res)->reg_base[idx].mmio
24#define ACPI_MULTI_IO_GET(res, idx) (res)->reg_base[idx].port
25#define ACPI_MULTI_RESOURCE_SIZE_GET(res, idx) (res)->reg_base[idx].length
26#define ACPI_MULTI_RESOURCE_TYPE_GET(res, idx) (res)->reg_base[idx].type
28#define ACPI_RESOURCE_COUNT_GET(res) (res)->mmio_max
89#define ACPI_DT_HID(node_id) DT_PROP(node_id, acpi_hid)
97#define ACPI_DT_UID(node_id) DT_PROP_OR(node_id, acpi_uid, NULL)
105#define ACPI_DT_HAS_HID(node_id) DT_NODE_HAS_PROP(node_id, acpi_hid)
113#define ACPI_DT_HAS_UID(node_id) DT_NODE_HAS_PROP(node_id, acpi_uid)
198 return res ? &res->Data.Irq : NULL;
265int acpi_drhd_get(
enum AcpiDmarScopeType scope, ACPI_DMAR_DEVICE_SCOPE *dev_scope,
266 union acpi_dmar_id *dmar_id,
int *num_inst,
int max_inst);
uint32_t acpi_legacy_irq_get(pcie_bdf_t bdf)
Retrieve a legacy interrupt number for a PCI device.
int acpi_drhd_get(enum AcpiDmarScopeType scope, ACPI_DMAR_DEVICE_SCOPE *dev_scope, union acpi_dmar_id *dmar_id, int *num_inst, int max_inst)
retrieve acpi DRHD info for the given scope.
acpi_res_type
Definition: acpi.h:30
@ ACPI_RES_TYPE_MEM
Memory mapped Resource type.
Definition: acpi.h:34
@ ACPI_RES_TYPE_UNKNOWN
Unknown Resource type.
Definition: acpi.h:36
@ ACPI_RES_TYPE_IO
IO mapped Resource type.
Definition: acpi.h:32
int acpi_dmar_entry_get(enum AcpiDmarType type, ACPI_SUBTABLE_HEADER **tables)
retrieve DMA remapping structure for the given type.
static ACPI_RESOURCE_IRQ * acpi_irq_res_get(ACPI_RESOURCE *res_lst)
Parse resource table for irq info.
Definition: acpi.h:194
int acpi_device_mmio_get(struct acpi_dev *child_dev, struct acpi_mmio_resource *mmio_res)
Parse resource table for MMIO info.
int acpi_device_type_get(ACPI_RESOURCE *res)
Parse resource table for identify resource type.
int acpi_possible_resource_get(char *dev_name, ACPI_RESOURCE **res)
Retrieve possible resource settings of a device.
struct acpi_dev * acpi_device_by_index_get(int index)
Retrieve acpi device info from the index.
struct acpi_dev * acpi_device_get(const char *hid, const char *uid)
Retrieve ACPI device info for given hardware id and unique id.
void(* dmar_foreach_devscope_func_t)(ACPI_DMAR_DEVICE_SCOPE *devscope, void *arg)
Definition: acpi.h:269
int acpi_current_resource_free(ACPI_RESOURCE *res)
Free current resource list memory which is retrieved by acpi_current_resource_get().
ACPI_MADT_LOCAL_APIC * acpi_local_apic_get(int cpu_num)
Retrieve the 'n'th enabled local apic info.
void acpi_dmar_foreach_devscope(ACPI_DMAR_HARDWARE_UNIT *hu, dmar_foreach_devscope_func_t func, void *arg)
int acpi_dmar_ioapic_get(uint16_t *ioapic_id)
Retrieve IOAPIC id.
ACPI_RESOURCE * acpi_resource_parse(ACPI_RESOURCE *res, int res_type)
Parse resource table for a given resource type.
int acpi_invoke_method(char *path, ACPI_OBJECT_LIST *arg_list, ACPI_OBJECT *ret_obj)
invoke an ACPI method and return the result.
void * acpi_table_get(char *signature, int inst)
Retrieve acpi table for the given signature.
int acpi_device_irq_get(struct acpi_dev *child_dev, struct acpi_irq_resource *irq_res)
Parse resource table for irq info.
int acpi_madt_entry_get(int type, ACPI_SUBTABLE_HEADER **tables, int *num_inst)
retrieve acpi MAD table for the given type.
int acpi_legacy_irq_init(const char *hid, const char *uid)
Init legacy interrupt routing table information from ACPI.
int acpi_current_resource_get(char *dev_name, ACPI_RESOURCE **res)
Retrieve the current resource settings of a device.
void acpi_dmar_foreach_subtable(ACPI_TABLE_DMAR *dmar, dmar_foreach_subtable_func_t func, void *arg)
void(* dmar_foreach_subtable_func_t)(ACPI_DMAR_HEADER *subtable, void *arg)
Definition: acpi.h:268
uint32_t pcie_bdf_t
A unique PCI(e) endpoint (bus, device, function).
Definition: pcie.h:37
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__UINT64_TYPE__ uint64_t
Definition: stdint.h:91
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINTPTR_TYPE__ uintptr_t
Definition: stdint.h:105
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
char * path
Definition: acpi.h:41
ACPI_DEVICE_INFO * dev_info
Definition: acpi.h:44
ACPI_RESOURCE * res_lst
Definition: acpi.h:42
int res_type
Definition: acpi.h:43
ACPI_HANDLE handle
Definition: acpi.h:40
uint16_t * irqs
Definition: acpi.h:66
uint8_t irq_vector_max
Definition: acpi.h:65
uint32_t flags
Definition: acpi.h:64
ACPI_MCFG_ALLOCATION pci_segs[]
Definition: acpi.h:60
ACPI_TABLE_HEADER header
Definition: acpi.h:58
uint8_t mmio_max
Definition: acpi.h:79
struct acpi_reg_base * reg_base
Definition: acpi.h:80
enum acpi_res_type type
Definition: acpi.h:70
uint32_t length
Definition: acpi.h:75
uintptr_t port
Definition: acpi.h:73
uintptr_t mmio
Definition: acpi.h:72
uint16_t device
Definition: acpi.h:50
struct acpi_dmar_id::@0 bits
uint16_t bus
Definition: acpi.h:51
uint16_t raw
Definition: acpi.h:54
uint16_t function
Definition: acpi.h:49