hw/arm/musicpal: Only use qdev_get_gpio_in() when necessary
We don't need to fill the full pic[] array if we only use few of the interrupt lines. Directly call qdev_get_gpio_in() when necessary. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-id: 20201107193403.436146-6-f4bug@amsat.org Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
498661dd22
commit
44cbf34975
@ -1587,8 +1587,8 @@ static struct arm_boot_info musicpal_binfo = {
|
|||||||
static void musicpal_init(MachineState *machine)
|
static void musicpal_init(MachineState *machine)
|
||||||
{
|
{
|
||||||
ARMCPU *cpu;
|
ARMCPU *cpu;
|
||||||
qemu_irq pic[32];
|
|
||||||
DeviceState *dev;
|
DeviceState *dev;
|
||||||
|
DeviceState *pic;
|
||||||
DeviceState *uart_orgate;
|
DeviceState *uart_orgate;
|
||||||
DeviceState *i2c_dev;
|
DeviceState *i2c_dev;
|
||||||
DeviceState *lcd_dev;
|
DeviceState *lcd_dev;
|
||||||
@ -1619,20 +1619,20 @@ static void musicpal_init(MachineState *machine)
|
|||||||
&error_fatal);
|
&error_fatal);
|
||||||
memory_region_add_subregion(address_space_mem, MP_SRAM_BASE, sram);
|
memory_region_add_subregion(address_space_mem, MP_SRAM_BASE, sram);
|
||||||
|
|
||||||
dev = sysbus_create_simple(TYPE_MV88W8618_PIC, MP_PIC_BASE,
|
pic = sysbus_create_simple(TYPE_MV88W8618_PIC, MP_PIC_BASE,
|
||||||
qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ));
|
qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ));
|
||||||
for (i = 0; i < 32; i++) {
|
sysbus_create_varargs(TYPE_MV88W8618_PIT, MP_PIT_BASE,
|
||||||
pic[i] = qdev_get_gpio_in(dev, i);
|
qdev_get_gpio_in(pic, MP_TIMER1_IRQ),
|
||||||
}
|
qdev_get_gpio_in(pic, MP_TIMER2_IRQ),
|
||||||
sysbus_create_varargs(TYPE_MV88W8618_PIT, MP_PIT_BASE, pic[MP_TIMER1_IRQ],
|
qdev_get_gpio_in(pic, MP_TIMER3_IRQ),
|
||||||
pic[MP_TIMER2_IRQ], pic[MP_TIMER3_IRQ],
|
qdev_get_gpio_in(pic, MP_TIMER4_IRQ), NULL);
|
||||||
pic[MP_TIMER4_IRQ], NULL);
|
|
||||||
|
|
||||||
/* Logically OR both UART IRQs together */
|
/* Logically OR both UART IRQs together */
|
||||||
uart_orgate = DEVICE(object_new(TYPE_OR_IRQ));
|
uart_orgate = DEVICE(object_new(TYPE_OR_IRQ));
|
||||||
object_property_set_int(OBJECT(uart_orgate), "num-lines", 2, &error_fatal);
|
object_property_set_int(OBJECT(uart_orgate), "num-lines", 2, &error_fatal);
|
||||||
qdev_realize_and_unref(uart_orgate, NULL, &error_fatal);
|
qdev_realize_and_unref(uart_orgate, NULL, &error_fatal);
|
||||||
qdev_connect_gpio_out(DEVICE(uart_orgate), 0, pic[MP_UART_SHARED_IRQ]);
|
qdev_connect_gpio_out(DEVICE(uart_orgate), 0,
|
||||||
|
qdev_get_gpio_in(pic, MP_UART_SHARED_IRQ));
|
||||||
|
|
||||||
serial_mm_init(address_space_mem, MP_UART1_BASE, 2,
|
serial_mm_init(address_space_mem, MP_UART1_BASE, 2,
|
||||||
qdev_get_gpio_in(uart_orgate, 0),
|
qdev_get_gpio_in(uart_orgate, 0),
|
||||||
@ -1674,14 +1674,15 @@ static void musicpal_init(MachineState *machine)
|
|||||||
OBJECT(get_system_memory()), &error_fatal);
|
OBJECT(get_system_memory()), &error_fatal);
|
||||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
||||||
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, MP_ETH_BASE);
|
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, MP_ETH_BASE);
|
||||||
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[MP_ETH_IRQ]);
|
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0,
|
||||||
|
qdev_get_gpio_in(pic, MP_ETH_IRQ));
|
||||||
|
|
||||||
sysbus_create_simple("mv88w8618_wlan", MP_WLAN_BASE, NULL);
|
sysbus_create_simple("mv88w8618_wlan", MP_WLAN_BASE, NULL);
|
||||||
|
|
||||||
sysbus_create_simple(TYPE_MUSICPAL_MISC, MP_MISC_BASE, NULL);
|
sysbus_create_simple(TYPE_MUSICPAL_MISC, MP_MISC_BASE, NULL);
|
||||||
|
|
||||||
dev = sysbus_create_simple(TYPE_MUSICPAL_GPIO, MP_GPIO_BASE,
|
dev = sysbus_create_simple(TYPE_MUSICPAL_GPIO, MP_GPIO_BASE,
|
||||||
pic[MP_GPIO_IRQ]);
|
qdev_get_gpio_in(pic, MP_GPIO_IRQ));
|
||||||
i2c_dev = sysbus_create_simple("gpio_i2c", -1, NULL);
|
i2c_dev = sysbus_create_simple("gpio_i2c", -1, NULL);
|
||||||
i2c = (I2CBus *)qdev_get_child_bus(i2c_dev, "i2c");
|
i2c = (I2CBus *)qdev_get_child_bus(i2c_dev, "i2c");
|
||||||
|
|
||||||
@ -1713,7 +1714,7 @@ static void musicpal_init(MachineState *machine)
|
|||||||
NULL);
|
NULL);
|
||||||
sysbus_realize_and_unref(s, &error_fatal);
|
sysbus_realize_and_unref(s, &error_fatal);
|
||||||
sysbus_mmio_map(s, 0, MP_AUDIO_BASE);
|
sysbus_mmio_map(s, 0, MP_AUDIO_BASE);
|
||||||
sysbus_connect_irq(s, 0, pic[MP_AUDIO_IRQ]);
|
sysbus_connect_irq(s, 0, qdev_get_gpio_in(pic, MP_AUDIO_IRQ));
|
||||||
|
|
||||||
musicpal_binfo.ram_size = MP_RAM_DEFAULT_SIZE;
|
musicpal_binfo.ram_size = MP_RAM_DEFAULT_SIZE;
|
||||||
arm_load_kernel(cpu, machine, &musicpal_binfo);
|
arm_load_kernel(cpu, machine, &musicpal_binfo);
|
||||||
|
Loading…
Reference in New Issue
Block a user