10d09e41aSPaolo Bonzini /* Declarations for use by board files for creating devices. */ 20d09e41aSPaolo Bonzini 30d09e41aSPaolo Bonzini #ifndef HW_BOARDS_H 40d09e41aSPaolo Bonzini #define HW_BOARDS_H 50d09e41aSPaolo Bonzini 6f1e29879SMarcel Apfelbaum #include "qemu/typedefs.h" 70d09e41aSPaolo Bonzini #include "sysemu/blockdev.h" 80d09e41aSPaolo Bonzini #include "hw/qdev.h" 936d20cb2SMarcel Apfelbaum #include "qom/object.h" 100d09e41aSPaolo Bonzini 110d09e41aSPaolo Bonzini 123ef96221SMarcel Apfelbaum typedef struct MachineState MachineState; 133ef96221SMarcel Apfelbaum 143ef96221SMarcel Apfelbaum typedef void QEMUMachineInitFunc(MachineState *ms); 150d09e41aSPaolo Bonzini 160d09e41aSPaolo Bonzini typedef void QEMUMachineResetFunc(void); 170d09e41aSPaolo Bonzini 18b4fc7b43SIgor Mammedov typedef void QEMUMachineHotAddCPUFunc(const int64_t id, Error **errp); 19b4fc7b43SIgor Mammedov 20135a129aSAneesh Kumar K.V typedef int QEMUMachineGetKvmtypeFunc(const char *arg); 21135a129aSAneesh Kumar K.V 22e689f7c6SMarkus Armbruster struct QEMUMachine { 230d09e41aSPaolo Bonzini const char *name; 240d09e41aSPaolo Bonzini const char *alias; 250d09e41aSPaolo Bonzini const char *desc; 260d09e41aSPaolo Bonzini QEMUMachineInitFunc *init; 270d09e41aSPaolo Bonzini QEMUMachineResetFunc *reset; 28b4fc7b43SIgor Mammedov QEMUMachineHotAddCPUFunc *hot_add_cpu; 29135a129aSAneesh Kumar K.V QEMUMachineGetKvmtypeFunc *kvm_type; 300d09e41aSPaolo Bonzini BlockInterfaceType block_default_type; 310d09e41aSPaolo Bonzini int max_cpus; 320d09e41aSPaolo Bonzini unsigned int no_serial:1, 330d09e41aSPaolo Bonzini no_parallel:1, 340d09e41aSPaolo Bonzini use_virtcon:1, 350d09e41aSPaolo Bonzini use_sclp:1, 360d09e41aSPaolo Bonzini no_floppy:1, 370d09e41aSPaolo Bonzini no_cdrom:1, 380d09e41aSPaolo Bonzini no_sdcard:1; 390d09e41aSPaolo Bonzini int is_default; 400d09e41aSPaolo Bonzini const char *default_machine_opts; 41c1654732SMarkus Armbruster const char *default_boot_order; 420d09e41aSPaolo Bonzini GlobalProperty *compat_props; 430d09e41aSPaolo Bonzini const char *hw_version; 44e689f7c6SMarkus Armbruster }; 450d09e41aSPaolo Bonzini 46261747f1SMarcel Apfelbaum #define TYPE_MACHINE_SUFFIX "-machine" 470d09e41aSPaolo Bonzini int qemu_register_machine(QEMUMachine *m); 480d09e41aSPaolo Bonzini 4936d20cb2SMarcel Apfelbaum #define TYPE_MACHINE "machine" 50c8897e8eSMarcel Apfelbaum #undef MACHINE /* BSD defines it and QEMU does not use it */ 5136d20cb2SMarcel Apfelbaum #define MACHINE(obj) \ 5236d20cb2SMarcel Apfelbaum OBJECT_CHECK(MachineState, (obj), TYPE_MACHINE) 5336d20cb2SMarcel Apfelbaum #define MACHINE_GET_CLASS(obj) \ 5436d20cb2SMarcel Apfelbaum OBJECT_GET_CLASS(MachineClass, (obj), TYPE_MACHINE) 5536d20cb2SMarcel Apfelbaum #define MACHINE_CLASS(klass) \ 5636d20cb2SMarcel Apfelbaum OBJECT_CLASS_CHECK(MachineClass, (klass), TYPE_MACHINE) 5736d20cb2SMarcel Apfelbaum 580056ae24SMarcel Apfelbaum MachineClass *find_default_machine(void); 590056ae24SMarcel Apfelbaum extern MachineState *current_machine; 600056ae24SMarcel Apfelbaum 6136d20cb2SMarcel Apfelbaum /** 6236d20cb2SMarcel Apfelbaum * MachineClass: 6336d20cb2SMarcel Apfelbaum * @qemu_machine: #QEMUMachine 64*b7454548SIgor Mammedov * @get_hotplug_handler: this function is called during bus-less 65*b7454548SIgor Mammedov * device hotplug. If defined it returns pointer to an instance 66*b7454548SIgor Mammedov * of HotplugHandler object, which handles hotplug operation 67*b7454548SIgor Mammedov * for a given @dev. It may return NULL if @dev doesn't require 68*b7454548SIgor Mammedov * any actions to be performed by hotplug handler. 6936d20cb2SMarcel Apfelbaum */ 7036d20cb2SMarcel Apfelbaum struct MachineClass { 7136d20cb2SMarcel Apfelbaum /*< private >*/ 7236d20cb2SMarcel Apfelbaum ObjectClass parent_class; 7336d20cb2SMarcel Apfelbaum /*< public >*/ 7436d20cb2SMarcel Apfelbaum 7500b4fbe2SMarcel Apfelbaum const char *name; 7600b4fbe2SMarcel Apfelbaum const char *alias; 7700b4fbe2SMarcel Apfelbaum const char *desc; 7800b4fbe2SMarcel Apfelbaum 793ef96221SMarcel Apfelbaum void (*init)(MachineState *state); 8000b4fbe2SMarcel Apfelbaum void (*reset)(void); 8100b4fbe2SMarcel Apfelbaum void (*hot_add_cpu)(const int64_t id, Error **errp); 8200b4fbe2SMarcel Apfelbaum int (*kvm_type)(const char *arg); 8300b4fbe2SMarcel Apfelbaum 8400b4fbe2SMarcel Apfelbaum BlockInterfaceType block_default_type; 8500b4fbe2SMarcel Apfelbaum int max_cpus; 8600b4fbe2SMarcel Apfelbaum unsigned int no_serial:1, 8700b4fbe2SMarcel Apfelbaum no_parallel:1, 8800b4fbe2SMarcel Apfelbaum use_virtcon:1, 8900b4fbe2SMarcel Apfelbaum use_sclp:1, 9000b4fbe2SMarcel Apfelbaum no_floppy:1, 9100b4fbe2SMarcel Apfelbaum no_cdrom:1, 9200b4fbe2SMarcel Apfelbaum no_sdcard:1; 9300b4fbe2SMarcel Apfelbaum int is_default; 9400b4fbe2SMarcel Apfelbaum const char *default_machine_opts; 9500b4fbe2SMarcel Apfelbaum const char *default_boot_order; 9600b4fbe2SMarcel Apfelbaum GlobalProperty *compat_props; 9700b4fbe2SMarcel Apfelbaum const char *hw_version; 98*b7454548SIgor Mammedov 99*b7454548SIgor Mammedov HotplugHandler *(*get_hotplug_handler)(MachineState *machine, 100*b7454548SIgor Mammedov DeviceState *dev); 10136d20cb2SMarcel Apfelbaum }; 10236d20cb2SMarcel Apfelbaum 10336d20cb2SMarcel Apfelbaum /** 10436d20cb2SMarcel Apfelbaum * MachineState: 10536d20cb2SMarcel Apfelbaum */ 10636d20cb2SMarcel Apfelbaum struct MachineState { 10736d20cb2SMarcel Apfelbaum /*< private >*/ 10836d20cb2SMarcel Apfelbaum Object parent_obj; 10936d20cb2SMarcel Apfelbaum /*< public >*/ 11036d20cb2SMarcel Apfelbaum 11136d20cb2SMarcel Apfelbaum char *accel; 11236d20cb2SMarcel Apfelbaum bool kernel_irqchip; 11336d20cb2SMarcel Apfelbaum int kvm_shadow_mem; 11436d20cb2SMarcel Apfelbaum char *dtb; 11536d20cb2SMarcel Apfelbaum char *dumpdtb; 11636d20cb2SMarcel Apfelbaum int phandle_start; 11736d20cb2SMarcel Apfelbaum char *dt_compatible; 11836d20cb2SMarcel Apfelbaum bool dump_guest_core; 11936d20cb2SMarcel Apfelbaum bool mem_merge; 12036d20cb2SMarcel Apfelbaum bool usb; 12136d20cb2SMarcel Apfelbaum char *firmware; 12236d20cb2SMarcel Apfelbaum 1233ef96221SMarcel Apfelbaum ram_addr_t ram_size; 124c270fb9eSIgor Mammedov ram_addr_t maxram_size; 125c270fb9eSIgor Mammedov uint64_t ram_slots; 1263ef96221SMarcel Apfelbaum const char *boot_order; 1276b1b1440SMarcel Apfelbaum char *kernel_filename; 1286b1b1440SMarcel Apfelbaum char *kernel_cmdline; 1296b1b1440SMarcel Apfelbaum char *initrd_filename; 1303ef96221SMarcel Apfelbaum const char *cpu_model; 13136d20cb2SMarcel Apfelbaum }; 13236d20cb2SMarcel Apfelbaum 1330d09e41aSPaolo Bonzini #endif 134