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