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