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