root / hw / pc.h @ 3e3648b2
History | View | Annotate | Download (5.5 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 | 022c62cb | Paolo Bonzini | #include "exec/memory.h" |
6 | 022c62cb | Paolo Bonzini | #include "exec/ioport.h" |
7 | 845773ab | Isaku Yamahata | #include "isa.h" |
8 | 845773ab | Isaku Yamahata | #include "fdc.h" |
9 | 1422e32d | Paolo Bonzini | #include "net/net.h" |
10 | 022c62cb | Paolo Bonzini | #include "exec/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 | /* parallel.c */
|
16 | 48a18b3c | Hervé Poussineau | static inline bool parallel_init(ISABus *bus, int index, CharDriverState *chr) |
17 | defdb20e | Blue Swirl | { |
18 | defdb20e | Blue Swirl | ISADevice *dev; |
19 | defdb20e | Blue Swirl | |
20 | 48a18b3c | Hervé Poussineau | dev = isa_try_create(bus, "isa-parallel");
|
21 | 73531538 | Blue Swirl | if (!dev) {
|
22 | 73531538 | Blue Swirl | return false; |
23 | 73531538 | Blue Swirl | } |
24 | defdb20e | Blue Swirl | qdev_prop_set_uint32(&dev->qdev, "index", index);
|
25 | defdb20e | Blue Swirl | qdev_prop_set_chr(&dev->qdev, "chardev", chr);
|
26 | defdb20e | Blue Swirl | if (qdev_init(&dev->qdev) < 0) { |
27 | defdb20e | Blue Swirl | return false; |
28 | defdb20e | Blue Swirl | } |
29 | defdb20e | Blue Swirl | return true; |
30 | defdb20e | Blue Swirl | } |
31 | defdb20e | Blue Swirl | |
32 | 63858cd9 | Avi Kivity | bool parallel_mm_init(MemoryRegion *address_space,
|
33 | a8170e5e | Avi Kivity | hwaddr base, int it_shift, qemu_irq irq,
|
34 | defdb20e | Blue Swirl | CharDriverState *chr); |
35 | 87ecb68b | pbrook | |
36 | 87ecb68b | pbrook | /* i8259.c */
|
37 | 87ecb68b | pbrook | |
38 | 9aa78c42 | Jan Kiszka | extern DeviceState *isa_pic;
|
39 | 48a18b3c | Hervé Poussineau | qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq); |
40 | 10b61882 | Jan Kiszka | qemu_irq *kvm_i8259_init(ISABus *bus); |
41 | 9aa78c42 | Jan Kiszka | int pic_read_irq(DeviceState *d);
|
42 | 9aa78c42 | Jan Kiszka | int pic_get_output(DeviceState *d);
|
43 | 84f2d0ea | Wenchao Xia | void pic_info(Monitor *mon, const QDict *qdict); |
44 | 84f2d0ea | Wenchao Xia | void irq_info(Monitor *mon, const QDict *qdict); |
45 | 87ecb68b | pbrook | |
46 | b881fbe9 | Jan Kiszka | /* Global System Interrupts */
|
47 | 96051119 | Blue Swirl | |
48 | b881fbe9 | Jan Kiszka | #define GSI_NUM_PINS IOAPIC_NUM_PINS
|
49 | 845773ab | Isaku Yamahata | |
50 | b881fbe9 | Jan Kiszka | typedef struct GSIState { |
51 | 43a0db35 | Jan Kiszka | qemu_irq i8259_irq[ISA_NUM_IRQS]; |
52 | b881fbe9 | Jan Kiszka | qemu_irq ioapic_irq[IOAPIC_NUM_PINS]; |
53 | b881fbe9 | Jan Kiszka | } GSIState; |
54 | b881fbe9 | Jan Kiszka | |
55 | b881fbe9 | Jan Kiszka | void gsi_handler(void *opaque, int n, int level); |
56 | 845773ab | Isaku Yamahata | |
57 | 87ecb68b | pbrook | /* vmport.c */
|
58 | 48a18b3c | Hervé Poussineau | static inline void vmport_init(ISABus *bus) |
59 | 6872ef61 | Blue Swirl | { |
60 | 48a18b3c | Hervé Poussineau | isa_create_simple(bus, "vmport");
|
61 | 6872ef61 | Blue Swirl | } |
62 | 87ecb68b | pbrook | void vmport_register(unsigned char command, IOPortReadFunc *func, void *opaque); |
63 | 86d86414 | Blue Swirl | void vmmouse_get_data(uint32_t *data);
|
64 | 86d86414 | Blue Swirl | void vmmouse_set_data(const uint32_t *data); |
65 | 87ecb68b | pbrook | |
66 | 87ecb68b | pbrook | /* pckbd.c */
|
67 | 87ecb68b | pbrook | |
68 | 87ecb68b | pbrook | void i8042_init(qemu_irq kbd_irq, qemu_irq mouse_irq, uint32_t io_base);
|
69 | 87ecb68b | pbrook | void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
|
70 | dbff76ac | Richard Henderson | MemoryRegion *region, ram_addr_t size, |
71 | a8170e5e | Avi Kivity | hwaddr mask); |
72 | 956a3e6b | Blue Swirl | void i8042_isa_mouse_fake_event(void *opaque); |
73 | 956a3e6b | Blue Swirl | void i8042_setup_a20_line(ISADevice *dev, qemu_irq *a20_out);
|
74 | 87ecb68b | pbrook | |
75 | 87ecb68b | pbrook | /* pc.c */
|
76 | 87ecb68b | pbrook | extern int fd_bootchk; |
77 | 87ecb68b | pbrook | |
78 | 8e78eb28 | Isaku Yamahata | void pc_register_ferr_irq(qemu_irq irq);
|
79 | 845773ab | Isaku Yamahata | void pc_acpi_smi_interrupt(void *opaque, int irq, int level); |
80 | 845773ab | Isaku Yamahata | |
81 | 845773ab | Isaku Yamahata | void pc_cpus_init(const char *cpu_model); |
82 | f7e4dd6c | Gerd Hoffmann | void pc_acpi_init(const char *default_dsdt); |
83 | 459ae5ea | Gleb Natapov | void *pc_memory_init(MemoryRegion *system_memory,
|
84 | 4aa63af1 | Avi Kivity | const char *kernel_filename, |
85 | 845773ab | Isaku Yamahata | const char *kernel_cmdline, |
86 | 845773ab | Isaku Yamahata | const char *initrd_filename, |
87 | e0e7e67b | Anthony PERARD | ram_addr_t below_4g_mem_size, |
88 | ae0a5466 | Avi Kivity | ram_addr_t above_4g_mem_size, |
89 | 4463aee6 | Jan Kiszka | MemoryRegion *rom_memory, |
90 | ae0a5466 | Avi Kivity | MemoryRegion **ram_memory); |
91 | 845773ab | Isaku Yamahata | qemu_irq *pc_allocate_cpu_irq(void);
|
92 | 48a18b3c | Hervé Poussineau | DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus); |
93 | 48a18b3c | Hervé Poussineau | void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
|
94 | 1611977c | Anthony PERARD | ISADevice **rtc_state, |
95 | 34d4260e | Kevin Wolf | ISADevice **floppy, |
96 | 1611977c | Anthony PERARD | bool no_vmport);
|
97 | 48a18b3c | Hervé Poussineau | void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd);
|
98 | 845773ab | Isaku Yamahata | void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
|
99 | c0897e0c | Markus Armbruster | const char *boot_device, |
100 | 34d4260e | Kevin Wolf | ISADevice *floppy, BusState *ide0, BusState *ide1, |
101 | 63ffb564 | Blue Swirl | ISADevice *s); |
102 | 9011a1a7 | Isaku Yamahata | void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus);
|
103 | 845773ab | Isaku Yamahata | void pc_pci_device_init(PCIBus *pci_bus);
|
104 | 8e78eb28 | Isaku Yamahata | |
105 | f885f1ea | Isaku Yamahata | typedef void (*cpu_set_smm_t)(int smm, void *arg); |
106 | f885f1ea | Isaku Yamahata | void cpu_smm_register(cpu_set_smm_t callback, void *arg); |
107 | f885f1ea | Isaku Yamahata | |
108 | a39e3564 | Jason Baron | void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name); |
109 | a39e3564 | Jason Baron | |
110 | 87ecb68b | pbrook | /* acpi.c */
|
111 | 87ecb68b | pbrook | extern int acpi_enabled; |
112 | 80deece2 | blueswir1 | extern char *acpi_tables; |
113 | 80deece2 | blueswir1 | extern size_t acpi_tables_len;
|
114 | 80deece2 | blueswir1 | |
115 | 9d5e77a2 | Isaku Yamahata | void acpi_bios_init(void); |
116 | 9d5e77a2 | Isaku Yamahata | int acpi_table_add(const char *table_desc); |
117 | 9d5e77a2 | Isaku Yamahata | |
118 | 9d5e77a2 | Isaku Yamahata | /* acpi_piix.c */
|
119 | 53b67b30 | Blue Swirl | |
120 | cf7a2fe2 | aurel32 | i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
|
121 | da98c8eb | Gerd Hoffmann | qemu_irq sci_irq, qemu_irq smi_irq, |
122 | 459ae5ea | Gleb Natapov | int kvm_enabled, void *fw_cfg); |
123 | 87ecb68b | pbrook | void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr);
|
124 | 87ecb68b | pbrook | |
125 | 16b29ae1 | aliguori | /* hpet.c */
|
126 | 16b29ae1 | aliguori | extern int no_hpet; |
127 | 16b29ae1 | aliguori | |
128 | 87ecb68b | pbrook | /* piix_pci.c */
|
129 | 0a3bacf3 | Juan Quintela | struct PCII440FXState;
|
130 | 0a3bacf3 | Juan Quintela | typedef struct PCII440FXState PCII440FXState; |
131 | 0a3bacf3 | Juan Quintela | |
132 | 1e39101c | Avi Kivity | PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn,
|
133 | 60573079 | Hervé Poussineau | ISABus **isa_bus, qemu_irq *pic, |
134 | aee97b84 | Avi Kivity | MemoryRegion *address_space_mem, |
135 | aee97b84 | Avi Kivity | MemoryRegion *address_space_io, |
136 | ae0a5466 | Avi Kivity | ram_addr_t ram_size, |
137 | a8170e5e | Avi Kivity | hwaddr pci_hole_start, |
138 | a8170e5e | Avi Kivity | hwaddr pci_hole_size, |
139 | a8170e5e | Avi Kivity | hwaddr pci_hole64_start, |
140 | a8170e5e | Avi Kivity | hwaddr pci_hole64_size, |
141 | ae0a5466 | Avi Kivity | MemoryRegion *pci_memory, |
142 | ae0a5466 | Avi Kivity | MemoryRegion *ram_memory); |
143 | 87ecb68b | pbrook | |
144 | 823e675a | Juan Quintela | /* piix4.c */
|
145 | b1d8e52e | blueswir1 | extern PCIDevice *piix4_dev;
|
146 | 142e9787 | Hervé Poussineau | int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn); |
147 | 87ecb68b | pbrook | |
148 | 87ecb68b | pbrook | /* vga.c */
|
149 | cb5a7aa8 | malc | enum vga_retrace_method {
|
150 | cb5a7aa8 | malc | VGA_RETRACE_DUMB, |
151 | cb5a7aa8 | malc | VGA_RETRACE_PRECISE |
152 | cb5a7aa8 | malc | }; |
153 | cb5a7aa8 | malc | |
154 | cb5a7aa8 | malc | extern enum vga_retrace_method vga_retrace_method; |
155 | 87ecb68b | pbrook | |
156 | a8170e5e | Avi Kivity | int isa_vga_mm_init(hwaddr vram_base,
|
157 | a8170e5e | Avi Kivity | hwaddr ctrl_base, int it_shift,
|
158 | be20f9e9 | Avi Kivity | MemoryRegion *address_space); |
159 | 87ecb68b | pbrook | |
160 | 87ecb68b | pbrook | /* ne2000.c */
|
161 | 48a18b3c | Hervé Poussineau | static inline bool isa_ne2000_init(ISABus *bus, int base, int irq, NICInfo *nd) |
162 | 60a14ad3 | Blue Swirl | { |
163 | 60a14ad3 | Blue Swirl | ISADevice *dev; |
164 | 87ecb68b | pbrook | |
165 | 60a14ad3 | Blue Swirl | qemu_check_nic_model(nd, "ne2k_isa");
|
166 | 60a14ad3 | Blue Swirl | |
167 | 48a18b3c | Hervé Poussineau | dev = isa_try_create(bus, "ne2k_isa");
|
168 | cd1b8a8b | Blue Swirl | if (!dev) {
|
169 | cd1b8a8b | Blue Swirl | return false; |
170 | cd1b8a8b | Blue Swirl | } |
171 | 60a14ad3 | Blue Swirl | qdev_prop_set_uint32(&dev->qdev, "iobase", base);
|
172 | 60a14ad3 | Blue Swirl | qdev_prop_set_uint32(&dev->qdev, "irq", irq);
|
173 | 60a14ad3 | Blue Swirl | qdev_set_nic_properties(&dev->qdev, nd); |
174 | 60a14ad3 | Blue Swirl | qdev_init_nofail(&dev->qdev); |
175 | cd1b8a8b | Blue Swirl | return true; |
176 | 60a14ad3 | Blue Swirl | } |
177 | 87ecb68b | pbrook | |
178 | cbc5b5f3 | Jordan Justen | /* pc_sysfw.c */
|
179 | cbc5b5f3 | Jordan Justen | void pc_system_firmware_init(MemoryRegion *rom_memory);
|
180 | cbc5b5f3 | Jordan Justen | |
181 | 4c5b10b7 | Jes Sorensen | /* e820 types */
|
182 | 4c5b10b7 | Jes Sorensen | #define E820_RAM 1 |
183 | 4c5b10b7 | Jes Sorensen | #define E820_RESERVED 2 |
184 | 4c5b10b7 | Jes Sorensen | #define E820_ACPI 3 |
185 | 4c5b10b7 | Jes Sorensen | #define E820_NVS 4 |
186 | 4c5b10b7 | Jes Sorensen | #define E820_UNUSABLE 5 |
187 | 4c5b10b7 | Jes Sorensen | |
188 | 4c5b10b7 | Jes Sorensen | int e820_add_entry(uint64_t, uint64_t, uint32_t);
|
189 | 4c5b10b7 | Jes Sorensen | |
190 | 87ecb68b | pbrook | #endif |