xref: /qemu/include/sysemu/sysemu.h (revision 2c65db5e)
1 #ifndef SYSEMU_H
2 #define SYSEMU_H
3 /* Misc. things related to the system emulator.  */
4 
5 #include "qemu/timer.h"
6 #include "qemu/notify.h"
7 #include "qemu/uuid.h"
8 
9 /* vl.c */
10 
11 extern int only_migratable;
12 extern const char *qemu_name;
13 extern QemuUUID qemu_uuid;
14 extern bool qemu_uuid_set;
15 
16 void qemu_add_exit_notifier(Notifier *notify);
17 void qemu_remove_exit_notifier(Notifier *notify);
18 
19 extern bool machine_init_done;
20 
21 void qemu_add_machine_init_done_notifier(Notifier *notify);
22 void qemu_remove_machine_init_done_notifier(Notifier *notify);
23 
24 extern int autostart;
25 
26 typedef enum {
27     VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL,
28     VGA_TCX, VGA_CG3, VGA_DEVICE, VGA_VIRTIO,
29     VGA_TYPE_MAX,
30 } VGAInterfaceType;
31 
32 extern int vga_interface_type;
33 
34 extern int graphic_width;
35 extern int graphic_height;
36 extern int graphic_depth;
37 extern int display_opengl;
38 extern const char *keyboard_layout;
39 extern int win2k_install_hack;
40 extern int alt_grab;
41 extern int ctrl_grab;
42 extern int graphic_rotate;
43 extern int no_shutdown;
44 extern int old_param;
45 extern int boot_menu;
46 extern bool boot_strict;
47 extern uint8_t *boot_splash_filedata;
48 extern bool enable_mlock;
49 extern bool enable_cpu_pm;
50 extern QEMUClockType rtc_clock;
51 
52 #define MAX_OPTION_ROMS 16
53 typedef struct QEMUOptionRom {
54     const char *name;
55     int32_t bootindex;
56 } QEMUOptionRom;
57 extern QEMUOptionRom option_rom[MAX_OPTION_ROMS];
58 extern int nb_option_roms;
59 
60 #define MAX_PROM_ENVS 128
61 extern const char *prom_envs[MAX_PROM_ENVS];
62 extern unsigned int nb_prom_envs;
63 
64 /* pcie aer error injection */
65 void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict);
66 
67 /* serial ports */
68 
69 /* Return the Chardev for serial port i, or NULL if none */
70 Chardev *serial_hd(int i);
71 /* return the number of serial ports defined by the user. serial_hd(i)
72  * will always return NULL for any i which is greater than or equal to this.
73  */
74 int serial_max_hds(void);
75 
76 /* parallel ports */
77 
78 #define MAX_PARALLEL_PORTS 3
79 
80 extern Chardev *parallel_hds[MAX_PARALLEL_PORTS];
81 
82 void hmp_info_usb(Monitor *mon, const QDict *qdict);
83 
84 void add_boot_device_path(int32_t bootindex, DeviceState *dev,
85                           const char *suffix);
86 char *get_boot_devices_list(size_t *size);
87 
88 DeviceState *get_boot_device(uint32_t position);
89 void check_boot_index(int32_t bootindex, Error **errp);
90 void del_boot_device_path(DeviceState *dev, const char *suffix);
91 void device_add_bootindex_property(Object *obj, int32_t *bootindex,
92                                    const char *name, const char *suffix,
93                                    DeviceState *dev);
94 void restore_boot_order(void *opaque);
95 void validate_bootdevices(const char *devices, Error **errp);
96 void add_boot_device_lchs(DeviceState *dev, const char *suffix,
97                           uint32_t lcyls, uint32_t lheads, uint32_t lsecs);
98 void del_boot_device_lchs(DeviceState *dev, const char *suffix);
99 char *get_boot_devices_lchs_list(size_t *size);
100 
101 /* handler to set the boot_device order for a specific type of MachineClass */
102 typedef void QEMUBootSetHandler(void *opaque, const char *boot_order,
103                                 Error **errp);
104 void qemu_register_boot_set(QEMUBootSetHandler *func, void *opaque);
105 void qemu_boot_set(const char *boot_order, Error **errp);
106 
107 QemuOpts *qemu_get_machine_opts(void);
108 
109 bool defaults_enabled(void);
110 
111 void qemu_init(int argc, char **argv, char **envp);
112 void qemu_main_loop(void);
113 void qemu_cleanup(void);
114 
115 extern QemuOptsList qemu_legacy_drive_opts;
116 extern QemuOptsList qemu_common_drive_opts;
117 extern QemuOptsList qemu_drive_opts;
118 extern QemuOptsList bdrv_runtime_opts;
119 extern QemuOptsList qemu_chardev_opts;
120 extern QemuOptsList qemu_device_opts;
121 extern QemuOptsList qemu_netdev_opts;
122 extern QemuOptsList qemu_nic_opts;
123 extern QemuOptsList qemu_net_opts;
124 extern QemuOptsList qemu_global_opts;
125 extern QemuOptsList qemu_semihosting_config_opts;
126 
127 #endif
128