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