215
216
r = fdt_get_phandle(fdt, findnode_nofail(fdt, path));
217
218
fprintf(stderr, "%s: Couldn't get phandle for %s: %s\n", __func__,
218
219
path, fdt_strerror(r));
239
240
* which phandle id to start allocting phandles.
242
QemuOpts *machine_opts;
243
machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
245
const char *phandle_start;
246
phandle_start = qemu_opt_get(machine_opts, "phandle_start");
248
phandle = strtoul(phandle_start, NULL, 0);
243
phandle = qemu_opt_get_number(qemu_get_machine_opts(),
308
302
void qemu_devtree_dumpdtb(void *fdt, int size)
310
QemuOpts *machine_opts;
312
machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
314
const char *dumpdtb = qemu_opt_get(machine_opts, "dumpdtb");
316
/* Dump the dtb to a file and quit */
317
exit(g_file_set_contents(dumpdtb, fdt, size, NULL) ? 0 : 1);
304
const char *dumpdtb = qemu_opt_get(qemu_get_machine_opts(), "dumpdtb");
307
/* Dump the dtb to a file and quit */
308
exit(g_file_set_contents(dumpdtb, fdt, size, NULL) ? 0 : 1);
312
int qemu_devtree_setprop_sized_cells_from_array(void *fdt,
313
const char *node_path,
314
const char *property,
320
int cellnum, vnum, ncells;
323
propcells = g_new0(uint32_t, numvalues * 2);
326
for (vnum = 0; vnum < numvalues; vnum++) {
327
ncells = values[vnum * 2];
328
if (ncells != 1 && ncells != 2) {
331
value = values[vnum * 2 + 1];
332
hival = cpu_to_be32(value >> 32);
334
propcells[cellnum++] = hival;
335
} else if (hival != 0) {
338
propcells[cellnum++] = cpu_to_be32(value);
341
return qemu_devtree_setprop(fdt, node_path, property, propcells,
342
cellnum * sizeof(uint32_t));