[init] Move PCIe probing to srv.init

This was kept in the kernel as a way to keep exercising the code, but it
doesn't belong there. This moves it to init, which doesn't do anything
but probe for devices currently - but at least it's executing the code
in userspace now.
This commit is contained in:
Justin C. Miller
2023-02-20 11:23:49 -08:00
parent 15e2f8abf3
commit 3a7a18011c
16 changed files with 294 additions and 235 deletions

View File

@@ -7,6 +7,7 @@
#include <stddef.h>
#include <stdint.h>
#include <bootproto/acpi.h>
#include <bootproto/bootconfig.h>
#include <bootproto/kernel.h>
#include <bootproto/memory.h>
@@ -176,9 +177,23 @@ efi_main(uefi::handle image, uefi::system_table *st)
bootproto::entrypoint kentry =
load_resources(args, screen, image, pager, bs);
bootproto::module *acpi_mod =
g_alloc.allocate_module(sizeof(bootproto::acpi));
acpi_mod->type = bootproto::module_type::acpi;
bootproto::acpi *acpi = acpi_mod->data<bootproto::acpi>();
acpi->root = args->acpi_table;
pager.update_kernel_args(args);
memory::efi_mem_map map = uefi_exit(args, image, st->boot_services);
for (size_t i = 0; i < args->mem_map.count; ++i) {
bootproto::mem_entry &e = args->mem_map.pointer[i];
if (e.type == bootproto::mem_type::acpi) {
acpi->region = util::buffer::from(e.start, e.pages * memory::page_size);
break;
}
}
args->allocations = allocs;
args->init_modules = reinterpret_cast<uintptr_t>(modules);