mittos65/documentation/5 - acpi.md
2022-01-17 14:38:40 +01:00

27 lines
1.2 KiB
Markdown

# Parsing ACPI information
> - [ACPI Specification](https://uefi.org/sites/default/files/resources/ACPI_6_3_final_Jan30.pdf)
ACPI is a standard for controlling things like power and temperatures in computers. It's also useful for getting some information about the machine, such as number of processors - which is what Mittos will be using it for (at least at first).
The bootloader will find the Root System Descriptor Pointer and provide it in a boot tag. Then the data just needs to be parsed.
The RSDP contains a pointer to the Root System Descriptor Table which contains pointers to more System Descriptor Tables.
The important fields for parsing a System Descript Tables are as follows:
```c
struct sdt {
char signature[4];
uint32_t length;
uint8_t _[28];
uint32_t data[];
}__attribute__((packed));
```
So I step through the pointers in the RSDT data field until I find an SDT with signature "APIC". That should contain the Multiple APIC Description Table.
The MADT in turn contains a number of fields with information - among other things - about Processor Local APICs, I/O Apics and IRQ redirections.
Those are things I may be interested in, and therefore store in some global data structures.
## Relevant files
- `src/kernel/cpu/acpi.c`