boards.h 3.5 KB

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