memory: reorder MemoryRegion fields
[qemu/ar7.git] / include / hw / boards.h
blobf19df9769ca44958cebcfdb74c01c462d76eeb08
1 /* Declarations for use by board files for creating devices. */
3 #ifndef HW_BOARDS_H
4 #define HW_BOARDS_H
6 #include "qemu/typedefs.h"
7 #include "sysemu/blockdev.h"
8 #include "sysemu/accel.h"
9 #include "hw/qdev.h"
10 #include "qom/object.h"
12 void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
13 const char *name,
14 uint64_t ram_size);
16 #define TYPE_MACHINE_SUFFIX "-machine"
18 /* Machine class name that needs to be used for class-name-based machine
19 * type lookup to work.
21 #define MACHINE_TYPE_NAME(machinename) (machinename TYPE_MACHINE_SUFFIX)
23 #define TYPE_MACHINE "machine"
24 #undef MACHINE /* BSD defines it and QEMU does not use it */
25 #define MACHINE(obj) \
26 OBJECT_CHECK(MachineState, (obj), TYPE_MACHINE)
27 #define MACHINE_GET_CLASS(obj) \
28 OBJECT_GET_CLASS(MachineClass, (obj), TYPE_MACHINE)
29 #define MACHINE_CLASS(klass) \
30 OBJECT_CLASS_CHECK(MachineClass, (klass), TYPE_MACHINE)
32 MachineClass *find_default_machine(void);
33 extern MachineState *current_machine;
35 bool machine_usb(MachineState *machine);
36 bool machine_kernel_irqchip_allowed(MachineState *machine);
37 bool machine_kernel_irqchip_required(MachineState *machine);
38 bool machine_kernel_irqchip_split(MachineState *machine);
39 int machine_kvm_shadow_mem(MachineState *machine);
40 int machine_phandle_start(MachineState *machine);
41 bool machine_dump_guest_core(MachineState *machine);
42 bool machine_mem_merge(MachineState *machine);
44 /**
45 * MachineClass:
46 * @get_hotplug_handler: this function is called during bus-less
47 * device hotplug. If defined it returns pointer to an instance
48 * of HotplugHandler object, which handles hotplug operation
49 * for a given @dev. It may return NULL if @dev doesn't require
50 * any actions to be performed by hotplug handler.
51 * @cpu_index_to_socket_id:
52 * used to provide @cpu_index to socket number mapping, allowing
53 * a machine to group CPU threads belonging to the same socket/package
54 * Returns: socket number given cpu_index belongs to.
55 * @hw_version:
56 * Value of QEMU_VERSION when the machine was added to QEMU.
57 * Set only by old machines because they need to keep
58 * compatibility on code that exposed QEMU_VERSION to guests in
59 * the past (and now use qemu_hw_version()).
61 struct MachineClass {
62 /*< private >*/
63 ObjectClass parent_class;
64 /*< public >*/
66 const char *family; /* NULL iff @name identifies a standalone machtype */
67 const char *name;
68 const char *alias;
69 const char *desc;
71 void (*init)(MachineState *state);
72 void (*reset)(void);
73 void (*hot_add_cpu)(const int64_t id, Error **errp);
74 int (*kvm_type)(const char *arg);
76 BlockInterfaceType block_default_type;
77 int units_per_default_bus;
78 int max_cpus;
79 unsigned int no_serial:1,
80 no_parallel:1,
81 use_virtcon:1,
82 use_sclp:1,
83 no_floppy:1,
84 no_cdrom:1,
85 no_sdcard:1,
86 has_dynamic_sysbus:1,
87 no_tco:1,
88 pci_allow_0_address:1;
89 int is_default;
90 const char *default_machine_opts;
91 const char *default_boot_order;
92 const char *default_display;
93 GlobalProperty *compat_props;
94 const char *hw_version;
95 ram_addr_t default_ram_size;
97 HotplugHandler *(*get_hotplug_handler)(MachineState *machine,
98 DeviceState *dev);
99 unsigned (*cpu_index_to_socket_id)(unsigned cpu_index);
103 * MachineState:
105 struct MachineState {
106 /*< private >*/
107 Object parent_obj;
108 Notifier sysbus_notifier;
110 /*< public >*/
112 char *accel;
113 bool kernel_irqchip_allowed;
114 bool kernel_irqchip_required;
115 bool kernel_irqchip_split;
116 int kvm_shadow_mem;
117 char *dtb;
118 char *dumpdtb;
119 int phandle_start;
120 char *dt_compatible;
121 bool dump_guest_core;
122 bool mem_merge;
123 bool usb;
124 bool usb_disabled;
125 bool igd_gfx_passthru;
126 char *firmware;
127 bool iommu;
128 bool suppress_vmdesc;
130 ram_addr_t ram_size;
131 ram_addr_t maxram_size;
132 uint64_t ram_slots;
133 const char *boot_order;
134 char *kernel_filename;
135 char *kernel_cmdline;
136 char *initrd_filename;
137 const char *cpu_model;
138 AccelState *accelerator;
141 #define DEFINE_MACHINE(namestr, machine_initfn) \
142 static void machine_initfn##_class_init(ObjectClass *oc, void *data) \
144 MachineClass *mc = MACHINE_CLASS(oc); \
145 machine_initfn(mc); \
147 static const TypeInfo machine_initfn##_typeinfo = { \
148 .name = MACHINE_TYPE_NAME(namestr), \
149 .parent = TYPE_MACHINE, \
150 .class_init = machine_initfn##_class_init, \
151 }; \
152 static void machine_initfn##_register_types(void) \
154 type_register_static(&machine_initfn##_typeinfo); \
156 machine_init(machine_initfn##_register_types)
158 #endif