2007-11-17 18:14:51 +01:00
|
|
|
/* Declarations for use by board files for creating devices. */
|
|
|
|
|
|
|
|
#ifndef HW_BOARDS_H
|
|
|
|
#define HW_BOARDS_H
|
|
|
|
|
2014-04-09 19:34:52 +02:00
|
|
|
#include "qemu/typedefs.h"
|
2012-12-17 18:20:04 +01:00
|
|
|
#include "sysemu/blockdev.h"
|
2013-02-04 15:40:22 +01:00
|
|
|
#include "hw/qdev.h"
|
2014-03-05 18:30:45 +01:00
|
|
|
#include "qom/object.h"
|
2009-07-15 13:48:21 +02:00
|
|
|
|
2012-10-15 22:22:02 +02:00
|
|
|
|
2014-05-07 16:42:57 +02:00
|
|
|
typedef void QEMUMachineInitFunc(MachineState *ms);
|
2007-11-17 18:14:51 +01:00
|
|
|
|
2012-08-07 08:41:51 +02:00
|
|
|
typedef void QEMUMachineResetFunc(void);
|
|
|
|
|
2013-04-30 15:41:24 +02:00
|
|
|
typedef void QEMUMachineHotAddCPUFunc(const int64_t id, Error **errp);
|
|
|
|
|
2013-12-23 16:40:40 +01:00
|
|
|
typedef int QEMUMachineGetKvmtypeFunc(const char *arg);
|
|
|
|
|
2013-10-30 13:56:39 +01:00
|
|
|
struct QEMUMachine {
|
2007-11-17 18:14:51 +01:00
|
|
|
const char *name;
|
2009-07-22 11:02:50 +02:00
|
|
|
const char *alias;
|
2007-11-17 18:14:51 +01:00
|
|
|
const char *desc;
|
|
|
|
QEMUMachineInitFunc *init;
|
2012-08-07 08:41:51 +02:00
|
|
|
QEMUMachineResetFunc *reset;
|
2013-04-30 15:41:24 +02:00
|
|
|
QEMUMachineHotAddCPUFunc *hot_add_cpu;
|
2013-12-23 16:40:40 +01:00
|
|
|
QEMUMachineGetKvmtypeFunc *kvm_type;
|
2012-11-20 15:30:34 +01:00
|
|
|
BlockInterfaceType block_default_type;
|
2008-10-07 22:39:39 +02:00
|
|
|
int max_cpus;
|
2009-12-25 17:12:26 +01:00
|
|
|
unsigned int no_serial:1,
|
2009-12-08 13:11:54 +01:00
|
|
|
no_parallel:1,
|
|
|
|
use_virtcon:1,
|
2013-01-24 12:18:52 +01:00
|
|
|
use_sclp:1,
|
2009-12-16 14:25:39 +01:00
|
|
|
no_floppy:1,
|
|
|
|
no_cdrom:1,
|
|
|
|
no_sdcard:1;
|
2009-05-22 03:41:01 +02:00
|
|
|
int is_default;
|
2010-11-22 16:44:15 +01: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 13:13:50 +02:00
|
|
|
const char *default_boot_order;
|
2009-12-08 13:11:33 +01:00
|
|
|
GlobalProperty *compat_props;
|
2012-05-30 05:35:51 +02:00
|
|
|
const char *hw_version;
|
2013-10-30 13:56:39 +01:00
|
|
|
};
|
2007-11-17 18:14:51 +01:00
|
|
|
|
2014-05-14 11:43:15 +02:00
|
|
|
void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
|
|
|
|
const char *name,
|
|
|
|
uint64_t ram_size);
|
|
|
|
|
2007-11-17 18:14:51 +01:00
|
|
|
int qemu_register_machine(QEMUMachine *m);
|
2009-02-11 16:21:54 +01:00
|
|
|
|
2014-05-14 11:43:15 +02:00
|
|
|
#define TYPE_MACHINE_SUFFIX "-machine"
|
2014-03-05 18:30:45 +01:00
|
|
|
#define TYPE_MACHINE "machine"
|
2014-03-18 16:26:35 +01:00
|
|
|
#undef MACHINE /* BSD defines it and QEMU does not use it */
|
2014-03-05 18:30:45 +01: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 18:30:47 +01:00
|
|
|
MachineClass *find_default_machine(void);
|
|
|
|
extern MachineState *current_machine;
|
|
|
|
|
2014-03-05 18:30:45 +01:00
|
|
|
/**
|
|
|
|
* MachineClass:
|
|
|
|
* @qemu_machine: #QEMUMachine
|
2014-06-02 15:25:03 +02: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 18:30:45 +01:00
|
|
|
*/
|
|
|
|
struct MachineClass {
|
|
|
|
/*< private >*/
|
|
|
|
ObjectClass parent_class;
|
|
|
|
/*< public >*/
|
|
|
|
|
2014-04-09 19:34:50 +02:00
|
|
|
const char *name;
|
|
|
|
const char *alias;
|
|
|
|
const char *desc;
|
|
|
|
|
2014-05-07 16:42:57 +02:00
|
|
|
void (*init)(MachineState *state);
|
2014-04-09 19:34:50 +02: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 15:25:03 +02:00
|
|
|
|
|
|
|
HotplugHandler *(*get_hotplug_handler)(MachineState *machine,
|
|
|
|
DeviceState *dev);
|
2014-03-05 18:30:45 +01: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-08-16 07:55:40 +02:00
|
|
|
bool iommu;
|
2014-03-05 18:30:45 +01:00
|
|
|
|
2014-05-07 16:42:57 +02:00
|
|
|
ram_addr_t ram_size;
|
2014-06-02 15:25:02 +02:00
|
|
|
ram_addr_t maxram_size;
|
|
|
|
uint64_t ram_slots;
|
2014-05-07 16:42:57 +02:00
|
|
|
const char *boot_order;
|
2014-05-26 14:40:58 +02:00
|
|
|
char *kernel_filename;
|
|
|
|
char *kernel_cmdline;
|
|
|
|
char *initrd_filename;
|
2014-05-07 16:42:57 +02:00
|
|
|
const char *cpu_model;
|
2014-03-05 18:30:45 +01:00
|
|
|
};
|
|
|
|
|
2007-11-17 18:14:51 +01:00
|
|
|
#endif
|