1 /* Declarations for use by board files for creating devices. */ 2 3 #ifndef HW_BOARDS_H 4 #define HW_BOARDS_H 5 6 #include "sysemu/blockdev.h" 7 #include "sysemu/qemumachine.h" 8 #include "hw/qdev.h" 9 #include "qom/object.h" 10 11 typedef struct QEMUMachineInitArgs { 12 const QEMUMachine *machine; 13 ram_addr_t ram_size; 14 const char *boot_order; 15 const char *kernel_filename; 16 const char *kernel_cmdline; 17 const char *initrd_filename; 18 const char *cpu_model; 19 } QEMUMachineInitArgs; 20 21 typedef void QEMUMachineInitFunc(QEMUMachineInitArgs *args); 22 23 typedef void QEMUMachineResetFunc(void); 24 25 typedef void QEMUMachineHotAddCPUFunc(const int64_t id, Error **errp); 26 27 typedef int QEMUMachineGetKvmtypeFunc(const char *arg); 28 29 struct QEMUMachine { 30 const char *name; 31 const char *alias; 32 const char *desc; 33 QEMUMachineInitFunc *init; 34 QEMUMachineResetFunc *reset; 35 QEMUMachineHotAddCPUFunc *hot_add_cpu; 36 QEMUMachineGetKvmtypeFunc *kvm_type; 37 BlockInterfaceType block_default_type; 38 int max_cpus; 39 unsigned int no_serial:1, 40 no_parallel:1, 41 use_virtcon:1, 42 use_sclp:1, 43 no_floppy:1, 44 no_cdrom:1, 45 no_sdcard:1; 46 int is_default; 47 const char *default_machine_opts; 48 const char *default_boot_order; 49 GlobalProperty *compat_props; 50 struct QEMUMachine *next; 51 const char *hw_version; 52 }; 53 54 #define TYPE_MACHINE_SUFFIX "-machine" 55 int qemu_register_machine(QEMUMachine *m); 56 57 #define TYPE_MACHINE "machine" 58 #define MACHINE(obj) \ 59 OBJECT_CHECK(MachineState, (obj), TYPE_MACHINE) 60 #define MACHINE_GET_CLASS(obj) \ 61 OBJECT_GET_CLASS(MachineClass, (obj), TYPE_MACHINE) 62 #define MACHINE_CLASS(klass) \ 63 OBJECT_CLASS_CHECK(MachineClass, (klass), TYPE_MACHINE) 64 65 typedef struct MachineState MachineState; 66 typedef struct MachineClass MachineClass; 67 68 MachineClass *find_default_machine(void); 69 extern MachineState *current_machine; 70 71 /** 72 * MachineClass: 73 * @qemu_machine: #QEMUMachine 74 */ 75 struct MachineClass { 76 /*< private >*/ 77 ObjectClass parent_class; 78 /*< public >*/ 79 80 QEMUMachine *qemu_machine; 81 }; 82 83 /** 84 * MachineState: 85 */ 86 struct MachineState { 87 /*< private >*/ 88 Object parent_obj; 89 /*< public >*/ 90 91 char *accel; 92 bool kernel_irqchip; 93 int kvm_shadow_mem; 94 char *kernel; 95 char *initrd; 96 char *append; 97 char *dtb; 98 char *dumpdtb; 99 int phandle_start; 100 char *dt_compatible; 101 bool dump_guest_core; 102 bool mem_merge; 103 bool usb; 104 char *firmware; 105 106 QEMUMachineInitArgs init_args; 107 }; 108 109 #endif 110