root / sysemu.h @ d8bcbabf
History | View | Annotate | Download (7.2 kB)
1 | 87ecb68b | pbrook | #ifndef SYSEMU_H
|
---|---|---|---|
2 | 87ecb68b | pbrook | #define SYSEMU_H
|
3 | 87ecb68b | pbrook | /* Misc. things related to the system emulator. */
|
4 | 87ecb68b | pbrook | |
5 | 376253ec | aliguori | #include "qemu-common.h" |
6 | 62c5802e | Gerd Hoffmann | #include "qemu-option.h" |
7 | 72cf2d4f | Blue Swirl | #include "qemu-queue.h" |
8 | 6875204c | Jan Kiszka | #include "qemu-timer.h" |
9 | d54908a5 | Luiz Capitulino | #include "qdict.h" |
10 | 8204a918 | Luiz Capitulino | #include "qerror.h" |
11 | 376253ec | aliguori | |
12 | 49dc768d | aliguori | #ifdef _WIN32
|
13 | 49dc768d | aliguori | #include <windows.h> |
14 | 49dc768d | aliguori | #endif
|
15 | 49dc768d | aliguori | |
16 | 87ecb68b | pbrook | /* vl.c */
|
17 | 87ecb68b | pbrook | extern const char *bios_name; |
18 | 5cea8590 | Paul Brook | |
19 | 5cea8590 | Paul Brook | #define QEMU_FILE_TYPE_BIOS 0 |
20 | 5cea8590 | Paul Brook | #define QEMU_FILE_TYPE_KEYMAP 1 |
21 | 5cea8590 | Paul Brook | char *qemu_find_file(int type, const char *name); |
22 | 87ecb68b | pbrook | |
23 | 87ecb68b | pbrook | extern int vm_running; |
24 | 87ecb68b | pbrook | extern const char *qemu_name; |
25 | 8fcb1b90 | blueswir1 | extern uint8_t qemu_uuid[];
|
26 | c4be29ff | aliguori | int qemu_uuid_parse(const char *str, uint8_t *uuid); |
27 | 8fcb1b90 | blueswir1 | #define UUID_FMT "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx" |
28 | 87ecb68b | pbrook | |
29 | 87ecb68b | pbrook | typedef struct vm_change_state_entry VMChangeStateEntry; |
30 | 9781e040 | aliguori | typedef void VMChangeStateHandler(void *opaque, int running, int reason); |
31 | 87ecb68b | pbrook | |
32 | 87ecb68b | pbrook | VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb, |
33 | 87ecb68b | pbrook | void *opaque);
|
34 | 87ecb68b | pbrook | void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
|
35 | 87ecb68b | pbrook | |
36 | 87ecb68b | pbrook | void vm_start(void); |
37 | 87ecb68b | pbrook | void vm_stop(int reason); |
38 | 87ecb68b | pbrook | |
39 | 9f9e28cd | Glauber Costa | uint64_t ram_bytes_remaining(void);
|
40 | 9f9e28cd | Glauber Costa | uint64_t ram_bytes_transferred(void);
|
41 | 9f9e28cd | Glauber Costa | uint64_t ram_bytes_total(void);
|
42 | 9f9e28cd | Glauber Costa | |
43 | 87ecb68b | pbrook | int64_t cpu_get_ticks(void);
|
44 | 87ecb68b | pbrook | void cpu_enable_ticks(void); |
45 | 87ecb68b | pbrook | void cpu_disable_ticks(void); |
46 | 87ecb68b | pbrook | |
47 | 87ecb68b | pbrook | void qemu_system_reset_request(void); |
48 | 87ecb68b | pbrook | void qemu_system_shutdown_request(void); |
49 | 87ecb68b | pbrook | void qemu_system_powerdown_request(void); |
50 | cf7a2fe2 | aurel32 | int qemu_shutdown_requested(void); |
51 | cf7a2fe2 | aurel32 | int qemu_reset_requested(void); |
52 | cf7a2fe2 | aurel32 | int qemu_powerdown_requested(void); |
53 | d9c32310 | Blue Swirl | extern qemu_irq qemu_system_powerdown;
|
54 | cf7a2fe2 | aurel32 | void qemu_system_reset(void); |
55 | 87ecb68b | pbrook | |
56 | d54908a5 | Luiz Capitulino | void do_savevm(Monitor *mon, const QDict *qdict); |
57 | 05f2401e | Juan Quintela | int load_vmstate(Monitor *mon, const char *name); |
58 | d54908a5 | Luiz Capitulino | void do_delvm(Monitor *mon, const QDict *qdict); |
59 | 376253ec | aliguori | void do_info_snapshots(Monitor *mon);
|
60 | 87ecb68b | pbrook | |
61 | 210f41ba | aliguori | void qemu_announce_self(void); |
62 | 210f41ba | aliguori | |
63 | 87ecb68b | pbrook | void main_loop_wait(int timeout); |
64 | 87ecb68b | pbrook | |
65 | f327aa0c | Jan Kiszka | int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable, |
66 | f327aa0c | Jan Kiszka | int shared);
|
67 | f327aa0c | Jan Kiszka | int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f);
|
68 | f327aa0c | Jan Kiszka | int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f);
|
69 | f327aa0c | Jan Kiszka | void qemu_savevm_state_cancel(Monitor *mon, QEMUFile *f);
|
70 | 9366f418 | aliguori | int qemu_loadvm_state(QEMUFile *f);
|
71 | 9366f418 | aliguori | |
72 | ac7531ec | Gerd Hoffmann | void qemu_errors_to_file(FILE *fp);
|
73 | ac7531ec | Gerd Hoffmann | void qemu_errors_to_mon(Monitor *mon);
|
74 | ac7531ec | Gerd Hoffmann | void qemu_errors_to_previous(void); |
75 | ac7531ec | Gerd Hoffmann | void qemu_error(const char *fmt, ...) __attribute__ ((format(printf, 1, 2))); |
76 | 8204a918 | Luiz Capitulino | void qemu_error_internal(const char *file, int linenr, const char *func, |
77 | 8204a918 | Luiz Capitulino | const char *fmt, ...) |
78 | 8204a918 | Luiz Capitulino | __attribute__ ((format(printf, 4, 5))); |
79 | 8204a918 | Luiz Capitulino | |
80 | 8204a918 | Luiz Capitulino | #define qemu_error_new(fmt, ...) \
|
81 | 8204a918 | Luiz Capitulino | qemu_error_internal(__FILE__, __LINE__, __func__, fmt, ## __VA_ARGS__) |
82 | ac7531ec | Gerd Hoffmann | |
83 | 56f3a5d0 | aliguori | #ifdef _WIN32
|
84 | 87ecb68b | pbrook | /* Polling handling */
|
85 | 87ecb68b | pbrook | |
86 | 87ecb68b | pbrook | /* return TRUE if no sleep should be done afterwards */
|
87 | 87ecb68b | pbrook | typedef int PollingFunc(void *opaque); |
88 | 87ecb68b | pbrook | |
89 | 87ecb68b | pbrook | int qemu_add_polling_cb(PollingFunc *func, void *opaque); |
90 | 87ecb68b | pbrook | void qemu_del_polling_cb(PollingFunc *func, void *opaque); |
91 | 87ecb68b | pbrook | |
92 | 87ecb68b | pbrook | /* Wait objects handling */
|
93 | 87ecb68b | pbrook | typedef void WaitObjectFunc(void *opaque); |
94 | 87ecb68b | pbrook | |
95 | 87ecb68b | pbrook | int qemu_add_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque); |
96 | 87ecb68b | pbrook | void qemu_del_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque); |
97 | 87ecb68b | pbrook | #endif
|
98 | 87ecb68b | pbrook | |
99 | 87ecb68b | pbrook | /* SLIRP */
|
100 | 376253ec | aliguori | void do_info_slirp(Monitor *mon);
|
101 | 87ecb68b | pbrook | |
102 | 993fbfdb | Anthony Liguori | typedef enum DisplayType |
103 | 993fbfdb | Anthony Liguori | { |
104 | 993fbfdb | Anthony Liguori | DT_DEFAULT, |
105 | 993fbfdb | Anthony Liguori | DT_CURSES, |
106 | 993fbfdb | Anthony Liguori | DT_SDL, |
107 | 993fbfdb | Anthony Liguori | DT_VNC, |
108 | 993fbfdb | Anthony Liguori | DT_NOGRAPHIC, |
109 | 993fbfdb | Anthony Liguori | } DisplayType; |
110 | 993fbfdb | Anthony Liguori | |
111 | d399f677 | Paolo Bonzini | extern int autostart; |
112 | 87ecb68b | pbrook | extern int bios_size; |
113 | 86176759 | Zachary Amsden | |
114 | 86176759 | Zachary Amsden | typedef enum { |
115 | 86176759 | Zachary Amsden | VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB |
116 | 86176759 | Zachary Amsden | } VGAInterfaceType; |
117 | 86176759 | Zachary Amsden | |
118 | 86176759 | Zachary Amsden | extern int vga_interface_type; |
119 | 86176759 | Zachary Amsden | #define cirrus_vga_enabled (vga_interface_type == VGA_CIRRUS)
|
120 | 86176759 | Zachary Amsden | #define std_vga_enabled (vga_interface_type == VGA_STD)
|
121 | 86176759 | Zachary Amsden | #define xenfb_enabled (vga_interface_type == VGA_XENFB)
|
122 | 86176759 | Zachary Amsden | #define vmsvga_enabled (vga_interface_type == VGA_VMWARE)
|
123 | 86176759 | Zachary Amsden | |
124 | 87ecb68b | pbrook | extern int graphic_width; |
125 | 87ecb68b | pbrook | extern int graphic_height; |
126 | 87ecb68b | pbrook | extern int graphic_depth; |
127 | 6b35e7bf | Jes Sorensen | extern uint8_t irq0override;
|
128 | 993fbfdb | Anthony Liguori | extern DisplayType display_type;
|
129 | 87ecb68b | pbrook | extern const char *keyboard_layout; |
130 | 87ecb68b | pbrook | extern int win2k_install_hack; |
131 | 73822ec8 | aliguori | extern int rtc_td_hack; |
132 | 87ecb68b | pbrook | extern int alt_grab; |
133 | 0ca9f8a4 | Dustin Kirkland | extern int ctrl_grab; |
134 | 87ecb68b | pbrook | extern int usb_enabled; |
135 | 87ecb68b | pbrook | extern int smp_cpus; |
136 | 6be68d7e | Jes Sorensen | extern int max_cpus; |
137 | 87ecb68b | pbrook | extern int cursor_hide; |
138 | 87ecb68b | pbrook | extern int graphic_rotate; |
139 | 87ecb68b | pbrook | extern int no_quit; |
140 | 87ecb68b | pbrook | extern int semihosting_enabled; |
141 | 87ecb68b | pbrook | extern int old_param; |
142 | 95387491 | Jan Kiszka | extern int boot_menu; |
143 | 6875204c | Jan Kiszka | extern QEMUClock *rtc_clock;
|
144 | 87ecb68b | pbrook | |
145 | 268a362c | aliguori | #define MAX_NODES 64 |
146 | 268a362c | aliguori | extern int nb_numa_nodes; |
147 | 268a362c | aliguori | extern uint64_t node_mem[MAX_NODES];
|
148 | 075cd324 | Blue Swirl | extern uint64_t node_cpumask[MAX_NODES];
|
149 | 268a362c | aliguori | |
150 | 87ecb68b | pbrook | #define MAX_OPTION_ROMS 16 |
151 | 87ecb68b | pbrook | extern const char *option_rom[MAX_OPTION_ROMS]; |
152 | 87ecb68b | pbrook | extern int nb_option_roms; |
153 | 87ecb68b | pbrook | |
154 | 1ad2134f | Paul Brook | #ifdef NEED_CPU_H
|
155 | 95efd11c | blueswir1 | #if defined(TARGET_SPARC) || defined(TARGET_PPC)
|
156 | 87ecb68b | pbrook | #define MAX_PROM_ENVS 128 |
157 | 87ecb68b | pbrook | extern const char *prom_envs[MAX_PROM_ENVS]; |
158 | 87ecb68b | pbrook | extern unsigned int nb_prom_envs; |
159 | 87ecb68b | pbrook | #endif
|
160 | 1ad2134f | Paul Brook | #endif
|
161 | 87ecb68b | pbrook | |
162 | e4bcb14c | ths | typedef enum { |
163 | a8659e90 | Gerd Hoffmann | IF_NONE, |
164 | aae9460e | Paul Brook | IF_IDE, IF_SCSI, IF_FLOPPY, IF_PFLASH, IF_MTD, IF_SD, IF_VIRTIO, IF_XEN, |
165 | aae9460e | Paul Brook | IF_COUNT |
166 | e4bcb14c | ths | } BlockInterfaceType; |
167 | e4bcb14c | ths | |
168 | 428c5705 | aliguori | typedef enum { |
169 | 428c5705 | aliguori | BLOCK_ERR_REPORT, BLOCK_ERR_IGNORE, BLOCK_ERR_STOP_ENOSPC, |
170 | 428c5705 | aliguori | BLOCK_ERR_STOP_ANY |
171 | 428c5705 | aliguori | } BlockInterfaceErrorAction; |
172 | 428c5705 | aliguori | |
173 | bf011293 | john cooper | #define BLOCK_SERIAL_STRLEN 20 |
174 | bf011293 | john cooper | |
175 | e4bcb14c | ths | typedef struct DriveInfo { |
176 | e4bcb14c | ths | BlockDriverState *bdrv; |
177 | 1dae12e6 | Gerd Hoffmann | char *id;
|
178 | c2cc47a4 | Markus Armbruster | const char *devaddr; |
179 | f60d39bc | ths | BlockInterfaceType type; |
180 | e4bcb14c | ths | int bus;
|
181 | e4bcb14c | ths | int unit;
|
182 | 9dfd7c7a | Gerd Hoffmann | QemuOpts *opts; |
183 | e9b2e818 | Kevin Wolf | BlockInterfaceErrorAction on_read_error; |
184 | f7850099 | Kevin Wolf | BlockInterfaceErrorAction on_write_error; |
185 | bf011293 | john cooper | char serial[BLOCK_SERIAL_STRLEN + 1]; |
186 | 72cf2d4f | Blue Swirl | QTAILQ_ENTRY(DriveInfo) next; |
187 | e4bcb14c | ths | } DriveInfo; |
188 | e4bcb14c | ths | |
189 | e4bcb14c | ths | #define MAX_IDE_DEVS 2 |
190 | e4bcb14c | ths | #define MAX_SCSI_DEVS 7 |
191 | e4bcb14c | ths | #define MAX_DRIVES 32 |
192 | e4bcb14c | ths | |
193 | 72cf2d4f | Blue Swirl | extern QTAILQ_HEAD(drivelist, DriveInfo) drives;
|
194 | 72cf2d4f | Blue Swirl | extern QTAILQ_HEAD(driveoptlist, DriveOpt) driveopts;
|
195 | e4bcb14c | ths | |
196 | 751c6a17 | Gerd Hoffmann | extern DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit); |
197 | 2e810b36 | Gerd Hoffmann | extern DriveInfo *drive_get_by_id(const char *id); |
198 | f60d39bc | ths | extern int drive_get_max_bus(BlockInterfaceType type); |
199 | 56a14938 | Gerd Hoffmann | extern void drive_uninit(DriveInfo *dinfo); |
200 | fa879c64 | aliguori | extern const char *drive_get_serial(BlockDriverState *bdrv); |
201 | f7850099 | Kevin Wolf | |
202 | f7850099 | Kevin Wolf | extern BlockInterfaceErrorAction drive_get_on_error(
|
203 | f7850099 | Kevin Wolf | BlockDriverState *bdrv, int is_read);
|
204 | 87ecb68b | pbrook | |
205 | aae9460e | Paul Brook | BlockDriverState *qdev_init_bdrv(DeviceState *dev, BlockInterfaceType type); |
206 | aae9460e | Paul Brook | |
207 | 9dfd7c7a | Gerd Hoffmann | extern QemuOpts *drive_add(const char *file, const char *fmt, ...); |
208 | 9dfd7c7a | Gerd Hoffmann | extern DriveInfo *drive_init(QemuOpts *arg, void *machine, int *fatal_error); |
209 | 4d73cd3b | aliguori | |
210 | 6f338c34 | aliguori | /* device-hotplug */
|
211 | 6f338c34 | aliguori | |
212 | 751c6a17 | Gerd Hoffmann | DriveInfo *add_init_drive(const char *opts); |
213 | 6f338c34 | aliguori | |
214 | 6f338c34 | aliguori | /* pci-hotplug */
|
215 | 7a344f7a | Luiz Capitulino | void pci_device_hot_add_print(Monitor *mon, const QObject *data); |
216 | 7a344f7a | Luiz Capitulino | void pci_device_hot_add(Monitor *mon, const QDict *qdict, QObject **ret_data); |
217 | f18c16de | Luiz Capitulino | void drive_hot_add(Monitor *mon, const QDict *qdict); |
218 | 376253ec | aliguori | void pci_device_hot_remove(Monitor *mon, const char *pci_addr); |
219 | 6848d827 | Luiz Capitulino | void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict, |
220 | 6848d827 | Luiz Capitulino | QObject **ret_data); |
221 | 6f338c34 | aliguori | |
222 | 87ecb68b | pbrook | /* serial ports */
|
223 | 87ecb68b | pbrook | |
224 | 87ecb68b | pbrook | #define MAX_SERIAL_PORTS 4 |
225 | 87ecb68b | pbrook | |
226 | 87ecb68b | pbrook | extern CharDriverState *serial_hds[MAX_SERIAL_PORTS];
|
227 | 87ecb68b | pbrook | |
228 | 87ecb68b | pbrook | /* parallel ports */
|
229 | 87ecb68b | pbrook | |
230 | 87ecb68b | pbrook | #define MAX_PARALLEL_PORTS 3 |
231 | 87ecb68b | pbrook | |
232 | 87ecb68b | pbrook | extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
|
233 | 87ecb68b | pbrook | |
234 | 9ede2fde | aliguori | /* virtio consoles */
|
235 | 9ede2fde | aliguori | |
236 | 9ede2fde | aliguori | #define MAX_VIRTIO_CONSOLES 1 |
237 | 9ede2fde | aliguori | |
238 | 9ede2fde | aliguori | extern CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES];
|
239 | 9ede2fde | aliguori | |
240 | 0e82f34d | aliguori | #define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR) |
241 | 0e82f34d | aliguori | |
242 | 87ecb68b | pbrook | #ifdef HAS_AUDIO
|
243 | 87ecb68b | pbrook | struct soundhw {
|
244 | 87ecb68b | pbrook | const char *name; |
245 | 87ecb68b | pbrook | const char *descr; |
246 | 87ecb68b | pbrook | int enabled;
|
247 | 87ecb68b | pbrook | int isa;
|
248 | 87ecb68b | pbrook | union {
|
249 | 22d83b14 | Paul Brook | int (*init_isa) (qemu_irq *pic);
|
250 | 22d83b14 | Paul Brook | int (*init_pci) (PCIBus *bus);
|
251 | 87ecb68b | pbrook | } init; |
252 | 87ecb68b | pbrook | }; |
253 | 87ecb68b | pbrook | |
254 | 87ecb68b | pbrook | extern struct soundhw soundhw[]; |
255 | 87ecb68b | pbrook | #endif
|
256 | 87ecb68b | pbrook | |
257 | d54908a5 | Luiz Capitulino | void do_usb_add(Monitor *mon, const QDict *qdict); |
258 | d54908a5 | Luiz Capitulino | void do_usb_del(Monitor *mon, const QDict *qdict); |
259 | 376253ec | aliguori | void usb_info(Monitor *mon);
|
260 | 87ecb68b | pbrook | |
261 | aae9460e | Paul Brook | void register_devices(void); |
262 | aae9460e | Paul Brook | |
263 | 87ecb68b | pbrook | #endif |