forked from seL4/seL4_tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
elfloader: pass DTB from bootloader to seL4 on ARM
On ARM, we expect the physical address of the dtb to be passed in r2 on aarch32 or x0 on aarch64. RISC-V supplies a DTB in a1, but we currently don't pass it to the kernel. The elfloader then moves the dtb to immediately after where the kernel is loaded in memory, and passes that address on to the kernel. If there is no bootloader provided DTB, the elfloader will pass 0 to the kernel as the start address of the DTB.
- Loading branch information
Showing
9 changed files
with
154 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright 2018, Data61 | ||
* Commonwealth Scientific and Industrial Research Organisation (CSIRO) | ||
* ABN 41 687 119 230. | ||
* | ||
* This software may be distributed and modified according to the terms of | ||
* the GNU General Public License version 2. Note that NO WARRANTY is provided. | ||
* See "LICENSE_GPLv2.txt" for details. | ||
* | ||
* @TAG(DATA61_GPL) | ||
*/ | ||
|
||
#pragma once | ||
|
||
uint32_t fdt_size(void *fdt); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright 2019, Data61 | ||
* Commonwealth Scientific and Industrial Research Organisation (CSIRO) | ||
* ABN 41 687 119 230. | ||
* | ||
* This software may be distributed and modified according to the terms of | ||
* the GNU General Public License version 2. Note that NO WARRANTY is provided. | ||
* See "LICENSE_GPLv2.txt" for details. | ||
* | ||
* @TAG(DATA61_GPL) | ||
*/ | ||
#include <types.h> | ||
|
||
#define FDT_MAGIC (0xd00dfeed) | ||
/* Newest FDT version that we understand */ | ||
#define FDT_MAX_VER 17 | ||
|
||
struct fdt_header { | ||
uint32_t magic; | ||
uint32_t totalsize; | ||
uint32_t off_dt_struct; | ||
uint32_t off_dt_strings; | ||
uint32_t off_mem_rsvmap; | ||
uint32_t version; | ||
uint32_t last_comp_version; | ||
uint32_t boot_cpuid_phys; | ||
uint32_t size_dt_strings; | ||
uint32_t size_dt_struct; | ||
}; | ||
|
||
uint32_t be32_to_le(uint32_t be) | ||
{ | ||
return ((be & 0xff) << 24) | | ||
((be & 0xff00) << 8) | | ||
((be & 0xff0000) >> 8) | | ||
((be & 0xff000000) >> 24); | ||
} | ||
|
||
uint32_t fdt_size(void *fdt) | ||
{ | ||
struct fdt_header *hdr = (struct fdt_header *)fdt; | ||
|
||
if (be32_to_le(hdr->magic) != FDT_MAGIC || | ||
be32_to_le(hdr->last_comp_version) > FDT_MAX_VER) { | ||
return 0; | ||
} | ||
|
||
return be32_to_le(hdr->totalsize); | ||
} | ||
|