diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2025-02-06 15:12:13 +0000 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2025-02-24 15:03:42 +0000 |
| commit | 8fd2518ef2f8d34dc9ee53d6915a2a610eb1a659 (patch) | |
| tree | a3aa86f95e85df008a01171202b7847403be0699 /system/device_tree.c | |
| parent | db0dd33559ee97a1fe84a1272258646279aca2e2 (diff) | |
| download | focaccia-qemu-8fd2518ef2f8d34dc9ee53d6915a2a610eb1a659.tar.gz focaccia-qemu-8fd2518ef2f8d34dc9ee53d6915a2a610eb1a659.zip | |
hw: Centralize handling of -machine dumpdtb option
Currently we handle the 'dumpdtb' machine sub-option ad-hoc in every board model that has an FDT. It's up to the board code to make sure it calls qemu_fdt_dumpdtb() in the right place. This means we're inconsistent and often just ignore the user's command line argument: * if the board doesn't have an FDT at all * if the board supports FDT, but there happens not to be one present (usually because of a missing -fdt option) This isn't very helpful because it gives the user no clue why their option was ignored. However, in order to support the QMP/HMP dumpdtb commands we require now that every FDT machine stores a pointer to the FDT in MachineState::fdt. This means we can handle -machine dumpdtb centrally by calling the qmp_dumpdtb() function, unifying its handling with the QMP/HMP commands. All the board code calls to qemu_fdt_dumpdtb() can then be removed. For this commit we retain the existing behaviour that if there is no FDT we silently ignore the -machine dumpdtb option. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'system/device_tree.c')
| -rw-r--r-- | system/device_tree.c | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/system/device_tree.c b/system/device_tree.c index 4bc2d61b93..d605ed2a21 100644 --- a/system/device_tree.c +++ b/system/device_tree.c @@ -594,21 +594,6 @@ int qemu_fdt_add_path(void *fdt, const char *path) return retval; } -void qemu_fdt_dumpdtb(void *fdt, int size) -{ - const char *dumpdtb = current_machine->dumpdtb; - - if (dumpdtb) { - /* Dump the dtb to a file and quit */ - if (g_file_set_contents(dumpdtb, fdt, size, NULL)) { - info_report("dtb dumped to %s. Exiting.", dumpdtb); - exit(0); - } - error_report("%s: Failed dumping dtb to %s", __func__, dumpdtb); - exit(1); - } -} - int qemu_fdt_setprop_sized_cells_from_array(void *fdt, const char *node_path, const char *property, |