Skip to contentSkip to conversation

[4212] Move the excess of arm_load_kernel() parameters into a struct.

Qemu-devel Andrzej Zaborowski 1 participant 1 message Apr 14, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 4212

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4212
Author:   balrog
Date:     2008-04-14 20:27:51 +0000 (Mon, 14 Apr 2008)

Log Message:
-----------
Move the excess of arm_load_kernel() parameters into a struct.

Modified Paths:
--------------
trunk/hw/arm-misc.h
trunk/hw/arm_boot.c
trunk/hw/integratorcp.c
trunk/hw/mainstone.c
trunk/hw/palm.c
trunk/hw/realview.c
trunk/hw/spitz.c
trunk/hw/versatilepb.c
trunk/target-arm/cpu.h

Modified: trunk/hw/arm-misc.h
===================================================================

hw/arm-misc.h +11 -4
@@ -21,11 +21,18 @@
                       const char *kernel_filename, const char *cpu_model);
 
 /* arm_boot.c */
+struct arm_boot_info {
+    int ram_size;
+    const char *kernel_filename;
+    const char *kernel_cmdline;
+    const char *initrd_filename;
+    target_phys_addr_t loader_start;
+    int nb_cpus;
+    int board_id;
+    int (*atag_board)(struct arm_boot_info *info, void *p);
+};
+void arm_load_kernel(CPUState *env, struct arm_boot_info *info);
 
-void arm_load_kernel(CPUState *env, int ram_size, const char *kernel_filename,
-                     const char *kernel_cmdline, const char *initrd_filename,
-                     int board_id, target_phys_addr_t loader_start);
-
 /* armv7m_nvic.c */
 int system_clock_scale;
 qemu_irq *armv7m_nvic_init(CPUState *env);

Modified: trunk/hw/arm_boot.c
===================================================================

hw/arm_boot.c +63 -55

220 lines not on this page · raw message

Modified: trunk/hw/integratorcp.c
===================================================================

hw/integratorcp.c +10 -2
@@ -469,6 +469,11 @@
 
 /* Board init.  */
 
+static struct arm_boot_info integrator_binfo = {
+    .loader_start = 0x0,
+    .board_id = 0x113,
+};
+
 static void integratorcp_init(int ram_size, int vga_ram_size,
                      const char *boot_device, DisplayState *ds,
                      const char *kernel_filename, const char *kernel_cmdline,
@@ -527,8 +532,11 @@
     }
     pl110_init(ds, 0xc0000000, pic[22], 0);
 
-    arm_load_kernel(env, ram_size, kernel_filename, kernel_cmdline,
-                    initrd_filename, 0x113, 0x0);
+    integrator_binfo.ram_size = ram_size;
+    integrator_binfo.kernel_filename = kernel_filename;
+    integrator_binfo.kernel_cmdline = kernel_cmdline;
+    integrator_binfo.initrd_filename = initrd_filename;
+    arm_load_kernel(env, &integrator_binfo);
 }
 
 QEMUMachine integratorcp_machine = {

Modified: trunk/hw/mainstone.c
===================================================================

hw/mainstone.c +12 -4
@@ -59,12 +59,17 @@
 
 enum mainstone_model_e { mainstone };
 
+static struct arm_boot_info mainstone_binfo = {
+    .loader_start = PXA2XX_SDRAM_BASE,
+    .ram_size = 0x04000000,
+};
+
 static void mainstone_common_init(int ram_size, int vga_ram_size,
                 DisplayState *ds, const char *kernel_filename,
                 const char *kernel_cmdline, const char *initrd_filename,
                 const char *cpu_model, enum mainstone_model_e model, int arm_id)
 {
-    uint32_t mainstone_ram   = 0x04000000;
+    uint32_t mainstone_ram   = mainstone_binfo.ram_size;
     uint32_t mainstone_rom   = 0x00800000;
     uint32_t mainstone_flash = 0x02000000;
     uint32_t sector_len = 256 * 1024;
@@ -90,7 +95,7 @@
                     qemu_ram_alloc(mainstone_rom) | IO_MEM_ROM);
 
     /* Setup initial (reset) machine state */
-    cpu->env->regs[15] = PXA2XX_SDRAM_BASE;
+    cpu->env->regs[15] = mainstone_binfo.loader_start;
 
     /* There are two 32MiB flash devices on the board */
     for (i = 0; i < 2; i ++) {
@@ -121,8 +126,11 @@
 
     smc91c111_init(&nd_table[0], MST_ETH_PHYS, mst_irq[ETHERNET_IRQ]);
 
-    arm_load_kernel(cpu->env, mainstone_ram, kernel_filename, kernel_cmdline,
-                    initrd_filename, arm_id, PXA2XX_SDRAM_BASE);
+    mainstone_binfo.kernel_filename = kernel_filename;
+    mainstone_binfo.kernel_cmdline = kernel_cmdline;
+    mainstone_binfo.initrd_filename = initrd_filename;
+    mainstone_binfo.board_id = arm_id;
+    arm_load_kernel(cpu->env, &mainstone_binfo);
 }
 
 static void mainstone_init(int ram_size, int vga_ram_size,

Modified: trunk/hw/palm.c
===================================================================

hw/palm.c +12 -4
@@ -183,6 +183,12 @@
     qemu_irq_raise(omap_mpuio_in_get(cpu->mpuio)[11]);
 }
 
+static struct arm_boot_info palmte_binfo = {
+    .loader_start = OMAP_EMIFF_BASE,
+    .ram_size = 0x02000000,
+    .board_id = 0x331,
+};
+
 static void palmte_init(int ram_size, int vga_ram_size,
                 const char *boot_device, DisplayState *ds,
                 const char *kernel_filename, const char *kernel_cmdline,
@@ -190,7 +196,7 @@
 {
     struct omap_mpu_state_s *cpu;
     int flash_size = 0x00800000;
-    int sdram_size = 0x02000000;
+    int sdram_size = palmte_binfo.ram_size;
     int io;
     static uint32_t cs0val = 0xffffffff;
     static uint32_t cs1val = 0x0000e1a0;
@@ -250,10 +256,12 @@
     /* Load the kernel.  */
     if (kernel_filename) {
         /* Start at bootloader.  */
-        cpu->env->regs[15] = OMAP_EMIFF_BASE;
+        cpu->env->regs[15] = palmte_binfo.loader_start;
 
-        arm_load_kernel(cpu->env, sdram_size, kernel_filename, kernel_cmdline,
-                        initrd_filename, 0x331, OMAP_EMIFF_BASE);
+        palmte_binfo.kernel_filename = kernel_filename;
+        palmte_binfo.kernel_cmdline = kernel_cmdline;
+        palmte_binfo.initrd_filename = initrd_filename;
+        arm_load_kernel(cpu->env, &palmte_binfo);
     }
 
     dpy_resize(ds, 320, 320);

Modified: trunk/hw/realview.c
===================================================================

hw/realview.c +11 -2
@@ -18,6 +18,11 @@
 
 /* Board init.  */
 
+static struct arm_boot_info realview_binfo = {
+    .loader_start = 0x0,
+    .board_id = 0x33b,
+};
+
 static void realview_init(int ram_size, int vga_ram_size,
                      const char *boot_device, DisplayState *ds,
                      const char *kernel_filename, const char *kernel_cmdline,
@@ -177,8 +182,12 @@
     /* 0x68000000 PCI mem 1.  */
     /* 0x6c000000 PCI mem 2.  */
 
-    arm_load_kernel(first_cpu, ram_size, kernel_filename, kernel_cmdline,
-                    initrd_filename, 0x33b, 0x0);
+    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.nb_cpus = ncpu;
+    arm_load_kernel(first_cpu, &realview_binfo);
 
     /* ??? Hack to map an additional page of ram for the secondary CPU
        startup code.  I guess this works on real hardware because the

Modified: trunk/hw/spitz.c
===================================================================

hw/spitz.c +12 -4
@@ -1180,12 +1180,17 @@
 /* Board init.  */
 enum spitz_model_e { spitz, akita, borzoi, terrier };
 
+static struct arm_boot_info spitz_binfo = {
+    .loader_start = PXA2XX_SDRAM_BASE,
+    .ram_size = 0x04000000,
+};
+
 static void spitz_common_init(int ram_size, int vga_ram_size,
                 DisplayState *ds, const char *kernel_filename,
                 const char *kernel_cmdline, const char *initrd_filename,
                 const char *cpu_model, enum spitz_model_e model, int arm_id)
 {
-    uint32_t spitz_ram = 0x04000000;
+    uint32_t spitz_ram = spitz_binfo.ram_size;
     uint32_t spitz_rom = 0x00800000;
     struct pxa2xx_state_s *cpu;
     struct scoop_info_s *scp;
@@ -1230,10 +1235,13 @@
         spitz_microdrive_attach(cpu);
 
     /* Setup initial (reset) machine state */
-    cpu->env->regs[15] = PXA2XX_SDRAM_BASE;
+    cpu->env->regs[15] = spitz_binfo.loader_start;
 
-    arm_load_kernel(cpu->env, spitz_ram, kernel_filename, kernel_cmdline,
-                    initrd_filename, arm_id, PXA2XX_SDRAM_BASE);
+    spitz_binfo.kernel_filename = kernel_filename;
+    spitz_binfo.kernel_cmdline = kernel_cmdline;
+    spitz_binfo.initrd_filename = initrd_filename;
+    spitz_binfo.board_id = arm_id;
+    arm_load_kernel(cpu->env, &spitz_binfo);
     sl_bootparam_write(SL_PXA_PARAM_BASE - PXA2XX_SDRAM_BASE);
 }
 

Modified: trunk/hw/versatilepb.c
===================================================================

hw/versatilepb.c +8 -2
@@ -157,6 +157,8 @@
    peripherans and expansion busses.  For now we emulate a subset of the
    PB peripherals and just change the board ID.  */
 
+static struct arm_boot_info versatile_binfo;
+
 static void versatile_init(int ram_size, int vga_ram_size,
                      const char *boot_device, DisplayState *ds,
                      const char *kernel_filename, const char *kernel_cmdline,
@@ -283,8 +285,12 @@
     /*  0x101f3000 UART2.  */
     /* 0x101f4000 SSPI.  */
 
-    arm_load_kernel(env, ram_size, kernel_filename, kernel_cmdline,
-                    initrd_filename, board_id, 0x0);
+    versatile_binfo.ram_size = ram_size;
+    versatile_binfo.kernel_filename = kernel_filename;
+    versatile_binfo.kernel_cmdline = kernel_cmdline;
+    versatile_binfo.initrd_filename = initrd_filename;
+    versatile_binfo.board_id = board_id;
+    arm_load_kernel(env, &versatile_binfo);
 }
 
 static void vpb_init(int ram_size, int vga_ram_size,

Modified: trunk/target-arm/cpu.h
===================================================================

target-arm/cpu.h +3 -6
@@ -55,6 +55,8 @@
 typedef uint32_t ARMReadCPFunc(void *opaque, int cp_info,
                                int dstreg, int operand);
 
+struct arm_boot_info;
+
 #define NB_MMU_MODES 2
 
 /* We currently assume float and double are IEEE single and double
@@ -196,12 +198,7 @@
     CPU_COMMON
 
     /* These fields after the common ones so they are preserved on reset.  */
-    int ram_size;
-    const char *kernel_filename;
-    const char *kernel_cmdline;
-    const char *initrd_filename;
-    int board_id;
-    target_phys_addr_t loader_start;
+    struct arm_boot_info *boot_info;
 } CPUARMState;
 
 CPUARMState *cpu_arm_init(const char *cpu_model);