apb: QOMify sabre PCI host bridge
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Sun, 21 Jan 2018 08:59:45 +0000 (08:59 +0000)
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Wed, 24 Jan 2018 19:19:51 +0000 (19:19 +0000)
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Artyom Tarasenko <atar4qemu@gmail.com>
hw/pci-host/apb.c
include/hw/pci-host/apb.h

index 98c5f344f7ab02db0dfec2cd4326327a17c362f1..36c6251816881e339c11e673c3bb852b3fa9b38f 100644 (file)
@@ -407,7 +407,7 @@ static void sabre_realize(DeviceState *dev, Error **errp)
                                      &s->pci_ioport,
                                      0, 32, TYPE_PCI_BUS);
 
-    pci_create_simple(phb->bus, 0, "pbm-pci");
+    pci_create_simple(phb->bus, 0, TYPE_SABRE_PCI_DEVICE);
 
     /* IOMMU */
     memory_region_add_subregion_overlap(&s->apb_config, 0x200,
@@ -498,9 +498,9 @@ static void sabre_pci_class_init(ObjectClass *klass, void *data)
 }
 
 static const TypeInfo sabre_pci_info = {
-    .name          = "pbm-pci",
+    .name          = TYPE_SABRE_PCI_DEVICE,
     .parent        = TYPE_PCI_DEVICE,
-    .instance_size = sizeof(PCIDevice),
+    .instance_size = sizeof(SabrePCIState),
     .class_init    = sabre_pci_class_init,
     .interfaces = (InterfaceInfo[]) {
         { INTERFACE_CONVENTIONAL_PCI_DEVICE },
index 41de01239670cdaac59bf52ebe7039ff4f54416c..470863639a2bbabca77bbf3bc3672438bd83bd8b 100644 (file)
 #define OBIO_MSE_IRQ         0x2a
 #define OBIO_SER_IRQ         0x2b
 
-#define TYPE_APB "pbm"
-#define APB_DEVICE(obj) \
-    OBJECT_CHECK(APBState, (obj), TYPE_APB)
+typedef struct SabrePCIState {
+    PCIDevice parent_obj;
+} SabrePCIState;
+
+#define TYPE_SABRE_PCI_DEVICE "sabre-pci"
+#define SABRE_PCI_DEVICE(obj) \
+    OBJECT_CHECK(SabrePCIState, (obj), TYPE_SABRE_PCI_DEVICE)
 
 typedef struct APBState {
     PCIHostState parent_obj;
@@ -41,4 +45,8 @@ typedef struct APBState {
     unsigned int nr_resets;
 } APBState;
 
+#define TYPE_APB "apb"
+#define APB_DEVICE(obj) \
+    OBJECT_CHECK(APBState, (obj), TYPE_APB)
+
 #endif