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 "hw/qdev.h" 8 #include "qom/object.h" 9 10 typedef struct QEMUMachineInitArgs { 11 const QEMUMachine *machine; 12 ram_addr_t ram_size; 13 const char *boot_order; 14 const char *kernel_filename; 15 const char *kernel_cmdline; 16 const char *initrd_filename; 17 const char *cpu_model; 18 } QEMUMachineInitArgs; 19 20 typedef void QEMUMachineInitFunc(QEMUMachineInitArgs *args); 21 22 typedef void QEMUMachineResetFunc(void); 23 24 typedef void QEMUMachineHotAddCPUFunc(const int64_t id, Error **errp); 25 26 typedef int QEMUMachineGetKvmtypeFunc(const char *arg); 27 28 struct QEMUMachine { 29 const char *name; 30 const char *alias; 31 const char *desc; 32 QEMUMachineInitFunc *init; 33 QEMUMachineResetFunc *reset; 34 QEMUMachineHotAddCPUFunc *hot_add_cpu; 35 QEMUMachineGetKvmtypeFunc *kvm_type; 36 BlockInterfaceType block_default_type; 37 int max_cpus; 38 unsigned int no_serial:1, 39 no_parallel:1, 40 use_virtcon:1, 41 use_sclp:1, 42 no_floppy:1, 43 no_cdrom:1, 44 no_sdcard:1; 45 int is_default; 46 const char *default_machine_opts; 47 const char *default_boot_order; 48 GlobalProperty *compat_props; 49 struct QEMUMachine *next; 50 const char *hw_version; 51 }; 52 53 #define TYPE_MACHINE_SUFFIX "-machine" 54 int qemu_register_machine(QEMUMachine *m); 55 56 #define TYPE_MACHINE "machine" 57 #undef MACHINE /* BSD defines it and QEMU does not use it */ 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