xref: /openbmc/qemu/include/hw/boards.h (revision 01c22f2c)
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 #define MACHINE(obj) \
58     OBJECT_CHECK(MachineState, (obj), TYPE_MACHINE)
59 #define MACHINE_GET_CLASS(obj) \
60     OBJECT_GET_CLASS(MachineClass, (obj), TYPE_MACHINE)
61 #define MACHINE_CLASS(klass) \
62     OBJECT_CLASS_CHECK(MachineClass, (klass), TYPE_MACHINE)
63 
64 typedef struct MachineState MachineState;
65 typedef struct MachineClass MachineClass;
66 
67 MachineClass *find_default_machine(void);
68 extern MachineState *current_machine;
69 
70 /**
71  * MachineClass:
72  * @qemu_machine: #QEMUMachine
73  */
74 struct MachineClass {
75     /*< private >*/
76     ObjectClass parent_class;
77     /*< public >*/
78 
79     QEMUMachine *qemu_machine;
80 };
81 
82 /**
83  * MachineState:
84  */
85 struct MachineState {
86     /*< private >*/
87     Object parent_obj;
88     /*< public >*/
89 
90     char *accel;
91     bool kernel_irqchip;
92     int kvm_shadow_mem;
93     char *kernel;
94     char *initrd;
95     char *append;
96     char *dtb;
97     char *dumpdtb;
98     int phandle_start;
99     char *dt_compatible;
100     bool dump_guest_core;
101     bool mem_merge;
102     bool usb;
103     char *firmware;
104 
105     QEMUMachineInitArgs init_args;
106 };
107 
108 #endif
109