diff options
| author | Stefan Hajnoczi <stefanha@redhat.com> | 2016-11-29 09:28:24 +0000 |
|---|---|---|
| committer | Stefan Hajnoczi <stefanha@redhat.com> | 2016-11-29 09:28:24 +0000 |
| commit | 517dcb8785de4ce078810f75d9598474cd6fbca8 (patch) | |
| tree | 466300ced83e404c6480d2c243aaaa331de89e51 /hw/arm/boot.c | |
| parent | 406c97c41f643dc835f32a3bcb6c612b2320547e (diff) | |
| parent | b77257d7bae26a0fca6a90af88d54ee2c45f5b61 (diff) | |
| download | focaccia-qemu-517dcb8785de4ce078810f75d9598474cd6fbca8.tar.gz focaccia-qemu-517dcb8785de4ce078810f75d9598474cd6fbca8.zip | |
Merge remote-tracking branch 'pm215/tags/pull-target-arm-20161128' into staging
target-arm queue: * hw/arm/boot: fix crash handling device trees with no /chosen or /memory nodes * generic-loader: only set PC if a CPU is specified # gpg: Signature made Mon 28 Nov 2016 01:47:21 PM GMT # gpg: using RSA key 0x3C2525ED14360CDE # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" # gpg: aka "Peter Maydell <pmaydell@gmail.com>" # gpg: aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83 15CF 3C25 25ED 1436 0CDE * pm215/tags/pull-target-arm-20161128: arm: Create /chosen and /memory devicetree nodes if necessary generic-loader: file: Only set a PC if a CPU is specified Message-id: 1480341071-5367-1-git-send-email-peter.maydell@linaro.org Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'hw/arm/boot.c')
| -rw-r--r-- | hw/arm/boot.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/hw/arm/boot.c b/hw/arm/boot.c index 942416d95a..ff621e4b6a 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -9,6 +9,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include <libfdt.h> #include "hw/hw.h" #include "hw/arm/arm.h" #include "hw/arm/linux-boot-if.h" @@ -486,6 +487,17 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo, g_free(nodename); } } else { + Error *err = NULL; + + rc = fdt_path_offset(fdt, "/memory"); + if (rc < 0) { + qemu_fdt_add_subnode(fdt, "/memory"); + } + + if (!qemu_fdt_getprop(fdt, "/memory", "device_type", NULL, &err)) { + qemu_fdt_setprop_string(fdt, "/memory", "device_type", "memory"); + } + rc = qemu_fdt_setprop_sized_cells(fdt, "/memory", "reg", acells, binfo->loader_start, scells, binfo->ram_size); @@ -495,6 +507,11 @@ static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo, } } + rc = fdt_path_offset(fdt, "/chosen"); + if (rc < 0) { + qemu_fdt_add_subnode(fdt, "/chosen"); + } + if (binfo->kernel_cmdline && *binfo->kernel_cmdline) { rc = qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", binfo->kernel_cmdline); |