summaryrefslogtreecommitdiff
path: root/sys/dev/acpi/acpi_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/acpi/acpi_init.c')
-rw-r--r--sys/dev/acpi/acpi_init.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/sys/dev/acpi/acpi_init.c b/sys/dev/acpi/acpi_init.c
index 448c522..67eed29 100644
--- a/sys/dev/acpi/acpi_init.c
+++ b/sys/dev/acpi/acpi_init.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
+ * Copyright (c) 2023-2025 Ian Marco Moffett and the Osmora Team.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -36,14 +36,17 @@
#include <dev/acpi/acpivar.h>
#include <dev/pci/pci.h>
#include <vm/vm.h>
+#include <string.h>
#if defined(__x86_64__)
#include <machine/hpet.h>
#endif /* __x86_64__ */
#define pr_trace(fmt, ...) kprintf("acpi: " fmt, ##__VA_ARGS__)
+static char oemid[OEMID_SIZE];
static struct acpi_root_sdt *root_sdt = NULL;
static size_t root_sdt_entries = 0;
+static paddr_t rsdp_pa = 0;
static volatile struct limine_rsdp_request rsdp_req = {
.id = LIMINE_RSDP_REQUEST,
.revision = 0
@@ -54,7 +57,7 @@ acpi_init_hpet(void)
{
#if defined(__x86_64__)
if (hpet_init() != 0) {
- panic("Could not init HPET\n");
+ panic("could not init HPET\n");
}
#endif
}
@@ -91,6 +94,18 @@ acpi_get_root_sdt_len(void)
return root_sdt_entries;
}
+const char *
+acpi_oemid(void)
+{
+ return oemid;
+}
+
+paddr_t
+acpi_rsdp(void)
+{
+ return rsdp_pa;
+}
+
void
acpi_init(void)
{
@@ -103,18 +118,20 @@ acpi_init(void)
/* Fetch the RSDP */
rsdp = rsdp_req.response->address;
acpi_print_oemid("RSDP", rsdp->oemid);
+ memcpy(oemid, rsdp->oemid, OEMID_SIZE);
+ rsdp_pa = VIRT_TO_PHYS(rsdp);
/* Fetch the root SDT */
if (rsdp->revision >= 2) {
root_sdt = PHYS_TO_VIRT(rsdp->xsdt_addr);
- pr_trace("Using XSDT as root SDT\n");
+ pr_trace("using XSDT as root SDT\n");
} else {
root_sdt = PHYS_TO_VIRT(rsdp->rsdt_addr);
- pr_trace("Using RSDT as root SDT\n");
+ pr_trace("using RSDT as root SDT\n");
}
if (acpi_checksum(&root_sdt->hdr) != 0) {
- panic("Root SDT checksum is invalid!\n");
+ panic("root SDT checksum is invalid!\n");
}
root_sdt_entries = (root_sdt->hdr.length - sizeof(root_sdt->hdr)) / 4;