#include #include #include "hal/hal.h" #include "kprintf.h" #include "dlmalloc/malloc.h" #include "compiler/attr.h" #include "acpi.h" #include "assert.h" #include "util/util.h" #include "bootinfo/bootinfo.h" #include "uacpi/uacpi.h" // uACPI void uacpi_kernel_log(uacpi_log_level lvl, const uacpi_char *s) { char *t = NULL; switch (lvl) { case UACPI_LOG_INFO: t = "Info"; break; case UACPI_LOG_WARN: t = "Warn"; break; case UACPI_LOG_DEBUG: t = "Dbg"; break; case UACPI_LOG_ERROR: t = "Err"; break; case UACPI_LOG_TRACE: t = "Trc"; break; } LOG("uACPI", "%s %s", t, s); } void uacpi_kernel_unmap(void *addr, uacpi_size len) { // . } void *uacpi_kernel_map(uacpi_phys_addr addr, uacpi_size len) { return (void *)(BOOT_INFO.hhdm_off + addr); } uacpi_status uacpi_kernel_get_rsdp(uacpi_phys_addr *out) { *out = BOOT_INFO.rsdp; return UACPI_STATUS_OK; } void acpi_init(void) { uacpi_status r; size_t tmpbufsize = 0x1000; void *tmpbuf = dlmalloc(tmpbufsize); if (tmpbuf == NULL) { ERR("hal", "could not allocate uACPI tmp buf\n"); hal_hang(); } r = uacpi_setup_early_table_access(tmpbuf, tmpbufsize); if (uacpi_unlikely_error(r)) { ERR("hal", "uACPI init early table failed\n"); hal_hang(); } LOG("hal", "acpi init\n"); } /* uint32_t acpi_remapirq(uint32_t irq) { */ /* } */