]> git.proxmox.com Git - mirror_qemu.git/blame - include/hw/boards.h
accel: Pass MachineState object to accel init functions
[mirror_qemu.git] / include / hw / boards.h
CommitLineData
87ecb68b
PB
1/* Declarations for use by board files for creating devices. */
2
3#ifndef HW_BOARDS_H
4#define HW_BOARDS_H
5
f1e29879 6#include "qemu/typedefs.h"
9c17d615 7#include "sysemu/blockdev.h"
83c9f4ca 8#include "hw/qdev.h"
36d20cb2 9#include "qom/object.h"
b6b61144 10
5f072e1f 11
3ef96221 12typedef void QEMUMachineInitFunc(MachineState *ms);
87ecb68b 13
be522029
DG
14typedef void QEMUMachineResetFunc(void);
15
b4fc7b43
IM
16typedef void QEMUMachineHotAddCPUFunc(const int64_t id, Error **errp);
17
135a129a
AK
18typedef int QEMUMachineGetKvmtypeFunc(const char *arg);
19
e689f7c6 20struct QEMUMachine {
87ecb68b 21 const char *name;
3f6599e6 22 const char *alias;
87ecb68b
PB
23 const char *desc;
24 QEMUMachineInitFunc *init;
be522029 25 QEMUMachineResetFunc *reset;
b4fc7b43 26 QEMUMachineHotAddCPUFunc *hot_add_cpu;
135a129a 27 QEMUMachineGetKvmtypeFunc *kvm_type;
2d0d2837 28 BlockInterfaceType block_default_type;
b2097003 29 int max_cpus;
2fe0ee97 30 unsigned int no_serial:1,
986c5f78
GH
31 no_parallel:1,
32 use_virtcon:1,
3ef669e1 33 use_sclp:1,
ac33f8fa
GH
34 no_floppy:1,
35 no_cdrom:1,
36 no_sdcard:1;
0c257437 37 int is_default;
67b724e6 38 const char *default_machine_opts;
c1654732 39 const char *default_boot_order;
458fb679 40 GlobalProperty *compat_props;
93bfef4c 41 const char *hw_version;
e689f7c6 42};
87ecb68b 43
dfabb8b9
PB
44void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
45 const char *name,
46 uint64_t ram_size);
47
87ecb68b 48int qemu_register_machine(QEMUMachine *m);
6f338c34 49
dfabb8b9 50#define TYPE_MACHINE_SUFFIX "-machine"
36d20cb2 51#define TYPE_MACHINE "machine"
c8897e8e 52#undef MACHINE /* BSD defines it and QEMU does not use it */
36d20cb2
MA
53#define MACHINE(obj) \
54 OBJECT_CHECK(MachineState, (obj), TYPE_MACHINE)
55#define MACHINE_GET_CLASS(obj) \
56 OBJECT_GET_CLASS(MachineClass, (obj), TYPE_MACHINE)
57#define MACHINE_CLASS(klass) \
58 OBJECT_CLASS_CHECK(MachineClass, (klass), TYPE_MACHINE)
59
0056ae24
MA
60MachineClass *find_default_machine(void);
61extern MachineState *current_machine;
62
36d20cb2
MA
63/**
64 * MachineClass:
65 * @qemu_machine: #QEMUMachine
b7454548
IM
66 * @get_hotplug_handler: this function is called during bus-less
67 * device hotplug. If defined it returns pointer to an instance
68 * of HotplugHandler object, which handles hotplug operation
69 * for a given @dev. It may return NULL if @dev doesn't require
70 * any actions to be performed by hotplug handler.
36d20cb2
MA
71 */
72struct MachineClass {
73 /*< private >*/
74 ObjectClass parent_class;
75 /*< public >*/
76
00b4fbe2
MA
77 const char *name;
78 const char *alias;
79 const char *desc;
80
3ef96221 81 void (*init)(MachineState *state);
00b4fbe2
MA
82 void (*reset)(void);
83 void (*hot_add_cpu)(const int64_t id, Error **errp);
84 int (*kvm_type)(const char *arg);
85
86 BlockInterfaceType block_default_type;
87 int max_cpus;
88 unsigned int no_serial:1,
89 no_parallel:1,
90 use_virtcon:1,
91 use_sclp:1,
92 no_floppy:1,
93 no_cdrom:1,
94 no_sdcard:1;
95 int is_default;
96 const char *default_machine_opts;
97 const char *default_boot_order;
98 GlobalProperty *compat_props;
99 const char *hw_version;
b7454548
IM
100
101 HotplugHandler *(*get_hotplug_handler)(MachineState *machine,
102 DeviceState *dev);
36d20cb2
MA
103};
104
105/**
106 * MachineState:
107 */
108struct MachineState {
109 /*< private >*/
110 Object parent_obj;
111 /*< public >*/
112
113 char *accel;
114 bool kernel_irqchip;
115 int kvm_shadow_mem;
36d20cb2
MA
116 char *dtb;
117 char *dumpdtb;
118 int phandle_start;
119 char *dt_compatible;
120 bool dump_guest_core;
121 bool mem_merge;
122 bool usb;
123 char *firmware;
a52a7fdf 124 bool iommu;
36d20cb2 125
3ef96221 126 ram_addr_t ram_size;
c270fb9e
IM
127 ram_addr_t maxram_size;
128 uint64_t ram_slots;
3ef96221 129 const char *boot_order;
6b1b1440
MA
130 char *kernel_filename;
131 char *kernel_cmdline;
132 char *initrd_filename;
3ef96221 133 const char *cpu_model;
36d20cb2
MA
134};
135
87ecb68b 136#endif