Skip to content

Commit

Permalink
arm/xilinx_zynq: Use object_new() rather than cpu_arm_init()
Browse files Browse the repository at this point in the history
To allow the machine model to set device properties before CPU
realization.

Signed-off-by: Peter Crosthwaite <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Message-id: e57658b4506b26ab6b6fadbe6d7827f669f51895.1387160489.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <[email protected]>
  • Loading branch information
pete128 authored and pm215 committed Dec 17, 2013
1 parent c0f1ead commit d8bbdcf
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions hw/arm/xilinx_zynq.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "sysemu/blockdev.h"
#include "hw/loader.h"
#include "hw/ssi.h"
#include "qemu/error-report.h"

#define NUM_SPI_FLASHES 4
#define NUM_QSPI_FLASHES 2
Expand Down Expand Up @@ -102,6 +103,7 @@ static void zynq_init(QEMUMachineInitArgs *args)
const char *kernel_filename = args->kernel_filename;
const char *kernel_cmdline = args->kernel_cmdline;
const char *initrd_filename = args->initrd_filename;
ObjectClass *cpu_oc;
ARMCPU *cpu;
MemoryRegion *address_space_mem = get_system_memory();
MemoryRegion *ext_ram = g_new(MemoryRegion, 1);
Expand All @@ -110,15 +112,19 @@ static void zynq_init(QEMUMachineInitArgs *args)
SysBusDevice *busdev;
qemu_irq pic[64];
NICInfo *nd;
Error *err = NULL;
int n;

if (!cpu_model) {
cpu_model = "cortex-a9";
}
cpu_oc = cpu_class_by_name(TYPE_ARM_CPU, cpu_model);

cpu = cpu_arm_init(cpu_model);
if (!cpu) {
fprintf(stderr, "Unable to find CPU definition\n");
cpu = ARM_CPU(object_new(object_class_get_name(cpu_oc)));

object_property_set_bool(OBJECT(cpu), true, "realized", &err);
if (err) {
error_report("%s", error_get_pretty(err));
exit(1);
}

Expand Down

0 comments on commit d8bbdcf

Please sign in to comment.