[init] Go back to boot modules having inline data

In order to pass along arguments like the framebuffer, it's far simpler
to have that data stored along with the modules than mapping new pages
for every structure. Also now optionally pass a module's data to a
driver as init starts it.
This commit is contained in:
Justin C. Miller
2023-02-10 01:01:01 -08:00
parent 0eddb002f0
commit ea587076ed
14 changed files with 132 additions and 200 deletions

View File

@@ -3,10 +3,13 @@
/// Data structures describing bootloader-passed framebuffer
#include <util/counted.h>
#include <util/hash.h>
namespace bootproto {
namespace devices {
inline constexpr uint64_t type_id_uefi_fb = "uefi.fb"_id;
enum class fb_layout : uint8_t { rgb8, bgr8, unknown = 0xff };
struct video_mode

View File

@@ -11,29 +11,21 @@
namespace bootproto {
enum class module_type : uint8_t { none, initrd, device, };
enum class initrd_format : uint8_t { none, zstd, };
enum class device_type : uint16_t { none, uefi_fb, };
struct module
{
module_type type;
// 1 byte padding
uint16_t subtype;
// 4 bytes padding
util::buffer data;
uint16_t bytes; //< Size of this module in bytes, including this header
module_type type; //< Type of module
// 5 bytes padding
uint64_t type_id; //< Optional subtype or id
template <typename T> T * data() { return reinterpret_cast<T*>(this+1); }
template <typename T> const T * data() const { return reinterpret_cast<const T*>(this+1); }
};
struct module_page_header
struct modules_page
{
uint8_t count;
uintptr_t next;
};
struct modules_page :
public module_page_header
{
static constexpr unsigned per_page = (0x1000 - sizeof(module_page_header)) / sizeof(module);
module modules[per_page];
modules_page *next;
};
} // namespace bootproto