[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

@@ -9,9 +9,11 @@
#include <j6/syslog.hh>
#include <j6/types.h>
#include <bootproto/acpi.h>
#include <bootproto/init.h>
#include <bootproto/devices/framebuffer.h>
#include "acpi.h"
#include "j6romfs.h"
#include "loader.h"
#include "modules.h"
@@ -86,6 +88,7 @@ driver_main(unsigned argc, const char **argv, const char **env, const j6_init_ar
load_modules(modules_addr, sys, 0, mods);
module const *initrd_module = nullptr;
module const *acpi_module = nullptr;
std::vector<module const*> devices;
for (auto mod : mods) {
@@ -94,6 +97,10 @@ driver_main(unsigned argc, const char **argv, const char **env, const j6_init_ar
initrd_module = mod;
break;
case module_type::acpi:
acpi_module = mod;
break;
case module_type::device:
devices.push_back(mod);
break;
@@ -105,7 +112,10 @@ driver_main(unsigned argc, const char **argv, const char **env, const j6_init_ar
}
if (!initrd_module)
return 1;
return 2;
if (!acpi_module)
return 3;
util::const_buffer initrd_buf = *initrd_module->data<util::const_buffer>();
@@ -120,6 +130,7 @@ driver_main(unsigned argc, const char **argv, const char **env, const j6_init_ar
// have driver_source objects..
j6romfs::fs initrd {initrd_buf};
load_acpi(sys, acpi_module);
const j6romfs::inode *driver_dir = initrd.lookup_inode("/jsix/drivers");
if (!driver_dir) {