qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 1/2] pci_host: Turn into SysBus-derived QOM t


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH v2 1/2] pci_host: Turn into SysBus-derived QOM type
Date: Sun, 10 Jun 2012 12:33:20 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1

On 06/10/2012 10:57 AM, Andreas Färber wrote:
From: Andreas Färber<address@hidden>

Allows us to access PCIHostState QOM-style with PCI_HOST() macro.

Update PReP Raven PCI to derive from this type.

Signed-off-by: Anthony Liguori<address@hidden>
Signed-off-by: Wanpeng Li<address@hidden>
Signed-off-by: Andreas Färber<address@hidden>
Reviewed-by: Anthony Liguori<address@hidden>
---
  hw/pci_host.c |   11 +++++++++++
  hw/pci_host.h |    3 +++
  hw/prep_pci.c |    4 ++--
  3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/hw/pci_host.c b/hw/pci_host.c
index 8041778..347bfa6 100644
--- a/hw/pci_host.c
+++ b/hw/pci_host.c
@@ -165,4 +165,15 @@ const MemoryRegionOps pci_host_data_be_ops = {
      .endianness = DEVICE_BIG_ENDIAN,
  };

+static const TypeInfo pci_host_type_info = {
+    .name = TYPE_PCI_HOST,
+    .parent = TYPE_SYS_BUS_DEVICE,
+    .instance_size = sizeof(PCIHostState),
+};

Any reason why PCIHost can't have TYPE_DEVICE as the the parent?

Regards,

Anthony Liguori

+
+static void pci_host_register_types(void)
+{
+    type_register_static(&pci_host_type_info);
+}

+type_init(pci_host_register_types)
diff --git a/hw/pci_host.h b/hw/pci_host.h
index 359e38f..fba9fde 100644
--- a/hw/pci_host.h
+++ b/hw/pci_host.h
@@ -30,6 +30,9 @@

  #include "sysbus.h"

+#define TYPE_PCI_HOST "pci-host"
+#define PCI_HOST(obj) OBJECT_CHECK(PCIHostState, (obj), TYPE_PCI_HOST)
+
  struct PCIHostState {
      SysBusDevice busdev;
      MemoryRegion conf_mem;
diff --git a/hw/prep_pci.c b/hw/prep_pci.c
index 38dbff4..3e9f6b8 100644
--- a/hw/prep_pci.c
+++ b/hw/prep_pci.c
@@ -183,9 +183,9 @@ static void raven_pcihost_class_init(ObjectClass *klass, 
void *data)
      dc->no_user = 1;
  }

-static TypeInfo raven_pcihost_info = {
+static const TypeInfo raven_pcihost_info = {
      .name = "raven-pcihost",
-    .parent = TYPE_SYS_BUS_DEVICE,
+    .parent = TYPE_PCI_HOST,
      .instance_size = sizeof(PREPPCIState),
      .class_init = raven_pcihost_class_init,
  };




reply via email to

[Prev in Thread] Current Thread [Next in Thread]