mcf_intc: Pass M68kCPU to mcf_intc_init()
Store it in mcf_intc_state. Prepares for passing it to m68k_set_irq_level(). Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
4025cfd5d7
commit
9a6ee9fd35
2
hw/mcf.h
2
hw/mcf.h
|
@ -17,7 +17,7 @@ void mcf_uart_mm_init(struct MemoryRegion *sysmem,
|
||||||
/* mcf_intc.c */
|
/* mcf_intc.c */
|
||||||
qemu_irq *mcf_intc_init(struct MemoryRegion *sysmem,
|
qemu_irq *mcf_intc_init(struct MemoryRegion *sysmem,
|
||||||
hwaddr base,
|
hwaddr base,
|
||||||
CPUM68KState *env);
|
M68kCPU *cpu);
|
||||||
|
|
||||||
/* mcf_fec.c */
|
/* mcf_fec.c */
|
||||||
void mcf_fec_init(struct MemoryRegion *sysmem, NICInfo *nd,
|
void mcf_fec_init(struct MemoryRegion *sysmem, NICInfo *nd,
|
||||||
|
|
11
hw/mcf5208.c
11
hw/mcf5208.c
|
@ -192,6 +192,7 @@ static void mcf5208evb_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;
|
||||||
|
@ -201,13 +202,15 @@ static void mcf5208evb_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 = "m5208";
|
cpu_model = "m5208";
|
||||||
env = cpu_init(cpu_model);
|
}
|
||||||
if (!env) {
|
cpu = cpu_m68k_init(cpu_model);
|
||||||
|
if (!cpu) {
|
||||||
fprintf(stderr, "Unable to find m68k CPU definition\n");
|
fprintf(stderr, "Unable to find m68k CPU definition\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
env = &cpu->env;
|
||||||
|
|
||||||
/* Initialize CPU registers. */
|
/* Initialize CPU registers. */
|
||||||
env->vbr = 0;
|
env->vbr = 0;
|
||||||
|
@ -224,7 +227,7 @@ static void mcf5208evb_init(QEMUMachineInitArgs *args)
|
||||||
memory_region_add_subregion(address_space_mem, 0x80000000, sram);
|
memory_region_add_subregion(address_space_mem, 0x80000000, sram);
|
||||||
|
|
||||||
/* Internal peripherals. */
|
/* Internal peripherals. */
|
||||||
pic = mcf_intc_init(address_space_mem, 0xfc048000, env);
|
pic = mcf_intc_init(address_space_mem, 0xfc048000, cpu);
|
||||||
|
|
||||||
mcf_uart_mm_init(address_space_mem, 0xfc060000, pic[26], serial_hds[0]);
|
mcf_uart_mm_init(address_space_mem, 0xfc060000, pic[26], serial_hds[0]);
|
||||||
mcf_uart_mm_init(address_space_mem, 0xfc064000, pic[27], serial_hds[1]);
|
mcf_uart_mm_init(address_space_mem, 0xfc064000, pic[27], serial_hds[1]);
|
||||||
|
|
|
@ -16,7 +16,7 @@ typedef struct {
|
||||||
uint64_t ifr;
|
uint64_t ifr;
|
||||||
uint64_t enabled;
|
uint64_t enabled;
|
||||||
uint8_t icr[64];
|
uint8_t icr[64];
|
||||||
CPUM68KState *env;
|
M68kCPU *cpu;
|
||||||
int active_vector;
|
int active_vector;
|
||||||
} mcf_intc_state;
|
} mcf_intc_state;
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ static void mcf_intc_update(mcf_intc_state *s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s->active_vector = ((best == 64) ? 24 : (best + 64));
|
s->active_vector = ((best == 64) ? 24 : (best + 64));
|
||||||
m68k_set_irq_level(s->env, best_level, s->active_vector);
|
m68k_set_irq_level(&s->cpu->env, best_level, s->active_vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint64_t mcf_intc_read(void *opaque, hwaddr addr,
|
static uint64_t mcf_intc_read(void *opaque, hwaddr addr,
|
||||||
|
@ -139,12 +139,12 @@ static const MemoryRegionOps mcf_intc_ops = {
|
||||||
|
|
||||||
qemu_irq *mcf_intc_init(MemoryRegion *sysmem,
|
qemu_irq *mcf_intc_init(MemoryRegion *sysmem,
|
||||||
hwaddr base,
|
hwaddr base,
|
||||||
CPUM68KState *env)
|
M68kCPU *cpu)
|
||||||
{
|
{
|
||||||
mcf_intc_state *s;
|
mcf_intc_state *s;
|
||||||
|
|
||||||
s = g_malloc0(sizeof(mcf_intc_state));
|
s = g_malloc0(sizeof(mcf_intc_state));
|
||||||
s->env = env;
|
s->cpu = cpu;
|
||||||
mcf_intc_reset(s);
|
mcf_intc_reset(s);
|
||||||
|
|
||||||
memory_region_init_io(&s->iomem, &mcf_intc_ops, s, "mcf", 0x100);
|
memory_region_init_io(&s->iomem, &mcf_intc_ops, s, "mcf", 0x100);
|
||||||
|
|
Loading…
Reference in a new issue