root / hw / pc.h @ 4b8f1c88
History | View | Annotate | Download (6.6 kB)
1 | 87ecb68b | pbrook | #ifndef HW_PC_H
|
---|---|---|---|
2 | 87ecb68b | pbrook | #define HW_PC_H
|
3 | 376253ec | aliguori | |
4 | 376253ec | aliguori | #include "qemu-common.h" |
5 | 00cb2a99 | Avi Kivity | #include "memory.h" |
6 | 35bed8ee | Paul Brook | #include "ioport.h" |
7 | 845773ab | Isaku Yamahata | #include "isa.h" |
8 | 845773ab | Isaku Yamahata | #include "fdc.h" |
9 | cd1b8a8b | Blue Swirl | #include "net.h" |
10 | 4aa63af1 | Avi Kivity | #include "memory.h" |
11 | b881fbe9 | Jan Kiszka | #include "ioapic.h" |
12 | 376253ec | aliguori | |
13 | 87ecb68b | pbrook | /* PC-style peripherals (also used by other machines). */
|
14 | 87ecb68b | pbrook | |
15 | 87ecb68b | pbrook | /* serial.c */
|
16 | 87ecb68b | pbrook | |
17 | b6cd0ea1 | aurel32 | SerialState *serial_init(int base, qemu_irq irq, int baudbase, |
18 | b6cd0ea1 | aurel32 | CharDriverState *chr); |
19 | 39186d8a | Richard Henderson | SerialState *serial_mm_init(MemoryRegion *address_space, |
20 | 39186d8a | Richard Henderson | target_phys_addr_t base, int it_shift,
|
21 | 39186d8a | Richard Henderson | qemu_irq irq, int baudbase,
|
22 | 39186d8a | Richard Henderson | CharDriverState *chr, enum device_endian);
|
23 | 48a18b3c | Hervé Poussineau | static inline bool serial_isa_init(ISABus *bus, int index, |
24 | 48a18b3c | Hervé Poussineau | CharDriverState *chr) |
25 | e22cf21e | Blue Swirl | { |
26 | e22cf21e | Blue Swirl | ISADevice *dev; |
27 | e22cf21e | Blue Swirl | |
28 | 48a18b3c | Hervé Poussineau | dev = isa_try_create(bus, "isa-serial");
|
29 | 9b13ef9f | Blue Swirl | if (!dev) {
|
30 | 9b13ef9f | Blue Swirl | return false; |
31 | 9b13ef9f | Blue Swirl | } |
32 | e22cf21e | Blue Swirl | qdev_prop_set_uint32(&dev->qdev, "index", index);
|
33 | e22cf21e | Blue Swirl | qdev_prop_set_chr(&dev->qdev, "chardev", chr);
|
34 | e22cf21e | Blue Swirl | if (qdev_init(&dev->qdev) < 0) { |
35 | e22cf21e | Blue Swirl | return false; |
36 | e22cf21e | Blue Swirl | } |
37 | e22cf21e | Blue Swirl | return true; |
38 | e22cf21e | Blue Swirl | } |
39 | e22cf21e | Blue Swirl | |
40 | 038eaf82 | Stefan Weil | void serial_set_frequency(SerialState *s, uint32_t frequency);
|
41 | 87ecb68b | pbrook | |
42 | 87ecb68b | pbrook | /* parallel.c */
|
43 | 48a18b3c | Hervé Poussineau | static inline bool parallel_init(ISABus *bus, int index, CharDriverState *chr) |
44 | defdb20e | Blue Swirl | { |
45 | defdb20e | Blue Swirl | ISADevice *dev; |
46 | defdb20e | Blue Swirl | |
47 | 48a18b3c | Hervé Poussineau | dev = isa_try_create(bus, "isa-parallel");
|
48 | 73531538 | Blue Swirl | if (!dev) {
|
49 | 73531538 | Blue Swirl | return false; |
50 | 73531538 | Blue Swirl | } |
51 | defdb20e | Blue Swirl | qdev_prop_set_uint32(&dev->qdev, "index", index);
|
52 | defdb20e | Blue Swirl | qdev_prop_set_chr(&dev->qdev, "chardev", chr);
|
53 | defdb20e | Blue Swirl | if (qdev_init(&dev->qdev) < 0) { |
54 | defdb20e | Blue Swirl | return false; |
55 | defdb20e | Blue Swirl | } |
56 | defdb20e | Blue Swirl | return true; |
57 | defdb20e | Blue Swirl | } |
58 | defdb20e | Blue Swirl | |
59 | 63858cd9 | Avi Kivity | bool parallel_mm_init(MemoryRegion *address_space,
|
60 | 63858cd9 | Avi Kivity | target_phys_addr_t base, int it_shift, qemu_irq irq,
|
61 | defdb20e | Blue Swirl | CharDriverState *chr); |
62 | 87ecb68b | pbrook | |
63 | 87ecb68b | pbrook | /* i8259.c */
|
64 | 87ecb68b | pbrook | |
65 | 9aa78c42 | Jan Kiszka | extern DeviceState *isa_pic;
|
66 | 48a18b3c | Hervé Poussineau | qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq); |
67 | 10b61882 | Jan Kiszka | qemu_irq *kvm_i8259_init(ISABus *bus); |
68 | 9aa78c42 | Jan Kiszka | int pic_read_irq(DeviceState *d);
|
69 | 9aa78c42 | Jan Kiszka | int pic_get_output(DeviceState *d);
|
70 | 376253ec | aliguori | void pic_info(Monitor *mon);
|
71 | 376253ec | aliguori | void irq_info(Monitor *mon);
|
72 | 87ecb68b | pbrook | |
73 | b881fbe9 | Jan Kiszka | /* Global System Interrupts */
|
74 | 96051119 | Blue Swirl | |
75 | b881fbe9 | Jan Kiszka | #define GSI_NUM_PINS IOAPIC_NUM_PINS
|
76 | 845773ab | Isaku Yamahata | |
77 | b881fbe9 | Jan Kiszka | typedef struct GSIState { |
78 | 43a0db35 | Jan Kiszka | qemu_irq i8259_irq[ISA_NUM_IRQS]; |
79 | b881fbe9 | Jan Kiszka | qemu_irq ioapic_irq[IOAPIC_NUM_PINS]; |
80 | b881fbe9 | Jan Kiszka | } GSIState; |
81 | b881fbe9 | Jan Kiszka | |
82 | b881fbe9 | Jan Kiszka | void gsi_handler(void *opaque, int n, int level); |
83 | 845773ab | Isaku Yamahata | |
84 | 87ecb68b | pbrook | /* vmport.c */
|
85 | 48a18b3c | Hervé Poussineau | static inline void vmport_init(ISABus *bus) |
86 | 6872ef61 | Blue Swirl | { |
87 | 48a18b3c | Hervé Poussineau | isa_create_simple(bus, "vmport");
|
88 | 6872ef61 | Blue Swirl | } |
89 | 87ecb68b | pbrook | void vmport_register(unsigned char command, IOPortReadFunc *func, void *opaque); |
90 | 86d86414 | Blue Swirl | void vmmouse_get_data(uint32_t *data);
|
91 | 86d86414 | Blue Swirl | void vmmouse_set_data(const uint32_t *data); |
92 | 87ecb68b | pbrook | |
93 | 87ecb68b | pbrook | /* pckbd.c */
|
94 | 87ecb68b | pbrook | |
95 | 87ecb68b | pbrook | void i8042_init(qemu_irq kbd_irq, qemu_irq mouse_irq, uint32_t io_base);
|
96 | 87ecb68b | pbrook | void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
|
97 | dbff76ac | Richard Henderson | MemoryRegion *region, ram_addr_t size, |
98 | c227f099 | Anthony Liguori | target_phys_addr_t mask); |
99 | 956a3e6b | Blue Swirl | void i8042_isa_mouse_fake_event(void *opaque); |
100 | 956a3e6b | Blue Swirl | void i8042_setup_a20_line(ISADevice *dev, qemu_irq *a20_out);
|
101 | 87ecb68b | pbrook | |
102 | 87ecb68b | pbrook | /* pc.c */
|
103 | 87ecb68b | pbrook | extern int fd_bootchk; |
104 | 87ecb68b | pbrook | |
105 | 8e78eb28 | Isaku Yamahata | void pc_register_ferr_irq(qemu_irq irq);
|
106 | 845773ab | Isaku Yamahata | void pc_acpi_smi_interrupt(void *opaque, int irq, int level); |
107 | 845773ab | Isaku Yamahata | |
108 | 845773ab | Isaku Yamahata | void pc_cpus_init(const char *cpu_model); |
109 | 4aa63af1 | Avi Kivity | void pc_memory_init(MemoryRegion *system_memory,
|
110 | 4aa63af1 | Avi Kivity | const char *kernel_filename, |
111 | 845773ab | Isaku Yamahata | const char *kernel_cmdline, |
112 | 845773ab | Isaku Yamahata | const char *initrd_filename, |
113 | e0e7e67b | Anthony PERARD | ram_addr_t below_4g_mem_size, |
114 | ae0a5466 | Avi Kivity | ram_addr_t above_4g_mem_size, |
115 | 4463aee6 | Jan Kiszka | MemoryRegion *rom_memory, |
116 | ae0a5466 | Avi Kivity | MemoryRegion **ram_memory); |
117 | 845773ab | Isaku Yamahata | qemu_irq *pc_allocate_cpu_irq(void);
|
118 | 48a18b3c | Hervé Poussineau | DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus); |
119 | 48a18b3c | Hervé Poussineau | void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
|
120 | 1611977c | Anthony PERARD | ISADevice **rtc_state, |
121 | 34d4260e | Kevin Wolf | ISADevice **floppy, |
122 | 1611977c | Anthony PERARD | bool no_vmport);
|
123 | 48a18b3c | Hervé Poussineau | void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd);
|
124 | 845773ab | Isaku Yamahata | void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
|
125 | c0897e0c | Markus Armbruster | const char *boot_device, |
126 | 34d4260e | Kevin Wolf | ISADevice *floppy, BusState *ide0, BusState *ide1, |
127 | 63ffb564 | Blue Swirl | ISADevice *s); |
128 | 845773ab | Isaku Yamahata | void pc_pci_device_init(PCIBus *pci_bus);
|
129 | 8e78eb28 | Isaku Yamahata | |
130 | f885f1ea | Isaku Yamahata | typedef void (*cpu_set_smm_t)(int smm, void *arg); |
131 | f885f1ea | Isaku Yamahata | void cpu_smm_register(cpu_set_smm_t callback, void *arg); |
132 | f885f1ea | Isaku Yamahata | |
133 | 87ecb68b | pbrook | /* acpi.c */
|
134 | 87ecb68b | pbrook | extern int acpi_enabled; |
135 | 80deece2 | blueswir1 | extern char *acpi_tables; |
136 | 80deece2 | blueswir1 | extern size_t acpi_tables_len;
|
137 | 80deece2 | blueswir1 | |
138 | 9d5e77a2 | Isaku Yamahata | void acpi_bios_init(void); |
139 | 9d5e77a2 | Isaku Yamahata | int acpi_table_add(const char *table_desc); |
140 | 9d5e77a2 | Isaku Yamahata | |
141 | 9d5e77a2 | Isaku Yamahata | /* acpi_piix.c */
|
142 | 53b67b30 | Blue Swirl | |
143 | cf7a2fe2 | aurel32 | i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
|
144 | da98c8eb | Gerd Hoffmann | qemu_irq sci_irq, qemu_irq smi_irq, |
145 | 53b67b30 | Blue Swirl | int kvm_enabled);
|
146 | 87ecb68b | pbrook | void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr);
|
147 | 87ecb68b | pbrook | |
148 | 16b29ae1 | aliguori | /* hpet.c */
|
149 | 16b29ae1 | aliguori | extern int no_hpet; |
150 | 16b29ae1 | aliguori | |
151 | 87ecb68b | pbrook | /* piix_pci.c */
|
152 | 0a3bacf3 | Juan Quintela | struct PCII440FXState;
|
153 | 0a3bacf3 | Juan Quintela | typedef struct PCII440FXState PCII440FXState; |
154 | 0a3bacf3 | Juan Quintela | |
155 | 1e39101c | Avi Kivity | PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn,
|
156 | 60573079 | Hervé Poussineau | ISABus **isa_bus, qemu_irq *pic, |
157 | aee97b84 | Avi Kivity | MemoryRegion *address_space_mem, |
158 | aee97b84 | Avi Kivity | MemoryRegion *address_space_io, |
159 | ae0a5466 | Avi Kivity | ram_addr_t ram_size, |
160 | ae0a5466 | Avi Kivity | target_phys_addr_t pci_hole_start, |
161 | ae0a5466 | Avi Kivity | target_phys_addr_t pci_hole_size, |
162 | ae0a5466 | Avi Kivity | target_phys_addr_t pci_hole64_start, |
163 | ae0a5466 | Avi Kivity | target_phys_addr_t pci_hole64_size, |
164 | ae0a5466 | Avi Kivity | MemoryRegion *pci_memory, |
165 | ae0a5466 | Avi Kivity | MemoryRegion *ram_memory); |
166 | 87ecb68b | pbrook | |
167 | 823e675a | Juan Quintela | /* piix4.c */
|
168 | b1d8e52e | blueswir1 | extern PCIDevice *piix4_dev;
|
169 | 142e9787 | Hervé Poussineau | int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn); |
170 | 87ecb68b | pbrook | |
171 | 87ecb68b | pbrook | /* vga.c */
|
172 | cb5a7aa8 | malc | enum vga_retrace_method {
|
173 | cb5a7aa8 | malc | VGA_RETRACE_DUMB, |
174 | cb5a7aa8 | malc | VGA_RETRACE_PRECISE |
175 | cb5a7aa8 | malc | }; |
176 | cb5a7aa8 | malc | |
177 | cb5a7aa8 | malc | extern enum vga_retrace_method vga_retrace_method; |
178 | 87ecb68b | pbrook | |
179 | 48a18b3c | Hervé Poussineau | static inline DeviceState *isa_vga_init(ISABus *bus) |
180 | 7435b791 | Blue Swirl | { |
181 | c74b88df | Blue Swirl | ISADevice *dev; |
182 | 7435b791 | Blue Swirl | |
183 | 48a18b3c | Hervé Poussineau | dev = isa_try_create(bus, "isa-vga");
|
184 | c74b88df | Blue Swirl | if (!dev) {
|
185 | c74b88df | Blue Swirl | fprintf(stderr, "Warning: isa-vga not available\n");
|
186 | ad6d45fa | Anthony Liguori | return NULL; |
187 | c74b88df | Blue Swirl | } |
188 | c74b88df | Blue Swirl | qdev_init_nofail(&dev->qdev); |
189 | ad6d45fa | Anthony Liguori | return &dev->qdev;
|
190 | 7435b791 | Blue Swirl | } |
191 | 7435b791 | Blue Swirl | |
192 | ad6d45fa | Anthony Liguori | DeviceState *pci_vga_init(PCIBus *bus); |
193 | c227f099 | Anthony Liguori | int isa_vga_mm_init(target_phys_addr_t vram_base,
|
194 | be20f9e9 | Avi Kivity | target_phys_addr_t ctrl_base, int it_shift,
|
195 | be20f9e9 | Avi Kivity | MemoryRegion *address_space); |
196 | 87ecb68b | pbrook | |
197 | 87ecb68b | pbrook | /* cirrus_vga.c */
|
198 | ad6d45fa | Anthony Liguori | DeviceState *pci_cirrus_vga_init(PCIBus *bus); |
199 | 87ecb68b | pbrook | |
200 | 87ecb68b | pbrook | /* ne2000.c */
|
201 | 48a18b3c | Hervé Poussineau | static inline bool isa_ne2000_init(ISABus *bus, int base, int irq, NICInfo *nd) |
202 | 60a14ad3 | Blue Swirl | { |
203 | 60a14ad3 | Blue Swirl | ISADevice *dev; |
204 | 87ecb68b | pbrook | |
205 | 60a14ad3 | Blue Swirl | qemu_check_nic_model(nd, "ne2k_isa");
|
206 | 60a14ad3 | Blue Swirl | |
207 | 48a18b3c | Hervé Poussineau | dev = isa_try_create(bus, "ne2k_isa");
|
208 | cd1b8a8b | Blue Swirl | if (!dev) {
|
209 | cd1b8a8b | Blue Swirl | return false; |
210 | cd1b8a8b | Blue Swirl | } |
211 | 60a14ad3 | Blue Swirl | qdev_prop_set_uint32(&dev->qdev, "iobase", base);
|
212 | 60a14ad3 | Blue Swirl | qdev_prop_set_uint32(&dev->qdev, "irq", irq);
|
213 | 60a14ad3 | Blue Swirl | qdev_set_nic_properties(&dev->qdev, nd); |
214 | 60a14ad3 | Blue Swirl | qdev_init_nofail(&dev->qdev); |
215 | cd1b8a8b | Blue Swirl | return true; |
216 | 60a14ad3 | Blue Swirl | } |
217 | 87ecb68b | pbrook | |
218 | cbc5b5f3 | Jordan Justen | /* pc_sysfw.c */
|
219 | cbc5b5f3 | Jordan Justen | void pc_system_firmware_init(MemoryRegion *rom_memory);
|
220 | cbc5b5f3 | Jordan Justen | |
221 | 4c5b10b7 | Jes Sorensen | /* e820 types */
|
222 | 4c5b10b7 | Jes Sorensen | #define E820_RAM 1 |
223 | 4c5b10b7 | Jes Sorensen | #define E820_RESERVED 2 |
224 | 4c5b10b7 | Jes Sorensen | #define E820_ACPI 3 |
225 | 4c5b10b7 | Jes Sorensen | #define E820_NVS 4 |
226 | 4c5b10b7 | Jes Sorensen | #define E820_UNUSABLE 5 |
227 | 4c5b10b7 | Jes Sorensen | |
228 | 4c5b10b7 | Jes Sorensen | int e820_add_entry(uint64_t, uint64_t, uint32_t);
|
229 | 4c5b10b7 | Jes Sorensen | |
230 | 87ecb68b | pbrook | #endif |