Revision 2ff3de68
b/device_tree.c | ||
---|---|---|
21 | 21 |
#include "config.h" |
22 | 22 |
#include "qemu-common.h" |
23 | 23 |
#include "sysemu/device_tree.h" |
24 |
#include "sysemu/sysemu.h" |
|
24 | 25 |
#include "hw/loader.h" |
25 | 26 |
#include "qemu/option.h" |
26 | 27 |
#include "qemu/config-file.h" |
... | ... | |
239 | 240 |
* which phandle id to start allocting phandles. |
240 | 241 |
*/ |
241 | 242 |
if (!phandle) { |
242 |
QemuOpts *machine_opts; |
|
243 |
machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0); |
|
244 |
if (machine_opts) { |
|
245 |
const char *phandle_start; |
|
246 |
phandle_start = qemu_opt_get(machine_opts, "phandle_start"); |
|
247 |
if (phandle_start) { |
|
248 |
phandle = strtoul(phandle_start, NULL, 0); |
|
249 |
} |
|
243 |
const char *phandle_start = qemu_opt_get(qemu_get_machine_opts(), |
|
244 |
"phandle_start"); |
|
245 |
if (phandle_start) { |
|
246 |
phandle = strtoul(phandle_start, NULL, 0); |
|
250 | 247 |
} |
251 | 248 |
} |
252 | 249 |
|
... | ... | |
307 | 304 |
|
308 | 305 |
void qemu_devtree_dumpdtb(void *fdt, int size) |
309 | 306 |
{ |
310 |
QemuOpts *machine_opts; |
|
311 |
|
|
312 |
machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0); |
|
313 |
if (machine_opts) { |
|
314 |
const char *dumpdtb = qemu_opt_get(machine_opts, "dumpdtb"); |
|
315 |
if (dumpdtb) { |
|
316 |
/* Dump the dtb to a file and quit */ |
|
317 |
exit(g_file_set_contents(dumpdtb, fdt, size, NULL) ? 0 : 1); |
|
318 |
} |
|
319 |
} |
|
307 |
const char *dumpdtb = qemu_opt_get(qemu_get_machine_opts(), "dumpdtb"); |
|
320 | 308 |
|
309 |
if (dumpdtb) { |
|
310 |
/* Dump the dtb to a file and quit */ |
|
311 |
exit(g_file_set_contents(dumpdtb, fdt, size, NULL) ? 0 : 1); |
|
312 |
} |
|
321 | 313 |
} |
b/exec.c | ||
---|---|---|
31 | 31 |
#include "hw/qdev.h" |
32 | 32 |
#include "qemu/osdep.h" |
33 | 33 |
#include "sysemu/kvm.h" |
34 |
#include "sysemu/sysemu.h" |
|
34 | 35 |
#include "hw/xen/xen.h" |
35 | 36 |
#include "qemu/timer.h" |
36 | 37 |
#include "qemu/config-file.h" |
... | ... | |
1043 | 1044 |
static void qemu_ram_setup_dump(void *addr, ram_addr_t size) |
1044 | 1045 |
{ |
1045 | 1046 |
int ret; |
1046 |
QemuOpts *machine_opts; |
|
1047 | 1047 |
|
1048 | 1048 |
/* Use MADV_DONTDUMP, if user doesn't want the guest memory in the core */ |
1049 |
machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0); |
|
1050 |
if (machine_opts && |
|
1051 |
!qemu_opt_get_bool(machine_opts, "dump-guest-core", true)) { |
|
1049 |
if (!qemu_opt_get_bool(qemu_get_machine_opts(), |
|
1050 |
"dump-guest-core", true)) { |
|
1052 | 1051 |
ret = qemu_madvise(addr, size, QEMU_MADV_DONTDUMP); |
1053 | 1052 |
if (ret) { |
1054 | 1053 |
perror("qemu_madvise"); |
... | ... | |
1095 | 1094 |
|
1096 | 1095 |
static int memory_try_enable_merging(void *addr, size_t len) |
1097 | 1096 |
{ |
1098 |
QemuOpts *opts; |
|
1099 |
|
|
1100 |
opts = qemu_opts_find(qemu_find_opts("machine"), 0); |
|
1101 |
if (opts && !qemu_opt_get_bool(opts, "mem-merge", true)) { |
|
1097 |
if (!qemu_opt_get_bool(qemu_get_machine_opts(), "mem-merge", true)) { |
|
1102 | 1098 |
/* disabled by the user */ |
1103 | 1099 |
return 0; |
1104 | 1100 |
} |
b/hw/arm/boot.c | ||
---|---|---|
359 | 359 |
uint64_t elf_entry; |
360 | 360 |
hwaddr entry; |
361 | 361 |
int big_endian; |
362 |
QemuOpts *machine_opts; |
|
363 | 362 |
|
364 | 363 |
/* Load the kernel. */ |
365 | 364 |
if (!info->kernel_filename) { |
... | ... | |
367 | 366 |
exit(1); |
368 | 367 |
} |
369 | 368 |
|
370 |
machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0); |
|
371 |
if (machine_opts) { |
|
372 |
info->dtb_filename = qemu_opt_get(machine_opts, "dtb"); |
|
373 |
} else { |
|
374 |
info->dtb_filename = NULL; |
|
375 |
} |
|
369 |
info->dtb_filename = qemu_opt_get(qemu_get_machine_opts(), "dtb"); |
|
376 | 370 |
|
377 | 371 |
if (!info->secondary_cpu_reset_hook) { |
378 | 372 |
info->secondary_cpu_reset_hook = default_reset_secondary; |
b/hw/ppc/e500.c | ||
---|---|---|
137 | 137 |
uint32_t clock_freq = 400000000; |
138 | 138 |
uint32_t tb_freq = 400000000; |
139 | 139 |
int i; |
140 |
const char *toplevel_compat = NULL; /* user override */ |
|
141 | 140 |
char compatible_sb[] = "fsl,mpc8544-immr\0simple-bus"; |
142 | 141 |
char soc[128]; |
143 | 142 |
char mpic[128]; |
... | ... | |
158 | 157 |
0x0, 0xe1000000, |
159 | 158 |
0x0, 0x10000, |
160 | 159 |
}; |
161 |
QemuOpts *machine_opts; |
|
162 |
const char *dtb_file = NULL; |
|
163 |
|
|
164 |
machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0); |
|
165 |
if (machine_opts) { |
|
166 |
dtb_file = qemu_opt_get(machine_opts, "dtb"); |
|
167 |
toplevel_compat = qemu_opt_get(machine_opts, "dt_compatible"); |
|
168 |
} |
|
160 |
QemuOpts *machine_opts = qemu_get_machine_opts(); |
|
161 |
const char *dtb_file = qemu_opt_get(machine_opts, "dtb"); |
|
162 |
const char *toplevel_compat = qemu_opt_get(machine_opts, "dt_compatible"); |
|
169 | 163 |
|
170 | 164 |
if (dtb_file) { |
171 | 165 |
char *filename; |
b/hw/ppc/spapr.c | ||
---|---|---|
676 | 676 |
|
677 | 677 |
static void spapr_create_nvram(sPAPREnvironment *spapr) |
678 | 678 |
{ |
679 |
QemuOpts *machine_opts;
|
|
680 |
DeviceState *dev;
|
|
679 |
DeviceState *dev = qdev_create(&spapr->vio_bus->bus, "spapr-nvram");
|
|
680 |
const char *drivename = qemu_opt_get(qemu_get_machine_opts(), "nvram");
|
|
681 | 681 |
|
682 |
dev = qdev_create(&spapr->vio_bus->bus, "spapr-nvram"); |
|
682 |
if (drivename) { |
|
683 |
BlockDriverState *bs; |
|
683 | 684 |
|
684 |
machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0); |
|
685 |
if (machine_opts) { |
|
686 |
const char *drivename; |
|
687 |
|
|
688 |
drivename = qemu_opt_get(machine_opts, "nvram"); |
|
689 |
if (drivename) { |
|
690 |
BlockDriverState *bs; |
|
691 |
|
|
692 |
bs = bdrv_find(drivename); |
|
693 |
if (!bs) { |
|
694 |
fprintf(stderr, "No such block device \"%s\" for nvram\n", |
|
695 |
drivename); |
|
696 |
exit(1); |
|
697 |
} |
|
698 |
qdev_prop_set_drive_nofail(dev, "drive", bs); |
|
685 |
bs = bdrv_find(drivename); |
|
686 |
if (!bs) { |
|
687 |
fprintf(stderr, "No such block device \"%s\" for nvram\n", |
|
688 |
drivename); |
|
689 |
exit(1); |
|
699 | 690 |
} |
691 |
qdev_prop_set_drive_nofail(dev, "drive", bs); |
|
700 | 692 |
} |
701 | 693 |
|
702 | 694 |
qdev_init_nofail(dev); |
b/vl.c | ||
---|---|---|
1036 | 1036 |
return 0; |
1037 | 1037 |
} |
1038 | 1038 |
|
1039 |
/*********QEMU USB setting******/ |
|
1040 | 1039 |
bool usb_enabled(bool default_usb) |
1041 | 1040 |
{ |
1042 |
QemuOpts *mach_opts; |
|
1043 |
mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); |
|
1044 |
if (mach_opts) { |
|
1045 |
return qemu_opt_get_bool(mach_opts, "usb", default_usb); |
|
1046 |
} |
|
1047 |
return default_usb; |
|
1041 |
return qemu_opt_get_bool(qemu_get_machine_opts(), "usb", default_usb); |
|
1048 | 1042 |
} |
1049 | 1043 |
|
1050 | 1044 |
#ifndef _WIN32 |
... | ... | |
4095 | 4089 |
qtest_init(); |
4096 | 4090 |
} |
4097 | 4091 |
|
4098 |
machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0); |
|
4099 |
if (machine_opts) { |
|
4100 |
kernel_filename = qemu_opt_get(machine_opts, "kernel"); |
|
4101 |
initrd_filename = qemu_opt_get(machine_opts, "initrd"); |
|
4102 |
kernel_cmdline = qemu_opt_get(machine_opts, "append"); |
|
4103 |
} else { |
|
4104 |
kernel_filename = initrd_filename = kernel_cmdline = NULL; |
|
4105 |
} |
|
4092 |
machine_opts = qemu_get_machine_opts(); |
|
4093 |
kernel_filename = qemu_opt_get(machine_opts, "kernel"); |
|
4094 |
initrd_filename = qemu_opt_get(machine_opts, "initrd"); |
|
4095 |
kernel_cmdline = qemu_opt_get(machine_opts, "append"); |
|
4106 | 4096 |
|
4107 | 4097 |
if (!boot_order) { |
4108 | 4098 |
boot_order = machine->boot_order; |
... | ... | |
4145 | 4135 |
exit(1); |
4146 | 4136 |
} |
4147 | 4137 |
|
4148 |
if (!linux_boot && machine_opts && qemu_opt_get(machine_opts, "dtb")) {
|
|
4138 |
if (!linux_boot && qemu_opt_get(machine_opts, "dtb")) { |
|
4149 | 4139 |
fprintf(stderr, "-dtb only allowed with -kernel option\n"); |
4150 | 4140 |
exit(1); |
4151 | 4141 |
} |
Also available in: Unified diff