1 #include "acpi.h"
2 #include <common/kprint.h>
3 #include <driver/multiboot2/multiboot2.h>
4 
5 extern void rs_acpi_init(uint64_t rsdp_paddr1, uint64_t rsdp_paddr2);
6 
7 static struct acpi_RSDP_t *rsdpv1;
8 static struct acpi_RSDP_2_t *rsdpv2;
9 
10 static struct multiboot_tag_old_acpi_t old_acpi;
11 static struct multiboot_tag_new_acpi_t new_acpi;
12 
13 /**
14  * @brief 初始化acpi模块
15  *
16  */
acpi_init()17 void acpi_init()
18 {
19     kinfo("Initializing ACPI...");
20 
21     // 获取物理地址
22     int reserved;
23 
24     multiboot2_iter(multiboot2_get_acpi_old_RSDP, &old_acpi, &reserved);
25     rsdpv1 = &(old_acpi.rsdp);
26 
27     multiboot2_iter(multiboot2_get_acpi_new_RSDP, &new_acpi, &reserved);
28     rsdpv2 = &(new_acpi.rsdp);
29 
30     // rsdpv1、rsdpv2,二者有一个能成功即可
31     rs_acpi_init((uint64_t)rsdpv1, (uint64_t)rsdpv2);
32 
33     kinfo("ACPI module initialized!");
34     return;
35 }
36