sysemu.h 5.47 KB
Newer Older
pbrook's avatar
pbrook committed
1 2 3 4
#ifndef SYSEMU_H
#define SYSEMU_H
/* Misc. things related to the system emulator.  */

aliguori's avatar
aliguori committed
5
#include "qemu-common.h"
6
#include "qemu-option.h"
7
#include "qemu-queue.h"
Jan Kiszka's avatar
Jan Kiszka committed
8
#include "qemu-timer.h"
Luiz Capitulino's avatar
Luiz Capitulino committed
9
#include "qapi-types.h"
Gerd Hoffmann's avatar
Gerd Hoffmann committed
10
#include "notify.h"
11
#include "main-loop.h"
aliguori's avatar
aliguori committed
12

pbrook's avatar
pbrook committed
13
/* vl.c */
14

pbrook's avatar
pbrook committed
15
extern const char *bios_name;
Paul Brook's avatar
Paul Brook committed
16

pbrook's avatar
pbrook committed
17
extern const char *qemu_name;
18
extern uint8_t qemu_uuid[];
19
int qemu_uuid_parse(const char *str, uint8_t *uuid);
20
#define UUID_FMT "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
pbrook's avatar
pbrook committed
21

22
void runstate_init(void);
23 24
bool runstate_check(RunState state);
void runstate_set(RunState new_state);
25
int runstate_is_running(void);
pbrook's avatar
pbrook committed
26
typedef struct vm_change_state_entry VMChangeStateEntry;
27
typedef void VMChangeStateHandler(void *opaque, int running, RunState state);
pbrook's avatar
pbrook committed
28 29 30 31

VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
                                                     void *opaque);
void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
32
void vm_state_notify(int running, RunState state);
33

Jan Kiszka's avatar
Jan Kiszka committed
34 35 36
#define VMRESET_SILENT   false
#define VMRESET_REPORT   true

pbrook's avatar
pbrook committed
37
void vm_start(void);
38
void vm_stop(RunState state);
39
void vm_stop_force_state(RunState state);
pbrook's avatar
pbrook committed
40

Gerd Hoffmann's avatar
Gerd Hoffmann committed
41 42
typedef enum WakeupReason {
    QEMU_WAKEUP_REASON_OTHER = 0,
43
    QEMU_WAKEUP_REASON_RTC,
44
    QEMU_WAKEUP_REASON_PMTIMER,
Gerd Hoffmann's avatar
Gerd Hoffmann committed
45 46
} WakeupReason;

pbrook's avatar
pbrook committed
47
void qemu_system_reset_request(void);
Gerd Hoffmann's avatar
Gerd Hoffmann committed
48 49 50 51 52
void qemu_system_suspend_request(void);
void qemu_register_suspend_notifier(Notifier *notifier);
void qemu_system_wakeup_request(WakeupReason reason);
void qemu_system_wakeup_enable(WakeupReason reason, bool enabled);
void qemu_register_wakeup_notifier(Notifier *notifier);
pbrook's avatar
pbrook committed
53 54
void qemu_system_shutdown_request(void);
void qemu_system_powerdown_request(void);
55
void qemu_system_debug_request(void);
56
void qemu_system_vmstop_request(RunState reason);
57 58
int qemu_shutdown_requested_get(void);
int qemu_reset_requested_get(void);
aurel32's avatar
aurel32 committed
59 60 61
int qemu_shutdown_requested(void);
int qemu_reset_requested(void);
int qemu_powerdown_requested(void);
62 63
void qemu_system_killed(int signal, pid_t pid);
void qemu_kill_report(void);
64
extern qemu_irq qemu_system_powerdown;
Jan Kiszka's avatar
Jan Kiszka committed
65
void qemu_system_reset(bool report);
pbrook's avatar
pbrook committed
66

Gerd Hoffmann's avatar
Gerd Hoffmann committed
67 68 69
void qemu_add_exit_notifier(Notifier *notify);
void qemu_remove_exit_notifier(Notifier *notify);

70 71
void qemu_add_machine_init_done_notifier(Notifier *notify);

72
void do_savevm(Monitor *mon, const QDict *qdict);
73
int load_vmstate(const char *name);
74
void do_delvm(Monitor *mon, const QDict *qdict);
aliguori's avatar
aliguori committed
75
void do_info_snapshots(Monitor *mon);
pbrook's avatar
pbrook committed
76

77 78
void qemu_announce_self(void);

Luiz Capitulino's avatar
Luiz Capitulino committed
79
bool qemu_savevm_state_blocked(Error **errp);
80 81 82 83
int qemu_savevm_state_begin(QEMUFile *f, int blk_enable, int shared);
int qemu_savevm_state_iterate(QEMUFile *f);
int qemu_savevm_state_complete(QEMUFile *f);
void qemu_savevm_state_cancel(QEMUFile *f);
aliguori's avatar
aliguori committed
84 85
int qemu_loadvm_state(QEMUFile *f);

pbrook's avatar
pbrook committed
86
/* SLIRP */
aliguori's avatar
aliguori committed
87
void do_info_slirp(Monitor *mon);
pbrook's avatar
pbrook committed
88

89 90 91 92 93 94
typedef enum DisplayType
{
    DT_DEFAULT,
    DT_CURSES,
    DT_SDL,
    DT_NOGRAPHIC,
Jes Sorensen's avatar
Jes Sorensen committed
95
    DT_NONE,
96 97
} DisplayType;

Paolo Bonzini's avatar
Paolo Bonzini committed
98
extern int autostart;
pbrook's avatar
pbrook committed
99
extern int bios_size;
100 101

typedef enum {
Gerd Hoffmann's avatar
Gerd Hoffmann committed
102
    VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL,
103 104 105 106 107 108 109
} VGAInterfaceType;

extern int vga_interface_type;
#define cirrus_vga_enabled (vga_interface_type == VGA_CIRRUS)
#define std_vga_enabled (vga_interface_type == VGA_STD)
#define xenfb_enabled (vga_interface_type == VGA_XENFB)
#define vmsvga_enabled (vga_interface_type == VGA_VMWARE)
Gerd Hoffmann's avatar
Gerd Hoffmann committed
110
#define qxl_enabled (vga_interface_type == VGA_QXL)
111

pbrook's avatar
pbrook committed
112 113 114
extern int graphic_width;
extern int graphic_height;
extern int graphic_depth;
115
extern DisplayType display_type;
pbrook's avatar
pbrook committed
116 117 118
extern const char *keyboard_layout;
extern int win2k_install_hack;
extern int alt_grab;
119
extern int ctrl_grab;
pbrook's avatar
pbrook committed
120 121
extern int usb_enabled;
extern int smp_cpus;
122
extern int max_cpus;
pbrook's avatar
pbrook committed
123 124 125
extern int cursor_hide;
extern int graphic_rotate;
extern int no_quit;
126
extern int no_shutdown;
pbrook's avatar
pbrook committed
127 128
extern int semihosting_enabled;
extern int old_param;
129
extern int boot_menu;
wayne's avatar
wayne committed
130 131 132
extern uint8_t *boot_splash_filedata;
extern int boot_splash_filedata_size;
extern uint8_t qemu_extra_params_fw[2];
Jan Kiszka's avatar
Jan Kiszka committed
133
extern QEMUClock *rtc_clock;
pbrook's avatar
pbrook committed
134

135 136 137
#define MAX_NODES 64
extern int nb_numa_nodes;
extern uint64_t node_mem[MAX_NODES];
138
extern uint64_t node_cpumask[MAX_NODES];
139

pbrook's avatar
pbrook committed
140
#define MAX_OPTION_ROMS 16
141 142 143 144 145
typedef struct QEMUOptionRom {
    const char *name;
    int32_t bootindex;
} QEMUOptionRom;
extern QEMUOptionRom option_rom[MAX_OPTION_ROMS];
pbrook's avatar
pbrook committed
146 147 148 149 150 151
extern int nb_option_roms;

#define MAX_PROM_ENVS 128
extern const char *prom_envs[MAX_PROM_ENVS];
extern unsigned int nb_prom_envs;

152
/* pci-hotplug */
153
void pci_device_hot_add(Monitor *mon, const QDict *qdict);
154 155
int pci_drive_hot_add(Monitor *mon, const QDict *qdict,
                      DriveInfo *dinfo, int type);
156
void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict);
157

158 159 160
/* generic hotplug */
void drive_hot_add(Monitor *mon, const QDict *qdict);

161 162
/* pcie aer error injection */
void pcie_aer_inject_error_print(Monitor *mon, const QObject *data);
163
int do_pcie_aer_inject_error(Monitor *mon,
164 165
                             const QDict *qdict, QObject **ret_data);

pbrook's avatar
pbrook committed
166 167 168 169 170 171 172 173 174 175 176 177
/* serial ports */

#define MAX_SERIAL_PORTS 4

extern CharDriverState *serial_hds[MAX_SERIAL_PORTS];

/* parallel ports */

#define MAX_PARALLEL_PORTS 3

extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];

178 179
void do_usb_add(Monitor *mon, const QDict *qdict);
void do_usb_del(Monitor *mon, const QDict *qdict);
aliguori's avatar
aliguori committed
180
void usb_info(Monitor *mon);
pbrook's avatar
pbrook committed
181

182 183
void rtc_change_mon_event(struct tm *tm);

Paul Brook's avatar
Paul Brook committed
184 185
void register_devices(void);

186 187
void add_boot_device_path(int32_t bootindex, DeviceState *dev,
                          const char *suffix);
188
char *get_boot_devices_list(uint32_t *size);
pbrook's avatar
pbrook committed
189
#endif