summaryrefslogtreecommitdiffhomepage
path: root/src/loader/inc/impl/mb2.h
blob: 3f64dbda0f0660b904beccb66ab3e7e66b3bb68c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// MIT License, Copyright (c) 2021 Marvin Borner

#ifndef IMPL_MB2_H
#define IMPL_MB2_H

#include <cfg.h>
#include <def.h>
#include <dev.h>

#define MB2_MAGIC 0xe85250d6 // Identifies kernel
#define MB2_LOAD_MAGIC 0x36d76289 // Passed to kernel

struct mb2_header {
	u32 total_size;
	u32 unknown;
} PACKED;

struct mb2_tag {
	u32 type;
	u32 size;
} PACKED;

struct mb2_memory {
	u32 addr_low;
	u32 addr_high;
	u32 size_low;
	u32 size_high;
	u32 type;
	u32 reserved;
} PACKED;

struct mb2_module {
	u32 start;
	u32 end;
	char string[1];
} PACKED;

struct mb2_fb {
	u32 addr_low;
	u32 addr_high;
	u32 pitch;
	u32 width;
	u32 height;
	u8 bpp;
	u8 type;
} PACKED;

enum mb2_tags {
	MB2_TAG_END = 0,
	MB2_TAG_CMDLINE = 1,
	MB2_TAG_MODULE = 3,
	MB2_TAG_MEMORY = 6,
	MB2_TAG_FB = 8,
	MB2_TAG_ACPI_1 = 14,
	MB2_TAG_ACPI_2 = 15,
};

u8 mb2_detect(struct cfg_entry *cfg);
void mb2_exec(struct cfg_entry *cfg);

#endif