Patchwork [03/20,MIPS] Jazz emulation: create a qdev cpu

login
register
mail settings
Submitter Hervé Poussineau
Date Aug. 1, 2010, 5:37 p.m.
Message ID <1280684242-19611-3-git-send-email-hpoussin@reactos.org>
Download mbox | patch
Permalink /patch/60474/
State New
Headers show

Comments

Hervé Poussineau - Aug. 1, 2010, 5:37 p.m.
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/mips_jazz.c |   21 +++++----------------
 1 files changed, 5 insertions(+), 16 deletions(-)

Patch

diff --git a/hw/mips_jazz.c b/hw/mips_jazz.c
index 71b05a2..78ef8f0 100644
--- a/hw/mips_jazz.c
+++ b/hw/mips_jazz.c
@@ -43,12 +43,6 @@  enum jazz_model_e
     JAZZ_PICA61,
 };
 
-static void main_cpu_reset(void *opaque)
-{
-    CPUState *env = opaque;
-    cpu_reset(env);
-}
-
 static uint32_t rtc_readb(void *opaque, target_phys_addr_t addr)
 {
     return cpu_inw(0x71);
@@ -128,7 +122,7 @@  void mips_jazz_init (ram_addr_t ram_size,
 {
     char *filename;
     int bios_size, n;
-    CPUState *env;
+    BusState *cpu;
     qemu_irq *rc4030, *i8259;
     rc4030_dma *dmas;
     void* rc4030_opaque;
@@ -150,12 +144,11 @@  void mips_jazz_init (ram_addr_t ram_size,
         cpu_model = "24Kf";
 #endif
     }
-    env = cpu_init(cpu_model);
-    if (!env) {
+    cpu = cpu_mips_init_cpu(cpu_model);
+    if (!cpu) {
         fprintf(stderr, "Unable to find CPU definition\n");
         exit(1);
     }
-    qemu_register_reset(main_cpu_reset, env);
 
     /* allocate RAM */
     ram_offset = qemu_ram_alloc(NULL, "mips_jazz.ram", ram_size);
@@ -184,17 +177,13 @@  void mips_jazz_init (ram_addr_t ram_size,
         exit(1);
     }
 
-    /* Init CPU internal devices */
-    cpu_mips_irq_init_cpu(env);
-    cpu_mips_clock_init(env);
-
     /* Chipset */
-    rc4030_opaque = rc4030_init(env->irq[6], env->irq[3], &rc4030, &dmas);
+    rc4030_opaque = rc4030_init(qdev_get_gpio_in(cpu->parent, 6), qdev_get_gpio_in(cpu->parent, 3), &rc4030, &dmas);
     s_dma_dummy = cpu_register_io_memory(dma_dummy_read, dma_dummy_write, NULL);
     cpu_register_physical_memory(0x8000d000, 0x00001000, s_dma_dummy);
 
     /* ISA devices */
-    i8259 = i8259_init(env->irq[4]);
+    i8259 = i8259_init(qdev_get_gpio_in(cpu->parent, 4));
     isa_bus_new(NULL);
     isa_bus_irqs(i8259);
     cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1);