]> git.proxmox.com Git - mirror_qemu.git/blame - include/sysemu/sysemu.h
console: allow VCs to be overridden by UI
[mirror_qemu.git] / include / sysemu / sysemu.h
CommitLineData
87ecb68b
PB
1#ifndef SYSEMU_H
2#define SYSEMU_H
3/* Misc. things related to the system emulator. */
4
1de7afc9
PB
5#include "qemu/typedefs.h"
6#include "qemu/option.h"
7#include "qemu/queue.h"
8#include "qemu/timer.h"
1fa9a5e4 9#include "qapi-types.h"
1de7afc9
PB
10#include "qemu/notify.h"
11#include "qemu/main-loop.h"
376253ec 12
87ecb68b 13/* vl.c */
1dfb4dd9 14
87ecb68b 15extern const char *bios_name;
5cea8590 16
87ecb68b 17extern const char *qemu_name;
8fcb1b90 18extern uint8_t qemu_uuid[];
c4be29ff 19int qemu_uuid_parse(const char *str, uint8_t *uuid);
8fcb1b90 20#define UUID_FMT "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
87ecb68b 21
f5bbfba1
LC
22bool runstate_check(RunState state);
23void runstate_set(RunState new_state);
1354869c 24int runstate_is_running(void);
87ecb68b 25typedef struct vm_change_state_entry VMChangeStateEntry;
1dfb4dd9 26typedef void VMChangeStateHandler(void *opaque, int running, RunState state);
87ecb68b
PB
27
28VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
29 void *opaque);
30void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
1dfb4dd9 31void vm_state_notify(int running, RunState state);
e07bbac5 32
e063eb1f
JK
33#define VMRESET_SILENT false
34#define VMRESET_REPORT true
35
87ecb68b 36void vm_start(void);
1dfb4dd9 37void vm_stop(RunState state);
8a9236f1 38void vm_stop_force_state(RunState state);
87ecb68b 39
95b363b5
GH
40typedef enum WakeupReason {
41 QEMU_WAKEUP_REASON_OTHER = 0,
62aeb0f7 42 QEMU_WAKEUP_REASON_RTC,
6595abc0 43 QEMU_WAKEUP_REASON_PMTIMER,
95b363b5
GH
44} WakeupReason;
45
87ecb68b 46void qemu_system_reset_request(void);
95b363b5
GH
47void qemu_system_suspend_request(void);
48void qemu_register_suspend_notifier(Notifier *notifier);
49void qemu_system_wakeup_request(WakeupReason reason);
50void qemu_system_wakeup_enable(WakeupReason reason, bool enabled);
51void qemu_register_wakeup_notifier(Notifier *notifier);
87ecb68b
PB
52void qemu_system_shutdown_request(void);
53void qemu_system_powerdown_request(void);
a9552c8e 54void qemu_register_powerdown_notifier(Notifier *notifier);
8cf71710 55void qemu_system_debug_request(void);
1dfb4dd9 56void qemu_system_vmstop_request(RunState reason);
1291eb35
AP
57int qemu_shutdown_requested_get(void);
58int qemu_reset_requested_get(void);
f64622c4 59void qemu_system_killed(int signal, pid_t pid);
be522029 60void qemu_devices_reset(void);
e063eb1f 61void qemu_system_reset(bool report);
87ecb68b 62
fd42deeb
GH
63void qemu_add_exit_notifier(Notifier *notify);
64void qemu_remove_exit_notifier(Notifier *notify);
65
4cab946a
GN
66void qemu_add_machine_init_done_notifier(Notifier *notify);
67
d54908a5 68void do_savevm(Monitor *mon, const QDict *qdict);
03cd4655 69int load_vmstate(const char *name);
d54908a5 70void do_delvm(Monitor *mon, const QDict *qdict);
84f2d0ea 71void do_info_snapshots(Monitor *mon, const QDict *qdict);
87ecb68b 72
210f41ba
AL
73void qemu_announce_self(void);
74
e1c37d0e 75bool qemu_savevm_state_blocked(Error **errp);
6607ae23
IY
76int qemu_savevm_state_begin(QEMUFile *f,
77 const MigrationParams *params);
539de124
LC
78int qemu_savevm_state_iterate(QEMUFile *f);
79int qemu_savevm_state_complete(QEMUFile *f);
6522773f 80void qemu_savevm_state_cancel(void);
e4ed1541 81uint64_t qemu_savevm_state_pending(QEMUFile *f, uint64_t max_size);
9366f418
AL
82int qemu_loadvm_state(QEMUFile *f);
83
87ecb68b 84/* SLIRP */
376253ec 85void do_info_slirp(Monitor *mon);
87ecb68b 86
993fbfdb
AL
87typedef enum DisplayType
88{
89 DT_DEFAULT,
90 DT_CURSES,
91 DT_SDL,
993fbfdb 92 DT_NOGRAPHIC,
4171d32e 93 DT_NONE,
993fbfdb
AL
94} DisplayType;
95
d399f677 96extern int autostart;
86176759
ZA
97
98typedef enum {
a19cbfb3 99 VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL,
86176759
ZA
100} VGAInterfaceType;
101
102extern int vga_interface_type;
86176759 103#define xenfb_enabled (vga_interface_type == VGA_XENFB)
a19cbfb3 104#define qxl_enabled (vga_interface_type == VGA_QXL)
86176759 105
87ecb68b
PB
106extern int graphic_width;
107extern int graphic_height;
108extern int graphic_depth;
993fbfdb 109extern DisplayType display_type;
87ecb68b
PB
110extern const char *keyboard_layout;
111extern int win2k_install_hack;
112extern int alt_grab;
0ca9f8a4 113extern int ctrl_grab;
87ecb68b 114extern int smp_cpus;
6be68d7e 115extern int max_cpus;
87ecb68b
PB
116extern int cursor_hide;
117extern int graphic_rotate;
118extern int no_quit;
a691d41a 119extern int no_shutdown;
87ecb68b 120extern int semihosting_enabled;
87ecb68b 121extern int old_param;
95387491 122extern int boot_menu;
3d3b8303 123extern uint8_t *boot_splash_filedata;
d09acb9b 124extern size_t boot_splash_filedata_size;
3d3b8303 125extern uint8_t qemu_extra_params_fw[2];
6875204c 126extern QEMUClock *rtc_clock;
87ecb68b 127
268a362c 128#define MAX_NODES 64
ee785fed 129#define MAX_CPUMASK_BITS 255
268a362c
AL
130extern int nb_numa_nodes;
131extern uint64_t node_mem[MAX_NODES];
ee785fed 132extern unsigned long *node_cpumask[MAX_NODES];
268a362c 133
87ecb68b 134#define MAX_OPTION_ROMS 16
2e55e842
GN
135typedef struct QEMUOptionRom {
136 const char *name;
137 int32_t bootindex;
138} QEMUOptionRom;
139extern QEMUOptionRom option_rom[MAX_OPTION_ROMS];
87ecb68b
PB
140extern int nb_option_roms;
141
87ecb68b
PB
142#define MAX_PROM_ENVS 128
143extern const char *prom_envs[MAX_PROM_ENVS];
144extern unsigned int nb_prom_envs;
87ecb68b 145
6f338c34 146/* pci-hotplug */
6c6a58ae 147void pci_device_hot_add(Monitor *mon, const QDict *qdict);
4dbd84e2 148int pci_drive_hot_add(Monitor *mon, const QDict *qdict, DriveInfo *dinfo);
b752daf0 149void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict);
6f338c34 150
dd97aa8a
AG
151/* generic hotplug */
152void drive_hot_add(Monitor *mon, const QDict *qdict);
153
2ae63bda
IY
154/* pcie aer error injection */
155void pcie_aer_inject_error_print(Monitor *mon, const QObject *data);
1f3392b7 156int do_pcie_aer_inject_error(Monitor *mon,
2ae63bda
IY
157 const QDict *qdict, QObject **ret_data);
158
87ecb68b
PB
159/* serial ports */
160
161#define MAX_SERIAL_PORTS 4
162
163extern CharDriverState *serial_hds[MAX_SERIAL_PORTS];
164
165/* parallel ports */
166
167#define MAX_PARALLEL_PORTS 3
168
169extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
170
d54908a5
LC
171void do_usb_add(Monitor *mon, const QDict *qdict);
172void do_usb_del(Monitor *mon, const QDict *qdict);
84f2d0ea 173void usb_info(Monitor *mon, const QDict *qdict);
87ecb68b 174
80cd3478
LC
175void rtc_change_mon_event(struct tm *tm);
176
aae9460e
PB
177void register_devices(void);
178
1ca4d09a
GN
179void add_boot_device_path(int32_t bootindex, DeviceState *dev,
180 const char *suffix);
0e7a7592 181char *get_boot_devices_list(size_t *size);
094b287f
LZ
182
183bool usb_enabled(bool default_usb);
184
4d454574
PB
185extern QemuOptsList qemu_drive_opts;
186extern QemuOptsList qemu_chardev_opts;
187extern QemuOptsList qemu_device_opts;
188extern QemuOptsList qemu_netdev_opts;
189extern QemuOptsList qemu_net_opts;
190extern QemuOptsList qemu_global_opts;
191extern QemuOptsList qemu_mon_opts;
192
87ecb68b 193#endif