Revision 2ff3de68 hw/ppc/spapr.c
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); |
Also available in: Unified diff