feat: capability list to enable greater flexibility of devices
[lunaix-os.git] / lunaix-os / kernel / proc0.c
index 64dbcd9a4520d9c713db77f671111057a748ff44..a9d25a78cf186a27108c93b59e116ac07ca94226 100644 (file)
@@ -1,28 +1,13 @@
-#include <lunaix/block.h>
 #include <lunaix/boot_generic.h>
 #include <lunaix/boot_generic.h>
-#include <lunaix/common.h>
 #include <lunaix/exec.h>
 #include <lunaix/foptions.h>
 #include <lunaix/fs.h>
 #include <lunaix/fs/probe_boot.h>
 #include <lunaix/fs/twifs.h>
 #include <lunaix/exec.h>
 #include <lunaix/foptions.h>
 #include <lunaix/fs.h>
 #include <lunaix/fs/probe_boot.h>
 #include <lunaix/fs/twifs.h>
-#include <lunaix/lxconsole.h>
-#include <lunaix/mm/cake.h>
-#include <lunaix/mm/pmm.h>
-#include <lunaix/mm/valloc.h>
-#include <lunaix/mm/vmm.h>
-#include <lunaix/peripheral/ps2kbd.h>
-#include <lunaix/peripheral/serial.h>
 #include <lunaix/spike.h>
 #include <lunaix/spike.h>
-#include <lunaix/syscall.h>
 #include <lunaix/syslog.h>
 #include <lunaix/types.h>
 #include <lunaix/syslog.h>
 #include <lunaix/types.h>
-
-#include <sdbg/protocol.h>
-
-#include <hal/acpi/acpi.h>
-#include <hal/ahci/ahci.h>
-#include <hal/pci.h>
+#include <lunaix/owloysius.h>
 
 #include <klibc/string.h>
 
 
 #include <klibc/string.h>
 
@@ -38,12 +23,12 @@ mount_bootmedium()
     int errno = 0;
     struct device* dev = probe_boot_medium();
     if (!dev) {
     int errno = 0;
     struct device* dev = probe_boot_medium();
     if (!dev) {
-        kprintf(KERROR "fail to acquire device. (%d)", errno);
+        ERROR("fail to acquire device. (%d)", errno);
         return 0;
     }
 
     if ((errno = vfs_mount("/mnt/lunaix-os", "iso9660", dev, 0))) {
         return 0;
     }
 
     if ((errno = vfs_mount("/mnt/lunaix-os", "iso9660", dev, 0))) {
-        kprintf(KERROR "fail to mount boot medium. (%d)", errno);
+        ERROR("fail to mount boot medium. (%d)", errno);
         return 0;
     }
 
         return 0;
     }
 
@@ -62,7 +47,7 @@ exec_initd()
     fail("should not reach");
 
 fail:
     fail("should not reach");
 
 fail:
-    kprintf(KERROR "fail to load initd. (%d)", errno);
+    ERROR("fail to load initd. (%d)", errno);
     return 0;
 }
 
     return 0;
 }
 
@@ -78,8 +63,8 @@ void
 __proc0()
 {
     /*
 __proc0()
 {
     /*
-     * We must defer boot code/data cleaning after we successfully escape that
-     * area
+     * We must defer boot code/data cleaning to here, after we successfully
+     * escape that area
      */
     boot_cleanup();
 
      */
     boot_cleanup();
 
@@ -88,9 +73,7 @@ __proc0()
     init_proc_user_space(__current);
 
     if (!mount_bootmedium() || !exec_initd()) {
     init_proc_user_space(__current);
 
     if (!mount_bootmedium() || !exec_initd()) {
-        while (1) {
-            asm("hlt");
-        }
+        FATAL("failed to initd");
         // should not reach
     }
 }
         // should not reach
     }
 }
@@ -98,24 +81,11 @@ __proc0()
 void
 init_platform()
 {
 void
 init_platform()
 {
-    kprintf(KINFO "\033[11;0mLunaixOS (gcc v%s, %s)\033[39;49m\n",
-            __VERSION__,
-            __TIME__);
+    device_postboot_load();
+    invoke_init_function(call_on_postboot);
 
     twifs_register_plugins();
 
 
     twifs_register_plugins();
 
-    /* we must start probing pci after all drivers are registered! */
-    pci_load_devices();
-
-    // debugger
-    serial_init();
-    sdbg_init();
-
-    // FIXME ps2 kbd is x86 PC specific, not here.
-    // peripherals & chipset features
-    ps2_kbd_init();
-
-    // console
-    console_start_flushing();
-    console_flush();
+    // FIXME Re-design needed!!
+    // sdbg_init();
 }
\ No newline at end of file
 }
\ No newline at end of file