Skip to content

Commit

Permalink
fix: reserve memory for firmware M-mode code in FDT
Browse files Browse the repository at this point in the history
  • Loading branch information
edubart committed Oct 10, 2023
1 parent eee575d commit 86cddbe
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/dtb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,20 @@ void dtb_init(const machine_config &c, unsigned char *dtb_start, uint64_t dtb_le
fdt.end_node();
}

{ // reserved memory
fdt.begin_node("reserved-memory");
fdt.prop_u32("#address-cells", 2);
fdt.prop_u32("#size-cells", 2);
fdt.prop_empty("ranges");
{ // reserve 256KB for firmware M-mode code (such as OpenSBI)
fdt.begin_node_num("fw_resv", PMA_RAM_START);
fdt.prop_u64_list<2>("reg", {PMA_RAM_START, 0x40000});
fdt.prop_empty("no-map");
fdt.end_node();
}
fdt.end_node();
}

// drives
int drive_index = 0;
for (const auto &f : c.flash_drive) {
Expand Down

0 comments on commit 86cddbe

Please sign in to comment.