mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-11 03:24:58 -06:00
target/xtensa: rearrange access to external interrupts
Replace xtensa_get_extint that returns single external IRQ descriptor with xtensa_get_extints that returns a vector of all external IRQs. Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
This commit is contained in:
parent
3f75038a33
commit
66f03d7e13
3 changed files with 20 additions and 19 deletions
|
@ -88,11 +88,11 @@ static void xtensa_ccompare_cb(void *opaque)
|
||||||
|
|
||||||
void xtensa_irq_init(CPUXtensaState *env)
|
void xtensa_irq_init(CPUXtensaState *env)
|
||||||
{
|
{
|
||||||
env->irq_inputs = (void **)qemu_allocate_irqs(
|
|
||||||
xtensa_set_irq, env, env->config->ninterrupt);
|
|
||||||
if (xtensa_option_enabled(env->config, XTENSA_OPTION_TIMER_INTERRUPT)) {
|
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
|
env->irq_inputs = qemu_allocate_irqs(xtensa_set_irq, env,
|
||||||
|
env->config->ninterrupt);
|
||||||
|
if (xtensa_option_enabled(env->config, XTENSA_OPTION_TIMER_INTERRUPT)) {
|
||||||
env->time_base = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
env->time_base = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||||
env->ccount_base = env->sregs[CCOUNT];
|
env->ccount_base = env->sregs[CCOUNT];
|
||||||
for (i = 0; i < env->config->nccompare; ++i) {
|
for (i = 0; i < env->config->nccompare; ++i) {
|
||||||
|
@ -101,16 +101,14 @@ void xtensa_irq_init(CPUXtensaState *env)
|
||||||
xtensa_ccompare_cb, env->ccompare + i);
|
xtensa_ccompare_cb, env->ccompare + i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
for (i = 0; i < env->config->nextint; ++i) {
|
||||||
|
unsigned irq = env->config->extint[i];
|
||||||
|
|
||||||
void *xtensa_get_extint(CPUXtensaState *env, unsigned extint)
|
env->ext_irq_inputs[i] = env->irq_inputs[irq];
|
||||||
{
|
|
||||||
if (extint < env->config->nextint) {
|
|
||||||
unsigned irq = env->config->extint[extint];
|
|
||||||
return env->irq_inputs[irq];
|
|
||||||
} else {
|
|
||||||
qemu_log("%s: trying to acquire invalid external interrupt %d\n",
|
|
||||||
__func__, extint);
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qemu_irq *xtensa_get_extints(CPUXtensaState *env)
|
||||||
|
{
|
||||||
|
return env->ext_irq_inputs;
|
||||||
|
}
|
||||||
|
|
|
@ -225,6 +225,7 @@ static void xtfpga_init(const XtfpgaBoardDesc *board, MachineState *machine)
|
||||||
XtensaCPU *cpu = NULL;
|
XtensaCPU *cpu = NULL;
|
||||||
CPUXtensaState *env = NULL;
|
CPUXtensaState *env = NULL;
|
||||||
MemoryRegion *system_io;
|
MemoryRegion *system_io;
|
||||||
|
qemu_irq *extints;
|
||||||
DriveInfo *dinfo;
|
DriveInfo *dinfo;
|
||||||
pflash_t *flash = NULL;
|
pflash_t *flash = NULL;
|
||||||
QemuOpts *machine_opts = qemu_get_machine_opts();
|
QemuOpts *machine_opts = qemu_get_machine_opts();
|
||||||
|
@ -253,6 +254,7 @@ static void xtfpga_init(const XtfpgaBoardDesc *board, MachineState *machine)
|
||||||
*/
|
*/
|
||||||
cpu_reset(CPU(cpu));
|
cpu_reset(CPU(cpu));
|
||||||
}
|
}
|
||||||
|
extints = xtensa_get_extints(env);
|
||||||
|
|
||||||
if (env) {
|
if (env) {
|
||||||
XtensaMemory sysram = env->config->sysram;
|
XtensaMemory sysram = env->config->sysram;
|
||||||
|
@ -284,10 +286,10 @@ static void xtfpga_init(const XtfpgaBoardDesc *board, MachineState *machine)
|
||||||
xtfpga_fpga_init(system_io, 0x0d020000, freq);
|
xtfpga_fpga_init(system_io, 0x0d020000, freq);
|
||||||
if (nd_table[0].used) {
|
if (nd_table[0].used) {
|
||||||
xtfpga_net_init(system_io, 0x0d030000, 0x0d030400, 0x0d800000,
|
xtfpga_net_init(system_io, 0x0d030000, 0x0d030400, 0x0d800000,
|
||||||
xtensa_get_extint(env, 1), nd_table);
|
extints[1], nd_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
serial_mm_init(system_io, 0x0d050020, 2, xtensa_get_extint(env, 0),
|
serial_mm_init(system_io, 0x0d050020, 2, extints[0],
|
||||||
115200, serial_hd(0), DEVICE_NATIVE_ENDIAN);
|
115200, serial_hd(0), DEVICE_NATIVE_ENDIAN);
|
||||||
|
|
||||||
dinfo = drive_get(IF_PFLASH, 0, 0);
|
dinfo = drive_get(IF_PFLASH, 0, 0);
|
||||||
|
|
|
@ -483,7 +483,8 @@ typedef struct CPUXtensaState {
|
||||||
AddressSpace *address_space_er;
|
AddressSpace *address_space_er;
|
||||||
MemoryRegion *system_er;
|
MemoryRegion *system_er;
|
||||||
int pending_irq_level; /* level of last raised IRQ */
|
int pending_irq_level; /* level of last raised IRQ */
|
||||||
void **irq_inputs;
|
qemu_irq *irq_inputs;
|
||||||
|
qemu_irq ext_irq_inputs[MAX_NINTERRUPT];
|
||||||
XtensaCcompareTimer ccompare[MAX_NCCOMPARE];
|
XtensaCcompareTimer ccompare[MAX_NCCOMPARE];
|
||||||
uint64_t time_base;
|
uint64_t time_base;
|
||||||
uint64_t ccount_time;
|
uint64_t ccount_time;
|
||||||
|
@ -569,7 +570,7 @@ void xtensa_register_core(XtensaConfigList *node);
|
||||||
void xtensa_sim_open_console(Chardev *chr);
|
void xtensa_sim_open_console(Chardev *chr);
|
||||||
void check_interrupts(CPUXtensaState *s);
|
void check_interrupts(CPUXtensaState *s);
|
||||||
void xtensa_irq_init(CPUXtensaState *env);
|
void xtensa_irq_init(CPUXtensaState *env);
|
||||||
void *xtensa_get_extint(CPUXtensaState *env, unsigned extint);
|
qemu_irq *xtensa_get_extints(CPUXtensaState *env);
|
||||||
int cpu_xtensa_signal_handler(int host_signum, void *pinfo, void *puc);
|
int cpu_xtensa_signal_handler(int host_signum, void *pinfo, void *puc);
|
||||||
void xtensa_cpu_list(FILE *f, fprintf_function cpu_fprintf);
|
void xtensa_cpu_list(FILE *f, fprintf_function cpu_fprintf);
|
||||||
void xtensa_sync_window_from_phys(CPUXtensaState *env);
|
void xtensa_sync_window_from_phys(CPUXtensaState *env);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue