228 |
228 |
static int load_dtb(hwaddr addr, const struct arm_boot_info *binfo)
|
229 |
229 |
{
|
230 |
230 |
void *fdt = NULL;
|
231 |
|
char *filename;
|
232 |
231 |
int size, rc;
|
233 |
232 |
uint32_t acells, scells;
|
234 |
233 |
|
235 |
|
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, binfo->dtb_filename);
|
236 |
|
if (!filename) {
|
237 |
|
fprintf(stderr, "Couldn't open dtb file %s\n", binfo->dtb_filename);
|
238 |
|
goto fail;
|
239 |
|
}
|
|
234 |
if (binfo->dtb_filename) {
|
|
235 |
char *filename;
|
|
236 |
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, binfo->dtb_filename);
|
|
237 |
if (!filename) {
|
|
238 |
fprintf(stderr, "Couldn't open dtb file %s\n", binfo->dtb_filename);
|
|
239 |
goto fail;
|
|
240 |
}
|
240 |
241 |
|
241 |
|
fdt = load_device_tree(filename, &size);
|
242 |
|
if (!fdt) {
|
243 |
|
fprintf(stderr, "Couldn't open dtb file %s\n", filename);
|
|
242 |
fdt = load_device_tree(filename, &size);
|
|
243 |
if (!fdt) {
|
|
244 |
fprintf(stderr, "Couldn't open dtb file %s\n", filename);
|
|
245 |
g_free(filename);
|
|
246 |
goto fail;
|
|
247 |
}
|
244 |
248 |
g_free(filename);
|
245 |
|
goto fail;
|
|
249 |
} else if (binfo->get_dtb) {
|
|
250 |
fdt = binfo->get_dtb(binfo, &size);
|
|
251 |
if (!fdt) {
|
|
252 |
fprintf(stderr, "Board was unable to create a dtb blob\n");
|
|
253 |
goto fail;
|
|
254 |
}
|
246 |
255 |
}
|
247 |
|
g_free(filename);
|
248 |
256 |
|
249 |
257 |
acells = qemu_devtree_getprop_cell(fdt, "/", "#address-cells");
|
250 |
258 |
scells = qemu_devtree_getprop_cell(fdt, "/", "#size-cells");
|
... | ... | |
438 |
446 |
/* for device tree boot, we pass the DTB directly in r2. Otherwise
|
439 |
447 |
* we point to the kernel args.
|
440 |
448 |
*/
|
441 |
|
if (info->dtb_filename) {
|
|
449 |
if (info->dtb_filename || info->get_dtb) {
|
442 |
450 |
/* Place the DTB after the initrd in memory. Note that some
|
443 |
451 |
* kernels will trash anything in the 4K page the initrd
|
444 |
452 |
* ends in, so make sure the DTB isn't caught up in that.
|