Commit 3371d27293dc40159069d6593da22ba77ac8513c
1 parent
76a66253
Implement --cpu for ARM.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2474 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
8 changed files
with
49 additions
and
44 deletions
hw/integratorcp.c
... | ... | @@ -471,7 +471,7 @@ static void icp_control_init(uint32_t base) |
471 | 471 | static void integratorcp_init(int ram_size, int vga_ram_size, int boot_device, |
472 | 472 | DisplayState *ds, const char **fd_filename, int snapshot, |
473 | 473 | const char *kernel_filename, const char *kernel_cmdline, |
474 | - const char *initrd_filename, uint32_t cpuid) | |
474 | + const char *initrd_filename, const char *cpu_model) | |
475 | 475 | { |
476 | 476 | CPUState *env; |
477 | 477 | uint32_t bios_offset; |
... | ... | @@ -479,7 +479,9 @@ static void integratorcp_init(int ram_size, int vga_ram_size, int boot_device, |
479 | 479 | void *cpu_pic; |
480 | 480 | |
481 | 481 | env = cpu_init(); |
482 | - cpu_arm_set_model(env, cpuid); | |
482 | + if (!cpu_model) | |
483 | + cpu_model = "arm926"; | |
484 | + cpu_arm_set_model(env, cpu_model); | |
483 | 485 | bios_offset = ram_size + vga_ram_size; |
484 | 486 | /* ??? On a real system the first 1Mb is mapped as SSRAM or boot flash. */ |
485 | 487 | /* ??? RAM shoud repeat to fill physical memory space. */ |
... | ... | @@ -513,34 +515,8 @@ static void integratorcp_init(int ram_size, int vga_ram_size, int boot_device, |
513 | 515 | initrd_filename, 0x113); |
514 | 516 | } |
515 | 517 | |
516 | -static void integratorcp926_init(int ram_size, int vga_ram_size, | |
517 | - int boot_device, DisplayState *ds, const char **fd_filename, int snapshot, | |
518 | - const char *kernel_filename, const char *kernel_cmdline, | |
519 | - const char *initrd_filename, const char *cpu_model) | |
520 | -{ | |
521 | - integratorcp_init(ram_size, vga_ram_size, boot_device, ds, fd_filename, | |
522 | - snapshot, kernel_filename, kernel_cmdline, | |
523 | - initrd_filename, ARM_CPUID_ARM926); | |
524 | -} | |
525 | - | |
526 | -static void integratorcp1026_init(int ram_size, int vga_ram_size, | |
527 | - int boot_device, DisplayState *ds, const char **fd_filename, int snapshot, | |
528 | - const char *kernel_filename, const char *kernel_cmdline, | |
529 | - const char *initrd_filename, const char *cpu_model) | |
530 | -{ | |
531 | - integratorcp_init(ram_size, vga_ram_size, boot_device, ds, fd_filename, | |
532 | - snapshot, kernel_filename, kernel_cmdline, | |
533 | - initrd_filename, ARM_CPUID_ARM1026); | |
534 | -} | |
535 | - | |
536 | -QEMUMachine integratorcp926_machine = { | |
537 | - "integratorcp926", | |
518 | +QEMUMachine integratorcp_machine = { | |
519 | + "integratorcp", | |
538 | 520 | "ARM Integrator/CP (ARM926EJ-S)", |
539 | - integratorcp926_init, | |
540 | -}; | |
541 | - | |
542 | -QEMUMachine integratorcp1026_machine = { | |
543 | - "integratorcp1026", | |
544 | - "ARM Integrator/CP (ARM1026EJ-S)", | |
545 | - integratorcp1026_init, | |
521 | + integratorcp_init, | |
546 | 522 | }; | ... | ... |
hw/realview.c
... | ... | @@ -26,8 +26,9 @@ static void realview_init(int ram_size, int vga_ram_size, int boot_device, |
26 | 26 | int done_smc = 0; |
27 | 27 | |
28 | 28 | env = cpu_init(); |
29 | - cpu_arm_set_model(env, ARM_CPUID_ARM926); | |
30 | - //cpu_arm_set_model(env, ARM_CPUID_ARM11MPCORE); | |
29 | + if (!cpu_model) | |
30 | + cpu_model = "arm926"; | |
31 | + cpu_arm_set_model(env, cpu_model); | |
31 | 32 | /* ??? RAM shoud repeat to fill physical memory space. */ |
32 | 33 | /* SDRAM at address zero. */ |
33 | 34 | cpu_register_physical_memory(0, ram_size, IO_MEM_RAM); | ... | ... |
hw/versatilepb.c
... | ... | @@ -154,7 +154,8 @@ static vpb_sic_state *vpb_sic_init(uint32_t base, void *parent, int irq) |
154 | 154 | static void versatile_init(int ram_size, int vga_ram_size, int boot_device, |
155 | 155 | DisplayState *ds, const char **fd_filename, int snapshot, |
156 | 156 | const char *kernel_filename, const char *kernel_cmdline, |
157 | - const char *initrd_filename, int board_id) | |
157 | + const char *initrd_filename, const char *cpu_model, | |
158 | + int board_id) | |
158 | 159 | { |
159 | 160 | CPUState *env; |
160 | 161 | void *pic; |
... | ... | @@ -166,7 +167,9 @@ static void versatile_init(int ram_size, int vga_ram_size, int boot_device, |
166 | 167 | int done_smc = 0; |
167 | 168 | |
168 | 169 | env = cpu_init(); |
169 | - cpu_arm_set_model(env, ARM_CPUID_ARM926); | |
170 | + if (!cpu_model) | |
171 | + cpu_model = "arm926"; | |
172 | + cpu_arm_set_model(env, cpu_model); | |
170 | 173 | /* ??? RAM shoud repeat to fill physical memory space. */ |
171 | 174 | /* SDRAM at address zero. */ |
172 | 175 | cpu_register_physical_memory(0, ram_size, IO_MEM_RAM); |
... | ... | @@ -262,7 +265,7 @@ static void vpb_init(int ram_size, int vga_ram_size, int boot_device, |
262 | 265 | versatile_init(ram_size, vga_ram_size, boot_device, |
263 | 266 | ds, fd_filename, snapshot, |
264 | 267 | kernel_filename, kernel_cmdline, |
265 | - initrd_filename, 0x183); | |
268 | + initrd_filename, cpu_model, 0x183); | |
266 | 269 | } |
267 | 270 | |
268 | 271 | static void vab_init(int ram_size, int vga_ram_size, int boot_device, |
... | ... | @@ -273,7 +276,7 @@ static void vab_init(int ram_size, int vga_ram_size, int boot_device, |
273 | 276 | versatile_init(ram_size, vga_ram_size, boot_device, |
274 | 277 | ds, fd_filename, snapshot, |
275 | 278 | kernel_filename, kernel_cmdline, |
276 | - initrd_filename, 0x25e); | |
279 | + initrd_filename, cpu_model, 0x25e); | |
277 | 280 | } |
278 | 281 | |
279 | 282 | QEMUMachine versatilepb_machine = { | ... | ... |
linux-user/main.c
... | ... | @@ -1756,7 +1756,7 @@ int main(int argc, char **argv) |
1756 | 1756 | #elif defined(TARGET_ARM) |
1757 | 1757 | { |
1758 | 1758 | int i; |
1759 | - cpu_arm_set_model(env, ARM_CPUID_ARM1026); | |
1759 | + cpu_arm_set_model(env, "arm926"); | |
1760 | 1760 | cpsr_write(env, regs->uregs[16], 0xffffffff); |
1761 | 1761 | for(i = 0; i < 16; i++) { |
1762 | 1762 | env->regs[i] = regs->uregs[i]; | ... | ... |
target-arm/cpu.h
... | ... | @@ -209,7 +209,7 @@ static inline int arm_feature(CPUARMState *env, int feature) |
209 | 209 | return (env->features & (1u << feature)) != 0; |
210 | 210 | } |
211 | 211 | |
212 | -void cpu_arm_set_model(CPUARMState *env, uint32_t id); | |
212 | +void cpu_arm_set_model(CPUARMState *env, const char *name); | |
213 | 213 | |
214 | 214 | #define ARM_CPUID_ARM1026 0x4106a262 |
215 | 215 | #define ARM_CPUID_ARM926 0x41069265 | ... | ... |
target-arm/helper.c
... | ... | @@ -36,8 +36,35 @@ static inline void set_feature(CPUARMState *env, int feature) |
36 | 36 | env->features |= 1u << feature; |
37 | 37 | } |
38 | 38 | |
39 | -void cpu_arm_set_model(CPUARMState *env, uint32_t id) | |
39 | +struct arm_cpu_t { | |
40 | + uint32_t id; | |
41 | + const char *name; | |
42 | +}; | |
43 | + | |
44 | +static const struct arm_cpu_t arm_cpu_names[] = { | |
45 | + { ARM_CPUID_ARM926, "arm926"}, | |
46 | + { ARM_CPUID_ARM1026, "arm1026"}, | |
47 | + { 0, NULL} | |
48 | +}; | |
49 | + | |
50 | +void cpu_arm_set_model(CPUARMState *env, const char *name) | |
40 | 51 | { |
52 | + int i; | |
53 | + uint32_t id; | |
54 | + | |
55 | + id = 0; | |
56 | + i = 0; | |
57 | + for (i = 0; arm_cpu_names[i].name; i++) { | |
58 | + if (strcmp(name, arm_cpu_names[i].name) == 0) { | |
59 | + id = arm_cpu_names[i].id; | |
60 | + break; | |
61 | + } | |
62 | + } | |
63 | + if (!id) { | |
64 | + cpu_abort(env, "Unknown CPU '%s'", name); | |
65 | + return; | |
66 | + } | |
67 | + | |
41 | 68 | env->cp15.c0_cpuid = id; |
42 | 69 | switch (id) { |
43 | 70 | case ARM_CPUID_ARM926: | ... | ... |
vl.c
... | ... | @@ -6710,8 +6710,7 @@ void register_machines(void) |
6710 | 6710 | qemu_register_machine(&sun4m_machine); |
6711 | 6711 | #endif |
6712 | 6712 | #elif defined(TARGET_ARM) |
6713 | - qemu_register_machine(&integratorcp926_machine); | |
6714 | - qemu_register_machine(&integratorcp1026_machine); | |
6713 | + qemu_register_machine(&integratorcp_machine); | |
6715 | 6714 | qemu_register_machine(&versatilepb_machine); |
6716 | 6715 | qemu_register_machine(&versatileab_machine); |
6717 | 6716 | qemu_register_machine(&realview_machine); | ... | ... |
vl.h
... | ... | @@ -1304,8 +1304,7 @@ void lsi_scsi_attach(void *opaque, BlockDriverState *bd, int id); |
1304 | 1304 | void *lsi_scsi_init(PCIBus *bus, int devfn); |
1305 | 1305 | |
1306 | 1306 | /* integratorcp.c */ |
1307 | -extern QEMUMachine integratorcp926_machine; | |
1308 | -extern QEMUMachine integratorcp1026_machine; | |
1307 | +extern QEMUMachine integratorcp_machine; | |
1309 | 1308 | |
1310 | 1309 | /* versatilepb.c */ |
1311 | 1310 | extern QEMUMachine versatilepb_machine; | ... | ... |