Index: vl.c =================================================================== RCS file: /sources/qemu/qemu/vl.c,v retrieving revision 1.259 diff -u -d -d -p -r1.259 vl.c --- vl.c 22 Feb 2007 01:48:01 -0000 1.259 +++ vl.c 28 Feb 2007 09:42:43 -0000 @@ -6339,6 +6339,7 @@ void help(void) "\n" "Standard options:\n" "-M machine select emulated machine (-M ? for list)\n" + "-C cpu select CPU (-C ? for list)\n" "-fda/-fdb file use 'file' as floppy disk 0/1 image\n" "-hda/-hdb file use 'file' as IDE hard disk 0/1 image\n" "-hdc/-hdd file use 'file' as IDE hard disk 2/3 image\n" @@ -6471,6 +6472,7 @@ enum { QEMU_OPTION_h, QEMU_OPTION_M, + QEMU_OPTION_C, QEMU_OPTION_fda, QEMU_OPTION_fdb, QEMU_OPTION_hda, @@ -6546,6 +6548,7 @@ const QEMUOption qemu_options[] = { { "help", 0, QEMU_OPTION_h }, { "M", HAS_ARG, QEMU_OPTION_M }, + { "C", HAS_ARG, QEMU_OPTION_C }, { "fda", HAS_ARG, QEMU_OPTION_fda }, { "fdb", HAS_ARG, QEMU_OPTION_fdb }, { "hda", HAS_ARG, QEMU_OPTION_hda }, @@ -6851,6 +6854,7 @@ int main(int argc, char **argv) int parallel_device_index; const char *loadvm = NULL; QEMUMachine *machine; + const char *cpu_model; char usb_devices[MAX_USB_CMDLINE][128]; int usb_devices_index; int fds[2]; @@ -6888,6 +6892,7 @@ int main(int argc, char **argv) register_machines(); machine = first_machine; + cpu_model = NULL; initrd_filename = NULL; for(i = 0; i < MAX_FD; i++) fd_filename[i] = NULL; @@ -6979,6 +6984,17 @@ int main(int argc, char **argv) exit(1); } break; + case QEMU_OPTION_C: + /* hw initialization will check this */ + if (optarg[0] == '?') { +#if defined(TARGET_PPC) || defined(TARGET_PPC64) + ppc_cpu_list(stdout, &fprintf); +#endif + exit(1); + } else { + cpu_model = optarg; + } + break; case QEMU_OPTION_initrd: initrd_filename = optarg; break; @@ -7553,7 +7569,7 @@ int main(int argc, char **argv) machine->init(ram_size, vga_ram_size, boot_device, ds, fd_filename, snapshot, - kernel_filename, kernel_cmdline, initrd_filename); + kernel_filename, kernel_cmdline, initrd_filename, cpu_model); /* init USB devices */ if (usb_enabled) { Index: vl.h =================================================================== RCS file: /sources/qemu/qemu/vl.h,v retrieving revision 1.189 diff -u -d -d -p -r1.189 vl.h --- vl.h 20 Feb 2007 00:05:08 -0000 1.189 +++ vl.h 28 Feb 2007 09:42:44 -0000 @@ -695,7 +695,7 @@ typedef void QEMUMachineInitFunc(int ram int boot_device, DisplayState *ds, const char **fd_filename, int snapshot, const char *kernel_filename, const char *kernel_cmdline, - const char *initrd_filename); + const char *initrd_filename, const char *cpu_model); typedef struct QEMUMachine { const char *name; @@ -709,6 +709,10 @@ int qemu_register_machine(QEMUMachine *m typedef void SetIRQFunc(void *opaque, int irq_num, int level); typedef void IRQRequestFunc(void *opaque, int level); +#if defined(TARGET_PPC) || defined(TARGET_PPC64) +void ppc_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...)); +#endif + /* ISA bus */ extern target_phys_addr_t isa_mem_base; Index: hw/integratorcp.c =================================================================== RCS file: /sources/qemu/qemu/hw/integratorcp.c,v retrieving revision 1.11 diff -u -d -d -p -r1.11 integratorcp.c --- hw/integratorcp.c 16 Jan 2007 18:54:31 -0000 1.11 +++ hw/integratorcp.c 28 Feb 2007 09:42:44 -0000 @@ -516,7 +516,7 @@ static void integratorcp_init(int ram_si static void integratorcp926_init(int ram_size, int vga_ram_size, int boot_device, DisplayState *ds, const char **fd_filename, int snapshot, const char *kernel_filename, const char *kernel_cmdline, - const char *initrd_filename) + const char *initrd_filename, const char *cpu_model) { integratorcp_init(ram_size, vga_ram_size, boot_device, ds, fd_filename, snapshot, kernel_filename, kernel_cmdline, @@ -526,7 +526,7 @@ static void integratorcp926_init(int ram static void integratorcp1026_init(int ram_size, int vga_ram_size, int boot_device, DisplayState *ds, const char **fd_filename, int snapshot, const char *kernel_filename, const char *kernel_cmdline, - const char *initrd_filename) + const char *initrd_filename, const char *cpu_model) { integratorcp_init(ram_size, vga_ram_size, boot_device, ds, fd_filename, snapshot, kernel_filename, kernel_cmdline, Index: hw/mips_malta.c =================================================================== RCS file: /sources/qemu/qemu/hw/mips_malta.c,v retrieving revision 1.12 diff -u -d -d -p -r1.12 mips_malta.c --- hw/mips_malta.c 21 Feb 2007 22:43:42 -0000 1.12 +++ hw/mips_malta.c 28 Feb 2007 09:42:44 -0000 @@ -494,7 +494,7 @@ static void mips_malta_init (int ram_size, int vga_ram_size, int boot_device, DisplayState *ds, const char **fd_filename, int snapshot, const char *kernel_filename, const char *kernel_cmdline, - const char *initrd_filename) + const char *initrd_filename, const char *cpu_model) { char buf[1024]; unsigned long bios_offset; Index: hw/mips_r4k.c =================================================================== RCS file: /sources/qemu/qemu/hw/mips_r4k.c,v retrieving revision 1.35 diff -u -d -d -p -r1.35 mips_r4k.c --- hw/mips_r4k.c 20 Feb 2007 23:37:21 -0000 1.35 +++ hw/mips_r4k.c 28 Feb 2007 09:42:44 -0000 @@ -130,7 +130,7 @@ static void mips_r4k_init (int ram_size, int vga_ram_size, int boot_device, DisplayState *ds, const char **fd_filename, int snapshot, const char *kernel_filename, const char *kernel_cmdline, - const char *initrd_filename) + const char *initrd_filename, const char *cpu_model) { char buf[1024]; unsigned long bios_offset; Index: hw/pc.c =================================================================== RCS file: /sources/qemu/qemu/hw/pc.c,v retrieving revision 1.70 diff -u -d -d -p -r1.70 pc.c --- hw/pc.c 8 Feb 2007 23:09:59 -0000 1.70 +++ hw/pc.c 28 Feb 2007 09:42:44 -0000 @@ -758,7 +758,8 @@ static void pc_init_pci(int ram_size, in int snapshot, const char *kernel_filename, const char *kernel_cmdline, - const char *initrd_filename) + const char *initrd_filename, + const char *cpu_model) { pc_init1(ram_size, vga_ram_size, boot_device, ds, fd_filename, snapshot, @@ -771,7 +772,8 @@ static void pc_init_isa(int ram_size, in int snapshot, const char *kernel_filename, const char *kernel_cmdline, - const char *initrd_filename) + const char *initrd_filename, + const char *cpu_model) { pc_init1(ram_size, vga_ram_size, boot_device, ds, fd_filename, snapshot, Index: hw/realview.c =================================================================== RCS file: /sources/qemu/qemu/hw/realview.c,v retrieving revision 1.3 diff -u -d -d -p -r1.3 realview.c --- hw/realview.c 16 Jan 2007 18:54:31 -0000 1.3 +++ hw/realview.c 28 Feb 2007 09:42:44 -0000 @@ -15,7 +15,7 @@ static void realview_init(int ram_size, int vga_ram_size, int boot_device, DisplayState *ds, const char **fd_filename, int snapshot, const char *kernel_filename, const char *kernel_cmdline, - const char *initrd_filename) + const char *initrd_filename, const char *cpu_model) { CPUState *env; void *pic; Index: hw/shix.c =================================================================== RCS file: /sources/qemu/qemu/hw/shix.c,v retrieving revision 1.1 diff -u -d -d -p -r1.1 shix.c --- hw/shix.c 27 Apr 2006 21:32:09 -0000 1.1 +++ hw/shix.c 28 Feb 2007 09:42:44 -0000 @@ -70,7 +70,7 @@ void vga_screen_dump(const char *filenam void shix_init(int ram_size, int vga_ram_size, int boot_device, DisplayState * ds, const char **fd_filename, int snapshot, const char *kernel_filename, const char *kernel_cmdline, - const char *initrd_filename) + const char *initrd_filename, const char *cpu_model) { int ret; CPUState *env; Index: hw/sun4m.c =================================================================== RCS file: /sources/qemu/qemu/hw/sun4m.c,v retrieving revision 1.24 diff -u -d -d -p -r1.24 sun4m.c --- hw/sun4m.c 10 Jan 2007 11:46:13 -0000 1.24 +++ hw/sun4m.c 28 Feb 2007 09:42:44 -0000 @@ -211,7 +211,7 @@ static void main_cpu_reset(void *opaque) static void sun4m_init(int ram_size, int vga_ram_size, int boot_device, DisplayState *ds, const char **fd_filename, int snapshot, const char *kernel_filename, const char *kernel_cmdline, - const char *initrd_filename) + const char *initrd_filename, const char *cpu_model) { CPUState *env, *envs[MAX_CPUS]; char buf[1024]; Index: hw/sun4u.c =================================================================== RCS file: /sources/qemu/qemu/hw/sun4u.c,v retrieving revision 1.12 diff -u -d -d -p -r1.12 sun4u.c --- hw/sun4u.c 10 Jan 2007 16:17:21 -0000 1.12 +++ hw/sun4u.c 28 Feb 2007 09:42:44 -0000 @@ -257,7 +257,7 @@ static fdctrl_t *floppy_controller; static void sun4u_init(int ram_size, int vga_ram_size, int boot_device, DisplayState *ds, const char **fd_filename, int snapshot, const char *kernel_filename, const char *kernel_cmdline, - const char *initrd_filename) + const char *initrd_filename, const char *cpu_model) { CPUState *env; char buf[1024]; Index: hw/versatilepb.c =================================================================== RCS file: /sources/qemu/qemu/hw/versatilepb.c,v retrieving revision 1.8 diff -u -d -d -p -r1.8 versatilepb.c --- hw/versatilepb.c 16 Jan 2007 18:54:31 -0000 1.8 +++ hw/versatilepb.c 28 Feb 2007 09:42:44 -0000 @@ -257,7 +257,7 @@ static void versatile_init(int ram_size, static void vpb_init(int ram_size, int vga_ram_size, int boot_device, DisplayState *ds, const char **fd_filename, int snapshot, const char *kernel_filename, const char *kernel_cmdline, - const char *initrd_filename) + const char *initrd_filename, const char *cpu_model) { versatile_init(ram_size, vga_ram_size, boot_device, ds, fd_filename, snapshot, @@ -268,7 +268,7 @@ static void vpb_init(int ram_size, int v static void vab_init(int ram_size, int vga_ram_size, int boot_device, DisplayState *ds, const char **fd_filename, int snapshot, const char *kernel_filename, const char *kernel_cmdline, - const char *initrd_filename) + const char *initrd_filename, const char *cpu_model) { versatile_init(ram_size, vga_ram_size, boot_device, ds, fd_filename, snapshot, Index: hw/ppc_chrp.c =================================================================== RCS file: /sources/qemu/qemu/hw/ppc_chrp.c,v retrieving revision 1.26 diff -u -d -d -p -r1.26 ppc_chrp.c --- hw/ppc_chrp.c 10 Jan 2007 16:17:21 -0000 1.26 +++ hw/ppc_chrp.c 28 Feb 2007 09:42:44 -0000 @@ -279,13 +289,14 @@ static uint8_t nvram_chksum(const uint8_ } /* PowerPC CHRP hardware initialisation */ -static void ppc_chrp_init(int ram_size, int vga_ram_size, int boot_device, - DisplayState *ds, const char **fd_filename, - int snapshot, - const char *kernel_filename, - const char *kernel_cmdline, - const char *initrd_filename, - int is_heathrow) +static void ppc_chrp_init (int ram_size, int vga_ram_size, int boot_device, + DisplayState *ds, const char **fd_filename, + int snapshot, + const char *kernel_filename, + const char *kernel_cmdline, + const char *initrd_filename, + const char *cpu_model, + int is_heathrow) { CPUState *env; char buf[1024]; @@ -320,22 +331,16 @@ static void ppc_chrp_init(int ram_size, env = cpu_init(); register_savevm("cpu", 0, 3, cpu_save, cpu_load, env); - /* Register CPU as a 74x/75x */ + /* Default CPU is a generic 74x/75x */ + if (cpu_model == NULL) + cpu_model = "750"; /* XXX: CPU model (or PVR) should be provided on command line */ // ppc_find_by_name("750gx", &def); // Linux boot OK // ppc_find_by_name("750fx", &def); // Linux boot OK /* Linux does not boot on 750cxe (and probably other 750cx based) * because it assumes it has 8 IBAT & DBAT pairs as it only have 4. */ - // ppc_find_by_name("750cxe", &def); - // ppc_find_by_name("750p", &def); - // ppc_find_by_name("740p", &def); - ppc_find_by_name("750", &def); - // ppc_find_by_name("740", &def); - // ppc_find_by_name("G3", &def); - // ppc_find_by_name("604r", &def); - // ppc_find_by_name("604e", &def); - // ppc_find_by_name("604", &def); + ppc_find_by_name(cpu_model, &def); if (def == NULL) { cpu_abort(env, "Unable to find PowerPC CPU definition\n"); } @@ -525,30 +530,32 @@ static void ppc_chrp_init(int ram_size, register_ioport_write(0x0F00, 4, 1, &PPC_debug_write, NULL); } -static void ppc_core99_init(int ram_size, int vga_ram_size, int boot_device, - DisplayState *ds, const char **fd_filename, - int snapshot, - const char *kernel_filename, - const char *kernel_cmdline, - const char *initrd_filename) +static void ppc_core99_init (int ram_size, int vga_ram_size, int boot_device, + DisplayState *ds, const char **fd_filename, + int snapshot, + const char *kernel_filename, + const char *kernel_cmdline, + const char *initrd_filename, + const char *cpu_model) { ppc_chrp_init(ram_size, vga_ram_size, boot_device, ds, fd_filename, snapshot, kernel_filename, kernel_cmdline, - initrd_filename, 0); + initrd_filename, cpu_model, 0); } -static void ppc_heathrow_init(int ram_size, int vga_ram_size, int boot_device, - DisplayState *ds, const char **fd_filename, - int snapshot, - const char *kernel_filename, - const char *kernel_cmdline, - const char *initrd_filename) +static void ppc_heathrow_init (int ram_size, int vga_ram_size, int boot_device, + DisplayState *ds, const char **fd_filename, + int snapshot, + const char *kernel_filename, + const char *kernel_cmdline, + const char *initrd_filename, + const char *cpu_model) { ppc_chrp_init(ram_size, vga_ram_size, boot_device, ds, fd_filename, snapshot, kernel_filename, kernel_cmdline, - initrd_filename, 1); + initrd_filename, cpu_model, 1); } QEMUMachine core99_machine = { Index: hw/ppc_prep.c =================================================================== RCS file: /sources/qemu/qemu/hw/ppc_prep.c,v retrieving revision 1.29 diff -u -d -d -p -r1.29 ppc_prep.c --- hw/ppc_prep.c 21 Dec 2006 16:50:54 -0000 1.29 +++ hw/ppc_prep.c 28 Feb 2007 09:42:44 -0000 @@ -518,10 +522,12 @@ CPUReadMemoryFunc *PPC_prep_io_read[] = #define NVRAM_SIZE 0x2000 /* PowerPC PREP hardware initialisation */ -static void ppc_prep_init(int ram_size, int vga_ram_size, int boot_device, - DisplayState *ds, const char **fd_filename, int snapshot, - const char *kernel_filename, const char *kernel_cmdline, - const char *initrd_filename) +static void ppc_prep_init (int ram_size, int vga_ram_size, int boot_device, + DisplayState *ds, const char **fd_filename, + int snapshot, const char *kernel_filename, + const char *kernel_cmdline, + const char *initrd_filename, + const char *cpu_model) { CPUState *env; char buf[1024]; @@ -535,12 +541,11 @@ static void ppc_prep_init(int ram_size, env = cpu_init(); register_savevm("cpu", 0, 3, cpu_save, cpu_load, env); - - /* Register CPU as a 604 */ - /* XXX: CPU model (or PVR) should be provided on command line */ - // ppc_find_by_name("604r", &def); - // ppc_find_by_name("604e", &def); - ppc_find_by_name("604", &def); + + /* Default CPU is a 604 */ + if (cpu_model == NULL) + cpu_model = "604"; + ppc_find_by_name(cpu_model, &def); if (def == NULL) { cpu_abort(env, "Unable to find PowerPC CPU definition\n"); }