aboutsummaryrefslogtreecommitdiff
path: root/hw/ppc440_bamboo.c
diff options
context:
space:
mode:
authorLiu Yu <yu.liu@freescale.com>2010-02-02 16:49:02 +0800
committerAurelien Jarno <aurelien@aurel32.net>2010-02-27 16:30:21 +0100
commit04088adbe0c5adca66adb6022723362ad90ed0fc (patch)
tree3392231a18137a1d79558de95f095ff2afdd9a3a /hw/ppc440_bamboo.c
parentc49638177f4e001588fe73b2acf7e4293aeb194b (diff)
powerpc/booke: move fdt loading to rom infrastructure
It's convinent to use rom to checking overlap, to reset etc. And uImage and ramdisk loading has already moved to it. Also, after we add fdt to rom, free it. Signed-off-by: Liu Yu <yu.liu@freescale.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'hw/ppc440_bamboo.c')
-rw-r--r--hw/ppc440_bamboo.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/hw/ppc440_bamboo.c b/hw/ppc440_bamboo.c
index 6d9c1b9cc5..dce37219c8 100644
--- a/hw/ppc440_bamboo.c
+++ b/hw/ppc440_bamboo.c
@@ -27,7 +27,7 @@
#define BINARY_DEVICE_TREE_FILE "bamboo.dtb"
-static void *bamboo_load_device_tree(target_phys_addr_t addr,
+static int bamboo_load_device_tree(target_phys_addr_t addr,
uint32_t ramsize,
target_phys_addr_t initrd_base,
target_phys_addr_t initrd_size,
@@ -42,11 +42,13 @@ static void *bamboo_load_device_tree(target_phys_addr_t addr,
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, BINARY_DEVICE_TREE_FILE);
if (!filename) {
+ ret = -1;
goto out;
}
fdt = load_device_tree(filename, &fdt_size);
qemu_free(filename);
if (fdt == NULL) {
+ ret = -1;
goto out;
}
@@ -75,12 +77,13 @@ static void *bamboo_load_device_tree(target_phys_addr_t addr,
if (kvm_enabled())
kvmppc_fdt_update(fdt);
- cpu_physical_memory_write (addr, (void *)fdt, fdt_size);
+ ret = rom_add_blob_fixed(BINARY_DEVICE_TREE_FILE, fdt, fdt_size, addr);
+ qemu_free(fdt);
out:
#endif
- return fdt;
+ return ret;
}
static void bamboo_init(ram_addr_t ram_size,
@@ -101,7 +104,6 @@ static void bamboo_init(ram_addr_t ram_size,
target_ulong initrd_base = 0;
target_long initrd_size = 0;
target_ulong dt_base = 0;
- void *fdt;
int i;
/* Setup CPU. */
@@ -153,9 +155,8 @@ static void bamboo_init(ram_addr_t ram_size,
else
dt_base = kernel_size + loadaddr;
- fdt = bamboo_load_device_tree(dt_base, ram_size,
- initrd_base, initrd_size, kernel_cmdline);
- if (fdt == NULL) {
+ if (bamboo_load_device_tree(dt_base, ram_size,
+ initrd_base, initrd_size, kernel_cmdline) < 0) {
fprintf(stderr, "couldn't load device tree\n");
exit(1);
}