Currently, the Typhoon has no additional class fields besides
its inheritance (PCIHostBridgeClass), so an explicit definition
of its class struct was unnecessary, and we simply used
OBJECT_DECLARE_SIMPLE_TYPE to declare its instance and class;
however, forthcoming changes will require additional Typhoon-specific
class fields.

This commit creates the Typhoon class definition, although it remains
a shell of its parent class for now.

Signed-off-by: Yodel Eldar <[email protected]>
---
 hw/alpha/alpha_sys.h | 8 +++++++-
 hw/alpha/typhoon.c   | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/hw/alpha/alpha_sys.h b/hw/alpha/alpha_sys.h
index 8611881b55..794a47127d 100644
--- a/hw/alpha/alpha_sys.h
+++ b/hw/alpha/alpha_sys.h
@@ -5,11 +5,17 @@
 
 #include "target/alpha/cpu-qom.h"
 #include "hw/pci/pci.h"
+#include "hw/pci/pci_host.h"
 #include "hw/core/boards.h"
 #include "hw/intc/i8259.h"
 
 #define TYPE_TYPHOON_PCI_HOST_BRIDGE "typhoon-pcihost"
-OBJECT_DECLARE_SIMPLE_TYPE(TyphoonState, TYPHOON_PCI_HOST_BRIDGE)
+
+typedef struct TyphoonClass {
+    PCIHostBridgeClass parent_class;
+} TyphoonClass;
+
+OBJECT_DECLARE_TYPE(TyphoonState, TyphoonClass, TYPHOON_PCI_HOST_BRIDGE)
 
 PCIBus *typhoon_init(pci_map_irq_fn, uint8_t devfn_min, TyphoonState *);
 
diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c
index 792ace5ce7..8745025319 100644
--- a/hw/alpha/typhoon.c
+++ b/hw/alpha/typhoon.c
@@ -976,6 +976,7 @@ static const TypeInfo typhoon_pcihost_info = {
     .parent        = TYPE_PCI_HOST_BRIDGE,
     .instance_size = sizeof(TyphoonState),
     .instance_init = typhoon_pcihost_init,
+    .class_size    = sizeof(TyphoonClass),
     .class_init    = typhoon_pcihost_class_init,
 };
 

-- 
2.53.0


Reply via email to