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