|
AquilaOS documentation
How it works, and its code
|
Reading the devicetree that the boot loader passes (a flattened one, an FDT) into the kernel's struct boot: the RAM (/memory's reg property), the initrd (/chosen's linux,initrd-start and linux,initrd-end), and the command line (/chosen's bootargs). More...
Go to the source code of this file.
Data Structures | |
| struct | fdt_header |
| The FDT's header (big-endian). More... | |
Macros | |
| #define | FDT_MAGIC 0xD00DFEED |
| #define | FDT_BEGIN_NODE 1 |
| #define | FDT_END_NODE 2 |
| #define | FDT_PROP 3 |
| #define | FDT_NOP 4 |
| #define | FDT_END 9 |
| #define | MMAP_MAX 16 |
Functions | |
| static uint32_t | be32 (const void *p) |
| Reads a big-endian 32-bit number. | |
| static uint64_t | cells (const void *p, int cells) |
| Reads cells big-endian 32-bit cells at p as one number. | |
| struct boot * | fdt_boot (uintptr_t dtb) |
| Reads the boot loader's devicetree into a struct boot. | |
Variables | |
| static struct boot | boot |
| static mmap_t | mmap [MMAP_MAX] |
| static module_t | modules [1] |
| static char | cmdline [1024] |
Reading the devicetree that the boot loader passes (a flattened one, an FDT) into the kernel's struct boot: the RAM (/memory's reg property), the initrd (/chosen's linux,initrd-start and linux,initrd-end), and the command line (/chosen's bootargs).
References: [1] - Devicetree Specification, release 0.4, chapter 5 (Flattened Devicetree Format)
The blob is big-endian: a header, then the structure (tokens: a node begins, a property, a node ends), then the strings (the properties' names). Only what the kernel needs is read. The root's #address-cells and #size-cells say how many 32-bit cells an address and a size take.
Definition in file fdt.c.
| #define FDT_BEGIN_NODE 1 |
Definition at line 24 of file fdt.c.
Referenced by fdt_boot().
| #define FDT_END_NODE 2 |
Definition at line 25 of file fdt.c.
Referenced by fdt_boot().
| #define FDT_MAGIC 0xD00DFEED |
Definition at line 23 of file fdt.c.
Referenced by fdt_boot().
| #define FDT_NOP 4 |
Definition at line 27 of file fdt.c.
Referenced by fdt_boot().
| #define FDT_PROP 3 |
Definition at line 26 of file fdt.c.
Referenced by fdt_boot().
| #define MMAP_MAX 16 |
Definition at line 63 of file fdt.c.
Referenced by fdt_boot().
|
inlinestatic |
|
static |
Reads cells big-endian 32-bit cells at p as one number.
Definition at line 52 of file fdt.c.
References be32(), and cells().
Referenced by cells(), fdt_boot(), and vcs_read().
Reads the boot loader's devicetree into a struct boot.
If there is no devicetree there, the struct boot is empty.
| dtb | the devicetree's physical address |
Definition at line 78 of file fdt.c.
References be32(), cells(), boot::cmdline, cmdline, FDT_BEGIN_NODE, fdt_boot(), FDT_END_NODE, FDT_MAGIC, FDT_NOP, FDT_PROP, fdt_header::magic, memcpy(), MIN, boot::mmap, mmap, boot::mmap_count, MMAP_MAX, MMAP_USABLE, boot::modules, modules, boot::modules_count, fdt_header::off_dt_strings, fdt_header::off_dt_struct, PHYS2VIRT, printk(), and boot::total_mem.
Referenced by aarch64_init(), and fdt_boot().
|
static |
Definition at line 69 of file fdt.c.
Referenced by fdt_boot().
Definition at line 67 of file fdt.c.
Referenced by fdt_boot().
|
static |
Definition at line 68 of file fdt.c.
Referenced by fdt_boot().