Patchwork unin_pci: Clean up qdev names

login
register
mail settings
Submitter Andreas Färber
Date Jan. 19, 2012, 1:24 p.m.
Message ID <1326979493-3789-1-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/136839/
State New
Headers show

Comments

Andreas Färber - Jan. 19, 2012, 1:24 p.m.
Add -pcihost to SysBus devices to resolve name conflicts,
and clarify PCI vs. Internal PCI.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Alexander Graf <agraf@suse.de>
Cc: Anthony Liguori <aliguori@us.ibm.com>
---
 hw/unin_pci.c |   53 ++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 38 insertions(+), 15 deletions(-)
Andreas Färber - Jan. 19, 2012, 1:29 p.m.
Am 19.01.2012 14:24, schrieb Andreas Färber:
> Add -pcihost to SysBus devices to resolve name conflicts,
> and clarify PCI vs. Internal PCI.
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> Cc: Alexander Graf <agraf@suse.de>
> Cc: Anthony Liguori <aliguori@us.ibm.com>
> ---

NB: Further cleanups based on these are still being worked on.

Andreas
Alexander Graf - Jan. 19, 2012, 3:55 p.m.
On 19.01.2012, at 14:24, Andreas Färber wrote:

> Add -pcihost to SysBus devices to resolve name conflicts,
> and clarify PCI vs. Internal PCI.
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> Cc: Alexander Graf <agraf@suse.de>
> Cc: Anthony Liguori <aliguori@us.ibm.com>
> ---
> hw/unin_pci.c |   53 ++++++++++++++++++++++++++++++++++++++---------------
> 1 files changed, 38 insertions(+), 15 deletions(-)
> 
> diff --git a/hw/unin_pci.c b/hw/unin_pci.c
> index 14d9914..bd1b32a 100644
> --- a/hw/unin_pci.c
> +++ b/hw/unin_pci.c
> @@ -213,7 +213,7 @@ PCIBus *pci_pmac_init(qemu_irq *pic,
> 
>     /* Use values found on a real PowerMac */
>     /* Uninorth main bus */
> -    dev = qdev_create(NULL, "uni-north");
> +    dev = qdev_create(NULL, "uni-north-pci-pcihost");
>     qdev_init_nofail(dev);
>     s = sysbus_from_qdev(dev);
>     d = FROM_SYSBUS(UNINState, s);
> @@ -245,7 +245,7 @@ PCIBus *pci_pmac_init(qemu_irq *pic,
> 
>     /* Uninorth AGP bus */
>     pci_create_simple(d->host_state.bus, PCI_DEVFN(11, 0), "uni-north-agp");
> -    dev = qdev_create(NULL, "uni-north-agp");
> +    dev = qdev_create(NULL, "uni-north-agp-pcihost");
>     qdev_init_nofail(dev);
>     s = sysbus_from_qdev(dev);
>     sysbus_mmio_map(s, 0, 0xf0800000);
> @@ -254,8 +254,8 @@ PCIBus *pci_pmac_init(qemu_irq *pic,
>     /* Uninorth internal bus */
> #if 0
>     /* XXX: not needed for now */
> -    pci_create_simple(d->host_state.bus, PCI_DEVFN(14, 0), "uni-north-pci");
> -    dev = qdev_create(NULL, "uni-north-pci");
> +    pci_create_simple(d->host_state.bus, PCI_DEVFN(14, 0), "uni-north-internal-pci");


agraf@lychee:/home/agraf/release/qemu> git pw am 'unin_pci: Clean up qdev names'
WARNING: line over 80 characters
#53: FILE: hw/unin_pci.c:257:
+    pci_create_simple(d->host_state.bus, PCI_DEVFN(14, 0), "uni-north-internal-pci");

total: 0 errors, 1 warnings, 100 lines checked


Mind to fix that one up and resubmit? The rest looks good to me.


Alex
Andreas Färber - Jan. 19, 2012, 5:40 p.m.
Hello Alex,

Here's an 80-char fixed version of the qdev renaming for Anthony
plus two more cleanups. More to follow.

Regards,
Andreas

Changes since v1:
* Respect 80-char limit.
* Add busdev and reset patches.

Andreas Färber (3):
  unin_pci: Clean up qdev names
  unin_pci: Drop duplicate busdev
  unin_pci: Drop unused reset handler

 hw/unin_pci.c |   90 +++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 59 insertions(+), 31 deletions(-)
Alexander Graf - Jan. 23, 2012, 5:05 p.m.
On 01/19/2012 06:40 PM, Andreas Färber wrote:
> Hello Alex,
>
> Here's an 80-char fixed version of the qdev renaming for Anthony
> plus two more cleanups. More to follow.

Thanks, applied all to ppc-next.


Alex

Patch

diff --git a/hw/unin_pci.c b/hw/unin_pci.c
index 14d9914..bd1b32a 100644
--- a/hw/unin_pci.c
+++ b/hw/unin_pci.c
@@ -213,7 +213,7 @@  PCIBus *pci_pmac_init(qemu_irq *pic,
 
     /* Use values found on a real PowerMac */
     /* Uninorth main bus */
-    dev = qdev_create(NULL, "uni-north");
+    dev = qdev_create(NULL, "uni-north-pci-pcihost");
     qdev_init_nofail(dev);
     s = sysbus_from_qdev(dev);
     d = FROM_SYSBUS(UNINState, s);
@@ -245,7 +245,7 @@  PCIBus *pci_pmac_init(qemu_irq *pic,
 
     /* Uninorth AGP bus */
     pci_create_simple(d->host_state.bus, PCI_DEVFN(11, 0), "uni-north-agp");
-    dev = qdev_create(NULL, "uni-north-agp");
+    dev = qdev_create(NULL, "uni-north-agp-pcihost");
     qdev_init_nofail(dev);
     s = sysbus_from_qdev(dev);
     sysbus_mmio_map(s, 0, 0xf0800000);
@@ -254,8 +254,8 @@  PCIBus *pci_pmac_init(qemu_irq *pic,
     /* Uninorth internal bus */
 #if 0
     /* XXX: not needed for now */
-    pci_create_simple(d->host_state.bus, PCI_DEVFN(14, 0), "uni-north-pci");
-    dev = qdev_create(NULL, "uni-north-pci");
+    pci_create_simple(d->host_state.bus, PCI_DEVFN(14, 0), "uni-north-internal-pci");
+    dev = qdev_create(NULL, "uni-north-internal-pci-pcihost");
     qdev_init_nofail(dev);
     s = sysbus_from_qdev(dev);
     sysbus_mmio_map(s, 0, 0xf4800000);
@@ -275,7 +275,7 @@  PCIBus *pci_pmac_u3_init(qemu_irq *pic,
 
     /* Uninorth AGP bus */
 
-    dev = qdev_create(NULL, "u3-agp");
+    dev = qdev_create(NULL, "u3-agp-pcihost");
     qdev_init_nofail(dev);
     s = sysbus_from_qdev(dev);
     d = FROM_SYSBUS(UNINState, s);
@@ -335,7 +335,7 @@  static int unin_internal_pci_host_init(PCIDevice *d)
 }
 
 static PCIDeviceInfo unin_main_pci_host_info = {
-    .qdev.name = "uni-north",
+    .qdev.name = "uni-north-pci",
     .qdev.size = sizeof(PCIDevice),
     .init      = unin_main_pci_host_init,
     .vendor_id = PCI_VENDOR_ID_APPLE,
@@ -365,7 +365,7 @@  static PCIDeviceInfo unin_agp_pci_host_info = {
 };
 
 static PCIDeviceInfo unin_internal_pci_host_info = {
-    .qdev.name = "uni-north-pci",
+    .qdev.name = "uni-north-internal-pci",
     .qdev.size = sizeof(PCIDevice),
     .init      = unin_internal_pci_host_init,
     .vendor_id = PCI_VENDOR_ID_APPLE,
@@ -374,19 +374,42 @@  static PCIDeviceInfo unin_internal_pci_host_info = {
     .class_id  = PCI_CLASS_BRIDGE_HOST,
 };
 
+static SysBusDeviceInfo sysbus_unin_pci_host_info = {
+    .qdev.name = "uni-north-pci-pcihost",
+    .qdev.size = sizeof(UNINState),
+    .init      = pci_unin_main_init_device,
+};
+
+static SysBusDeviceInfo sysbus_u3_agp_pci_host_info = {
+    .qdev.name = "u3-agp-pcihost",
+    .qdev.size = sizeof(UNINState),
+    .init      = pci_u3_agp_init_device,
+};
+
+static SysBusDeviceInfo sysbus_unin_agp_pci_host_info = {
+    .qdev.name = "uni-north-agp-pcihost",
+    .qdev.size = sizeof(UNINState),
+    .init      = pci_unin_agp_init_device,
+};
+
+static SysBusDeviceInfo sysbus_unin_internal_pci_host_info = {
+    .qdev.name = "uni-north-internal-pci-pcihost",
+    .qdev.size = sizeof(UNINState),
+    .init      = pci_unin_internal_init_device,
+};
+
 static void unin_register_devices(void)
 {
-    sysbus_register_dev("uni-north", sizeof(UNINState),
-                        pci_unin_main_init_device);
+    sysbus_register_withprop(&sysbus_unin_pci_host_info);
     pci_qdev_register(&unin_main_pci_host_info);
-    sysbus_register_dev("u3-agp", sizeof(UNINState),
-                        pci_u3_agp_init_device);
+
+    sysbus_register_withprop(&sysbus_u3_agp_pci_host_info);
     pci_qdev_register(&u3_agp_pci_host_info);
-    sysbus_register_dev("uni-north-agp", sizeof(UNINState),
-                        pci_unin_agp_init_device);
+
+    sysbus_register_withprop(&sysbus_unin_agp_pci_host_info);
     pci_qdev_register(&unin_agp_pci_host_info);
-    sysbus_register_dev("uni-north-pci", sizeof(UNINState),
-                        pci_unin_internal_init_device);
+
+    sysbus_register_withprop(&sysbus_unin_internal_pci_host_info);
     pci_qdev_register(&unin_internal_pci_host_info);
 }