]> Git Repo - qemu.git/commitdiff
heathrow: remove obsolete heathow_init() function
authorMark Cave-Ayland <[email protected]>
Tue, 6 Mar 2018 22:01:54 +0000 (22:01 +0000)
committerDavid Gibson <[email protected]>
Fri, 27 Apr 2018 08:05:22 +0000 (18:05 +1000)
Instead wire up heathrow to the CPU and grackle PCI host using qdev GPIOs.

Signed-off-by: Mark Cave-Ayland <[email protected]>
Signed-off-by: David Gibson <[email protected]>
hw/intc/heathrow_pic.c
hw/ppc/mac.h
hw/ppc/mac_oldworld.c
include/hw/intc/heathrow_pic.h

index 393fdd7326c4d7c961fdde12368c9a14c7268e65..b8b997decac002d4f31a3c76e6ccadee45091f1e 100644 (file)
@@ -172,27 +172,14 @@ static void heathrow_init(Object *obj)
     HeathrowState *s = HEATHROW(obj);
     SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
 
-    memory_region_init_io(&s->mem, OBJECT(s), &heathrow_ops, s,
-                          "heathrow-pic", 0x1000);
-    sysbus_init_mmio(sbd, &s->mem);
-}
-
-DeviceState *heathrow_pic_init(int nb_cpus, qemu_irq **irqs,
-                               qemu_irq **pic_irqs)
-{
-    DeviceState *d;
-    HeathrowState *s;
-
-    d = qdev_create(NULL, TYPE_HEATHROW);
-    qdev_init_nofail(d);
-
-    s = HEATHROW(d);
     /* only 1 CPU */
-    s->irqs = irqs[0];
+    qdev_init_gpio_out(DEVICE(obj), s->irqs, 1);
 
-    *pic_irqs = qemu_allocate_irqs(heathrow_set_irq, s, HEATHROW_NUM_IRQS);
+    qdev_init_gpio_in(DEVICE(obj), heathrow_set_irq, HEATHROW_NUM_IRQS);
 
-    return d;
+    memory_region_init_io(&s->mem, OBJECT(s), &heathrow_ops, s,
+                          "heathrow-pic", 0x1000);
+    sysbus_init_mmio(sbd, &s->mem);
 }
 
 static void heathrow_class_init(ObjectClass *oc, void *data)
index fcf13cb757ed0be406d49c038fd03cd577ef3edb..d661515e9d52e42704d6f7fb13cc969369d99815 100644 (file)
@@ -77,10 +77,6 @@ void macio_ide_register_dma(MACIOIDEState *ide);
 void macio_init(PCIDevice *dev,
                 MemoryRegion *pic_mem);
 
-/* Heathrow PIC */
-DeviceState *heathrow_pic_init(int nb_cpus, qemu_irq **irqs,
-                               qemu_irq **pic_irqs);
-
 /* Grackle PCI */
 #define TYPE_GRACKLE_PCI_HOST_BRIDGE "grackle-pcihost"
 PCIBus *pci_grackle_init(uint32_t base, qemu_irq *pic,
index 10e291ca22f57543e5996804804b53658fbf3f17..9bd4ece16d34c93d2099dd38b315a8bfa170b0c9 100644 (file)
@@ -84,7 +84,7 @@ static void ppc_heathrow_init(MachineState *machine)
     PowerPCCPU *cpu = NULL;
     CPUPPCState *env = NULL;
     char *filename;
-    qemu_irq *pic, **heathrow_irqs;
+    qemu_irq *pic;
     int linux_boot, i;
     MemoryRegion *ram = g_new(MemoryRegion, 1);
     MemoryRegion *bios = g_new(MemoryRegion, 1);
@@ -227,16 +227,15 @@ static void ppc_heathrow_init(MachineState *machine)
     memory_region_add_subregion(sysmem, 0xfe000000, isa);
 
     /* XXX: we register only 1 output pin for heathrow PIC */
-    heathrow_irqs = g_malloc0(smp_cpus * sizeof(qemu_irq *));
-    heathrow_irqs[0] =
-        g_malloc0(smp_cpus * sizeof(qemu_irq) * 1);
+    pic_dev = qdev_create(NULL, TYPE_HEATHROW);
+    qdev_init_nofail(pic_dev);
+
     /* Connect the heathrow PIC outputs to the 6xx bus */
     for (i = 0; i < smp_cpus; i++) {
         switch (PPC_INPUT(env)) {
         case PPC_FLAGS_INPUT_6xx:
-            heathrow_irqs[i] = heathrow_irqs[0] + (i * 1);
-            heathrow_irqs[i][0] =
-                ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT];
+            qdev_connect_gpio_out(pic_dev, 0,
+                ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT]);
             break;
         default:
             error_report("Bus model not supported on OldWorld Mac machine");
@@ -244,6 +243,11 @@ static void ppc_heathrow_init(MachineState *machine)
         }
     }
 
+    pic = g_new0(qemu_irq, HEATHROW_NUM_IRQS);
+    for (i = 0; i < HEATHROW_NUM_IRQS; i++) {
+        pic[i] = qdev_get_gpio_in(pic_dev, i);
+    }
+
     /* Timebase Frequency */
     if (kvm_enabled()) {
         tbfreq = kvmppc_get_tbfreq();
@@ -256,7 +260,7 @@ static void ppc_heathrow_init(MachineState *machine)
         error_report("Only 6xx bus is supported on heathrow machine");
         exit(1);
     }
-    pic_dev = heathrow_pic_init(1, heathrow_irqs, &pic);
+
     pci_bus = pci_grackle_init(0xfec00000, pic,
                                get_system_memory(),
                                get_system_io());
index bc3ffaab8757969939d7c27581167d85c7ce7673..56c2ef339f52d958bb5b2288abae47528ca59939 100644 (file)
@@ -41,7 +41,7 @@ typedef struct HeathrowState {
 
     MemoryRegion mem;
     HeathrowPICState pics[2];
-    qemu_irq *irqs;
+    qemu_irq irqs[1];
 } HeathrowState;
 
 #define HEATHROW_NUM_IRQS 64
This page took 0.035925 seconds and 4 git commands to generate.