mem: improve device memory mapping

MMIO ports will no longer directly map to HHDM addresses and will need
to be searched for in the memory mapping tree
This commit is contained in:
Michael Shaw 2023-10-24 22:16:33 -04:00
commit 4dc4f07dc6
10 changed files with 111 additions and 16 deletions

View file

@ -45,11 +45,12 @@ static void rsdt_parse(struct rsdt *rsdt)
void acpi_init()
{
rsdp = (struct rsdp *)rsdp_req.response->address;
rsdp_req.response->address = (void *)((uintptr_t)rsdp_req.response->address & ~(hhdm_start));
rsdp = kmap_device(rsdp_req.response->address, 0x1000);
/* 2 steps silences warning */
uintptr_t rsdt_addr = (uintptr_t)(rsdp->rsdt_addr | hhdm_start);
struct rsdt *rsdt = (struct rsdt *)rsdt_addr;
uintptr_t rsdt_addr = (uintptr_t)(rsdp->rsdt_addr & ~(hhdm_start));
struct rsdt *rsdt = kmap_device((void *)rsdt_addr, 0x4000);
rsdt_parse(rsdt);
#ifdef KDEBUG

View file

@ -13,6 +13,7 @@
#include <dev/serial.h>
#include <dev/pci.h>
#include <dev/ahci.h>
#include <dev/apic.h>
#include <fs/vfs.h>
@ -149,6 +150,7 @@ void kmain_post_stack_init()
vfs_init(root_path);
_pic_init();
apic_init();
console_init();
kprintf("\n\n# ");