2007-11-17 20:14:51 +03:00
|
|
|
/* Declarations for use by board files for creating devices. */
|
|
|
|
|
|
|
|
#ifndef HW_BOARDS_H
|
|
|
|
#define HW_BOARDS_H
|
|
|
|
|
2014-04-09 21:34:52 +04:00
|
|
|
#include "qemu/typedefs.h"
|
2012-12-17 21:20:04 +04:00
|
|
|
#include "sysemu/blockdev.h"
|
2013-02-04 18:40:22 +04:00
|
|
|
#include "hw/qdev.h"
|
2014-03-05 21:30:45 +04:00
|
|
|
#include "qom/object.h"
|
2009-07-15 15:48:21 +04:00
|
|
|
|
2012-10-16 00:22:02 +04:00
|
|
|
|
2014-05-07 18:42:57 +04:00
|
|
|
typedef struct MachineState MachineState;
|
|
|
|
|
|
|
|
typedef void QEMUMachineInitFunc(MachineState *ms);
|
2007-11-17 20:14:51 +03:00
|
|
|
|
2012-08-07 10:41:51 +04:00
|
|
|
typedef void QEMUMachineResetFunc(void);
|
|
|
|
|
2013-04-30 17:41:24 +04:00
|
|
|
typedef void QEMUMachineHotAddCPUFunc(const int64_t id, Error **errp);
|
|
|
|
|
2013-12-23 19:40:40 +04:00
|
|
|
typedef int QEMUMachineGetKvmtypeFunc(const char *arg);
|
|
|
|
|
2013-10-30 16:56:39 +04:00
|
|
|
struct QEMUMachine {
|
2007-11-17 20:14:51 +03:00
|
|
|
const char *name;
|
2009-07-22 13:02:50 +04:00
|
|
|
const char *alias;
|
2007-11-17 20:14:51 +03:00
|
|
|
const char *desc;
|
|
|
|
QEMUMachineInitFunc *init;
|
2012-08-07 10:41:51 +04:00
|
|
|
QEMUMachineResetFunc *reset;
|
2013-04-30 17:41:24 +04:00
|
|
|
QEMUMachineHotAddCPUFunc *hot_add_cpu;
|
2013-12-23 19:40:40 +04:00
|
|
|
QEMUMachineGetKvmtypeFunc *kvm_type;
|
2012-11-20 18:30:34 +04:00
|
|
|
BlockInterfaceType block_default_type;
|
2008-10-08 00:39:39 +04:00
|
|
|
int max_cpus;
|
2009-12-25 19:12:26 +03:00
|
|
|
unsigned int no_serial:1,
|
2009-12-08 15:11:54 +03:00
|
|
|
no_parallel:1,
|
|
|
|
use_virtcon:1,
|
2013-01-24 15:18:52 +04:00
|
|
|
use_sclp:1,
|
2009-12-16 16:25:39 +03:00
|
|
|
no_floppy:1,
|
|
|
|
no_cdrom:1,
|
|
|
|
no_sdcard:1;
|
2009-05-22 05:41:01 +04:00
|
|
|
int is_default;
|
2010-11-22 18:44:15 +03:00
|
|
|
const char *default_machine_opts;
|
hw: Clean up bogus default boot order
We set default boot order "cad" in every single machine definition
except "pseries" and "moxiesim", even though very few boards actually
care for boot order, and "cad" makes sense for even fewer.
Machines that care:
* pc and its variants
Accept up to three letters 'a', 'b' (undocumented alias for 'a'),
'c', 'd' and 'n'. Reject all others (fatal with -boot).
* nseries (n800, n810)
Check whether order starts with 'n'. Silently ignored otherwise.
* prep, g3beige, mac99
Extract the first character the machine understands (subset of
'a'..'f'). Silently ignored otherwise.
* spapr
Accept an arbitrary string (vl.c restricts it to contain only
'a'..'p', no duplicates).
* sun4[mdc]
Use the first character. Silently ignored otherwise.
Strip characters these machines ignore from their default boot order.
For all other machines, remove the unused default boot order
alltogether.
Note that my rename of QEMUMachine member boot_order to
default_boot_order and QEMUMachineInitArgs member boot_device to
boot_order has a welcome side effect: it makes every use of boot
orders visible in this patch, for easy review.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-08-16 15:13:50 +04:00
|
|
|
const char *default_boot_order;
|
2009-12-08 15:11:33 +03:00
|
|
|
GlobalProperty *compat_props;
|
2012-05-30 07:35:51 +04:00
|
|
|
const char *hw_version;
|
2013-10-30 16:56:39 +04:00
|
|
|
};
|
2007-11-17 20:14:51 +03:00
|
|
|
|
2014-05-14 13:43:15 +04:00
|
|
|
void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
|
|
|
|
const char *name,
|
|
|
|
uint64_t ram_size);
|
|
|
|
|
2007-11-17 20:14:51 +03:00
|
|
|
int qemu_register_machine(QEMUMachine *m);
|
2009-02-11 18:21:54 +03:00
|
|
|
|
2014-05-14 13:43:15 +04:00
|
|
|
#define TYPE_MACHINE_SUFFIX "-machine"
|
2014-03-05 21:30:45 +04:00
|
|
|
#define TYPE_MACHINE "machine"
|
2014-03-18 19:26:35 +04:00
|
|
|
#undef MACHINE /* BSD defines it and QEMU does not use it */
|
2014-03-05 21:30:45 +04:00
|
|
|
#define MACHINE(obj) \
|
|
|
|
OBJECT_CHECK(MachineState, (obj), TYPE_MACHINE)
|
|
|
|
#define MACHINE_GET_CLASS(obj) \
|
|
|
|
OBJECT_GET_CLASS(MachineClass, (obj), TYPE_MACHINE)
|
|
|
|
#define MACHINE_CLASS(klass) \
|
|
|
|
OBJECT_CLASS_CHECK(MachineClass, (klass), TYPE_MACHINE)
|
|
|
|
|
2014-03-05 21:30:47 +04:00
|
|
|
MachineClass *find_default_machine(void);
|
|
|
|
extern MachineState *current_machine;
|
|
|
|
|
2014-03-05 21:30:45 +04:00
|
|
|
/**
|
|
|
|
* MachineClass:
|
|
|
|
* @qemu_machine: #QEMUMachine
|
2014-06-02 17:25:03 +04:00
|
|
|
* @get_hotplug_handler: this function is called during bus-less
|
|
|
|
* device hotplug. If defined it returns pointer to an instance
|
|
|
|
* of HotplugHandler object, which handles hotplug operation
|
|
|
|
* for a given @dev. It may return NULL if @dev doesn't require
|
|
|
|
* any actions to be performed by hotplug handler.
|
2014-03-05 21:30:45 +04:00
|
|
|
*/
|
|
|
|
struct MachineClass {
|
|
|
|
/*< private >*/
|
|
|
|
ObjectClass parent_class;
|
|
|
|
/*< public >*/
|
|
|
|
|
2014-04-09 21:34:50 +04:00
|
|
|
const char *name;
|
|
|
|
const char *alias;
|
|
|
|
const char *desc;
|
|
|
|
|
2014-05-07 18:42:57 +04:00
|
|
|
void (*init)(MachineState *state);
|
2014-04-09 21:34:50 +04:00
|
|
|
void (*reset)(void);
|
|
|
|
void (*hot_add_cpu)(const int64_t id, Error **errp);
|
|
|
|
int (*kvm_type)(const char *arg);
|
|
|
|
|
|
|
|
BlockInterfaceType block_default_type;
|
|
|
|
int max_cpus;
|
|
|
|
unsigned int no_serial:1,
|
|
|
|
no_parallel:1,
|
|
|
|
use_virtcon:1,
|
|
|
|
use_sclp:1,
|
|
|
|
no_floppy:1,
|
|
|
|
no_cdrom:1,
|
|
|
|
no_sdcard:1;
|
|
|
|
int is_default;
|
|
|
|
const char *default_machine_opts;
|
|
|
|
const char *default_boot_order;
|
|
|
|
GlobalProperty *compat_props;
|
|
|
|
const char *hw_version;
|
2014-06-02 17:25:03 +04:00
|
|
|
|
|
|
|
HotplugHandler *(*get_hotplug_handler)(MachineState *machine,
|
|
|
|
DeviceState *dev);
|
2014-03-05 21:30:45 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* MachineState:
|
|
|
|
*/
|
|
|
|
struct MachineState {
|
|
|
|
/*< private >*/
|
|
|
|
Object parent_obj;
|
|
|
|
/*< public >*/
|
|
|
|
|
|
|
|
char *accel;
|
|
|
|
bool kernel_irqchip;
|
|
|
|
int kvm_shadow_mem;
|
|
|
|
char *dtb;
|
|
|
|
char *dumpdtb;
|
|
|
|
int phandle_start;
|
|
|
|
char *dt_compatible;
|
|
|
|
bool dump_guest_core;
|
|
|
|
bool mem_merge;
|
|
|
|
bool usb;
|
|
|
|
char *firmware;
|
|
|
|
|
2014-05-07 18:42:57 +04:00
|
|
|
ram_addr_t ram_size;
|
2014-06-02 17:25:02 +04:00
|
|
|
ram_addr_t maxram_size;
|
|
|
|
uint64_t ram_slots;
|
2014-05-07 18:42:57 +04:00
|
|
|
const char *boot_order;
|
2014-05-26 16:40:58 +04:00
|
|
|
char *kernel_filename;
|
|
|
|
char *kernel_cmdline;
|
|
|
|
char *initrd_filename;
|
2014-05-07 18:42:57 +04:00
|
|
|
const char *cpu_model;
|
2014-03-05 21:30:45 +04:00
|
|
|
};
|
|
|
|
|
2007-11-17 20:14:51 +03:00
|
|
|
#endif
|