diff options
author | Oliver O'Halloran <oohall@gmail.com> | 2017-06-08 21:51:22 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-06-15 13:37:37 +1000 |
commit | 106557d9d1888765cf6fccca7fe0dcf2b8fbe7fb (patch) | |
tree | d5f9942af3048fd001aa7816f0b683357c0a97ec | |
parent | fb267a0120ff8dab4f5cff2bc4ddd72091f94dec (diff) | |
download | skiboot-106557d9d1888765cf6fccca7fe0dcf2b8fbe7fb.zip skiboot-106557d9d1888765cf6fccca7fe0dcf2b8fbe7fb.tar.gz skiboot-106557d9d1888765cf6fccca7fe0dcf2b8fbe7fb.tar.bz2 |
core/fdt: Always add a reserve map
Currently we skip adding the reserved ranges block to the generated
FDT blob if we are excluding the root node. This can result in a DTB
that dtc will barf on because the reserved memory ranges overlap with
the start of the dt_struct block. As an example:
$ fdtdump broken.dtb -d
/dts-v1/;
// magic: 0xd00dfeed
// totalsize: 0x7f3 (2035)
// off_dt_struct: 0x30 <----\
// off_dt_strings: 0x7b8 | this is bad!
// off_mem_rsvmap: 0x30 <----/
// version: 17
// last_comp_version: 16
// boot_cpuid_phys: 0x0
// size_dt_strings: 0x3b
// size_dt_struct: 0x788
/memreserve/ 0x100000000 0x300000004;
/memreserve/ 0x3300000001 0x169626d2c;
/memreserve/ 0x706369652d736c6f 0x7473000000000003;
*continues*
With this patch:
$ fdtdump working.dtb -d
/dts-v1/;
// magic: 0xd00dfeed
// totalsize: 0x803 (2051)
// off_dt_struct: 0x40
// off_dt_strings: 0x7c8
// off_mem_rsvmap: 0x30
// version: 17
// last_comp_version: 16
// boot_cpuid_phys: 0x0
// size_dt_strings: 0x3b
// size_dt_struct: 0x788
// 0040: tag: 0x00000001 (FDT_BEGIN_NODE)
/ {
// 0048: tag: 0x00000003 (FDT_PROP)
// 07fb: string: phandle
// 0054: value
phandle = <0x00000001>;
*continues*
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | core/fdt.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -172,6 +172,9 @@ static int __create_dtb(void *fdt, size_t len, fdt_create(fdt, len); if (root == dt_root && !exclusive) create_dtb_reservemap(fdt, root); + else + fdt_finish_reservemap(fdt); + flatten_dt_node(fdt, root, exclusive); save_err(fdt_finish(fdt)); |