mcf5206: Pass M68kCPU to mcf5206_init()
Store it in m5206_mbar_state. Prepares for passing M68kCPU to m68k_set_irq_level(). Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
c7937d9f9a
commit
4025cfd5d7
11
hw/an5206.c
11
hw/an5206.c
|
@ -24,6 +24,7 @@ static void an5206_init(QEMUMachineInitArgs *args)
|
||||||
ram_addr_t ram_size = args->ram_size;
|
ram_addr_t ram_size = args->ram_size;
|
||||||
const char *cpu_model = args->cpu_model;
|
const char *cpu_model = args->cpu_model;
|
||||||
const char *kernel_filename = args->kernel_filename;
|
const char *kernel_filename = args->kernel_filename;
|
||||||
|
M68kCPU *cpu;
|
||||||
CPUM68KState *env;
|
CPUM68KState *env;
|
||||||
int kernel_size;
|
int kernel_size;
|
||||||
uint64_t elf_entry;
|
uint64_t elf_entry;
|
||||||
|
@ -32,12 +33,14 @@ static void an5206_init(QEMUMachineInitArgs *args)
|
||||||
MemoryRegion *ram = g_new(MemoryRegion, 1);
|
MemoryRegion *ram = g_new(MemoryRegion, 1);
|
||||||
MemoryRegion *sram = g_new(MemoryRegion, 1);
|
MemoryRegion *sram = g_new(MemoryRegion, 1);
|
||||||
|
|
||||||
if (!cpu_model)
|
if (!cpu_model) {
|
||||||
cpu_model = "m5206";
|
cpu_model = "m5206";
|
||||||
env = cpu_init(cpu_model);
|
}
|
||||||
if (!env) {
|
cpu = cpu_m68k_init(cpu_model);
|
||||||
|
if (!cpu) {
|
||||||
hw_error("Unable to find m68k CPU definition\n");
|
hw_error("Unable to find m68k CPU definition\n");
|
||||||
}
|
}
|
||||||
|
env = &cpu->env;
|
||||||
|
|
||||||
/* Initialize CPU registers. */
|
/* Initialize CPU registers. */
|
||||||
env->vbr = 0;
|
env->vbr = 0;
|
||||||
|
@ -55,7 +58,7 @@ static void an5206_init(QEMUMachineInitArgs *args)
|
||||||
vmstate_register_ram_global(sram);
|
vmstate_register_ram_global(sram);
|
||||||
memory_region_add_subregion(address_space_mem, AN5206_RAMBAR_ADDR, sram);
|
memory_region_add_subregion(address_space_mem, AN5206_RAMBAR_ADDR, sram);
|
||||||
|
|
||||||
mcf5206_init(address_space_mem, AN5206_MBAR_ADDR, env);
|
mcf5206_init(address_space_mem, AN5206_MBAR_ADDR, cpu);
|
||||||
|
|
||||||
/* Load kernel. */
|
/* Load kernel. */
|
||||||
if (!kernel_filename) {
|
if (!kernel_filename) {
|
||||||
|
|
2
hw/mcf.h
2
hw/mcf.h
|
@ -25,6 +25,6 @@ void mcf_fec_init(struct MemoryRegion *sysmem, NICInfo *nd,
|
||||||
|
|
||||||
/* mcf5206.c */
|
/* mcf5206.c */
|
||||||
qemu_irq *mcf5206_init(struct MemoryRegion *sysmem,
|
qemu_irq *mcf5206_init(struct MemoryRegion *sysmem,
|
||||||
uint32_t base, CPUM68KState *env);
|
uint32_t base, M68kCPU *cpu);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -145,7 +145,7 @@ static m5206_timer_state *m5206_timer_init(qemu_irq irq)
|
||||||
/* System Integration Module. */
|
/* System Integration Module. */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
CPUM68KState *env;
|
M68kCPU *cpu;
|
||||||
MemoryRegion iomem;
|
MemoryRegion iomem;
|
||||||
m5206_timer_state *timer[2];
|
m5206_timer_state *timer[2];
|
||||||
void *uart[2];
|
void *uart[2];
|
||||||
|
@ -226,7 +226,7 @@ static void m5206_mbar_update(m5206_mbar_state *s)
|
||||||
level = 0;
|
level = 0;
|
||||||
vector = 0;
|
vector = 0;
|
||||||
}
|
}
|
||||||
m68k_set_irq_level(s->env, level, vector);
|
m68k_set_irq_level(&s->cpu->env, level, vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void m5206_mbar_set_irq(void *opaque, int irq, int level)
|
static void m5206_mbar_set_irq(void *opaque, int irq, int level)
|
||||||
|
@ -525,7 +525,7 @@ static const MemoryRegionOps m5206_mbar_ops = {
|
||||||
.endianness = DEVICE_NATIVE_ENDIAN,
|
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||||
};
|
};
|
||||||
|
|
||||||
qemu_irq *mcf5206_init(MemoryRegion *sysmem, uint32_t base, CPUM68KState *env)
|
qemu_irq *mcf5206_init(MemoryRegion *sysmem, uint32_t base, M68kCPU *cpu)
|
||||||
{
|
{
|
||||||
m5206_mbar_state *s;
|
m5206_mbar_state *s;
|
||||||
qemu_irq *pic;
|
qemu_irq *pic;
|
||||||
|
@ -541,7 +541,7 @@ qemu_irq *mcf5206_init(MemoryRegion *sysmem, uint32_t base, CPUM68KState *env)
|
||||||
s->timer[1] = m5206_timer_init(pic[10]);
|
s->timer[1] = m5206_timer_init(pic[10]);
|
||||||
s->uart[0] = mcf_uart_init(pic[12], serial_hds[0]);
|
s->uart[0] = mcf_uart_init(pic[12], serial_hds[0]);
|
||||||
s->uart[1] = mcf_uart_init(pic[13], serial_hds[1]);
|
s->uart[1] = mcf_uart_init(pic[13], serial_hds[1]);
|
||||||
s->env = env;
|
s->cpu = cpu;
|
||||||
|
|
||||||
m5206_mbar_reset(s);
|
m5206_mbar_reset(s);
|
||||||
return pic;
|
return pic;
|
||||||
|
|
Loading…
Reference in a new issue