sysemu.h 5.5 KB
Newer Older
P
pbrook 已提交
1 2 3 4
#ifndef SYSEMU_H
#define SYSEMU_H
/* Misc. things related to the system emulator.  */

A
aliguori 已提交
5
#include "qemu-common.h"
6
#include "qemu-option.h"
B
Blue Swirl 已提交
7
#include "qemu-queue.h"
J
Jan Kiszka 已提交
8
#include "qemu-timer.h"
L
Luiz Capitulino 已提交
9
#include "qapi-types.h"
G
Gerd Hoffmann 已提交
10
#include "notify.h"
P
Paolo Bonzini 已提交
11
#include "main-loop.h"
A
aliguori 已提交
12

P
pbrook 已提交
13
/* vl.c */
14

P
pbrook 已提交
15
extern const char *bios_name;
P
Paul Brook 已提交
16

P
pbrook 已提交
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"
P
pbrook 已提交
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);
P
pbrook 已提交
26
typedef struct vm_change_state_entry VMChangeStateEntry;
27
typedef void VMChangeStateHandler(void *opaque, int running, RunState state);
P
pbrook 已提交
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);
J
Jan Kiszka 已提交
33

J
Jan Kiszka 已提交
34 35 36
#define VMRESET_SILENT   false
#define VMRESET_REPORT   true

P
pbrook 已提交
37
void vm_start(void);
38
void vm_stop(RunState state);
39
void vm_stop_force_state(RunState state);
P
pbrook 已提交
40

G
Gerd Hoffmann 已提交
41 42
typedef enum WakeupReason {
    QEMU_WAKEUP_REASON_OTHER = 0,
43
    QEMU_WAKEUP_REASON_RTC,
44
    QEMU_WAKEUP_REASON_PMTIMER,
G
Gerd Hoffmann 已提交
45 46
} WakeupReason;

P
pbrook 已提交
47
void qemu_system_reset_request(void);
G
Gerd Hoffmann 已提交
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);
P
pbrook 已提交
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);
A
aurel32 已提交
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);
B
Blue Swirl 已提交
64
extern qemu_irq qemu_system_powerdown;
J
Jan Kiszka 已提交
65
void qemu_system_reset(bool report);
P
pbrook 已提交
66

G
Gerd Hoffmann 已提交
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);
A
aliguori 已提交
75
void do_info_snapshots(Monitor *mon);
P
pbrook 已提交
76

77 78
void qemu_announce_self(void);

L
Luiz Capitulino 已提交
79
bool qemu_savevm_state_blocked(Error **errp);
I
Isaku Yamahata 已提交
80 81
int qemu_savevm_state_begin(QEMUFile *f,
                            const MigrationParams *params);
82 83 84
int qemu_savevm_state_iterate(QEMUFile *f);
int qemu_savevm_state_complete(QEMUFile *f);
void qemu_savevm_state_cancel(QEMUFile *f);
A
aliguori 已提交
85 86
int qemu_loadvm_state(QEMUFile *f);

P
pbrook 已提交
87
/* SLIRP */
A
aliguori 已提交
88
void do_info_slirp(Monitor *mon);
P
pbrook 已提交
89

90 91 92 93 94 95
typedef enum DisplayType
{
    DT_DEFAULT,
    DT_CURSES,
    DT_SDL,
    DT_NOGRAPHIC,
J
Jes Sorensen 已提交
96
    DT_NONE,
97 98
} DisplayType;

P
Paolo Bonzini 已提交
99
extern int autostart;
P
pbrook 已提交
100
extern int bios_size;
101 102

typedef enum {
G
Gerd Hoffmann 已提交
103
    VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL,
104 105 106 107 108 109 110
} 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)
G
Gerd Hoffmann 已提交
111
#define qxl_enabled (vga_interface_type == VGA_QXL)
112

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

136
#define MAX_NODES 64
137
#define MAX_CPUMASK_BITS 255
138 139
extern int nb_numa_nodes;
extern uint64_t node_mem[MAX_NODES];
140
extern unsigned long *node_cpumask[MAX_NODES];
141

P
pbrook 已提交
142
#define MAX_OPTION_ROMS 16
G
Gleb Natapov 已提交
143 144 145 146 147
typedef struct QEMUOptionRom {
    const char *name;
    int32_t bootindex;
} QEMUOptionRom;
extern QEMUOptionRom option_rom[MAX_OPTION_ROMS];
P
pbrook 已提交
148 149 150 151 152 153
extern int nb_option_roms;

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

154
/* pci-hotplug */
155
void pci_device_hot_add(Monitor *mon, const QDict *qdict);
A
Alexander Graf 已提交
156 157
int pci_drive_hot_add(Monitor *mon, const QDict *qdict,
                      DriveInfo *dinfo, int type);
158
void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict);
159

A
Alexander Graf 已提交
160 161 162
/* generic hotplug */
void drive_hot_add(Monitor *mon, const QDict *qdict);

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

P
pbrook 已提交
168 169 170 171 172 173 174 175 176 177 178 179
/* 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];

180 181
void do_usb_add(Monitor *mon, const QDict *qdict);
void do_usb_del(Monitor *mon, const QDict *qdict);
A
aliguori 已提交
182
void usb_info(Monitor *mon);
P
pbrook 已提交
183

184 185
void rtc_change_mon_event(struct tm *tm);

P
Paul Brook 已提交
186 187
void register_devices(void);

188 189
void add_boot_device_path(int32_t bootindex, DeviceState *dev,
                          const char *suffix);
G
Gleb Natapov 已提交
190
char *get_boot_devices_list(uint32_t *size);
P
pbrook 已提交
191
#endif