]>
Commit | Line | Data |
---|---|---|
1 | #ifndef SYSEMU_H | |
2 | #define SYSEMU_H | |
3 | /* Misc. things related to the system emulator. */ | |
4 | ||
5 | #include "qemu-common.h" | |
6 | #include "qemu-option.h" | |
7 | #include "qemu-queue.h" | |
8 | #include "qemu-timer.h" | |
9 | #include "notify.h" | |
10 | ||
11 | /* vl.c */ | |
12 | ||
13 | typedef enum { | |
14 | RUN_STATE_DEBUG, /* qemu is running under gdb */ | |
15 | RUN_STATE_INMIGRATE, /* paused waiting for an incoming migration */ | |
16 | RUN_STATE_INTERNAL_ERROR, /* paused due to an internal error */ | |
17 | RUN_STATE_IO_ERROR, /* paused due to an I/O error */ | |
18 | RUN_STATE_PAUSED, /* paused by the user (ie. the 'stop' command) */ | |
19 | RUN_STATE_POSTMIGRATE, /* paused following a successful migration */ | |
20 | RUN_STATE_PRELAUNCH, /* qemu was started with -S and haven't started */ | |
21 | RUN_STATE_FINISH_MIGRATE, /* paused preparing to finish migrate */ | |
22 | RUN_STATE_RESTORE_VM, /* paused restoring the VM state */ | |
23 | RUN_STATE_RUNNING, /* qemu is running */ | |
24 | RUN_STATE_SAVE_VM, /* paused saving VM state */ | |
25 | RUN_STATE_SHUTDOWN, /* guest shut down and -no-shutdown is in use */ | |
26 | RUN_STATE_WATCHDOG, /* watchdog fired and qemu is configured to pause */ | |
27 | RUN_STATE_MAX | |
28 | } RunState; | |
29 | ||
30 | extern const char *bios_name; | |
31 | ||
32 | extern const char *qemu_name; | |
33 | extern uint8_t qemu_uuid[]; | |
34 | int qemu_uuid_parse(const char *str, uint8_t *uuid); | |
35 | #define UUID_FMT "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx" | |
36 | ||
37 | void runstate_init(void); | |
38 | bool runstate_check(RunState state); | |
39 | void runstate_set(RunState new_state); | |
40 | int runstate_is_running(void); | |
41 | const char *runstate_as_string(void); | |
42 | typedef struct vm_change_state_entry VMChangeStateEntry; | |
43 | typedef void VMChangeStateHandler(void *opaque, int running, RunState state); | |
44 | ||
45 | VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb, | |
46 | void *opaque); | |
47 | void qemu_del_vm_change_state_handler(VMChangeStateEntry *e); | |
48 | void vm_state_notify(int running, RunState state); | |
49 | ||
50 | #define VMRESET_SILENT false | |
51 | #define VMRESET_REPORT true | |
52 | ||
53 | void vm_start(void); | |
54 | void vm_stop(RunState state); | |
55 | ||
56 | void qemu_system_reset_request(void); | |
57 | void qemu_system_shutdown_request(void); | |
58 | void qemu_system_powerdown_request(void); | |
59 | void qemu_system_debug_request(void); | |
60 | void qemu_system_vmstop_request(RunState reason); | |
61 | int qemu_shutdown_requested_get(void); | |
62 | int qemu_reset_requested_get(void); | |
63 | int qemu_shutdown_requested(void); | |
64 | int qemu_reset_requested(void); | |
65 | int qemu_powerdown_requested(void); | |
66 | void qemu_system_killed(int signal, pid_t pid); | |
67 | void qemu_kill_report(void); | |
68 | extern qemu_irq qemu_system_powerdown; | |
69 | void qemu_system_reset(bool report); | |
70 | ||
71 | void qemu_add_exit_notifier(Notifier *notify); | |
72 | void qemu_remove_exit_notifier(Notifier *notify); | |
73 | ||
74 | void qemu_add_machine_init_done_notifier(Notifier *notify); | |
75 | ||
76 | void do_savevm(Monitor *mon, const QDict *qdict); | |
77 | int load_vmstate(const char *name); | |
78 | void do_delvm(Monitor *mon, const QDict *qdict); | |
79 | void do_info_snapshots(Monitor *mon); | |
80 | ||
81 | void qemu_announce_self(void); | |
82 | ||
83 | int main_loop_wait(int nonblocking); | |
84 | ||
85 | bool qemu_savevm_state_blocked(Monitor *mon); | |
86 | int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable, | |
87 | int shared); | |
88 | int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f); | |
89 | int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f); | |
90 | void qemu_savevm_state_cancel(Monitor *mon, QEMUFile *f); | |
91 | int qemu_loadvm_state(QEMUFile *f); | |
92 | ||
93 | /* SLIRP */ | |
94 | void do_info_slirp(Monitor *mon); | |
95 | ||
96 | typedef enum DisplayType | |
97 | { | |
98 | DT_DEFAULT, | |
99 | DT_CURSES, | |
100 | DT_SDL, | |
101 | DT_NOGRAPHIC, | |
102 | DT_NONE, | |
103 | } DisplayType; | |
104 | ||
105 | extern int autostart; | |
106 | extern int bios_size; | |
107 | ||
108 | typedef enum { | |
109 | VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL, | |
110 | } VGAInterfaceType; | |
111 | ||
112 | extern int vga_interface_type; | |
113 | #define cirrus_vga_enabled (vga_interface_type == VGA_CIRRUS) | |
114 | #define std_vga_enabled (vga_interface_type == VGA_STD) | |
115 | #define xenfb_enabled (vga_interface_type == VGA_XENFB) | |
116 | #define vmsvga_enabled (vga_interface_type == VGA_VMWARE) | |
117 | #define qxl_enabled (vga_interface_type == VGA_QXL) | |
118 | ||
119 | extern int graphic_width; | |
120 | extern int graphic_height; | |
121 | extern int graphic_depth; | |
122 | extern uint8_t irq0override; | |
123 | extern DisplayType display_type; | |
124 | extern const char *keyboard_layout; | |
125 | extern int win2k_install_hack; | |
126 | extern int rtc_td_hack; | |
127 | extern int alt_grab; | |
128 | extern int ctrl_grab; | |
129 | extern int usb_enabled; | |
130 | extern int smp_cpus; | |
131 | extern int max_cpus; | |
132 | extern int cursor_hide; | |
133 | extern int graphic_rotate; | |
134 | extern int no_quit; | |
135 | extern int no_shutdown; | |
136 | extern int semihosting_enabled; | |
137 | extern int old_param; | |
138 | extern int boot_menu; | |
139 | extern uint8_t *boot_splash_filedata; | |
140 | extern int boot_splash_filedata_size; | |
141 | extern uint8_t qemu_extra_params_fw[2]; | |
142 | extern QEMUClock *rtc_clock; | |
143 | ||
144 | #define MAX_NODES 64 | |
145 | extern int nb_numa_nodes; | |
146 | extern uint64_t node_mem[MAX_NODES]; | |
147 | extern uint64_t node_cpumask[MAX_NODES]; | |
148 | ||
149 | #define MAX_OPTION_ROMS 16 | |
150 | typedef struct QEMUOptionRom { | |
151 | const char *name; | |
152 | int32_t bootindex; | |
153 | } QEMUOptionRom; | |
154 | extern QEMUOptionRom option_rom[MAX_OPTION_ROMS]; | |
155 | extern int nb_option_roms; | |
156 | ||
157 | #define MAX_PROM_ENVS 128 | |
158 | extern const char *prom_envs[MAX_PROM_ENVS]; | |
159 | extern unsigned int nb_prom_envs; | |
160 | ||
161 | /* pci-hotplug */ | |
162 | void pci_device_hot_add(Monitor *mon, const QDict *qdict); | |
163 | void drive_hot_add(Monitor *mon, const QDict *qdict); | |
164 | void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict); | |
165 | ||
166 | /* pcie aer error injection */ | |
167 | void pcie_aer_inject_error_print(Monitor *mon, const QObject *data); | |
168 | int do_pcie_aer_inejct_error(Monitor *mon, | |
169 | const QDict *qdict, QObject **ret_data); | |
170 | ||
171 | /* serial ports */ | |
172 | ||
173 | #define MAX_SERIAL_PORTS 4 | |
174 | ||
175 | extern CharDriverState *serial_hds[MAX_SERIAL_PORTS]; | |
176 | ||
177 | /* parallel ports */ | |
178 | ||
179 | #define MAX_PARALLEL_PORTS 3 | |
180 | ||
181 | extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS]; | |
182 | ||
183 | void do_usb_add(Monitor *mon, const QDict *qdict); | |
184 | void do_usb_del(Monitor *mon, const QDict *qdict); | |
185 | void usb_info(Monitor *mon); | |
186 | ||
187 | void rtc_change_mon_event(struct tm *tm); | |
188 | ||
189 | void register_devices(void); | |
190 | ||
191 | void add_boot_device_path(int32_t bootindex, DeviceState *dev, | |
192 | const char *suffix); | |
193 | char *get_boot_devices_list(uint32_t *size); | |
194 | #endif |