PatchworkOS
Loading...
Searching...
No Matches
Tables

System Description Tables. More...

Data Structures

struct  fadt_gas_t
 FADT generic Address. More...
 
struct  fadt_t
 Fixed ACPI Description Table. More...
 
struct  interrupt_controller_header_t
 
struct  processor_local_apic_t
 Processor Local APIC. More...
 
struct  ioapic_t
 IO APIC. More...
 
struct  madt_t
 Multiple APIC Description Table. More...
 
struct  dsdt_t
 Differentiated System Description Table. More...
 
struct  ssdt_t
 Secondary System Description Table. More...
 
struct  acpi_sdt_handler_t
 ACPI System Description Table handler. More...
 
struct  acpi_cached_table_t
 Cached ACPI table. More...
 
struct  madt_interrupt_controller_header_t
 MADT Interrupt Controller Header. More...
 

Macros

#define FADT_GET()   ((fadt_t*)acpi_tables_lookup("FACP", 0))
 Type safe way to get the FADT table.
 
#define MADT_FLAG_PCAT_COMPAT   ((madt_flags_t)(1 << 0))
 
#define INTERRUPT_CONTROLLER_PROCESSOR_LOCAL_APIC   ((interrupt_controller_type_t)0)
 
#define INTERRUPT_CONTROLLER_IO_APIC   ((interrupt_controller_type_t)1)
 
#define PROCESSOR_LOCAL_APIC_ENABLED   (1 << 0)
 
#define PROCESSOR_LOCAL_APIC_ONLINE_CAPABLE   (1 << 1)
 
#define MADT_FOR_EACH(madt, ic)
 Iterate over all MADT interrupt controllers.
 
#define MADT_SIGNATURE   "APIC"
 MADT table signature.
 
#define DSDT_SIGNATURE   "DSDT"
 DSDT table signature.
 
#define SSDT_SIGNATURE   "SSDT"
 SSDT table signature.
 
#define ACPI_SDT_HANDLER_REGISTER(sig, initHandler)
 Macro to register an ACPI SDT handler.
 

Typedefs

typedef uint32_t madt_flags_t
 Multiple APIC Description Table flags.
 
typedef uint8_t interrupt_controller_type_t
 MADT Interrupt Controller Types.
 
typedef uint32_t processor_local_apic_flags_t
 MADT Processor Local APIC flags.
 

Enumerations

enum  fadt_boot_arch_flags_t { FADT_BOOT_ARCH_PS2_EXISTS = (1 << 1) }
 Enum for the fadt_t::bootArchFlags field. More...
 

Functions

void acpi_tables_init (rsdp_t *rsdp)
 Initialize ACPI tables and call their init handlers.
 
void acpi_tables_expose (void)
 Expose ACPI tables to sysfs.
 
sdt_header_tacpi_tables_lookup (const char *signature, uint64_t n)
 Lookup the n'th table matching the signature.
 

Detailed Description

System Description Tables.

This module defines the ACPI tables found in the ACPI specification, tables defined outside of the specification, for example, MCFG is defined in their own files.

Macro Definition Documentation

◆ ACPI_SDT_HANDLER_REGISTER

#define ACPI_SDT_HANDLER_REGISTER (   sig,
  initHandler 
)
Value:
static const acpi_sdt_handler_t _acpiSdtHandler##handler_name \
__attribute__((used, section(".acpi_sdt_handlers"))) = { \
.signature = sig, \
.init = initHandler, \
};
ACPI System Description Table handler.
Definition tables.h:249
const char * signature
The signature of the table to handle.
Definition tables.h:250

Macro to register an ACPI SDT handler.

This macro registers a handler for a specific ACPI table signature using the linker section .acpi_sdt_handlers.

Might be integrated into some bigger device driver registration system in the future.

Parameters
sigThe signature of the table to handle.
handler_nameThe name of the handler function to generate.

Definition at line 276 of file tables.h.

◆ DSDT_SIGNATURE

#define DSDT_SIGNATURE   "DSDT"

DSDT table signature.

Definition at line 221 of file tables.h.

◆ FADT_GET

#define FADT_GET ( )    ((fadt_t*)acpi_tables_lookup("FACP", 0))

Type safe way to get the FADT table.

Returns
fadt_t* The FADT table pointer

Definition at line 105 of file tables.h.

◆ INTERRUPT_CONTROLLER_IO_APIC

#define INTERRUPT_CONTROLLER_IO_APIC   ((interrupt_controller_type_t)1)

Definition at line 124 of file tables.h.

◆ INTERRUPT_CONTROLLER_PROCESSOR_LOCAL_APIC

#define INTERRUPT_CONTROLLER_PROCESSOR_LOCAL_APIC   ((interrupt_controller_type_t)0)

Definition at line 123 of file tables.h.

◆ MADT_FLAG_PCAT_COMPAT

#define MADT_FLAG_PCAT_COMPAT   ((madt_flags_t)(1 << 0))

Definition at line 114 of file tables.h.

◆ MADT_FOR_EACH

#define MADT_FOR_EACH (   madt,
  ic 
)
Value:
for (ic = (typeof(ic))madt->interruptControllers; (uint8_t*)ic < (uint8_t*)madt + madt->header.length && \
(uint8_t*)ic + ic->header.length <= (uint8_t*)madt + madt->header.length; \
ic = (typeof(ic))((uint8_t*)ic + ic->header.length))
static madt_t * madt
Definition apic.c:18
__UINT8_TYPE__ uint8_t
Definition stdint.h:11
sdt_header_t header
Definition tables.h:183
interrupt_controller_header_t interruptControllers[]
Definition tables.h:186
uint32_t length
Definition acpi.h:92

Iterate over all MADT interrupt controllers.

Parameters
madtThe MADT table to iterate over.
icA pointer to a madt_interrupt_controller_header_t* that will be set to the current interrupt controller.

Definition at line 195 of file tables.h.

◆ MADT_SIGNATURE

#define MADT_SIGNATURE   "APIC"

MADT table signature.

Definition at line 204 of file tables.h.

◆ PROCESSOR_LOCAL_APIC_ENABLED

#define PROCESSOR_LOCAL_APIC_ENABLED   (1 << 0)

Definition at line 143 of file tables.h.

◆ PROCESSOR_LOCAL_APIC_ONLINE_CAPABLE

#define PROCESSOR_LOCAL_APIC_ONLINE_CAPABLE   (1 << 1)

Definition at line 144 of file tables.h.

◆ SSDT_SIGNATURE

#define SSDT_SIGNATURE   "SSDT"

SSDT table signature.

Note that there might be multiple SSDT tables.

Definition at line 240 of file tables.h.

Typedef Documentation

◆ interrupt_controller_type_t

MADT Interrupt Controller Types.

See also
Section 5.2.12 table 5.21 of the ACPI specification for more details.

Definition at line 121 of file tables.h.

◆ madt_flags_t

Multiple APIC Description Table flags.

See also
Section 5.2.12 table 5.20 of the ACPI specification for more details.

Definition at line 112 of file tables.h.

◆ processor_local_apic_flags_t

MADT Processor Local APIC flags.

See also
Section 5.2.12.2 table 5.23 of the ACPI specification for more details.

Definition at line 141 of file tables.h.

Enumeration Type Documentation

◆ fadt_boot_arch_flags_t

Enum for the fadt_t::bootArchFlags field.

Enumerator
FADT_BOOT_ARCH_PS2_EXISTS 

Definition at line 19 of file tables.h.

Function Documentation

◆ acpi_tables_expose()

◆ acpi_tables_init()

void acpi_tables_init ( rsdp_t rsdp)

◆ acpi_tables_lookup()

sdt_header_t * acpi_tables_lookup ( const char *  signature,
uint64_t  n 
)

Lookup the n'th table matching the signature.

Parameters
signatureThe signature of the table to look up.
nThe index of the table to look up (0 indexed).
Returns
The table if found, NULL otherwise.

Definition at line 266 of file tables.c.

References cachedTables, LOG_ERR, memcmp(), NULL, SDT_SIGNATURE_LENGTH, strlen(), acpi_cached_table_t::table, and tableAmount.

Referenced by aml_def_data_region_read(), aml_init_parse_all(), aml_integer_handling_init(), and smp_others_init().