Skip to contentSkip to conversation

PPC: Qdev'ify e500 pci

PATCH In review Alexander Graf 2 participants 2 messages May 8, 2011 – May 9, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 7/7 PPC: Qdev'ify e500 pci

The e500 PCI controller isn't qdev'ified yet. This leads to severe issues when running with -drive.

To be able to use a virtio disk with an e500 VM, let's convert the PCI controller over to qdev.

---

v2 -> v3:

- rebase to current code base
- fix endian issue
- use sysbus helpers

v3 -> v4:

- drop base_addr

v4 -> v5:

- model qdev conversion similar to versatilepb (pbrook)

v5 -> v6:

- use qdev.vmsd for vmstate registration (pbrook)

---
 hw/ppce500.h           |   22 --------
 hw/ppce500_mpc8544ds.c |   16 +++---
 hw/ppce500_pci.c       |  136 +++++++++++++++++++++++++++---------------------
 3 files changed, 84 insertions(+), 90 deletions(-)
 delete mode 100644 hw/ppce500.h
hw/ppce500.h deleted +0 -22
deleted file mode 100644
index 24d49bb..0000000
@@ -1,22 +0,0 @@
-/*
- * QEMU PowerPC E500 emulation shared definitions
- *
- * Copyright (C) 2009 Freescale Semiconductor, Inc. All rights reserved.
- *
- * Author: Yu Liu,     <[email protected]>
- *
- * This file is derived from hw/ppc440.h
- * the copyright for that material belongs to the original owners.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of  the GNU General  Public License as published by
- * the Free Software Foundation;  either version 2 of the  License, or
- * (at your option) any later version.
- */
-
-#if !defined(PPC_E500_H)
-#define PPC_E500_H
-
-PCIBus *ppce500_pci_init(qemu_irq *pic, target_phys_addr_t registers);
-
-#endif /* !defined(PPC_E500_H) */
hw/ppce500_mpc8544ds.c +8 -8
index 4120977..f92d07e 100644
@@ -29,9 +29,9 @@
 #include "device_tree.h"
 #include "openpic.h"
 #include "ppc.h"
-#include "ppce500.h"
 #include "loader.h"
 #include "elf.h"
+#include "sysbus.h"
 
 #define BINARY_DEVICE_TREE_FILE    "mpc8544ds.dtb"
 #define UIMAGE_LOAD_BASE           0
@@ -222,7 +222,8 @@ static void mpc8544ds_init(ram_addr_t ram_size,
     target_long initrd_size=0;
     int i=0;
     unsigned int pci_irq_nrs[4] = {1, 2, 3, 4};
-    qemu_irq *irqs, *mpic, *pci_irqs;
+    qemu_irq *irqs, *mpic;
+    DeviceState *dev;
 
     /* Setup CPU */
     if (cpu_model == NULL) {
@@ -269,12 +270,11 @@ static void mpc8544ds_init(ram_addr_t ram_size,
     }
 
     /* PCI */
-    pci_irqs = qemu_malloc(sizeof(qemu_irq) * 4);
-    pci_irqs[0] = mpic[pci_irq_nrs[0]];
-    pci_irqs[1] = mpic[pci_irq_nrs[1]];
-    pci_irqs[2] = mpic[pci_irq_nrs[2]];
-    pci_irqs[3] = mpic[pci_irq_nrs[3]];
-    pci_bus = ppce500_pci_init(pci_irqs, MPC8544_PCI_REGS_BASE);
+    dev = sysbus_create_varargs("e500-pcihost", MPC8544_PCI_REGS_BASE,
+                                mpic[pci_irq_nrs[0]], mpic[pci_irq_nrs[1]],
+                                mpic[pci_irq_nrs[2]], mpic[pci_irq_nrs[3]],
+                                NULL);
+    pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci");
     if (!pci_bus)
         printf("couldn't create PCI controller!\n");
 
hw/ppce500_pci.c +76 -60

168 lines not on this page · raw message

Signature · 1 line
1.6.0.2