mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 06:43:53 -06:00
Simplify -machine option queries with qemu_get_machine_opts()
The previous two commits fixed bugs in -machine option queries. I can't find fault with the remaining queries, but let's use qemu_get_machine_opts() everywhere, for consistency, simplicity and robustness. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-id: 1372943363-24081-7-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
7bccd94026
commit
2ff3de685a
6 changed files with 33 additions and 75 deletions
|
@ -359,7 +359,6 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
|
|||
uint64_t elf_entry;
|
||||
hwaddr entry;
|
||||
int big_endian;
|
||||
QemuOpts *machine_opts;
|
||||
|
||||
/* Load the kernel. */
|
||||
if (!info->kernel_filename) {
|
||||
|
@ -367,12 +366,7 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
|
||||
if (machine_opts) {
|
||||
info->dtb_filename = qemu_opt_get(machine_opts, "dtb");
|
||||
} else {
|
||||
info->dtb_filename = NULL;
|
||||
}
|
||||
info->dtb_filename = qemu_opt_get(qemu_get_machine_opts(), "dtb");
|
||||
|
||||
if (!info->secondary_cpu_reset_hook) {
|
||||
info->secondary_cpu_reset_hook = default_reset_secondary;
|
||||
|
|
|
@ -137,7 +137,6 @@ static int ppce500_load_device_tree(CPUPPCState *env,
|
|||
uint32_t clock_freq = 400000000;
|
||||
uint32_t tb_freq = 400000000;
|
||||
int i;
|
||||
const char *toplevel_compat = NULL; /* user override */
|
||||
char compatible_sb[] = "fsl,mpc8544-immr\0simple-bus";
|
||||
char soc[128];
|
||||
char mpic[128];
|
||||
|
@ -158,14 +157,9 @@ static int ppce500_load_device_tree(CPUPPCState *env,
|
|||
0x0, 0xe1000000,
|
||||
0x0, 0x10000,
|
||||
};
|
||||
QemuOpts *machine_opts;
|
||||
const char *dtb_file = NULL;
|
||||
|
||||
machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
|
||||
if (machine_opts) {
|
||||
dtb_file = qemu_opt_get(machine_opts, "dtb");
|
||||
toplevel_compat = qemu_opt_get(machine_opts, "dt_compatible");
|
||||
}
|
||||
QemuOpts *machine_opts = qemu_get_machine_opts();
|
||||
const char *dtb_file = qemu_opt_get(machine_opts, "dtb");
|
||||
const char *toplevel_compat = qemu_opt_get(machine_opts, "dt_compatible");
|
||||
|
||||
if (dtb_file) {
|
||||
char *filename;
|
||||
|
|
|
@ -676,27 +676,19 @@ static void spapr_cpu_reset(void *opaque)
|
|||
|
||||
static void spapr_create_nvram(sPAPREnvironment *spapr)
|
||||
{
|
||||
QemuOpts *machine_opts;
|
||||
DeviceState *dev;
|
||||
DeviceState *dev = qdev_create(&spapr->vio_bus->bus, "spapr-nvram");
|
||||
const char *drivename = qemu_opt_get(qemu_get_machine_opts(), "nvram");
|
||||
|
||||
dev = qdev_create(&spapr->vio_bus->bus, "spapr-nvram");
|
||||
if (drivename) {
|
||||
BlockDriverState *bs;
|
||||
|
||||
machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
|
||||
if (machine_opts) {
|
||||
const char *drivename;
|
||||
|
||||
drivename = qemu_opt_get(machine_opts, "nvram");
|
||||
if (drivename) {
|
||||
BlockDriverState *bs;
|
||||
|
||||
bs = bdrv_find(drivename);
|
||||
if (!bs) {
|
||||
fprintf(stderr, "No such block device \"%s\" for nvram\n",
|
||||
drivename);
|
||||
exit(1);
|
||||
}
|
||||
qdev_prop_set_drive_nofail(dev, "drive", bs);
|
||||
bs = bdrv_find(drivename);
|
||||
if (!bs) {
|
||||
fprintf(stderr, "No such block device \"%s\" for nvram\n",
|
||||
drivename);
|
||||
exit(1);
|
||||
}
|
||||
qdev_prop_set_drive_nofail(dev, "drive", bs);
|
||||
}
|
||||
|
||||
qdev_init_nofail(dev);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue