xref: /openbmc/qemu/include/hw/boards.h (revision 3ef96221)
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 
12*3ef96221SMarcel Apfelbaum typedef struct MachineState MachineState;
13*3ef96221SMarcel Apfelbaum 
14*3ef96221SMarcel 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
6436d20cb2SMarcel Apfelbaum  */
6536d20cb2SMarcel Apfelbaum struct MachineClass {
6636d20cb2SMarcel Apfelbaum     /*< private >*/
6736d20cb2SMarcel Apfelbaum     ObjectClass parent_class;
6836d20cb2SMarcel Apfelbaum     /*< public >*/
6936d20cb2SMarcel Apfelbaum 
7000b4fbe2SMarcel Apfelbaum     const char *name;
7100b4fbe2SMarcel Apfelbaum     const char *alias;
7200b4fbe2SMarcel Apfelbaum     const char *desc;
7300b4fbe2SMarcel Apfelbaum 
74*3ef96221SMarcel Apfelbaum     void (*init)(MachineState *state);
7500b4fbe2SMarcel Apfelbaum     void (*reset)(void);
7600b4fbe2SMarcel Apfelbaum     void (*hot_add_cpu)(const int64_t id, Error **errp);
7700b4fbe2SMarcel Apfelbaum     int (*kvm_type)(const char *arg);
7800b4fbe2SMarcel Apfelbaum 
7900b4fbe2SMarcel Apfelbaum     BlockInterfaceType block_default_type;
8000b4fbe2SMarcel Apfelbaum     int max_cpus;
8100b4fbe2SMarcel Apfelbaum     unsigned int no_serial:1,
8200b4fbe2SMarcel Apfelbaum         no_parallel:1,
8300b4fbe2SMarcel Apfelbaum         use_virtcon:1,
8400b4fbe2SMarcel Apfelbaum         use_sclp:1,
8500b4fbe2SMarcel Apfelbaum         no_floppy:1,
8600b4fbe2SMarcel Apfelbaum         no_cdrom:1,
8700b4fbe2SMarcel Apfelbaum         no_sdcard:1;
8800b4fbe2SMarcel Apfelbaum     int is_default;
8900b4fbe2SMarcel Apfelbaum     const char *default_machine_opts;
9000b4fbe2SMarcel Apfelbaum     const char *default_boot_order;
9100b4fbe2SMarcel Apfelbaum     GlobalProperty *compat_props;
9200b4fbe2SMarcel Apfelbaum     const char *hw_version;
9336d20cb2SMarcel Apfelbaum };
9436d20cb2SMarcel Apfelbaum 
9536d20cb2SMarcel Apfelbaum /**
9636d20cb2SMarcel Apfelbaum  * MachineState:
9736d20cb2SMarcel Apfelbaum  */
9836d20cb2SMarcel Apfelbaum struct MachineState {
9936d20cb2SMarcel Apfelbaum     /*< private >*/
10036d20cb2SMarcel Apfelbaum     Object parent_obj;
10136d20cb2SMarcel Apfelbaum     /*< public >*/
10236d20cb2SMarcel Apfelbaum 
10336d20cb2SMarcel Apfelbaum     char *accel;
10436d20cb2SMarcel Apfelbaum     bool kernel_irqchip;
10536d20cb2SMarcel Apfelbaum     int kvm_shadow_mem;
10636d20cb2SMarcel Apfelbaum     char *dtb;
10736d20cb2SMarcel Apfelbaum     char *dumpdtb;
10836d20cb2SMarcel Apfelbaum     int phandle_start;
10936d20cb2SMarcel Apfelbaum     char *dt_compatible;
11036d20cb2SMarcel Apfelbaum     bool dump_guest_core;
11136d20cb2SMarcel Apfelbaum     bool mem_merge;
11236d20cb2SMarcel Apfelbaum     bool usb;
11336d20cb2SMarcel Apfelbaum     char *firmware;
11436d20cb2SMarcel Apfelbaum 
115*3ef96221SMarcel Apfelbaum     ram_addr_t ram_size;
116*3ef96221SMarcel Apfelbaum     const char *boot_order;
117*3ef96221SMarcel Apfelbaum     const char *kernel_filename;
118*3ef96221SMarcel Apfelbaum     const char *kernel_cmdline;
119*3ef96221SMarcel Apfelbaum     const char *initrd_filename;
120*3ef96221SMarcel Apfelbaum     const char *cpu_model;
12136d20cb2SMarcel Apfelbaum };
12236d20cb2SMarcel Apfelbaum 
1230d09e41aSPaolo Bonzini #endif
124