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