Advanced configuration and power interface (ACPI) tables. More...
#include <core.h>
#include <libc/string.h>
#include <kernel/debug/log.h>
#include <kernel/mem/acpi.h>
#include <kernel/mem/kmem.h>
#include <kernel/mem/paging.h>
#include <kernel/mem/pmap.h>
#include <kernel/x86/cpu.h>
Go to the source code of this file.
Data Structures | |
struct | btable_t |
A structure used to track the state of the temporary page table generated by the boot loader. More... | |
struct | acpi_rsdp |
struct | acpi_rsdt |
struct | acpi_xsdt |
struct | acpi |
Macros | |
#define | SIGNATURE_RSDP 0x2052545020445352ll |
#define | SIGNATURE_MADT 0x43495041 |
#define | SIGNATURE_BOOT 0x544f4f42 |
#define | SIGNATURE_FADT 0x50434146 |
#define | SIGNATURE_HPET 0x54455048 |
#define | SIGNATURE_MCFG 0x4746434d |
#define | SIGNATURE_SRAT 0x54415253 |
#define | SIGNATURE_SSDT 0x54445353 |
#define | SIGNATURE_WAET 0x54454157 |
#define | PAGE_ALIGN_DOWN(a) ((a) & ~(PAGE_SIZE - 1)) |
#define | PAGE_ALIGN_UP(a) (((a) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)) |
Functions | |
static void | read_fadt (const struct acpi_hdr *hdr) |
static void | read_madt (const struct acpi_hdr *hdr) |
static void | read_mcfg (const struct acpi_hdr *hdr) |
static void | read_table (const struct acpi_hdr *hdr) |
static bool | is_mapped (btable_t *btable, uint64_t addr) |
static uint64_t | alloc_page (btable_t *btable) |
static void | create_page (btable_t *btable, uint64_t addr, uint64_t flags) |
static void | map_range (btable_t *btable, uint64_t addr, uint64_t size, uint64_t flags) |
static void | map_table (btable_t *btable, const struct acpi_hdr *hdr) |
static void | read_xsdt (btable_t *btable) |
static void | read_rsdt (btable_t *btable) |
static const struct acpi_rsdp * | find_rsdp (uint64_t addr, uint64_t size) |
void | acpi_init () |
Find and parse all available ACPI tables. More... | |
int | acpi_version () |
Return the ACPI version number. More... | |
const struct acpi_fadt * | acpi_fadt () |
Return a pointer to the ACPI fixed ACPI description table. More... | |
const struct acpi_madt * | acpi_madt () |
Return a pointer to the ACPI multiple APIC description table (MADT). More... | |
static const void * | madt_find (enum acpi_madt_type type, const void *prev) |
const struct acpi_madt_local_apic * | acpi_next_local_apic (const struct acpi_madt_local_apic *prev) |
Return a pointer to the next Local APIC structure entry in the MADT table. More... | |
const struct acpi_madt_io_apic * | acpi_next_io_apic (const struct acpi_madt_io_apic *prev) |
Return a pointer to the next I/O APIC structure entry in the MADT table. More... | |
const struct acpi_madt_iso * | acpi_next_iso (const struct acpi_madt_iso *prev) |
Return a pointer to the next Interrupt Source Override (ISO) structure entry in the MADT table. More... | |
const struct acpi_mcfg_addr * | acpi_next_mcfg_addr (const struct acpi_mcfg_addr *prev) |
Return a pointer to the next Mapped Configuration (MCFG) address entry, used for PCIe. More... | |
Variables | |
struct acpi_rsdp | PACKSTRUCT |
static struct acpi | acpi |
Advanced configuration and power interface (ACPI) tables.
Definition in file acpi.c.
struct btable_t |
A structure used to track the state of the temporary page table generated by the boot loader.
The ACPI code updates it to access the memory stored in ACPI tables.
Data Fields | ||
---|---|---|
page_t * | root | The top-level (PML4) page table. |
page_t * | next_page | The next page to use when allocating. |
page_t * | term_page | Just beyond the last available page. |
struct acpi_rsdp |
struct acpi_rsdt |
struct acpi_xsdt |
struct acpi |
#define SIGNATURE_RSDP 0x2052545020445352ll |
Definition at line 19 of file acpi.c.
Referenced by find_rsdp().
#define SIGNATURE_MADT 0x43495041 |
Definition at line 20 of file acpi.c.
Referenced by read_table().
#define SIGNATURE_FADT 0x50434146 |
Definition at line 22 of file acpi.c.
Referenced by read_table().
#define SIGNATURE_MCFG 0x4746434d |
Definition at line 24 of file acpi.c.
Referenced by read_table().
#define PAGE_ALIGN_DOWN | ( | a | ) | ((a) & ~(PAGE_SIZE - 1)) |
Definition at line 30 of file acpi.c.
Referenced by acpi_init(), map_range(), and map_table().
Definition at line 31 of file acpi.c.
Referenced by map_range(), and map_table().
|
static |
Definition at line 84 of file acpi.c.
Referenced by read_table().
|
static |
Definition at line 91 of file acpi.c.
Referenced by read_table().
|
static |
Definition at line 98 of file acpi.c.
Referenced by read_table().
|
static |
Definition at line 105 of file acpi.c.
Referenced by read_rsdt(), and read_xsdt().
|
static |
Definition at line 124 of file acpi.c.
Referenced by map_range().
|
static |
Definition at line 152 of file acpi.c.
Referenced by create_page().
|
static |
Definition at line 163 of file acpi.c.
Referenced by map_range().
|
static |
Definition at line 187 of file acpi.c.
Referenced by map_table().
Definition at line 202 of file acpi.c.
Referenced by acpi_init(), read_rsdt(), and read_xsdt().
|
static |
Definition at line 223 of file acpi.c.
Referenced by acpi_init().
|
static |
Definition at line 245 of file acpi.c.
Referenced by acpi_init().
|
static |
Definition at line 267 of file acpi.c.
Referenced by acpi_init().
void acpi_init | ( | ) |
int acpi_version | ( | ) |
Return a pointer to the ACPI multiple APIC description table (MADT).
Definition at line 364 of file acpi.c.
Referenced by cmd_display_apic().
|
static |
Definition at line 370 of file acpi.c.
Referenced by acpi_next_io_apic(), acpi_next_iso(), and acpi_next_local_apic().
const struct acpi_madt_local_apic* acpi_next_local_apic | ( | const struct acpi_madt_local_apic * | prev | ) |
Return a pointer to the next Local APIC structure entry in the MADT table.
[in] | prev | Pointer to the local APIC returned by a previous call to this function. Pass NULL for the first call. |
Definition at line 398 of file acpi.c.
Referenced by cmd_display_apic().
const struct acpi_madt_io_apic* acpi_next_io_apic | ( | const struct acpi_madt_io_apic * | prev | ) |
Return a pointer to the next I/O APIC structure entry in the MADT table.
[in] | prev | Pointer to the I/O APIC returned by a previous call to this function. Pass NULL for the first call. |
Definition at line 405 of file acpi.c.
Referenced by acpi_init(), and cmd_display_apic().
const struct acpi_madt_iso* acpi_next_iso | ( | const struct acpi_madt_iso * | prev | ) |
Return a pointer to the next Interrupt Source Override (ISO) structure entry in the MADT table.
[in] | prev | Pointer to the ISO returned by a previous call to this function. Pass NULL for the first call. |
Definition at line 412 of file acpi.c.
Referenced by cmd_display_apic().
const struct acpi_mcfg_addr* acpi_next_mcfg_addr | ( | const struct acpi_mcfg_addr * | prev | ) |
Return a pointer to the next Mapped Configuration (MCFG) address entry, used for PCIe.
[in] | prev | Pointer to the MCFG entry returned by a previous call to this function. Pass NULL for the first call. |
Definition at line 419 of file acpi.c.
Referenced by cmd_display_pcie().
struct acpi_xsdt PACKSTRUCT |