root / vl.h @ 67f36560
History | View | Annotate | Download (33.4 kB)
1 |
/*
|
---|---|
2 |
* QEMU System Emulator header
|
3 |
*
|
4 |
* Copyright (c) 2003 Fabrice Bellard
|
5 |
*
|
6 |
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 |
* of this software and associated documentation files (the "Software"), to deal
|
8 |
* in the Software without restriction, including without limitation the rights
|
9 |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 |
* copies of the Software, and to permit persons to whom the Software is
|
11 |
* furnished to do so, subject to the following conditions:
|
12 |
*
|
13 |
* The above copyright notice and this permission notice shall be included in
|
14 |
* all copies or substantial portions of the Software.
|
15 |
*
|
16 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
19 |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22 |
* THE SOFTWARE.
|
23 |
*/
|
24 |
#ifndef VL_H
|
25 |
#define VL_H
|
26 |
|
27 |
/* we put basic includes here to avoid repeating them in device drivers */
|
28 |
#include <stdlib.h> |
29 |
#include <stdio.h> |
30 |
#include <stdarg.h> |
31 |
#include <string.h> |
32 |
#include <inttypes.h> |
33 |
#include <limits.h> |
34 |
#include <time.h> |
35 |
#include <ctype.h> |
36 |
#include <errno.h> |
37 |
#include <unistd.h> |
38 |
#include <fcntl.h> |
39 |
#include <sys/stat.h> |
40 |
#include "audio/audio.h" |
41 |
|
42 |
#ifndef O_LARGEFILE
|
43 |
#define O_LARGEFILE 0 |
44 |
#endif
|
45 |
#ifndef O_BINARY
|
46 |
#define O_BINARY 0 |
47 |
#endif
|
48 |
|
49 |
#ifdef _WIN32
|
50 |
#define lseek _lseeki64
|
51 |
#define ENOTSUP 4096 |
52 |
/* XXX: find 64 bit version */
|
53 |
#define ftruncate chsize
|
54 |
|
55 |
static inline char *realpath(const char *path, char *resolved_path) |
56 |
{ |
57 |
_fullpath(resolved_path, path, _MAX_PATH); |
58 |
return resolved_path;
|
59 |
} |
60 |
#endif
|
61 |
|
62 |
#ifdef QEMU_TOOL
|
63 |
|
64 |
/* we use QEMU_TOOL in the command line tools which do not depend on
|
65 |
the target CPU type */
|
66 |
#include "config-host.h" |
67 |
#include <setjmp.h> |
68 |
#include "osdep.h" |
69 |
#include "bswap.h" |
70 |
|
71 |
#else
|
72 |
|
73 |
#include "cpu.h" |
74 |
#include "gdbstub.h" |
75 |
|
76 |
#endif /* !defined(QEMU_TOOL) */ |
77 |
|
78 |
#ifndef glue
|
79 |
#define xglue(x, y) x ## y |
80 |
#define glue(x, y) xglue(x, y)
|
81 |
#define stringify(s) tostring(s)
|
82 |
#define tostring(s) #s |
83 |
#endif
|
84 |
|
85 |
#ifndef MIN
|
86 |
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
87 |
#endif
|
88 |
#ifndef MAX
|
89 |
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
90 |
#endif
|
91 |
|
92 |
/* vl.c */
|
93 |
uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c); |
94 |
|
95 |
void hw_error(const char *fmt, ...); |
96 |
|
97 |
extern const char *bios_dir; |
98 |
|
99 |
void pstrcpy(char *buf, int buf_size, const char *str); |
100 |
char *pstrcat(char *buf, int buf_size, const char *s); |
101 |
int strstart(const char *str, const char *val, const char **ptr); |
102 |
|
103 |
extern int vm_running; |
104 |
|
105 |
typedef struct vm_change_state_entry VMChangeStateEntry; |
106 |
typedef void VMChangeStateHandler(void *opaque, int running); |
107 |
typedef void VMStopHandler(void *opaque, int reason); |
108 |
|
109 |
VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb, |
110 |
void *opaque);
|
111 |
void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
|
112 |
|
113 |
int qemu_add_vm_stop_handler(VMStopHandler *cb, void *opaque); |
114 |
void qemu_del_vm_stop_handler(VMStopHandler *cb, void *opaque); |
115 |
|
116 |
void vm_start(void); |
117 |
void vm_stop(int reason); |
118 |
|
119 |
typedef void QEMUResetHandler(void *opaque); |
120 |
|
121 |
void qemu_register_reset(QEMUResetHandler *func, void *opaque); |
122 |
void qemu_system_reset_request(void); |
123 |
void qemu_system_shutdown_request(void); |
124 |
void qemu_system_powerdown_request(void); |
125 |
#if !defined(TARGET_SPARC)
|
126 |
// Please implement a power failure function to signal the OS
|
127 |
#define qemu_system_powerdown() do{}while(0) |
128 |
#else
|
129 |
void qemu_system_powerdown(void); |
130 |
#endif
|
131 |
|
132 |
void main_loop_wait(int timeout); |
133 |
|
134 |
extern int ram_size; |
135 |
extern int bios_size; |
136 |
extern int rtc_utc; |
137 |
extern int cirrus_vga_enabled; |
138 |
extern int graphic_width; |
139 |
extern int graphic_height; |
140 |
extern int graphic_depth; |
141 |
extern const char *keyboard_layout; |
142 |
extern int kqemu_allowed; |
143 |
extern int win2k_install_hack; |
144 |
extern int usb_enabled; |
145 |
extern int smp_cpus; |
146 |
|
147 |
/* XXX: make it dynamic */
|
148 |
#if defined (TARGET_PPC)
|
149 |
#define BIOS_SIZE ((512 + 32) * 1024) |
150 |
#elif defined(TARGET_MIPS)
|
151 |
#define BIOS_SIZE (128 * 1024) |
152 |
#else
|
153 |
#define BIOS_SIZE ((256 + 64) * 1024) |
154 |
#endif
|
155 |
|
156 |
/* keyboard/mouse support */
|
157 |
|
158 |
#define MOUSE_EVENT_LBUTTON 0x01 |
159 |
#define MOUSE_EVENT_RBUTTON 0x02 |
160 |
#define MOUSE_EVENT_MBUTTON 0x04 |
161 |
|
162 |
typedef void QEMUPutKBDEvent(void *opaque, int keycode); |
163 |
typedef void QEMUPutMouseEvent(void *opaque, int dx, int dy, int dz, int buttons_state); |
164 |
|
165 |
void qemu_add_kbd_event_handler(QEMUPutKBDEvent *func, void *opaque); |
166 |
void qemu_add_mouse_event_handler(QEMUPutMouseEvent *func, void *opaque, int absolute); |
167 |
|
168 |
void kbd_put_keycode(int keycode); |
169 |
void kbd_mouse_event(int dx, int dy, int dz, int buttons_state); |
170 |
int kbd_mouse_is_absolute(void); |
171 |
|
172 |
/* keysym is a unicode code except for special keys (see QEMU_KEY_xxx
|
173 |
constants) */
|
174 |
#define QEMU_KEY_ESC1(c) ((c) | 0xe100) |
175 |
#define QEMU_KEY_BACKSPACE 0x007f |
176 |
#define QEMU_KEY_UP QEMU_KEY_ESC1('A') |
177 |
#define QEMU_KEY_DOWN QEMU_KEY_ESC1('B') |
178 |
#define QEMU_KEY_RIGHT QEMU_KEY_ESC1('C') |
179 |
#define QEMU_KEY_LEFT QEMU_KEY_ESC1('D') |
180 |
#define QEMU_KEY_HOME QEMU_KEY_ESC1(1) |
181 |
#define QEMU_KEY_END QEMU_KEY_ESC1(4) |
182 |
#define QEMU_KEY_PAGEUP QEMU_KEY_ESC1(5) |
183 |
#define QEMU_KEY_PAGEDOWN QEMU_KEY_ESC1(6) |
184 |
#define QEMU_KEY_DELETE QEMU_KEY_ESC1(3) |
185 |
|
186 |
#define QEMU_KEY_CTRL_UP 0xe400 |
187 |
#define QEMU_KEY_CTRL_DOWN 0xe401 |
188 |
#define QEMU_KEY_CTRL_LEFT 0xe402 |
189 |
#define QEMU_KEY_CTRL_RIGHT 0xe403 |
190 |
#define QEMU_KEY_CTRL_HOME 0xe404 |
191 |
#define QEMU_KEY_CTRL_END 0xe405 |
192 |
#define QEMU_KEY_CTRL_PAGEUP 0xe406 |
193 |
#define QEMU_KEY_CTRL_PAGEDOWN 0xe407 |
194 |
|
195 |
void kbd_put_keysym(int keysym); |
196 |
|
197 |
/* async I/O support */
|
198 |
|
199 |
typedef void IOReadHandler(void *opaque, const uint8_t *buf, int size); |
200 |
typedef int IOCanRWHandler(void *opaque); |
201 |
typedef void IOHandler(void *opaque); |
202 |
|
203 |
int qemu_set_fd_handler2(int fd, |
204 |
IOCanRWHandler *fd_read_poll, |
205 |
IOHandler *fd_read, |
206 |
IOHandler *fd_write, |
207 |
void *opaque);
|
208 |
int qemu_set_fd_handler(int fd, |
209 |
IOHandler *fd_read, |
210 |
IOHandler *fd_write, |
211 |
void *opaque);
|
212 |
|
213 |
/* Polling handling */
|
214 |
|
215 |
/* return TRUE if no sleep should be done afterwards */
|
216 |
typedef int PollingFunc(void *opaque); |
217 |
|
218 |
int qemu_add_polling_cb(PollingFunc *func, void *opaque); |
219 |
void qemu_del_polling_cb(PollingFunc *func, void *opaque); |
220 |
|
221 |
/* character device */
|
222 |
|
223 |
#define CHR_EVENT_BREAK 0 /* serial break char */ |
224 |
#define CHR_EVENT_FOCUS 1 /* focus to this terminal (modal input needed) */ |
225 |
|
226 |
|
227 |
|
228 |
#define CHR_IOCTL_SERIAL_SET_PARAMS 1 |
229 |
typedef struct { |
230 |
int speed;
|
231 |
int parity;
|
232 |
int data_bits;
|
233 |
int stop_bits;
|
234 |
} QEMUSerialSetParams; |
235 |
|
236 |
#define CHR_IOCTL_SERIAL_SET_BREAK 2 |
237 |
|
238 |
#define CHR_IOCTL_PP_READ_DATA 3 |
239 |
#define CHR_IOCTL_PP_WRITE_DATA 4 |
240 |
#define CHR_IOCTL_PP_READ_CONTROL 5 |
241 |
#define CHR_IOCTL_PP_WRITE_CONTROL 6 |
242 |
#define CHR_IOCTL_PP_READ_STATUS 7 |
243 |
|
244 |
typedef void IOEventHandler(void *opaque, int event); |
245 |
|
246 |
typedef struct CharDriverState { |
247 |
int (*chr_write)(struct CharDriverState *s, const uint8_t *buf, int len); |
248 |
void (*chr_add_read_handler)(struct CharDriverState *s, |
249 |
IOCanRWHandler *fd_can_read, |
250 |
IOReadHandler *fd_read, void *opaque);
|
251 |
int (*chr_ioctl)(struct CharDriverState *s, int cmd, void *arg); |
252 |
IOEventHandler *chr_event; |
253 |
void (*chr_send_event)(struct CharDriverState *chr, int event); |
254 |
void (*chr_close)(struct CharDriverState *chr); |
255 |
void *opaque;
|
256 |
} CharDriverState; |
257 |
|
258 |
void qemu_chr_printf(CharDriverState *s, const char *fmt, ...); |
259 |
int qemu_chr_write(CharDriverState *s, const uint8_t *buf, int len); |
260 |
void qemu_chr_send_event(CharDriverState *s, int event); |
261 |
void qemu_chr_add_read_handler(CharDriverState *s,
|
262 |
IOCanRWHandler *fd_can_read, |
263 |
IOReadHandler *fd_read, void *opaque);
|
264 |
void qemu_chr_add_event_handler(CharDriverState *s, IOEventHandler *chr_event);
|
265 |
int qemu_chr_ioctl(CharDriverState *s, int cmd, void *arg); |
266 |
|
267 |
/* consoles */
|
268 |
|
269 |
typedef struct DisplayState DisplayState; |
270 |
typedef struct TextConsole TextConsole; |
271 |
|
272 |
typedef void (*vga_hw_update_ptr)(void *); |
273 |
typedef void (*vga_hw_invalidate_ptr)(void *); |
274 |
typedef void (*vga_hw_screen_dump_ptr)(void *, const char *); |
275 |
|
276 |
TextConsole *graphic_console_init(DisplayState *ds, vga_hw_update_ptr update, |
277 |
vga_hw_invalidate_ptr invalidate, |
278 |
vga_hw_screen_dump_ptr screen_dump, |
279 |
void *opaque);
|
280 |
void vga_hw_update(void); |
281 |
void vga_hw_invalidate(void); |
282 |
void vga_hw_screen_dump(const char *filename); |
283 |
|
284 |
int is_graphic_console(void); |
285 |
CharDriverState *text_console_init(DisplayState *ds); |
286 |
void console_select(unsigned int index); |
287 |
|
288 |
/* serial ports */
|
289 |
|
290 |
#define MAX_SERIAL_PORTS 4 |
291 |
|
292 |
extern CharDriverState *serial_hds[MAX_SERIAL_PORTS];
|
293 |
|
294 |
/* parallel ports */
|
295 |
|
296 |
#define MAX_PARALLEL_PORTS 3 |
297 |
|
298 |
extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
|
299 |
|
300 |
/* VLANs support */
|
301 |
|
302 |
typedef struct VLANClientState VLANClientState; |
303 |
|
304 |
struct VLANClientState {
|
305 |
IOReadHandler *fd_read; |
306 |
/* Packets may still be sent if this returns zero. It's used to
|
307 |
rate-limit the slirp code. */
|
308 |
IOCanRWHandler *fd_can_read; |
309 |
void *opaque;
|
310 |
struct VLANClientState *next;
|
311 |
struct VLANState *vlan;
|
312 |
char info_str[256]; |
313 |
}; |
314 |
|
315 |
typedef struct VLANState { |
316 |
int id;
|
317 |
VLANClientState *first_client; |
318 |
struct VLANState *next;
|
319 |
} VLANState; |
320 |
|
321 |
VLANState *qemu_find_vlan(int id);
|
322 |
VLANClientState *qemu_new_vlan_client(VLANState *vlan, |
323 |
IOReadHandler *fd_read, |
324 |
IOCanRWHandler *fd_can_read, |
325 |
void *opaque);
|
326 |
int qemu_can_send_packet(VLANClientState *vc);
|
327 |
void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size); |
328 |
void qemu_handler_true(void *opaque); |
329 |
|
330 |
void do_info_network(void); |
331 |
|
332 |
/* TAP win32 */
|
333 |
int tap_win32_init(VLANState *vlan, const char *ifname); |
334 |
void tap_win32_poll(void); |
335 |
|
336 |
/* NIC info */
|
337 |
|
338 |
#define MAX_NICS 8 |
339 |
|
340 |
typedef struct NICInfo { |
341 |
uint8_t macaddr[6];
|
342 |
const char *model; |
343 |
VLANState *vlan; |
344 |
} NICInfo; |
345 |
|
346 |
extern int nb_nics; |
347 |
extern NICInfo nd_table[MAX_NICS];
|
348 |
|
349 |
/* timers */
|
350 |
|
351 |
typedef struct QEMUClock QEMUClock; |
352 |
typedef struct QEMUTimer QEMUTimer; |
353 |
typedef void QEMUTimerCB(void *opaque); |
354 |
|
355 |
/* The real time clock should be used only for stuff which does not
|
356 |
change the virtual machine state, as it is run even if the virtual
|
357 |
machine is stopped. The real time clock has a frequency of 1000
|
358 |
Hz. */
|
359 |
extern QEMUClock *rt_clock;
|
360 |
|
361 |
/* The virtual clock is only run during the emulation. It is stopped
|
362 |
when the virtual machine is stopped. Virtual timers use a high
|
363 |
precision clock, usually cpu cycles (use ticks_per_sec). */
|
364 |
extern QEMUClock *vm_clock;
|
365 |
|
366 |
int64_t qemu_get_clock(QEMUClock *clock); |
367 |
|
368 |
QEMUTimer *qemu_new_timer(QEMUClock *clock, QEMUTimerCB *cb, void *opaque);
|
369 |
void qemu_free_timer(QEMUTimer *ts);
|
370 |
void qemu_del_timer(QEMUTimer *ts);
|
371 |
void qemu_mod_timer(QEMUTimer *ts, int64_t expire_time);
|
372 |
int qemu_timer_pending(QEMUTimer *ts);
|
373 |
|
374 |
extern int64_t ticks_per_sec;
|
375 |
extern int pit_min_timer_count; |
376 |
|
377 |
void cpu_enable_ticks(void); |
378 |
void cpu_disable_ticks(void); |
379 |
|
380 |
/* VM Load/Save */
|
381 |
|
382 |
typedef FILE QEMUFile;
|
383 |
|
384 |
void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size); |
385 |
void qemu_put_byte(QEMUFile *f, int v); |
386 |
void qemu_put_be16(QEMUFile *f, unsigned int v); |
387 |
void qemu_put_be32(QEMUFile *f, unsigned int v); |
388 |
void qemu_put_be64(QEMUFile *f, uint64_t v);
|
389 |
int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size); |
390 |
int qemu_get_byte(QEMUFile *f);
|
391 |
unsigned int qemu_get_be16(QEMUFile *f); |
392 |
unsigned int qemu_get_be32(QEMUFile *f); |
393 |
uint64_t qemu_get_be64(QEMUFile *f); |
394 |
|
395 |
static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv) |
396 |
{ |
397 |
qemu_put_be64(f, *pv); |
398 |
} |
399 |
|
400 |
static inline void qemu_put_be32s(QEMUFile *f, const uint32_t *pv) |
401 |
{ |
402 |
qemu_put_be32(f, *pv); |
403 |
} |
404 |
|
405 |
static inline void qemu_put_be16s(QEMUFile *f, const uint16_t *pv) |
406 |
{ |
407 |
qemu_put_be16(f, *pv); |
408 |
} |
409 |
|
410 |
static inline void qemu_put_8s(QEMUFile *f, const uint8_t *pv) |
411 |
{ |
412 |
qemu_put_byte(f, *pv); |
413 |
} |
414 |
|
415 |
static inline void qemu_get_be64s(QEMUFile *f, uint64_t *pv) |
416 |
{ |
417 |
*pv = qemu_get_be64(f); |
418 |
} |
419 |
|
420 |
static inline void qemu_get_be32s(QEMUFile *f, uint32_t *pv) |
421 |
{ |
422 |
*pv = qemu_get_be32(f); |
423 |
} |
424 |
|
425 |
static inline void qemu_get_be16s(QEMUFile *f, uint16_t *pv) |
426 |
{ |
427 |
*pv = qemu_get_be16(f); |
428 |
} |
429 |
|
430 |
static inline void qemu_get_8s(QEMUFile *f, uint8_t *pv) |
431 |
{ |
432 |
*pv = qemu_get_byte(f); |
433 |
} |
434 |
|
435 |
#if TARGET_LONG_BITS == 64 |
436 |
#define qemu_put_betl qemu_put_be64
|
437 |
#define qemu_get_betl qemu_get_be64
|
438 |
#define qemu_put_betls qemu_put_be64s
|
439 |
#define qemu_get_betls qemu_get_be64s
|
440 |
#else
|
441 |
#define qemu_put_betl qemu_put_be32
|
442 |
#define qemu_get_betl qemu_get_be32
|
443 |
#define qemu_put_betls qemu_put_be32s
|
444 |
#define qemu_get_betls qemu_get_be32s
|
445 |
#endif
|
446 |
|
447 |
int64_t qemu_ftell(QEMUFile *f); |
448 |
int64_t qemu_fseek(QEMUFile *f, int64_t pos, int whence);
|
449 |
|
450 |
typedef void SaveStateHandler(QEMUFile *f, void *opaque); |
451 |
typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id); |
452 |
|
453 |
int qemu_loadvm(const char *filename); |
454 |
int qemu_savevm(const char *filename); |
455 |
int register_savevm(const char *idstr, |
456 |
int instance_id,
|
457 |
int version_id,
|
458 |
SaveStateHandler *save_state, |
459 |
LoadStateHandler *load_state, |
460 |
void *opaque);
|
461 |
void qemu_get_timer(QEMUFile *f, QEMUTimer *ts);
|
462 |
void qemu_put_timer(QEMUFile *f, QEMUTimer *ts);
|
463 |
|
464 |
void cpu_save(QEMUFile *f, void *opaque); |
465 |
int cpu_load(QEMUFile *f, void *opaque, int version_id); |
466 |
|
467 |
/* block.c */
|
468 |
typedef struct BlockDriverState BlockDriverState; |
469 |
typedef struct BlockDriver BlockDriver; |
470 |
|
471 |
extern BlockDriver bdrv_raw;
|
472 |
extern BlockDriver bdrv_cow;
|
473 |
extern BlockDriver bdrv_qcow;
|
474 |
extern BlockDriver bdrv_vmdk;
|
475 |
extern BlockDriver bdrv_cloop;
|
476 |
extern BlockDriver bdrv_dmg;
|
477 |
extern BlockDriver bdrv_bochs;
|
478 |
extern BlockDriver bdrv_vpc;
|
479 |
extern BlockDriver bdrv_vvfat;
|
480 |
|
481 |
void bdrv_init(void); |
482 |
BlockDriver *bdrv_find_format(const char *format_name); |
483 |
int bdrv_create(BlockDriver *drv,
|
484 |
const char *filename, int64_t size_in_sectors, |
485 |
const char *backing_file, int flags); |
486 |
BlockDriverState *bdrv_new(const char *device_name); |
487 |
void bdrv_delete(BlockDriverState *bs);
|
488 |
int bdrv_open(BlockDriverState *bs, const char *filename, int snapshot); |
489 |
int bdrv_open2(BlockDriverState *bs, const char *filename, int snapshot, |
490 |
BlockDriver *drv); |
491 |
void bdrv_close(BlockDriverState *bs);
|
492 |
int bdrv_read(BlockDriverState *bs, int64_t sector_num,
|
493 |
uint8_t *buf, int nb_sectors);
|
494 |
int bdrv_write(BlockDriverState *bs, int64_t sector_num,
|
495 |
const uint8_t *buf, int nb_sectors); |
496 |
void bdrv_get_geometry(BlockDriverState *bs, int64_t *nb_sectors_ptr);
|
497 |
int bdrv_commit(BlockDriverState *bs);
|
498 |
void bdrv_set_boot_sector(BlockDriverState *bs, const uint8_t *data, int size); |
499 |
|
500 |
#define BDRV_TYPE_HD 0 |
501 |
#define BDRV_TYPE_CDROM 1 |
502 |
#define BDRV_TYPE_FLOPPY 2 |
503 |
#define BIOS_ATA_TRANSLATION_AUTO 0 |
504 |
#define BIOS_ATA_TRANSLATION_NONE 1 |
505 |
#define BIOS_ATA_TRANSLATION_LBA 2 |
506 |
|
507 |
void bdrv_set_geometry_hint(BlockDriverState *bs,
|
508 |
int cyls, int heads, int secs); |
509 |
void bdrv_set_type_hint(BlockDriverState *bs, int type); |
510 |
void bdrv_set_translation_hint(BlockDriverState *bs, int translation); |
511 |
void bdrv_get_geometry_hint(BlockDriverState *bs,
|
512 |
int *pcyls, int *pheads, int *psecs); |
513 |
int bdrv_get_type_hint(BlockDriverState *bs);
|
514 |
int bdrv_get_translation_hint(BlockDriverState *bs);
|
515 |
int bdrv_is_removable(BlockDriverState *bs);
|
516 |
int bdrv_is_read_only(BlockDriverState *bs);
|
517 |
int bdrv_is_inserted(BlockDriverState *bs);
|
518 |
int bdrv_is_locked(BlockDriverState *bs);
|
519 |
void bdrv_set_locked(BlockDriverState *bs, int locked); |
520 |
void bdrv_set_change_cb(BlockDriverState *bs,
|
521 |
void (*change_cb)(void *opaque), void *opaque); |
522 |
void bdrv_get_format(BlockDriverState *bs, char *buf, int buf_size); |
523 |
void bdrv_info(void); |
524 |
BlockDriverState *bdrv_find(const char *name); |
525 |
void bdrv_iterate(void (*it)(void *opaque, const char *name), void *opaque); |
526 |
int bdrv_is_encrypted(BlockDriverState *bs);
|
527 |
int bdrv_set_key(BlockDriverState *bs, const char *key); |
528 |
void bdrv_iterate_format(void (*it)(void *opaque, const char *name), |
529 |
void *opaque);
|
530 |
const char *bdrv_get_device_name(BlockDriverState *bs); |
531 |
|
532 |
int qcow_get_cluster_size(BlockDriverState *bs);
|
533 |
int qcow_compress_cluster(BlockDriverState *bs, int64_t sector_num,
|
534 |
const uint8_t *buf);
|
535 |
|
536 |
#ifndef QEMU_TOOL
|
537 |
|
538 |
typedef void QEMUMachineInitFunc(int ram_size, int vga_ram_size, |
539 |
int boot_device,
|
540 |
DisplayState *ds, const char **fd_filename, int snapshot, |
541 |
const char *kernel_filename, const char *kernel_cmdline, |
542 |
const char *initrd_filename); |
543 |
|
544 |
typedef struct QEMUMachine { |
545 |
const char *name; |
546 |
const char *desc; |
547 |
QEMUMachineInitFunc *init; |
548 |
struct QEMUMachine *next;
|
549 |
} QEMUMachine; |
550 |
|
551 |
int qemu_register_machine(QEMUMachine *m);
|
552 |
|
553 |
typedef void SetIRQFunc(void *opaque, int irq_num, int level); |
554 |
typedef void IRQRequestFunc(void *opaque, int level); |
555 |
|
556 |
/* ISA bus */
|
557 |
|
558 |
extern target_phys_addr_t isa_mem_base;
|
559 |
|
560 |
typedef void (IOPortWriteFunc)(void *opaque, uint32_t address, uint32_t data); |
561 |
typedef uint32_t (IOPortReadFunc)(void *opaque, uint32_t address); |
562 |
|
563 |
int register_ioport_read(int start, int length, int size, |
564 |
IOPortReadFunc *func, void *opaque);
|
565 |
int register_ioport_write(int start, int length, int size, |
566 |
IOPortWriteFunc *func, void *opaque);
|
567 |
void isa_unassign_ioport(int start, int length); |
568 |
|
569 |
/* PCI bus */
|
570 |
|
571 |
extern target_phys_addr_t pci_mem_base;
|
572 |
|
573 |
typedef struct PCIBus PCIBus; |
574 |
typedef struct PCIDevice PCIDevice; |
575 |
|
576 |
typedef void PCIConfigWriteFunc(PCIDevice *pci_dev, |
577 |
uint32_t address, uint32_t data, int len);
|
578 |
typedef uint32_t PCIConfigReadFunc(PCIDevice *pci_dev,
|
579 |
uint32_t address, int len);
|
580 |
typedef void PCIMapIORegionFunc(PCIDevice *pci_dev, int region_num, |
581 |
uint32_t addr, uint32_t size, int type);
|
582 |
|
583 |
#define PCI_ADDRESS_SPACE_MEM 0x00 |
584 |
#define PCI_ADDRESS_SPACE_IO 0x01 |
585 |
#define PCI_ADDRESS_SPACE_MEM_PREFETCH 0x08 |
586 |
|
587 |
typedef struct PCIIORegion { |
588 |
uint32_t addr; /* current PCI mapping address. -1 means not mapped */
|
589 |
uint32_t size; |
590 |
uint8_t type; |
591 |
PCIMapIORegionFunc *map_func; |
592 |
} PCIIORegion; |
593 |
|
594 |
#define PCI_ROM_SLOT 6 |
595 |
#define PCI_NUM_REGIONS 7 |
596 |
struct PCIDevice {
|
597 |
/* PCI config space */
|
598 |
uint8_t config[256];
|
599 |
|
600 |
/* the following fields are read only */
|
601 |
PCIBus *bus; |
602 |
int devfn;
|
603 |
char name[64]; |
604 |
PCIIORegion io_regions[PCI_NUM_REGIONS]; |
605 |
|
606 |
/* do not access the following fields */
|
607 |
PCIConfigReadFunc *config_read; |
608 |
PCIConfigWriteFunc *config_write; |
609 |
int irq_index;
|
610 |
}; |
611 |
|
612 |
PCIDevice *pci_register_device(PCIBus *bus, const char *name, |
613 |
int instance_size, int devfn, |
614 |
PCIConfigReadFunc *config_read, |
615 |
PCIConfigWriteFunc *config_write); |
616 |
|
617 |
void pci_register_io_region(PCIDevice *pci_dev, int region_num, |
618 |
uint32_t size, int type,
|
619 |
PCIMapIORegionFunc *map_func); |
620 |
|
621 |
void pci_set_irq(PCIDevice *pci_dev, int irq_num, int level); |
622 |
|
623 |
uint32_t pci_default_read_config(PCIDevice *d, |
624 |
uint32_t address, int len);
|
625 |
void pci_default_write_config(PCIDevice *d,
|
626 |
uint32_t address, uint32_t val, int len);
|
627 |
void generic_pci_save(QEMUFile* f, void *opaque); |
628 |
int generic_pci_load(QEMUFile* f, void *opaque, int version_id); |
629 |
|
630 |
extern struct PIIX3State *piix3_state; |
631 |
|
632 |
PCIBus *i440fx_init(void);
|
633 |
void piix3_init(PCIBus *bus);
|
634 |
void pci_bios_init(void); |
635 |
void pci_info(void); |
636 |
|
637 |
/* temporary: will be moved in platform specific file */
|
638 |
void pci_set_pic(PCIBus *bus, SetIRQFunc *set_irq, void *irq_opaque); |
639 |
PCIBus *pci_prep_init(void);
|
640 |
PCIBus *pci_grackle_init(uint32_t base); |
641 |
PCIBus *pci_pmac_init(void);
|
642 |
PCIBus *pci_apb_init(target_ulong special_base, target_ulong mem_base); |
643 |
|
644 |
void pci_nic_init(PCIBus *bus, NICInfo *nd);
|
645 |
|
646 |
/* openpic.c */
|
647 |
typedef struct openpic_t openpic_t; |
648 |
void openpic_set_irq(void *opaque, int n_IRQ, int level); |
649 |
openpic_t *openpic_init (PCIBus *bus, int *pmem_index, int nb_cpus, |
650 |
CPUState **envp); |
651 |
|
652 |
/* heathrow_pic.c */
|
653 |
typedef struct HeathrowPICS HeathrowPICS; |
654 |
void heathrow_pic_set_irq(void *opaque, int num, int level); |
655 |
HeathrowPICS *heathrow_pic_init(int *pmem_index);
|
656 |
|
657 |
#ifdef HAS_AUDIO
|
658 |
struct soundhw {
|
659 |
const char *name; |
660 |
const char *descr; |
661 |
int enabled;
|
662 |
int isa;
|
663 |
union {
|
664 |
int (*init_isa) (AudioState *s);
|
665 |
int (*init_pci) (PCIBus *bus, AudioState *s);
|
666 |
} init; |
667 |
}; |
668 |
|
669 |
extern struct soundhw soundhw[]; |
670 |
#endif
|
671 |
|
672 |
/* vga.c */
|
673 |
|
674 |
#define VGA_RAM_SIZE (4096 * 1024) |
675 |
|
676 |
struct DisplayState {
|
677 |
uint8_t *data; |
678 |
int linesize;
|
679 |
int depth;
|
680 |
int width;
|
681 |
int height;
|
682 |
void *opaque;
|
683 |
|
684 |
void (*dpy_update)(struct DisplayState *s, int x, int y, int w, int h); |
685 |
void (*dpy_resize)(struct DisplayState *s, int w, int h); |
686 |
void (*dpy_refresh)(struct DisplayState *s); |
687 |
void (*dpy_copy)(struct DisplayState *s, int src_x, int src_y, int dst_x, int dst_y, int w, int h); |
688 |
}; |
689 |
|
690 |
static inline void dpy_update(DisplayState *s, int x, int y, int w, int h) |
691 |
{ |
692 |
s->dpy_update(s, x, y, w, h); |
693 |
} |
694 |
|
695 |
static inline void dpy_resize(DisplayState *s, int w, int h) |
696 |
{ |
697 |
s->dpy_resize(s, w, h); |
698 |
} |
699 |
|
700 |
int vga_initialize(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base,
|
701 |
unsigned long vga_ram_offset, int vga_ram_size, |
702 |
unsigned long vga_bios_offset, int vga_bios_size); |
703 |
|
704 |
/* cirrus_vga.c */
|
705 |
void pci_cirrus_vga_init(PCIBus *bus, DisplayState *ds, uint8_t *vga_ram_base,
|
706 |
unsigned long vga_ram_offset, int vga_ram_size); |
707 |
void isa_cirrus_vga_init(DisplayState *ds, uint8_t *vga_ram_base,
|
708 |
unsigned long vga_ram_offset, int vga_ram_size); |
709 |
|
710 |
/* sdl.c */
|
711 |
void sdl_display_init(DisplayState *ds, int full_screen); |
712 |
|
713 |
/* cocoa.m */
|
714 |
void cocoa_display_init(DisplayState *ds, int full_screen); |
715 |
|
716 |
/* vnc.c */
|
717 |
void vnc_display_init(DisplayState *ds, int display); |
718 |
|
719 |
/* ide.c */
|
720 |
#define MAX_DISKS 4 |
721 |
|
722 |
extern BlockDriverState *bs_table[MAX_DISKS];
|
723 |
|
724 |
void isa_ide_init(int iobase, int iobase2, int irq, |
725 |
BlockDriverState *hd0, BlockDriverState *hd1); |
726 |
void pci_cmd646_ide_init(PCIBus *bus, BlockDriverState **hd_table,
|
727 |
int secondary_ide_enabled);
|
728 |
void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table);
|
729 |
int pmac_ide_init (BlockDriverState **hd_table,
|
730 |
SetIRQFunc *set_irq, void *irq_opaque, int irq); |
731 |
|
732 |
/* es1370.c */
|
733 |
int es1370_init (PCIBus *bus, AudioState *s);
|
734 |
|
735 |
/* sb16.c */
|
736 |
int SB16_init (AudioState *s);
|
737 |
|
738 |
/* adlib.c */
|
739 |
int Adlib_init (AudioState *s);
|
740 |
|
741 |
/* gus.c */
|
742 |
int GUS_init (AudioState *s);
|
743 |
|
744 |
/* dma.c */
|
745 |
typedef int (*DMA_transfer_handler) (void *opaque, int nchan, int pos, int size); |
746 |
int DMA_get_channel_mode (int nchan); |
747 |
int DMA_read_memory (int nchan, void *buf, int pos, int size); |
748 |
int DMA_write_memory (int nchan, void *buf, int pos, int size); |
749 |
void DMA_hold_DREQ (int nchan); |
750 |
void DMA_release_DREQ (int nchan); |
751 |
void DMA_schedule(int nchan); |
752 |
void DMA_run (void); |
753 |
void DMA_init (int high_page_enable); |
754 |
void DMA_register_channel (int nchan, |
755 |
DMA_transfer_handler transfer_handler, |
756 |
void *opaque);
|
757 |
/* fdc.c */
|
758 |
#define MAX_FD 2 |
759 |
extern BlockDriverState *fd_table[MAX_FD];
|
760 |
|
761 |
typedef struct fdctrl_t fdctrl_t; |
762 |
|
763 |
fdctrl_t *fdctrl_init (int irq_lvl, int dma_chann, int mem_mapped, |
764 |
uint32_t io_base, |
765 |
BlockDriverState **fds); |
766 |
int fdctrl_get_drive_type(fdctrl_t *fdctrl, int drive_num); |
767 |
|
768 |
/* ne2000.c */
|
769 |
|
770 |
void isa_ne2000_init(int base, int irq, NICInfo *nd); |
771 |
void pci_ne2000_init(PCIBus *bus, NICInfo *nd);
|
772 |
|
773 |
/* rtl8139.c */
|
774 |
|
775 |
void pci_rtl8139_init(PCIBus *bus, NICInfo *nd);
|
776 |
|
777 |
/* pckbd.c */
|
778 |
|
779 |
void kbd_init(void); |
780 |
|
781 |
/* mc146818rtc.c */
|
782 |
|
783 |
typedef struct RTCState RTCState; |
784 |
|
785 |
RTCState *rtc_init(int base, int irq); |
786 |
void rtc_set_memory(RTCState *s, int addr, int val); |
787 |
void rtc_set_date(RTCState *s, const struct tm *tm); |
788 |
|
789 |
/* serial.c */
|
790 |
|
791 |
typedef struct SerialState SerialState; |
792 |
SerialState *serial_init(SetIRQFunc *set_irq, void *opaque,
|
793 |
int base, int irq, CharDriverState *chr); |
794 |
SerialState *serial_mm_init (SetIRQFunc *set_irq, void *opaque,
|
795 |
target_ulong base, int it_shift,
|
796 |
int irq, CharDriverState *chr);
|
797 |
|
798 |
/* parallel.c */
|
799 |
|
800 |
typedef struct ParallelState ParallelState; |
801 |
ParallelState *parallel_init(int base, int irq, CharDriverState *chr); |
802 |
|
803 |
/* i8259.c */
|
804 |
|
805 |
typedef struct PicState2 PicState2; |
806 |
extern PicState2 *isa_pic;
|
807 |
void pic_set_irq(int irq, int level); |
808 |
void pic_set_irq_new(void *opaque, int irq, int level); |
809 |
PicState2 *pic_init(IRQRequestFunc *irq_request, void *irq_request_opaque);
|
810 |
void pic_set_alt_irq_func(PicState2 *s, SetIRQFunc *alt_irq_func,
|
811 |
void *alt_irq_opaque);
|
812 |
int pic_read_irq(PicState2 *s);
|
813 |
void pic_update_irq(PicState2 *s);
|
814 |
uint32_t pic_intack_read(PicState2 *s); |
815 |
void pic_info(void); |
816 |
void irq_info(void); |
817 |
|
818 |
/* APIC */
|
819 |
typedef struct IOAPICState IOAPICState; |
820 |
|
821 |
int apic_init(CPUState *env);
|
822 |
int apic_get_interrupt(CPUState *env);
|
823 |
IOAPICState *ioapic_init(void);
|
824 |
void ioapic_set_irq(void *opaque, int vector, int level); |
825 |
|
826 |
/* i8254.c */
|
827 |
|
828 |
#define PIT_FREQ 1193182 |
829 |
|
830 |
typedef struct PITState PITState; |
831 |
|
832 |
PITState *pit_init(int base, int irq); |
833 |
void pit_set_gate(PITState *pit, int channel, int val); |
834 |
int pit_get_gate(PITState *pit, int channel); |
835 |
int pit_get_initial_count(PITState *pit, int channel); |
836 |
int pit_get_mode(PITState *pit, int channel); |
837 |
int pit_get_out(PITState *pit, int channel, int64_t current_time); |
838 |
|
839 |
/* pcspk.c */
|
840 |
void pcspk_init(PITState *);
|
841 |
int pcspk_audio_init(AudioState *);
|
842 |
|
843 |
/* acpi.c */
|
844 |
extern int acpi_enabled; |
845 |
void piix4_pm_init(PCIBus *bus);
|
846 |
void acpi_bios_init(void); |
847 |
|
848 |
/* pc.c */
|
849 |
extern QEMUMachine pc_machine;
|
850 |
extern QEMUMachine isapc_machine;
|
851 |
|
852 |
void ioport_set_a20(int enable); |
853 |
int ioport_get_a20(void); |
854 |
|
855 |
/* ppc.c */
|
856 |
extern QEMUMachine prep_machine;
|
857 |
extern QEMUMachine core99_machine;
|
858 |
extern QEMUMachine heathrow_machine;
|
859 |
|
860 |
/* mips_r4k.c */
|
861 |
extern QEMUMachine mips_machine;
|
862 |
|
863 |
/* shix.c */
|
864 |
extern QEMUMachine shix_machine;
|
865 |
|
866 |
#ifdef TARGET_PPC
|
867 |
ppc_tb_t *cpu_ppc_tb_init (CPUState *env, uint32_t freq); |
868 |
#endif
|
869 |
void PREP_debug_write (void *opaque, uint32_t addr, uint32_t val); |
870 |
|
871 |
extern CPUWriteMemoryFunc *PPC_io_write[];
|
872 |
extern CPUReadMemoryFunc *PPC_io_read[];
|
873 |
void PPC_debug_write (void *opaque, uint32_t addr, uint32_t val); |
874 |
|
875 |
/* sun4m.c */
|
876 |
extern QEMUMachine sun4m_machine;
|
877 |
uint32_t iommu_translate(uint32_t addr); |
878 |
void pic_set_irq_cpu(int irq, int level, unsigned int cpu); |
879 |
|
880 |
/* iommu.c */
|
881 |
void *iommu_init(uint32_t addr);
|
882 |
uint32_t iommu_translate_local(void *opaque, uint32_t addr);
|
883 |
|
884 |
/* lance.c */
|
885 |
void lance_init(NICInfo *nd, int irq, uint32_t leaddr, uint32_t ledaddr); |
886 |
|
887 |
/* tcx.c */
|
888 |
void tcx_init(DisplayState *ds, uint32_t addr, uint8_t *vram_base,
|
889 |
unsigned long vram_offset, int vram_size, int width, int height); |
890 |
|
891 |
/* slavio_intctl.c */
|
892 |
void *slavio_intctl_init();
|
893 |
void slavio_intctl_set_cpu(void *opaque, unsigned int cpu, CPUState *env); |
894 |
void slavio_pic_info(void *opaque); |
895 |
void slavio_irq_info(void *opaque); |
896 |
void slavio_pic_set_irq(void *opaque, int irq, int level); |
897 |
void slavio_pic_set_irq_cpu(void *opaque, int irq, int level, unsigned int cpu); |
898 |
|
899 |
/* loader.c */
|
900 |
int get_image_size(const char *filename); |
901 |
int load_image(const char *filename, uint8_t *addr); |
902 |
int load_elf(const char *filename, int64_t virt_to_phys_addend, uint64_t *pentry); |
903 |
int load_aout(const char *filename, uint8_t *addr); |
904 |
|
905 |
/* slavio_timer.c */
|
906 |
void slavio_timer_init(uint32_t addr, int irq, int mode, unsigned int cpu); |
907 |
|
908 |
/* slavio_serial.c */
|
909 |
SerialState *slavio_serial_init(int base, int irq, CharDriverState *chr1, CharDriverState *chr2); |
910 |
void slavio_serial_ms_kbd_init(int base, int irq); |
911 |
|
912 |
/* slavio_misc.c */
|
913 |
void *slavio_misc_init(uint32_t base, int irq); |
914 |
void slavio_set_power_fail(void *opaque, int power_failing); |
915 |
|
916 |
/* esp.c */
|
917 |
void esp_init(BlockDriverState **bd, int irq, uint32_t espaddr, uint32_t espdaddr); |
918 |
|
919 |
/* sun4u.c */
|
920 |
extern QEMUMachine sun4u_machine;
|
921 |
|
922 |
/* NVRAM helpers */
|
923 |
#include "hw/m48t59.h" |
924 |
|
925 |
void NVRAM_set_byte (m48t59_t *nvram, uint32_t addr, uint8_t value);
|
926 |
uint8_t NVRAM_get_byte (m48t59_t *nvram, uint32_t addr); |
927 |
void NVRAM_set_word (m48t59_t *nvram, uint32_t addr, uint16_t value);
|
928 |
uint16_t NVRAM_get_word (m48t59_t *nvram, uint32_t addr); |
929 |
void NVRAM_set_lword (m48t59_t *nvram, uint32_t addr, uint32_t value);
|
930 |
uint32_t NVRAM_get_lword (m48t59_t *nvram, uint32_t addr); |
931 |
void NVRAM_set_string (m48t59_t *nvram, uint32_t addr,
|
932 |
const unsigned char *str, uint32_t max); |
933 |
int NVRAM_get_string (m48t59_t *nvram, uint8_t *dst, uint16_t addr, int max); |
934 |
void NVRAM_set_crc (m48t59_t *nvram, uint32_t addr,
|
935 |
uint32_t start, uint32_t count); |
936 |
int PPC_NVRAM_set_params (m48t59_t *nvram, uint16_t NVRAM_size,
|
937 |
const unsigned char *arch, |
938 |
uint32_t RAM_size, int boot_device,
|
939 |
uint32_t kernel_image, uint32_t kernel_size, |
940 |
const char *cmdline, |
941 |
uint32_t initrd_image, uint32_t initrd_size, |
942 |
uint32_t NVRAM_image, |
943 |
int width, int height, int depth); |
944 |
|
945 |
/* adb.c */
|
946 |
|
947 |
#define MAX_ADB_DEVICES 16 |
948 |
|
949 |
#define ADB_MAX_OUT_LEN 16 |
950 |
|
951 |
typedef struct ADBDevice ADBDevice; |
952 |
|
953 |
/* buf = NULL means polling */
|
954 |
typedef int ADBDeviceRequest(ADBDevice *d, uint8_t *buf_out, |
955 |
const uint8_t *buf, int len); |
956 |
typedef int ADBDeviceReset(ADBDevice *d); |
957 |
|
958 |
struct ADBDevice {
|
959 |
struct ADBBusState *bus;
|
960 |
int devaddr;
|
961 |
int handler;
|
962 |
ADBDeviceRequest *devreq; |
963 |
ADBDeviceReset *devreset; |
964 |
void *opaque;
|
965 |
}; |
966 |
|
967 |
typedef struct ADBBusState { |
968 |
ADBDevice devices[MAX_ADB_DEVICES]; |
969 |
int nb_devices;
|
970 |
int poll_index;
|
971 |
} ADBBusState; |
972 |
|
973 |
int adb_request(ADBBusState *s, uint8_t *buf_out,
|
974 |
const uint8_t *buf, int len); |
975 |
int adb_poll(ADBBusState *s, uint8_t *buf_out);
|
976 |
|
977 |
ADBDevice *adb_register_device(ADBBusState *s, int devaddr,
|
978 |
ADBDeviceRequest *devreq, |
979 |
ADBDeviceReset *devreset, |
980 |
void *opaque);
|
981 |
void adb_kbd_init(ADBBusState *bus);
|
982 |
void adb_mouse_init(ADBBusState *bus);
|
983 |
|
984 |
/* cuda.c */
|
985 |
|
986 |
extern ADBBusState adb_bus;
|
987 |
int cuda_init(SetIRQFunc *set_irq, void *irq_opaque, int irq); |
988 |
|
989 |
#include "hw/usb.h" |
990 |
|
991 |
/* usb ports of the VM */
|
992 |
|
993 |
#define MAX_VM_USB_PORTS 8 |
994 |
|
995 |
extern USBPort *vm_usb_ports[MAX_VM_USB_PORTS];
|
996 |
extern USBDevice *vm_usb_hub;
|
997 |
|
998 |
void do_usb_add(const char *devname); |
999 |
void do_usb_del(const char *devname); |
1000 |
void usb_info(void); |
1001 |
|
1002 |
/* integratorcp.c */
|
1003 |
extern QEMUMachine integratorcp926_machine;
|
1004 |
extern QEMUMachine integratorcp1026_machine;
|
1005 |
|
1006 |
/* versatilepb.c */
|
1007 |
extern QEMUMachine versatilepb_machine;
|
1008 |
extern QEMUMachine versatileab_machine;
|
1009 |
|
1010 |
/* ps2.c */
|
1011 |
void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg); |
1012 |
void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg); |
1013 |
void ps2_write_mouse(void *, int val); |
1014 |
void ps2_write_keyboard(void *, int val); |
1015 |
uint32_t ps2_read_data(void *);
|
1016 |
void ps2_queue(void *, int b); |
1017 |
void ps2_keyboard_set_translation(void *opaque, int mode); |
1018 |
|
1019 |
/* smc91c111.c */
|
1020 |
void smc91c111_init(NICInfo *, uint32_t, void *, int); |
1021 |
|
1022 |
/* pl110.c */
|
1023 |
void *pl110_init(DisplayState *ds, uint32_t base, void *pic, int irq, int); |
1024 |
|
1025 |
/* pl011.c */
|
1026 |
void pl011_init(uint32_t base, void *pic, int irq, CharDriverState *chr); |
1027 |
|
1028 |
/* pl050.c */
|
1029 |
void pl050_init(uint32_t base, void *pic, int irq, int is_mouse); |
1030 |
|
1031 |
/* pl080.c */
|
1032 |
void *pl080_init(uint32_t base, void *pic, int irq); |
1033 |
|
1034 |
/* pl190.c */
|
1035 |
void *pl190_init(uint32_t base, void *parent, int irq, int fiq); |
1036 |
|
1037 |
/* arm-timer.c */
|
1038 |
void sp804_init(uint32_t base, void *pic, int irq); |
1039 |
void icp_pit_init(uint32_t base, void *pic, int irq); |
1040 |
|
1041 |
/* arm_boot.c */
|
1042 |
|
1043 |
void arm_load_kernel(int ram_size, const char *kernel_filename, |
1044 |
const char *kernel_cmdline, const char *initrd_filename, |
1045 |
int board_id);
|
1046 |
|
1047 |
/* sh7750.c */
|
1048 |
struct SH7750State;
|
1049 |
|
1050 |
struct SH7750State *sh7750_init(CPUState * cpu);
|
1051 |
|
1052 |
typedef struct { |
1053 |
/* The callback will be triggered if any of the designated lines change */
|
1054 |
uint16_t portamask_trigger; |
1055 |
uint16_t portbmask_trigger; |
1056 |
/* Return 0 if no action was taken */
|
1057 |
int (*port_change_cb) (uint16_t porta, uint16_t portb,
|
1058 |
uint16_t * periph_pdtra, |
1059 |
uint16_t * periph_portdira, |
1060 |
uint16_t * periph_pdtrb, |
1061 |
uint16_t * periph_portdirb); |
1062 |
} sh7750_io_device; |
1063 |
|
1064 |
int sh7750_register_io_device(struct SH7750State *s, |
1065 |
sh7750_io_device * device); |
1066 |
/* tc58128.c */
|
1067 |
int tc58128_init(struct SH7750State *s, char *zone1, char *zone2); |
1068 |
|
1069 |
#endif /* defined(QEMU_TOOL) */ |
1070 |
|
1071 |
/* monitor.c */
|
1072 |
void monitor_init(CharDriverState *hd, int show_banner); |
1073 |
void term_puts(const char *str); |
1074 |
void term_vprintf(const char *fmt, va_list ap); |
1075 |
void term_printf(const char *fmt, ...) __attribute__ ((__format__ (__printf__, 1, 2))); |
1076 |
void term_flush(void); |
1077 |
void term_print_help(void); |
1078 |
void monitor_readline(const char *prompt, int is_password, |
1079 |
char *buf, int buf_size); |
1080 |
|
1081 |
/* readline.c */
|
1082 |
typedef void ReadLineFunc(void *opaque, const char *str); |
1083 |
|
1084 |
extern int completion_index; |
1085 |
void add_completion(const char *str); |
1086 |
void readline_handle_byte(int ch); |
1087 |
void readline_find_completion(const char *cmdline); |
1088 |
const char *readline_get_history(unsigned int index); |
1089 |
void readline_start(const char *prompt, int is_password, |
1090 |
ReadLineFunc *readline_func, void *opaque);
|
1091 |
|
1092 |
void kqemu_record_dump(void); |
1093 |
|
1094 |
#endif /* VL_H */ |