xref: /openbmc/qemu/include/sysemu/sysemu.h (revision 7d87775f)
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 const char *qemu_get_vm_name(void);
17 
18 void qemu_add_exit_notifier(Notifier *notify);
19 void qemu_remove_exit_notifier(Notifier *notify);
20 
21 void qemu_add_machine_init_done_notifier(Notifier *notify);
22 void qemu_remove_machine_init_done_notifier(Notifier *notify);
23 
24 void configure_rtc(QemuOpts *opts);
25 
26 void qemu_init_subsystems(void);
27 
28 extern int autostart;
29 
30 typedef enum {
31     VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL,
32     VGA_TCX, VGA_CG3, VGA_DEVICE, VGA_VIRTIO,
33     VGA_TYPE_MAX,
34 } VGAInterfaceType;
35 
36 extern int vga_interface_type;
37 extern bool vga_interface_created;
38 
39 extern int graphic_width;
40 extern int graphic_height;
41 extern int graphic_depth;
42 extern int display_opengl;
43 extern const char *keyboard_layout;
44 extern int old_param;
45 extern uint8_t *boot_splash_filedata;
46 extern bool enable_mlock;
47 extern bool enable_cpu_pm;
48 extern QEMUClockType rtc_clock;
49 
50 #define MAX_OPTION_ROMS 16
51 typedef struct QEMUOptionRom {
52     const char *name;
53     int32_t bootindex;
54 } QEMUOptionRom;
55 extern QEMUOptionRom option_rom[MAX_OPTION_ROMS];
56 extern int nb_option_roms;
57 
58 #define MAX_PROM_ENVS 128
59 extern const char *prom_envs[MAX_PROM_ENVS];
60 extern unsigned int nb_prom_envs;
61 
62 /* serial ports */
63 
64 /* Return the Chardev for serial port i, or NULL if none */
65 Chardev *serial_hd(int i);
66 
67 /* parallel ports */
68 
69 #define MAX_PARALLEL_PORTS 3
70 
71 extern Chardev *parallel_hds[MAX_PARALLEL_PORTS];
72 
73 void add_boot_device_path(int32_t bootindex, DeviceState *dev,
74                           const char *suffix);
75 char *get_boot_devices_list(size_t *size);
76 
77 DeviceState *get_boot_device(uint32_t position);
78 void check_boot_index(int32_t bootindex, Error **errp);
79 void del_boot_device_path(DeviceState *dev, const char *suffix);
80 void device_add_bootindex_property(Object *obj, int32_t *bootindex,
81                                    const char *name, const char *suffix,
82                                    DeviceState *dev);
83 void restore_boot_order(void *opaque);
84 void validate_bootdevices(const char *devices, Error **errp);
85 void add_boot_device_lchs(DeviceState *dev, const char *suffix,
86                           uint32_t lcyls, uint32_t lheads, uint32_t lsecs);
87 void del_boot_device_lchs(DeviceState *dev, const char *suffix);
88 char *get_boot_devices_lchs_list(size_t *size);
89 
90 /* handler to set the boot_device order for a specific type of MachineClass */
91 typedef void QEMUBootSetHandler(void *opaque, const char *boot_order,
92                                 Error **errp);
93 void qemu_register_boot_set(QEMUBootSetHandler *func, void *opaque);
94 void qemu_boot_set(const char *boot_order, Error **errp);
95 
96 bool defaults_enabled(void);
97 
98 void qemu_init(int argc, char **argv);
99 int qemu_main_loop(void);
100 void qemu_cleanup(int);
101 
102 extern QemuOptsList qemu_legacy_drive_opts;
103 extern QemuOptsList qemu_common_drive_opts;
104 extern QemuOptsList qemu_drive_opts;
105 extern QemuOptsList bdrv_runtime_opts;
106 extern QemuOptsList qemu_chardev_opts;
107 extern QemuOptsList qemu_device_opts;
108 extern QemuOptsList qemu_netdev_opts;
109 extern QemuOptsList qemu_nic_opts;
110 extern QemuOptsList qemu_net_opts;
111 extern QemuOptsList qemu_global_opts;
112 extern QemuOptsList qemu_semihosting_config_opts;
113 
114 #endif
115