aboutsummaryrefslogtreecommitdiff
path: root/hw/ppc/e500.h
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2018-04-18 16:28:02 +0200
committerDavid Gibson <david@gibson.dropbear.id.au>2018-04-27 18:05:23 +1000
commit03f048090ee73bfb18b16a5dc462b5411120fb4d (patch)
treef35740bf3e901b5ec572f88a72f4ba3741659a01 /hw/ppc/e500.h
parentda9f80fbad21319194e73355dea8a1cff6a574e4 (diff)
ppc: e500: switch E500 based machines to full machine definition
Convert PPCE500Params to PCCE500MachineClass which it essentially is, and introduce PCCE500MachineState to keep track of E500 specific state instead of adding global variables or extra parameters to functions when we need to keep data beyond machine init (i.e. make it look like typical fully defined machine). It's pretty shallow conversion instead of currently used trivial DEFINE_MACHINE() macro. It adds extra 60LOC of boilerplate code of full machine definition. The patch on top[1] will use PCCE500MachineState to keep track of platform_bus device and add E500Plate specific machine class to use HOTPLUG_HANDLER for explicitly initializing dynamic sysbus devices at the time they are added instead of delaying it to machine done time by platform_bus_init_notify() which is being removed. 1) <1523551221-11612-3-git-send-email-imammedo@redhat.com> Signed-off-by: Igor Mammedov <imammedo@redhat.com> Suggested-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc/e500.h')
-rw-r--r--hw/ppc/e500.h29
1 files changed, 23 insertions, 6 deletions
diff --git a/hw/ppc/e500.h b/hw/ppc/e500.h
index 70ba1d8f4f..621403bd24 100644
--- a/hw/ppc/e500.h
+++ b/hw/ppc/e500.h
@@ -3,12 +3,21 @@
#include "hw/boards.h"
-typedef struct PPCE500Params {
- int pci_first_slot;
- int pci_nr_slots;
+typedef struct PPCE500MachineState {
+ /*< private >*/
+ MachineState parent_obj;
+
+} PPCE500MachineState;
+
+typedef struct PPCE500MachineClass {
+ /*< private >*/
+ MachineClass parent_class;
/* required -- must at least add toplevel board compatible */
- void (*fixup_devtree)(struct PPCE500Params *params, void *fdt);
+ void (*fixup_devtree)(void *fdt);
+
+ int pci_first_slot;
+ int pci_nr_slots;
int mpic_version;
bool has_mpc8xxx_gpio;
@@ -22,10 +31,18 @@ typedef struct PPCE500Params {
hwaddr pci_mmio_base;
hwaddr pci_mmio_bus_base;
hwaddr spin_base;
-} PPCE500Params;
+} PPCE500MachineClass;
-void ppce500_init(MachineState *machine, PPCE500Params *params);
+void ppce500_init(MachineState *machine);
hwaddr booke206_page_size_to_tlb(uint64_t size);
+#define TYPE_PPCE500_MACHINE "ppce500-base-machine"
+#define PPCE500_MACHINE(obj) \
+ OBJECT_CHECK(PPCE500MachineState, (obj), TYPE_PPCE500_MACHINE)
+#define PPCE500_MACHINE_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(PPCE500MachineClass, obj, TYPE_PPCE500_MACHINE)
+#define PPCE500_MACHINE_CLASS(klass) \
+ OBJECT_CLASS_CHECK(PPCE500MachineClass, klass, TYPE_PPCE500_MACHINE)
+
#endif