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" 8ac2da55eSEduardo Habkost #include "sysemu/accel.h" 90d09e41aSPaolo Bonzini #include "hw/qdev.h" 1036d20cb2SMarcel Apfelbaum #include "qom/object.h" 110d09e41aSPaolo Bonzini 120d09e41aSPaolo Bonzini 133ef96221SMarcel Apfelbaum typedef void QEMUMachineInitFunc(MachineState *ms); 140d09e41aSPaolo Bonzini 150d09e41aSPaolo Bonzini typedef void QEMUMachineResetFunc(void); 160d09e41aSPaolo Bonzini 17b4fc7b43SIgor Mammedov typedef void QEMUMachineHotAddCPUFunc(const int64_t id, Error **errp); 18b4fc7b43SIgor Mammedov 19135a129aSAneesh Kumar K.V typedef int QEMUMachineGetKvmtypeFunc(const char *arg); 20135a129aSAneesh Kumar K.V 21e689f7c6SMarkus Armbruster struct QEMUMachine { 222709f263SLaszlo Ersek const char *family; /* NULL iff @name identifies a standalone machtype */ 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; 3116026518SJohn Snow int units_per_default_bus; 320d09e41aSPaolo Bonzini int max_cpus; 330d09e41aSPaolo Bonzini unsigned int no_serial:1, 340d09e41aSPaolo Bonzini no_parallel:1, 350d09e41aSPaolo Bonzini use_virtcon:1, 360d09e41aSPaolo Bonzini use_sclp:1, 370d09e41aSPaolo Bonzini no_floppy:1, 380d09e41aSPaolo Bonzini no_cdrom:1, 390d09e41aSPaolo Bonzini no_sdcard:1; 400d09e41aSPaolo Bonzini int is_default; 410d09e41aSPaolo Bonzini const char *default_machine_opts; 42c1654732SMarkus Armbruster const char *default_boot_order; 43*6f00494aSGerd Hoffmann const char *default_display; 440d09e41aSPaolo Bonzini GlobalProperty *compat_props; 450d09e41aSPaolo Bonzini const char *hw_version; 46e689f7c6SMarkus Armbruster }; 470d09e41aSPaolo Bonzini 48dfabb8b9SPaolo Bonzini void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner, 49dfabb8b9SPaolo Bonzini const char *name, 50dfabb8b9SPaolo Bonzini uint64_t ram_size); 51dfabb8b9SPaolo Bonzini 520d09e41aSPaolo Bonzini int qemu_register_machine(QEMUMachine *m); 530d09e41aSPaolo Bonzini 54dfabb8b9SPaolo Bonzini #define TYPE_MACHINE_SUFFIX "-machine" 5536d20cb2SMarcel Apfelbaum #define TYPE_MACHINE "machine" 56c8897e8eSMarcel Apfelbaum #undef MACHINE /* BSD defines it and QEMU does not use it */ 5736d20cb2SMarcel Apfelbaum #define MACHINE(obj) \ 5836d20cb2SMarcel Apfelbaum OBJECT_CHECK(MachineState, (obj), TYPE_MACHINE) 5936d20cb2SMarcel Apfelbaum #define MACHINE_GET_CLASS(obj) \ 6036d20cb2SMarcel Apfelbaum OBJECT_GET_CLASS(MachineClass, (obj), TYPE_MACHINE) 6136d20cb2SMarcel Apfelbaum #define MACHINE_CLASS(klass) \ 6236d20cb2SMarcel Apfelbaum OBJECT_CLASS_CHECK(MachineClass, (klass), TYPE_MACHINE) 6336d20cb2SMarcel Apfelbaum 640056ae24SMarcel Apfelbaum MachineClass *find_default_machine(void); 650056ae24SMarcel Apfelbaum extern MachineState *current_machine; 660056ae24SMarcel Apfelbaum 6736d20cb2SMarcel Apfelbaum /** 6836d20cb2SMarcel Apfelbaum * MachineClass: 6936d20cb2SMarcel Apfelbaum * @qemu_machine: #QEMUMachine 70b7454548SIgor Mammedov * @get_hotplug_handler: this function is called during bus-less 71b7454548SIgor Mammedov * device hotplug. If defined it returns pointer to an instance 72b7454548SIgor Mammedov * of HotplugHandler object, which handles hotplug operation 73b7454548SIgor Mammedov * for a given @dev. It may return NULL if @dev doesn't require 74b7454548SIgor Mammedov * any actions to be performed by hotplug handler. 7536d20cb2SMarcel Apfelbaum */ 7636d20cb2SMarcel Apfelbaum struct MachineClass { 7736d20cb2SMarcel Apfelbaum /*< private >*/ 7836d20cb2SMarcel Apfelbaum ObjectClass parent_class; 7936d20cb2SMarcel Apfelbaum /*< public >*/ 8036d20cb2SMarcel Apfelbaum 812709f263SLaszlo Ersek const char *family; /* NULL iff @name identifies a standalone machtype */ 8200b4fbe2SMarcel Apfelbaum const char *name; 8300b4fbe2SMarcel Apfelbaum const char *alias; 8400b4fbe2SMarcel Apfelbaum const char *desc; 8500b4fbe2SMarcel Apfelbaum 863ef96221SMarcel Apfelbaum void (*init)(MachineState *state); 8700b4fbe2SMarcel Apfelbaum void (*reset)(void); 8800b4fbe2SMarcel Apfelbaum void (*hot_add_cpu)(const int64_t id, Error **errp); 8900b4fbe2SMarcel Apfelbaum int (*kvm_type)(const char *arg); 9000b4fbe2SMarcel Apfelbaum 9100b4fbe2SMarcel Apfelbaum BlockInterfaceType block_default_type; 9216026518SJohn Snow int units_per_default_bus; 9300b4fbe2SMarcel Apfelbaum int max_cpus; 9400b4fbe2SMarcel Apfelbaum unsigned int no_serial:1, 9500b4fbe2SMarcel Apfelbaum no_parallel:1, 9600b4fbe2SMarcel Apfelbaum use_virtcon:1, 9700b4fbe2SMarcel Apfelbaum use_sclp:1, 9800b4fbe2SMarcel Apfelbaum no_floppy:1, 9900b4fbe2SMarcel Apfelbaum no_cdrom:1, 10000b4fbe2SMarcel Apfelbaum no_sdcard:1; 10100b4fbe2SMarcel Apfelbaum int is_default; 10200b4fbe2SMarcel Apfelbaum const char *default_machine_opts; 10300b4fbe2SMarcel Apfelbaum const char *default_boot_order; 104*6f00494aSGerd Hoffmann const char *default_display; 10500b4fbe2SMarcel Apfelbaum GlobalProperty *compat_props; 10600b4fbe2SMarcel Apfelbaum const char *hw_version; 107b7454548SIgor Mammedov 108b7454548SIgor Mammedov HotplugHandler *(*get_hotplug_handler)(MachineState *machine, 109b7454548SIgor Mammedov DeviceState *dev); 11036d20cb2SMarcel Apfelbaum }; 11136d20cb2SMarcel Apfelbaum 11236d20cb2SMarcel Apfelbaum /** 11336d20cb2SMarcel Apfelbaum * MachineState: 11436d20cb2SMarcel Apfelbaum */ 11536d20cb2SMarcel Apfelbaum struct MachineState { 11636d20cb2SMarcel Apfelbaum /*< private >*/ 11736d20cb2SMarcel Apfelbaum Object parent_obj; 11836d20cb2SMarcel Apfelbaum /*< public >*/ 11936d20cb2SMarcel Apfelbaum 12036d20cb2SMarcel Apfelbaum char *accel; 12136d20cb2SMarcel Apfelbaum bool kernel_irqchip; 12236d20cb2SMarcel Apfelbaum int kvm_shadow_mem; 12336d20cb2SMarcel Apfelbaum char *dtb; 12436d20cb2SMarcel Apfelbaum char *dumpdtb; 12536d20cb2SMarcel Apfelbaum int phandle_start; 12636d20cb2SMarcel Apfelbaum char *dt_compatible; 12736d20cb2SMarcel Apfelbaum bool dump_guest_core; 12836d20cb2SMarcel Apfelbaum bool mem_merge; 12936d20cb2SMarcel Apfelbaum bool usb; 13036d20cb2SMarcel Apfelbaum char *firmware; 131a52a7fdfSLe Tan bool iommu; 13236d20cb2SMarcel Apfelbaum 1333ef96221SMarcel Apfelbaum ram_addr_t ram_size; 134c270fb9eSIgor Mammedov ram_addr_t maxram_size; 135c270fb9eSIgor Mammedov uint64_t ram_slots; 1363ef96221SMarcel Apfelbaum const char *boot_order; 1376b1b1440SMarcel Apfelbaum char *kernel_filename; 1386b1b1440SMarcel Apfelbaum char *kernel_cmdline; 1396b1b1440SMarcel Apfelbaum char *initrd_filename; 1403ef96221SMarcel Apfelbaum const char *cpu_model; 141ac2da55eSEduardo Habkost AccelState *accelerator; 14236d20cb2SMarcel Apfelbaum }; 14336d20cb2SMarcel Apfelbaum 1440d09e41aSPaolo Bonzini #endif 145