root / include / hw / i386 / pc.h @ f8c457b8
History | View | Annotate | Download (8.8 kB)
1 |
#ifndef HW_PC_H
|
---|---|
2 |
#define HW_PC_H
|
3 |
|
4 |
#include "qemu-common.h" |
5 |
#include "exec/memory.h" |
6 |
#include "exec/ioport.h" |
7 |
#include "hw/isa/isa.h" |
8 |
#include "hw/block/fdc.h" |
9 |
#include "net/net.h" |
10 |
#include "hw/i386/ioapic.h" |
11 |
|
12 |
#include "qemu/range.h" |
13 |
|
14 |
/* PC-style peripherals (also used by other machines). */
|
15 |
|
16 |
typedef struct PcPciInfo { |
17 |
Range w32; |
18 |
Range w64; |
19 |
} PcPciInfo; |
20 |
|
21 |
struct PcGuestInfo {
|
22 |
PcPciInfo pci_info; |
23 |
bool has_pci_info;
|
24 |
FWCfgState *fw_cfg; |
25 |
}; |
26 |
|
27 |
/* parallel.c */
|
28 |
static inline bool parallel_init(ISABus *bus, int index, CharDriverState *chr) |
29 |
{ |
30 |
DeviceState *dev; |
31 |
ISADevice *isadev; |
32 |
|
33 |
isadev = isa_try_create(bus, "isa-parallel");
|
34 |
if (!isadev) {
|
35 |
return false; |
36 |
} |
37 |
dev = DEVICE(isadev); |
38 |
qdev_prop_set_uint32(dev, "index", index);
|
39 |
qdev_prop_set_chr(dev, "chardev", chr);
|
40 |
if (qdev_init(dev) < 0) { |
41 |
return false; |
42 |
} |
43 |
return true; |
44 |
} |
45 |
|
46 |
bool parallel_mm_init(MemoryRegion *address_space,
|
47 |
hwaddr base, int it_shift, qemu_irq irq,
|
48 |
CharDriverState *chr); |
49 |
|
50 |
/* i8259.c */
|
51 |
|
52 |
extern DeviceState *isa_pic;
|
53 |
qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq); |
54 |
qemu_irq *kvm_i8259_init(ISABus *bus); |
55 |
int pic_read_irq(DeviceState *d);
|
56 |
int pic_get_output(DeviceState *d);
|
57 |
void pic_info(Monitor *mon, const QDict *qdict); |
58 |
void irq_info(Monitor *mon, const QDict *qdict); |
59 |
|
60 |
/* Global System Interrupts */
|
61 |
|
62 |
#define GSI_NUM_PINS IOAPIC_NUM_PINS
|
63 |
|
64 |
typedef struct GSIState { |
65 |
qemu_irq i8259_irq[ISA_NUM_IRQS]; |
66 |
qemu_irq ioapic_irq[IOAPIC_NUM_PINS]; |
67 |
} GSIState; |
68 |
|
69 |
void gsi_handler(void *opaque, int n, int level); |
70 |
|
71 |
/* vmport.c */
|
72 |
static inline void vmport_init(ISABus *bus) |
73 |
{ |
74 |
isa_create_simple(bus, "vmport");
|
75 |
} |
76 |
void vmport_register(unsigned char command, IOPortReadFunc *func, void *opaque); |
77 |
void vmmouse_get_data(uint32_t *data);
|
78 |
void vmmouse_set_data(const uint32_t *data); |
79 |
|
80 |
/* pckbd.c */
|
81 |
|
82 |
void i8042_init(qemu_irq kbd_irq, qemu_irq mouse_irq, uint32_t io_base);
|
83 |
void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
|
84 |
MemoryRegion *region, ram_addr_t size, |
85 |
hwaddr mask); |
86 |
void i8042_isa_mouse_fake_event(void *opaque); |
87 |
void i8042_setup_a20_line(ISADevice *dev, qemu_irq *a20_out);
|
88 |
|
89 |
/* pc.c */
|
90 |
extern int fd_bootchk; |
91 |
|
92 |
void pc_register_ferr_irq(qemu_irq irq);
|
93 |
void pc_acpi_smi_interrupt(void *opaque, int irq, int level); |
94 |
|
95 |
void pc_cpus_init(const char *cpu_model, DeviceState *icc_bridge); |
96 |
void pc_hot_add_cpu(const int64_t id, Error **errp); |
97 |
void pc_acpi_init(const char *default_dsdt); |
98 |
|
99 |
PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size, |
100 |
ram_addr_t above_4g_mem_size); |
101 |
|
102 |
FWCfgState *pc_memory_init(MemoryRegion *system_memory, |
103 |
const char *kernel_filename, |
104 |
const char *kernel_cmdline, |
105 |
const char *initrd_filename, |
106 |
ram_addr_t below_4g_mem_size, |
107 |
ram_addr_t above_4g_mem_size, |
108 |
MemoryRegion *rom_memory, |
109 |
MemoryRegion **ram_memory, |
110 |
PcGuestInfo *guest_info); |
111 |
qemu_irq *pc_allocate_cpu_irq(void);
|
112 |
DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus); |
113 |
void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
|
114 |
ISADevice **rtc_state, |
115 |
ISADevice **floppy, |
116 |
bool no_vmport);
|
117 |
void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd);
|
118 |
void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
|
119 |
const char *boot_device, |
120 |
ISADevice *floppy, BusState *ide0, BusState *ide1, |
121 |
ISADevice *s); |
122 |
void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus);
|
123 |
void pc_pci_device_init(PCIBus *pci_bus);
|
124 |
|
125 |
typedef void (*cpu_set_smm_t)(int smm, void *arg); |
126 |
void cpu_smm_register(cpu_set_smm_t callback, void *arg); |
127 |
|
128 |
void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name); |
129 |
|
130 |
/* acpi_piix.c */
|
131 |
|
132 |
i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
|
133 |
qemu_irq sci_irq, qemu_irq smi_irq, |
134 |
int kvm_enabled, FWCfgState *fw_cfg);
|
135 |
void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr);
|
136 |
|
137 |
/* hpet.c */
|
138 |
extern int no_hpet; |
139 |
|
140 |
/* piix_pci.c */
|
141 |
struct PCII440FXState;
|
142 |
typedef struct PCII440FXState PCII440FXState; |
143 |
|
144 |
PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn,
|
145 |
ISABus **isa_bus, qemu_irq *pic, |
146 |
MemoryRegion *address_space_mem, |
147 |
MemoryRegion *address_space_io, |
148 |
ram_addr_t ram_size, |
149 |
hwaddr pci_hole_start, |
150 |
hwaddr pci_hole_size, |
151 |
hwaddr pci_hole64_start, |
152 |
hwaddr pci_hole64_size, |
153 |
MemoryRegion *pci_memory, |
154 |
MemoryRegion *ram_memory); |
155 |
|
156 |
/* piix4.c */
|
157 |
extern PCIDevice *piix4_dev;
|
158 |
int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn); |
159 |
|
160 |
/* vga.c */
|
161 |
enum vga_retrace_method {
|
162 |
VGA_RETRACE_DUMB, |
163 |
VGA_RETRACE_PRECISE |
164 |
}; |
165 |
|
166 |
extern enum vga_retrace_method vga_retrace_method; |
167 |
|
168 |
int isa_vga_mm_init(hwaddr vram_base,
|
169 |
hwaddr ctrl_base, int it_shift,
|
170 |
MemoryRegion *address_space); |
171 |
|
172 |
/* ne2000.c */
|
173 |
static inline bool isa_ne2000_init(ISABus *bus, int base, int irq, NICInfo *nd) |
174 |
{ |
175 |
DeviceState *dev; |
176 |
ISADevice *isadev; |
177 |
|
178 |
qemu_check_nic_model(nd, "ne2k_isa");
|
179 |
|
180 |
isadev = isa_try_create(bus, "ne2k_isa");
|
181 |
if (!isadev) {
|
182 |
return false; |
183 |
} |
184 |
dev = DEVICE(isadev); |
185 |
qdev_prop_set_uint32(dev, "iobase", base);
|
186 |
qdev_prop_set_uint32(dev, "irq", irq);
|
187 |
qdev_set_nic_properties(dev, nd); |
188 |
qdev_init_nofail(dev); |
189 |
return true; |
190 |
} |
191 |
|
192 |
/* pc_sysfw.c */
|
193 |
void pc_system_firmware_init(MemoryRegion *rom_memory);
|
194 |
|
195 |
/* pvpanic.c */
|
196 |
int pvpanic_init(ISABus *bus);
|
197 |
|
198 |
/* e820 types */
|
199 |
#define E820_RAM 1 |
200 |
#define E820_RESERVED 2 |
201 |
#define E820_ACPI 3 |
202 |
#define E820_NVS 4 |
203 |
#define E820_UNUSABLE 5 |
204 |
|
205 |
int e820_add_entry(uint64_t, uint64_t, uint32_t);
|
206 |
|
207 |
#define PC_COMPAT_1_5 \
|
208 |
{\ |
209 |
.driver = "Conroe-" TYPE_X86_CPU,\
|
210 |
.property = "model",\
|
211 |
.value = stringify(2),\
|
212 |
},{\ |
213 |
.driver = "Conroe-" TYPE_X86_CPU,\
|
214 |
.property = "level",\
|
215 |
.value = stringify(2),\
|
216 |
},{\ |
217 |
.driver = "Penryn-" TYPE_X86_CPU,\
|
218 |
.property = "model",\
|
219 |
.value = stringify(2),\
|
220 |
},{\ |
221 |
.driver = "Penryn-" TYPE_X86_CPU,\
|
222 |
.property = "level",\
|
223 |
.value = stringify(2),\
|
224 |
},{\ |
225 |
.driver = "Nehalem-" TYPE_X86_CPU,\
|
226 |
.property = "model",\
|
227 |
.value = stringify(2),\
|
228 |
},{\ |
229 |
.driver = "Nehalem-" TYPE_X86_CPU,\
|
230 |
.property = "level",\
|
231 |
.value = stringify(2),\
|
232 |
} |
233 |
|
234 |
#define PC_COMPAT_1_4 \
|
235 |
PC_COMPAT_1_5, \ |
236 |
{\ |
237 |
.driver = "scsi-hd",\
|
238 |
.property = "discard_granularity",\
|
239 |
.value = stringify(0),\
|
240 |
},{\ |
241 |
.driver = "scsi-cd",\
|
242 |
.property = "discard_granularity",\
|
243 |
.value = stringify(0),\
|
244 |
},{\ |
245 |
.driver = "scsi-disk",\
|
246 |
.property = "discard_granularity",\
|
247 |
.value = stringify(0),\
|
248 |
},{\ |
249 |
.driver = "ide-hd",\
|
250 |
.property = "discard_granularity",\
|
251 |
.value = stringify(0),\
|
252 |
},{\ |
253 |
.driver = "ide-cd",\
|
254 |
.property = "discard_granularity",\
|
255 |
.value = stringify(0),\
|
256 |
},{\ |
257 |
.driver = "ide-drive",\
|
258 |
.property = "discard_granularity",\
|
259 |
.value = stringify(0),\
|
260 |
},{\ |
261 |
.driver = "virtio-blk-pci",\
|
262 |
.property = "discard_granularity",\
|
263 |
.value = stringify(0),\
|
264 |
},{\ |
265 |
.driver = "virtio-serial-pci",\
|
266 |
.property = "vectors",\
|
267 |
/* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\
|
268 |
.value = stringify(0xFFFFFFFF),\
|
269 |
},{ \ |
270 |
.driver = "virtio-net-pci", \
|
271 |
.property = "ctrl_guest_offloads", \
|
272 |
.value = "off", \
|
273 |
},{\ |
274 |
.driver = "e1000",\
|
275 |
.property = "romfile",\
|
276 |
.value = "pxe-e1000.rom",\
|
277 |
},{\ |
278 |
.driver = "ne2k_pci",\
|
279 |
.property = "romfile",\
|
280 |
.value = "pxe-ne2k_pci.rom",\
|
281 |
},{\ |
282 |
.driver = "pcnet",\
|
283 |
.property = "romfile",\
|
284 |
.value = "pxe-pcnet.rom",\
|
285 |
},{\ |
286 |
.driver = "rtl8139",\
|
287 |
.property = "romfile",\
|
288 |
.value = "pxe-rtl8139.rom",\
|
289 |
},{\ |
290 |
.driver = "virtio-net-pci",\
|
291 |
.property = "romfile",\
|
292 |
.value = "pxe-virtio.rom",\
|
293 |
},{\ |
294 |
.driver = "486-" TYPE_X86_CPU,\
|
295 |
.property = "model",\
|
296 |
.value = stringify(0),\
|
297 |
} |
298 |
|
299 |
#endif
|