aboutsummaryrefslogtreecommitdiff
path: root/kernel/drivers/acpi.c
diff options
context:
space:
mode:
authorMarvin Borner2020-09-06 14:07:21 +0200
committerMarvin Borner2020-09-06 14:07:21 +0200
commita35b6b09b90da7180e3c1321abb313d581f9530c (patch)
tree0a82489d7d3e0ef46a2ca7df767eb3a034660cc5 /kernel/drivers/acpi.c
parentc2d88b639c759e06444c1bf0efdd96e243d3a6c2 (diff)
Added some ACPI tables
Diffstat (limited to 'kernel/drivers/acpi.c')
-rw-r--r--kernel/drivers/acpi.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/kernel/drivers/acpi.c b/kernel/drivers/acpi.c
index 02f3718..f7f643c 100644
--- a/kernel/drivers/acpi.c
+++ b/kernel/drivers/acpi.c
@@ -44,6 +44,19 @@ struct rsdp *find_rsdp()
return NULL;
}
+void *find_sdt(struct rsdt *rsdt, const char *signature)
+{
+ int entries = (rsdt->header.length - sizeof(rsdt->header)) / 4;
+
+ for (int i = 0; i < entries; i++) {
+ struct sdt_header *header = (struct sdt_header *)rsdt->sdt_pointer[i];
+ if (memcmp(header->signature, signature, 4) == 0)
+ return header;
+ }
+
+ return NULL;
+}
+
void acpi_install()
{
struct rsdp *rsdp = find_rsdp();
@@ -51,4 +64,10 @@ void acpi_install()
struct rsdt *rsdt = rsdp->rsdt;
assert(rsdt && memcmp(rsdt->header.signature, RSDT_MAGIC, 4) == 0 &&
check_sdt(&rsdt->header));
+
+ madt = find_sdt(rsdt, MADT_MAGIC);
+ fadt = find_sdt(rsdt, FADT_MAGIC);
+ hpet = find_sdt(rsdt, HPET_MAGIC);
+ assert(madt && check_sdt(&madt->header) && fadt && check_sdt(&fadt->header) && hpet &&
+ check_sdt(&hpet->header));
}