Patchwork [v2,11/21] pcie: Convert PCIExpressHost to use the QOM.

login
register
mail settings
Submitter Jason Baron
Date Oct. 9, 2012, 3:30 a.m.
Message ID <05ae1bad7d67e30a53a6a1bfc3cf2f20abeb50aa.1349749915.git.jbaron@redhat.com>
Download mbox | patch
Permalink /patch/190194/
State New
Headers show

Comments

Jason Baron - Oct. 9, 2012, 3:30 a.m.
From: Jason Baron <jbaron@redhat.com>

Let's use PCIExpressHost with QOM.

Acked-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Jason Baron <jbaron@redhat.com>
---
 hw/pcie_host.c |   14 ++++++++++++++
 hw/pcie_host.h |    4 ++++
 2 files changed, 18 insertions(+), 0 deletions(-)
Paolo Bonzini - Oct. 9, 2012, 7:52 a.m.
Il 09/10/2012 05:30, Jason Baron ha scritto:
> From: Jason Baron <jbaron@redhat.com>
> 
> Let's use PCIExpressHost with QOM.
> 
> Acked-by: Andreas Färber <afaerber@suse.de>
> Signed-off-by: Jason Baron <jbaron@redhat.com>
> ---
>  hw/pcie_host.c |   14 ++++++++++++++
>  hw/pcie_host.h |    4 ++++
>  2 files changed, 18 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/pcie_host.c b/hw/pcie_host.c
> index e2fd276..027ba05 100644
> --- a/hw/pcie_host.c
> +++ b/hw/pcie_host.c
> @@ -145,3 +145,17 @@ void pcie_host_mmcfg_update(PCIExpressHost *e,
>          pcie_host_mmcfg_map(e, addr, size);
>      }
>  }
> +
> +static const TypeInfo pcie_host_type_info = {
> +    .name = TYPE_PCIE_HOST_BRIDGE,
> +    .parent = TYPE_PCI_HOST_BRIDGE,
> +    .abstract = true,
> +    .instance_size = sizeof(PCIExpressHost),
> +};
> +
> +static void pcie_host_register_types(void)
> +{
> +    type_register_static(&pcie_host_type_info);
> +}
> +
> +type_init(pcie_host_register_types)
> diff --git a/hw/pcie_host.h b/hw/pcie_host.h
> index 2faa54e..2494c71 100644
> --- a/hw/pcie_host.h
> +++ b/hw/pcie_host.h
> @@ -24,6 +24,10 @@
>  #include "pci_host.h"
>  #include "memory.h"
>  
> +#define TYPE_PCIE_HOST_BRIDGE "pcie-host-bridge"
> +#define PCIE_HOST_BRIDGE(obj) \
> +    OBJECT_CHECK(PCIExpressHost, (obj), TYPE_PCIE_HOST_BRIDGE)
> +
>  struct PCIExpressHost {
>      PCIHostState pci;
>  
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Paolo

Patch

diff --git a/hw/pcie_host.c b/hw/pcie_host.c
index e2fd276..027ba05 100644
--- a/hw/pcie_host.c
+++ b/hw/pcie_host.c
@@ -145,3 +145,17 @@  void pcie_host_mmcfg_update(PCIExpressHost *e,
         pcie_host_mmcfg_map(e, addr, size);
     }
 }
+
+static const TypeInfo pcie_host_type_info = {
+    .name = TYPE_PCIE_HOST_BRIDGE,
+    .parent = TYPE_PCI_HOST_BRIDGE,
+    .abstract = true,
+    .instance_size = sizeof(PCIExpressHost),
+};
+
+static void pcie_host_register_types(void)
+{
+    type_register_static(&pcie_host_type_info);
+}
+
+type_init(pcie_host_register_types)
diff --git a/hw/pcie_host.h b/hw/pcie_host.h
index 2faa54e..2494c71 100644
--- a/hw/pcie_host.h
+++ b/hw/pcie_host.h
@@ -24,6 +24,10 @@ 
 #include "pci_host.h"
 #include "memory.h"
 
+#define TYPE_PCIE_HOST_BRIDGE "pcie-host-bridge"
+#define PCIE_HOST_BRIDGE(obj) \
+    OBJECT_CHECK(PCIExpressHost, (obj), TYPE_PCIE_HOST_BRIDGE)
+
 struct PCIExpressHost {
     PCIHostState pci;