PatchworkOS
Loading...
Searching...
No Matches
ACPI

Advanced Configuration and Power Interface. More...

Modules

 AML
 ACPI AML.
 
 Devices
 Device and Power Management.
 
 Tables
 System Description Tables.
 

Data Structures

struct  sdt_header_t
 System Description Table Header. More...
 
struct  rsdp_t
 Root System Description Pointer. More...
 
struct  xsdt_t
 Extended System Description Table. More...
 

Macros

#define RSDP_CURRENT_REVISION   2
 The expected value of the revision field in the RSDP structure.
 
#define SDT_SIGNATURE_LENGTH   4
 The length of the signature field in the SDT header structure.
 
#define SDT_OEM_ID_LENGTH   6
 The length of the OEM ID field in the SDT header structure.
 
#define SDT_OEM_TABLE_ID_LENGTH   8
 The length of the OEM Table ID field in the SDT header structure.
 
#define RSDP_SIGNATURE_LENGTH   8
 Length of the signature field in the RSDP structure.
 
#define RSDP_V1_LENGTH   20
 Length of the RSDP structure for ACPI version 1.0.
 

Functions

bool acpi_is_checksum_valid (void *table, uint64_t length)
 Check if the sum of all bytes in a table is 0.
 
dentry_tacpi_get_sysfs_root (void)
 Retrieve the sysfs root directory for ACPI.
 
void acpi_reclaim_memory (const boot_memory_map_t *map)
 Reclaim ACPI memory regions.
 

Detailed Description

Advanced Configuration and Power Interface.

We use version 6.6 of the ACPI specification, but it contains minor mistakes or deprecated features that we use other versions to straighten out. If the "ACPI specification" is ever sourced, without mentioning its version, assume version 6.6.

Take a look at this osdev post if you want to understand how annoying the ACPI spec is.

Checklist for ACPI support from section 1.7.2 of the ACPI specification:

Included below is a list of deviations from the ACPI specification that we have made. Each deviation is marked with the source of the diversion:

See also
Easier to read version of the ACPI Specification
ACPI Specification Version 6.6
ACPI Specification Version 6.3
ACPI Specification Version 4.0
ACPICA Reference Version 6.3
LAI Library

Macro Definition Documentation

◆ RSDP_CURRENT_REVISION

#define RSDP_CURRENT_REVISION   2

The expected value of the revision field in the RSDP structure.

See also
Section 5.2.5.3 of the ACPI specification for more details.

Definition at line 66 of file acpi.h.

◆ RSDP_SIGNATURE_LENGTH

#define RSDP_SIGNATURE_LENGTH   8

Length of the signature field in the RSDP structure.

Definition at line 105 of file acpi.h.

◆ RSDP_V1_LENGTH

#define RSDP_V1_LENGTH   20

Length of the RSDP structure for ACPI version 1.0.

Definition at line 129 of file acpi.h.

◆ SDT_OEM_ID_LENGTH

#define SDT_OEM_ID_LENGTH   6

The length of the OEM ID field in the SDT header structure.

Definition at line 76 of file acpi.h.

◆ SDT_OEM_TABLE_ID_LENGTH

#define SDT_OEM_TABLE_ID_LENGTH   8

The length of the OEM Table ID field in the SDT header structure.

Definition at line 81 of file acpi.h.

◆ SDT_SIGNATURE_LENGTH

#define SDT_SIGNATURE_LENGTH   4

The length of the signature field in the SDT header structure.

Definition at line 71 of file acpi.h.

Function Documentation

◆ acpi_get_sysfs_root()

dentry_t * acpi_get_sysfs_root ( void  )

Retrieve the sysfs root directory for ACPI.

The acpi group and by extension its directory is lazily initialized.

Returns
Pointer to the ACPI sysfs root directory.

Definition at line 28 of file acpi.c.

References mount, mountInitialzed, NULL, panic(), REF, mount_t::root, and sysfs_mount_new().

Referenced by acpi_tables_expose().

◆ acpi_is_checksum_valid()

bool acpi_is_checksum_valid ( void *  table,
uint64_t  length 
)

Check if the sum of all bytes in a table is 0.

Used to validate the checksum of ACPI tables.

Parameters
tablePointer to the table structure.
Returns
true if the table is valid, false otherwise.

Definition at line 17 of file acpi.c.

Referenced by acpi_is_rsdp_valid(), and acpi_is_table_valid().

◆ acpi_reclaim_memory()

void acpi_reclaim_memory ( const boot_memory_map_t map)

Reclaim ACPI memory regions.

This function will free all memory regions marked as ACPI Reclaimable in the provided boot memory map.

Should be called after all ACPI initialization is complete.

Parameters
mapPointer to the boot memory map.

Definition at line 44 of file acpi.c.

References BOOT_MEMORY_MAP_GET_DESCRIPTOR, boot_memory_map_t::length, LOG_INFO, map, PAGE_SIZE, PML_LOWER_TO_HIGHER, and pmm_free_region().

Referenced by init_finalize().