diff mbox

[5/6] hw/arm/boot: load DTB as a ROM image

Message ID 1409930126-28449-6-git-send-email-ard.biesheuvel@linaro.org
State Superseded
Headers show

Commit Message

Ard Biesheuvel Sept. 5, 2014, 3:15 p.m. UTC
In order to make the device tree blob (DTB) available in memory not only at
first boot, but also after system reset, use rom_blob_add_fixed() to install
it into memory.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 hw/arm/boot.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Peter Maydell Sept. 9, 2014, 6:03 p.m. UTC | #1
On 5 September 2014 16:15, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> In order to make the device tree blob (DTB) available in memory not only at
> first boot, but also after system reset, use rom_blob_add_fixed() to install
> it into memory.
>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  hw/arm/boot.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/hw/arm/boot.c b/hw/arm/boot.c
> index 0cfc11d42962..8d8653978dfe 100644
> --- a/hw/arm/boot.c
> +++ b/hw/arm/boot.c
> @@ -400,7 +400,10 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
>
>      qemu_fdt_dumpdtb(fdt, size);
>
> -    cpu_physical_memory_write(addr, fdt, size);
> +    /* Put the DTB into the memory map as a ROM image: this will ensure
> +     * the DTB is copied again upon reset, even if addr points into RAM.
> +     */
> +    rom_add_blob_fixed("dtb", fdt, size, addr);
>
>      g_free(fdt);

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

-- PMM
diff mbox

Patch

diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index 0cfc11d42962..8d8653978dfe 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -400,7 +400,10 @@  static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
 
     qemu_fdt_dumpdtb(fdt, size);
 
-    cpu_physical_memory_write(addr, fdt, size);
+    /* Put the DTB into the memory map as a ROM image: this will ensure
+     * the DTB is copied again upon reset, even if addr points into RAM.
+     */
+    rom_add_blob_fixed("dtb", fdt, size, addr);
 
     g_free(fdt);