aboutsummaryrefslogtreecommitdiff
path: root/hw/realview.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2012-10-30 07:45:07 +0000
committerPeter Maydell <peter.maydell@linaro.org>2012-10-30 07:45:07 +0000
commitdb4ff6f111c42e2b33eddcf5f20cc53cceda60a2 (patch)
treeb12804a217f5d76628551a56a8bf3231d2236ea7 /hw/realview.c
parentf3cdbc329fa7621ece7e673f23c3101e6b0c952b (diff)
hw/realview.c: Don't prematurely explode QEMUMachineInitArgs
Don't explode QEMUMachineInitArgs in every realview init function; just pass it to the common realview_init() code instead. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/realview.c')
-rw-r--r--hw/realview.c68
1 files changed, 19 insertions, 49 deletions
diff --git a/hw/realview.c b/hw/realview.c
index b5cb08cb84..e789c159a9 100644
--- a/hw/realview.c
+++ b/hw/realview.c
@@ -44,11 +44,8 @@ static const int realview_board_id[] = {
0x76d
};
-static void realview_init(ram_addr_t ram_size,
- const char *boot_device,
- const char *kernel_filename, const char *kernel_cmdline,
- const char *initrd_filename, const char *cpu_model,
- enum realview_board_type board_type)
+static void realview_init(QEMUMachineInitArgs *args,
+ enum realview_board_type board_type)
{
ARMCPU *cpu = NULL;
CPUARMState *env;
@@ -73,6 +70,7 @@ static void realview_init(ram_addr_t ram_size,
uint32_t proc_id = 0;
uint32_t sys_id;
ram_addr_t low_ram_size;
+ ram_addr_t ram_size = args->ram_size;
switch (board_type) {
case BOARD_EB:
@@ -89,7 +87,7 @@ static void realview_init(ram_addr_t ram_size,
break;
}
for (n = 0; n < smp_cpus; n++) {
- cpu = cpu_arm_init(cpu_model);
+ cpu = cpu_arm_init(args->cpu_model);
if (!cpu) {
fprintf(stderr, "Unable to find CPU definition\n");
exit(1);
@@ -321,9 +319,9 @@ static void realview_init(ram_addr_t ram_size,
memory_region_add_subregion(sysmem, SMP_BOOT_ADDR, ram_hack);
realview_binfo.ram_size = ram_size;
- realview_binfo.kernel_filename = kernel_filename;
- realview_binfo.kernel_cmdline = kernel_cmdline;
- realview_binfo.initrd_filename = initrd_filename;
+ realview_binfo.kernel_filename = args->kernel_filename;
+ realview_binfo.kernel_cmdline = args->kernel_cmdline;
+ realview_binfo.initrd_filename = args->initrd_filename;
realview_binfo.nb_cpus = smp_cpus;
realview_binfo.board_id = realview_board_id[board_type];
realview_binfo.loader_start = (board_type == BOARD_PB_A8 ? 0x70000000 : 0);
@@ -332,62 +330,34 @@ static void realview_init(ram_addr_t ram_size,
static void realview_eb_init(QEMUMachineInitArgs *args)
{
- ram_addr_t ram_size = args->ram_size;
- const char *cpu_model = args->cpu_model;
- const char *kernel_filename = args->kernel_filename;
- const char *kernel_cmdline = args->kernel_cmdline;
- const char *initrd_filename = args->initrd_filename;
- const char *boot_device = args->boot_device;
- if (!cpu_model) {
- cpu_model = "arm926";
+ if (!args->cpu_model) {
+ args->cpu_model = "arm926";
}
- realview_init(ram_size, boot_device, kernel_filename, kernel_cmdline,
- initrd_filename, cpu_model, BOARD_EB);
+ realview_init(args, BOARD_EB);
}
static void realview_eb_mpcore_init(QEMUMachineInitArgs *args)
{
- ram_addr_t ram_size = args->ram_size;
- const char *cpu_model = args->cpu_model;
- const char *kernel_filename = args->kernel_filename;
- const char *kernel_cmdline = args->kernel_cmdline;
- const char *initrd_filename = args->initrd_filename;
- const char *boot_device = args->boot_device;
- if (!cpu_model) {
- cpu_model = "arm11mpcore";
+ if (!args->cpu_model) {
+ args->cpu_model = "arm11mpcore";
}
- realview_init(ram_size, boot_device, kernel_filename, kernel_cmdline,
- initrd_filename, cpu_model, BOARD_EB_MPCORE);
+ realview_init(args, BOARD_EB_MPCORE);
}
static void realview_pb_a8_init(QEMUMachineInitArgs *args)
{
- ram_addr_t ram_size = args->ram_size;
- const char *cpu_model = args->cpu_model;
- const char *kernel_filename = args->kernel_filename;
- const char *kernel_cmdline = args->kernel_cmdline;
- const char *initrd_filename = args->initrd_filename;
- const char *boot_device = args->boot_device;
- if (!cpu_model) {
- cpu_model = "cortex-a8";
+ if (!args->cpu_model) {
+ args->cpu_model = "cortex-a8";
}
- realview_init(ram_size, boot_device, kernel_filename, kernel_cmdline,
- initrd_filename, cpu_model, BOARD_PB_A8);
+ realview_init(args, BOARD_PB_A8);
}
static void realview_pbx_a9_init(QEMUMachineInitArgs *args)
{
- ram_addr_t ram_size = args->ram_size;
- const char *cpu_model = args->cpu_model;
- const char *kernel_filename = args->kernel_filename;
- const char *kernel_cmdline = args->kernel_cmdline;
- const char *initrd_filename = args->initrd_filename;
- const char *boot_device = args->boot_device;
- if (!cpu_model) {
- cpu_model = "cortex-a9";
+ if (!args->cpu_model) {
+ args->cpu_model = "cortex-a9";
}
- realview_init(ram_size, boot_device, kernel_filename, kernel_cmdline,
- initrd_filename, cpu_model, BOARD_PBX_A9);
+ realview_init(args, BOARD_PBX_A9);
}
static QEMUMachine realview_eb_machine = {