[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 16/26] pc, pc_piix: split out allocating isa irqs
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATCH 16/26] pc, pc_piix: split out allocating isa irqs |
Date: |
Wed, 16 Mar 2011 18:29:27 +0900 |
Factor out the logic of allocating isa irqs.
This simplifies the pc initialization and will reduce the code
duplication of q35 pc initialization.
Signed-off-by: Isaku Yamahata <address@hidden>
---
hw/pc.c | 16 ++++++++++++++--
hw/pc.h | 2 +-
hw/pc_piix.c | 8 +-------
3 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index 4d67d9f..39c7cf0 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1044,9 +1044,21 @@ void pc_memory_init(ram_addr_t ram_size,
}
}
-qemu_irq *pc_allocate_cpu_irq(void)
+qemu_irq *pc_isa_irq(IsaIrqState **isa_irq_state_p)
{
- return qemu_allocate_irqs(pic_irq_request, NULL, 1);
+ qemu_irq *cpu_irq;
+ qemu_irq *i8259;
+ IsaIrqState *isa_irq_state;
+ qemu_irq *isa_irq;
+
+ cpu_irq = qemu_allocate_irqs(pic_irq_request, NULL, 1);;
+ i8259 = i8259_init(cpu_irq[0]);
+ isa_irq_state = qemu_mallocz(sizeof(*isa_irq_state));
+ isa_irq_state->i8259 = i8259;
+ isa_irq = qemu_allocate_irqs(isa_irq_handler, isa_irq_state, 24);
+
+ *isa_irq_state_p = isa_irq_state;
+ return isa_irq;
}
void pc_vga_init(PCIBus *pci_bus)
diff --git a/hw/pc.h b/hw/pc.h
index feb8a7a..0ee4b89 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -135,7 +135,7 @@ void pc_memory_init(ram_addr_t ram_size,
const char *initrd_filename,
ram_addr_t *below_4g_mem_size_p,
ram_addr_t *above_4g_mem_size_p);
-qemu_irq *pc_allocate_cpu_irq(void);
+qemu_irq *pc_isa_irq(IsaIrqState **isa_irq_state_p);
void pc_vga_init(PCIBus *pci_bus);
void pc_basic_device_init(qemu_irq *isa_irq,
ISADevice **rtc_state);
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index 337f2ec..1ac69ff 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -76,9 +76,7 @@ static void pc_init1(ram_addr_t ram_size,
PCIBus *pci_bus;
PCII440FXState *i440fx_state;
int piix3_devfn = -1;
- qemu_irq *cpu_irq;
qemu_irq *isa_irq;
- qemu_irq *i8259;
qemu_irq *cmos_s3;
qemu_irq *smi_irq;
IsaIrqState *isa_irq_state;
@@ -96,14 +94,10 @@ static void pc_init1(ram_addr_t ram_size,
pc_memory_init(ram_size, kernel_filename, kernel_cmdline, initrd_filename,
&below_4g_mem_size, &above_4g_mem_size);
- cpu_irq = pc_allocate_cpu_irq();
- i8259 = i8259_init(cpu_irq[0]);
- isa_irq_state = qemu_mallocz(sizeof(*isa_irq_state));
- isa_irq_state->i8259 = i8259;
+ isa_irq = pc_isa_irq(&isa_irq_state);
if (pci_enabled) {
ioapic_init(isa_irq_state);
}
- isa_irq = qemu_allocate_irqs(isa_irq_handler, isa_irq_state, 24);
if (pci_enabled) {
pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, isa_irq, ram_size);
--
1.7.1.1
- [Qemu-devel] [PATCH 00/26] q35 chipset support for native pci express support, Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 10/26] ide/ahci/ich: use qdev.reset, Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 06/26] pci_bridge: add helper function to convert PCIBridge into PCIDevice, Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 25/26] pci_ids: add intel 82801BA pci-to-pci bridge id and PCI_CLASS_SERIAL_SMBUS, Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 13/26] usb/uhci: add ich9 usb uhci id's device, Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 01/26] pci: replace the magic, 256, for the maximum of slot, Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 17/26] pc, pc_piix: split out pc nic initialization, Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 16/26] pc, pc_piix: split out allocating isa irqs,
Isaku Yamahata <=
- [Qemu-devel] [PATCH 14/26] ide: consolidate drive_get(IF_IDE), Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 11/26] ahci: add ide device initialization helper, Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 18/26] ioapic: move ioapic_init() from pc_piix.c to pc.c, Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 02/26] pci: add opaque argument to pci_map_irq_fn, Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 03/26] pci: introduce pci_swizzle_map_irq_fn() for standardized interrupt pin swizzle, Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 20/26] pc, i440fx: simply i440fx initialization, Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 21/26] acpi, acpi_piix: factor out PM_TMR logic, Isaku Yamahata, 2011/03/16