bt: avoid unintended sign extension
[qemu/ar7.git] / include / hw / boards.h
blob5da4fb00eeda22f3e204f3316993180d23a730ea
1 /* Declarations for use by board files for creating devices. */
3 #ifndef HW_BOARDS_H
4 #define HW_BOARDS_H
6 #include "qemu/typedefs.h"
7 #include "sysemu/blockdev.h"
8 #include "sysemu/accel.h"
9 #include "hw/qdev.h"
10 #include "qom/object.h"
12 void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
13 const char *name,
14 uint64_t ram_size);
16 #define TYPE_MACHINE_SUFFIX "-machine"
18 /* Machine class name that needs to be used for class-name-based machine
19 * type lookup to work.
21 #define MACHINE_TYPE_NAME(machinename) (machinename TYPE_MACHINE_SUFFIX)
23 #define TYPE_MACHINE "machine"
24 #undef MACHINE /* BSD defines it and QEMU does not use it */
25 #define MACHINE(obj) \
26 OBJECT_CHECK(MachineState, (obj), TYPE_MACHINE)
27 #define MACHINE_GET_CLASS(obj) \
28 OBJECT_GET_CLASS(MachineClass, (obj), TYPE_MACHINE)
29 #define MACHINE_CLASS(klass) \
30 OBJECT_CLASS_CHECK(MachineClass, (klass), TYPE_MACHINE)
32 MachineClass *find_default_machine(void);
33 extern MachineState *current_machine;
35 bool machine_usb(MachineState *machine);
36 bool machine_kernel_irqchip_allowed(MachineState *machine);
37 bool machine_kernel_irqchip_required(MachineState *machine);
38 int machine_kvm_shadow_mem(MachineState *machine);
39 int machine_phandle_start(MachineState *machine);
40 bool machine_dump_guest_core(MachineState *machine);
41 bool machine_mem_merge(MachineState *machine);
43 /**
44 * MachineClass:
45 * @get_hotplug_handler: this function is called during bus-less
46 * device hotplug. If defined it returns pointer to an instance
47 * of HotplugHandler object, which handles hotplug operation
48 * for a given @dev. It may return NULL if @dev doesn't require
49 * any actions to be performed by hotplug handler.
50 * @cpu_index_to_socket_id:
51 * used to provide @cpu_index to socket number mapping, allowing
52 * a machine to group CPU threads belonging to the same socket/package
53 * Returns: socket number given cpu_index belongs to.
54 * @hw_version:
55 * Value of QEMU_VERSION when the machine was added to QEMU.
56 * Set only by old machines because they need to keep
57 * compatibility on code that exposed QEMU_VERSION to guests in
58 * the past (and now use qemu_hw_version()).
60 struct MachineClass {
61 /*< private >*/
62 ObjectClass parent_class;
63 /*< public >*/
65 const char *family; /* NULL iff @name identifies a standalone machtype */
66 const char *name;
67 const char *alias;
68 const char *desc;
70 void (*init)(MachineState *state);
71 void (*reset)(void);
72 void (*hot_add_cpu)(const int64_t id, Error **errp);
73 int (*kvm_type)(const char *arg);
75 BlockInterfaceType block_default_type;
76 int units_per_default_bus;
77 int max_cpus;
78 unsigned int no_serial:1,
79 no_parallel:1,
80 use_virtcon:1,
81 use_sclp:1,
82 no_floppy:1,
83 no_cdrom:1,
84 no_sdcard:1,
85 has_dynamic_sysbus:1,
86 no_tco:1,
87 pci_allow_0_address:1;
88 int is_default;
89 const char *default_machine_opts;
90 const char *default_boot_order;
91 const char *default_display;
92 GlobalProperty *compat_props;
93 const char *hw_version;
94 ram_addr_t default_ram_size;
96 HotplugHandler *(*get_hotplug_handler)(MachineState *machine,
97 DeviceState *dev);
98 unsigned (*cpu_index_to_socket_id)(unsigned cpu_index);
102 * MachineState:
104 struct MachineState {
105 /*< private >*/
106 Object parent_obj;
107 Notifier sysbus_notifier;
109 /*< public >*/
111 char *accel;
112 bool kernel_irqchip_allowed;
113 bool kernel_irqchip_required;
114 int kvm_shadow_mem;
115 char *dtb;
116 char *dumpdtb;
117 int phandle_start;
118 char *dt_compatible;
119 bool dump_guest_core;
120 bool mem_merge;
121 bool usb;
122 bool usb_disabled;
123 bool igd_gfx_passthru;
124 char *firmware;
125 bool iommu;
126 bool suppress_vmdesc;
128 ram_addr_t ram_size;
129 ram_addr_t maxram_size;
130 uint64_t ram_slots;
131 const char *boot_order;
132 char *kernel_filename;
133 char *kernel_cmdline;
134 char *initrd_filename;
135 const char *cpu_model;
136 AccelState *accelerator;
139 #define DEFINE_MACHINE(namestr, machine_initfn) \
140 static void machine_initfn##_class_init(ObjectClass *oc, void *data) \
142 MachineClass *mc = MACHINE_CLASS(oc); \
143 machine_initfn(mc); \
145 static const TypeInfo machine_initfn##_typeinfo = { \
146 .name = MACHINE_TYPE_NAME(namestr), \
147 .parent = TYPE_MACHINE, \
148 .class_init = machine_initfn##_class_init, \
149 }; \
150 static void machine_initfn##_register_types(void) \
152 type_register_static(&machine_initfn##_typeinfo); \
154 machine_init(machine_initfn##_register_types)
156 #endif