feat: device subsystem rework
[lunaix-os.git] / lunaix-os / includes / lunaix / boot_generic.h
1 #ifndef __LUNAIX_BOOT_GENERIC_H
2 #define __LUNAIX_BOOT_GENERIC_H
3
4 #include <lunaix/types.h>
5
6 // Free memory region
7 #define BOOT_MMAP_FREE 0
8
9 // Reserved memory region
10 #define BOOT_MMAP_RSVD 1
11
12 // Reclaimable memory region
13 #define BOOT_MMAP_RCLM 2
14
15 struct boot_mmapent
16 {
17     ptr_t start;
18     size_t size;
19     int type;
20 };
21
22 struct boot_modent
23 {
24     ptr_t start;
25     ptr_t end;
26     char* str;
27 };
28
29 struct boot_handoff
30 {
31     size_t msize;
32     struct
33     {
34         size_t size;
35         struct boot_mmapent* mmap;
36         size_t mmap_len;
37     } mem;
38
39     struct
40     {
41         ptr_t ksections;
42         size_t size;
43
44         char** argv;
45         size_t argc;
46     } kexec;
47
48     struct
49     {
50         size_t mods_num;
51         struct boot_modent* entries;
52     } mods;
53
54     void (*release)(struct boot_handoff*);
55     void (*prepare)(struct boot_handoff*);
56
57     // XXX: should arch specific boot detect platform interface provider?
58 };
59
60 #ifndef __BOOT_CODE__
61 void
62 boot_begin(struct boot_handoff*);
63
64 void
65 boot_end(struct boot_handoff*);
66
67 void
68 boot_cleanup();
69 #endif
70
71 #endif /* __LUNAIX_BOOT_GENERIC_H */