minor adjustments
[lunaix-os.git] / lunaix-os / includes / hal / acpi / acpi.h
1 #ifndef __LUNAIX_ACPI_ACPI_H
2 #define __LUNAIX_ACPI_ACPI_H
3
4 #include <stdint.h>
5 #include <stddef.h>
6 #include <arch/x86/boot/multiboot.h>
7
8 #include "sdt.h"
9 #include "madt.h"
10
11 #define ACPI_RSDP_SIG_L       0x20445352      // 'RSD '
12 #define ACPI_RSDP_SIG_H      0x20525450       // 'PTR '
13
14 #define ACPI_MADT_SIG        0x43495041       // 'APIC'
15
16 typedef struct {
17     uint32_t signature_l;
18     uint32_t signature_h;
19     uint8_t chksum;
20     char oem_id[6];
21     // Revision
22     uint8_t rev;
23     acpi_rsdt_t* rsdt;
24     uint32_t length;
25     acpi_sdthdr_t* xsdt;
26     uint8_t x_chksum;
27     char reserved[3];    // Reserved field
28 } __attribute__((packed)) acpi_rsdp_t;
29
30 /**
31  * @brief Main TOC of ACPI tables, provide hassle-free access of ACPI info.
32  * 
33  */
34 typedef struct
35 {
36     // Make it as null terminated
37     char oem_id[7];
38     acpi_madt_toc_t madt;
39 } acpi_context;
40
41 int
42 acpi_init(multiboot_info_t* mb_info);
43
44 acpi_context*
45 acpi_get_context();
46
47 #endif /* __LUNAIX_ACPI_ACPI_H */