sysemu.h 5.1 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 41 42 43

void qemu_system_reset_request(void);
void qemu_system_shutdown_request(void);
void qemu_system_powerdown_request(void);
44
void qemu_system_debug_request(void);
45
void qemu_system_vmstop_request(RunState reason);
46 47
int qemu_shutdown_requested_get(void);
int qemu_reset_requested_get(void);
A
aurel32 已提交
48 49 50
int qemu_shutdown_requested(void);
int qemu_reset_requested(void);
int qemu_powerdown_requested(void);
51 52
void qemu_system_killed(int signal, pid_t pid);
void qemu_kill_report(void);
B
Blue Swirl 已提交
53
extern qemu_irq qemu_system_powerdown;
J
Jan Kiszka 已提交
54
void qemu_system_reset(bool report);
P
pbrook 已提交
55

G
Gerd Hoffmann 已提交
56 57 58
void qemu_add_exit_notifier(Notifier *notify);
void qemu_remove_exit_notifier(Notifier *notify);

59 60
void qemu_add_machine_init_done_notifier(Notifier *notify);

61
void do_savevm(Monitor *mon, const QDict *qdict);
62
int load_vmstate(const char *name);
63
void do_delvm(Monitor *mon, const QDict *qdict);
A
aliguori 已提交
64
void do_info_snapshots(Monitor *mon);
P
pbrook 已提交
65

66 67
void qemu_announce_self(void);

A
Alex Williamson 已提交
68
bool qemu_savevm_state_blocked(Monitor *mon);
69 70 71 72 73
int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable,
                            int shared);
int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f);
int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f);
void qemu_savevm_state_cancel(Monitor *mon, QEMUFile *f);
A
aliguori 已提交
74 75
int qemu_loadvm_state(QEMUFile *f);

P
pbrook 已提交
76
/* SLIRP */
A
aliguori 已提交
77
void do_info_slirp(Monitor *mon);
P
pbrook 已提交
78

79 80 81 82 83 84
typedef enum DisplayType
{
    DT_DEFAULT,
    DT_CURSES,
    DT_SDL,
    DT_NOGRAPHIC,
J
Jes Sorensen 已提交
85
    DT_NONE,
86 87
} DisplayType;

P
Paolo Bonzini 已提交
88
extern int autostart;
P
pbrook 已提交
89
extern int bios_size;
90 91

typedef enum {
G
Gerd Hoffmann 已提交
92
    VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL,
93 94 95 96 97 98 99
} 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 已提交
100
#define qxl_enabled (vga_interface_type == VGA_QXL)
101

P
pbrook 已提交
102 103 104
extern int graphic_width;
extern int graphic_height;
extern int graphic_depth;
J
Jes Sorensen 已提交
105
extern uint8_t irq0override;
106
extern DisplayType display_type;
P
pbrook 已提交
107 108
extern const char *keyboard_layout;
extern int win2k_install_hack;
109
extern int rtc_td_hack;
P
pbrook 已提交
110
extern int alt_grab;
111
extern int ctrl_grab;
P
pbrook 已提交
112 113
extern int usb_enabled;
extern int smp_cpus;
114
extern int max_cpus;
P
pbrook 已提交
115 116 117
extern int cursor_hide;
extern int graphic_rotate;
extern int no_quit;
L
Luiz Capitulino 已提交
118
extern int no_shutdown;
P
pbrook 已提交
119 120
extern int semihosting_enabled;
extern int old_param;
121
extern int boot_menu;
W
wayne 已提交
122 123 124
extern uint8_t *boot_splash_filedata;
extern int boot_splash_filedata_size;
extern uint8_t qemu_extra_params_fw[2];
J
Jan Kiszka 已提交
125
extern QEMUClock *rtc_clock;
P
pbrook 已提交
126

127 128 129
#define MAX_NODES 64
extern int nb_numa_nodes;
extern uint64_t node_mem[MAX_NODES];
B
Blue Swirl 已提交
130
extern uint64_t node_cpumask[MAX_NODES];
131

P
pbrook 已提交
132
#define MAX_OPTION_ROMS 16
G
Gleb Natapov 已提交
133 134 135 136 137
typedef struct QEMUOptionRom {
    const char *name;
    int32_t bootindex;
} QEMUOptionRom;
extern QEMUOptionRom option_rom[MAX_OPTION_ROMS];
P
pbrook 已提交
138 139 140 141 142 143
extern int nb_option_roms;

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

144
/* pci-hotplug */
145
void pci_device_hot_add(Monitor *mon, const QDict *qdict);
146
void drive_hot_add(Monitor *mon, const QDict *qdict);
147
void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict);
148

149 150 151 152 153
/* pcie aer error injection */
void pcie_aer_inject_error_print(Monitor *mon, const QObject *data);
int do_pcie_aer_inejct_error(Monitor *mon,
                             const QDict *qdict, QObject **ret_data);

P
pbrook 已提交
154 155 156 157 158 159 160 161 162 163 164 165
/* 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];

166 167
void do_usb_add(Monitor *mon, const QDict *qdict);
void do_usb_del(Monitor *mon, const QDict *qdict);
A
aliguori 已提交
168
void usb_info(Monitor *mon);
P
pbrook 已提交
169

170 171
void rtc_change_mon_event(struct tm *tm);

P
Paul Brook 已提交
172 173
void register_devices(void);

174 175
void add_boot_device_path(int32_t bootindex, DeviceState *dev,
                          const char *suffix);
G
Gleb Natapov 已提交
176
char *get_boot_devices_list(uint32_t *size);
P
pbrook 已提交
177
#endif