[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [RFC 1/4] target-ppc: introduce PPCMachineClass and PPCMachin
From: |
Mark Cave-Ayland |
Subject: |
[Qemu-ppc] [RFC 1/4] target-ppc: introduce PPCMachineClass and PPCMachineState |
Date: |
Thu, 7 Apr 2016 16:23:11 +0100 |
Introduce PPCMachineClass in anticipation of making it the superclass for
all PPC machines.
Signed-off-by: Mark Cave-Ayland <address@hidden>
---
hw/ppc/ppc.c | 16 ++++++++++++++++
include/hw/ppc/ppc.h | 16 ++++++++++++++++
include/qemu/typedefs.h | 2 ++
3 files changed, 34 insertions(+)
diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
index 38ff2e1..ccdca5d 100644
--- a/hw/ppc/ppc.c
+++ b/hw/ppc/ppc.c
@@ -1343,3 +1343,19 @@ PowerPCCPU *ppc_get_vcpu_by_dt_id(int cpu_dt_id)
return NULL;
}
+
+/* Generic PPC machine */
+static const TypeInfo ppc_machine_info = {
+ .name = TYPE_PPC_MACHINE,
+ .parent = TYPE_MACHINE,
+ .abstract = true,
+ .instance_size = sizeof(PPCMachineState),
+ .class_size = sizeof(PPCMachineClass)
+};
+
+static void ppc_machine_register_types(void)
+{
+ type_register_static(&ppc_machine_info);
+}
+
+type_init(ppc_machine_register_types)
diff --git a/include/hw/ppc/ppc.h b/include/hw/ppc/ppc.h
index 14efd0c..f1be147 100644
--- a/include/hw/ppc/ppc.h
+++ b/include/hw/ppc/ppc.h
@@ -1,6 +1,22 @@
#ifndef HW_PPC_H
#define HW_PPC_H 1
+#include "hw/boards.h"
+
+struct PPCMachineState {
+ /*< private >*/
+ MachineState parent_obj;
+};
+
+struct PPCMachineClass {
+ /*< private >*/
+ MachineClass parent_class;
+};
+
+#define TYPE_PPC_MACHINE "generic-ppc-machine"
+#define PPC_MACHINE(obj) \
+ OBJECT_CHECK(PPCMachineState, (obj), TYPE_PPC_MACHINE)
+
void ppc_set_irq(PowerPCCPU *cpu, int n_IRQ, int level);
/* PowerPC hardware exceptions management helpers */
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index 1dcf6f5..73fbad5 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -73,6 +73,8 @@ typedef struct PCMachineState PCMachineState;
typedef struct PCMCIACardState PCMCIACardState;
typedef struct PixelFormat PixelFormat;
typedef struct PostcopyDiscardState PostcopyDiscardState;
+typedef struct PPCMachineClass PPCMachineClass;
+typedef struct PPCMachineState PPCMachineState;
typedef struct Property Property;
typedef struct PropertyInfo PropertyInfo;
typedef struct QEMUBH QEMUBH;
--
1.7.10.4