root / hw / pc.h @ 9b8251c5
History | View | Annotate | Download (5.3 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 | /* 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 | 376253ec | aliguori | void pic_info(Monitor *mon);
|
44 | 376253ec | aliguori | void irq_info(Monitor *mon);
|
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 | 459ae5ea | Gleb Natapov | void *pc_memory_init(MemoryRegion *system_memory,
|
83 | 4aa63af1 | Avi Kivity | const char *kernel_filename, |
84 | 845773ab | Isaku Yamahata | const char *kernel_cmdline, |
85 | 845773ab | Isaku Yamahata | const char *initrd_filename, |
86 | e0e7e67b | Anthony PERARD | ram_addr_t below_4g_mem_size, |
87 | ae0a5466 | Avi Kivity | ram_addr_t above_4g_mem_size, |
88 | 4463aee6 | Jan Kiszka | MemoryRegion *rom_memory, |
89 | ae0a5466 | Avi Kivity | MemoryRegion **ram_memory); |
90 | 845773ab | Isaku Yamahata | qemu_irq *pc_allocate_cpu_irq(void);
|
91 | 48a18b3c | Hervé Poussineau | DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus); |
92 | 48a18b3c | Hervé Poussineau | void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
|
93 | 1611977c | Anthony PERARD | ISADevice **rtc_state, |
94 | 34d4260e | Kevin Wolf | ISADevice **floppy, |
95 | 1611977c | Anthony PERARD | bool no_vmport);
|
96 | 48a18b3c | Hervé Poussineau | void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd);
|
97 | 845773ab | Isaku Yamahata | void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
|
98 | c0897e0c | Markus Armbruster | const char *boot_device, |
99 | 34d4260e | Kevin Wolf | ISADevice *floppy, BusState *ide0, BusState *ide1, |
100 | 63ffb564 | Blue Swirl | ISADevice *s); |
101 | 845773ab | Isaku Yamahata | void pc_pci_device_init(PCIBus *pci_bus);
|
102 | 8e78eb28 | Isaku Yamahata | |
103 | f885f1ea | Isaku Yamahata | typedef void (*cpu_set_smm_t)(int smm, void *arg); |
104 | f885f1ea | Isaku Yamahata | void cpu_smm_register(cpu_set_smm_t callback, void *arg); |
105 | f885f1ea | Isaku Yamahata | |
106 | 87ecb68b | pbrook | /* acpi.c */
|
107 | 87ecb68b | pbrook | extern int acpi_enabled; |
108 | 80deece2 | blueswir1 | extern char *acpi_tables; |
109 | 80deece2 | blueswir1 | extern size_t acpi_tables_len;
|
110 | 80deece2 | blueswir1 | |
111 | 9d5e77a2 | Isaku Yamahata | void acpi_bios_init(void); |
112 | 9d5e77a2 | Isaku Yamahata | int acpi_table_add(const char *table_desc); |
113 | 9d5e77a2 | Isaku Yamahata | |
114 | 9d5e77a2 | Isaku Yamahata | /* acpi_piix.c */
|
115 | 53b67b30 | Blue Swirl | |
116 | cf7a2fe2 | aurel32 | i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
|
117 | da98c8eb | Gerd Hoffmann | qemu_irq sci_irq, qemu_irq smi_irq, |
118 | 459ae5ea | Gleb Natapov | int kvm_enabled, void *fw_cfg); |
119 | 87ecb68b | pbrook | void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr);
|
120 | 87ecb68b | pbrook | |
121 | 16b29ae1 | aliguori | /* hpet.c */
|
122 | 16b29ae1 | aliguori | extern int no_hpet; |
123 | 16b29ae1 | aliguori | |
124 | 87ecb68b | pbrook | /* piix_pci.c */
|
125 | 0a3bacf3 | Juan Quintela | struct PCII440FXState;
|
126 | 0a3bacf3 | Juan Quintela | typedef struct PCII440FXState PCII440FXState; |
127 | 0a3bacf3 | Juan Quintela | |
128 | 1e39101c | Avi Kivity | PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn,
|
129 | 60573079 | Hervé Poussineau | ISABus **isa_bus, qemu_irq *pic, |
130 | aee97b84 | Avi Kivity | MemoryRegion *address_space_mem, |
131 | aee97b84 | Avi Kivity | MemoryRegion *address_space_io, |
132 | ae0a5466 | Avi Kivity | ram_addr_t ram_size, |
133 | a8170e5e | Avi Kivity | hwaddr pci_hole_start, |
134 | a8170e5e | Avi Kivity | hwaddr pci_hole_size, |
135 | a8170e5e | Avi Kivity | hwaddr pci_hole64_start, |
136 | a8170e5e | Avi Kivity | hwaddr pci_hole64_size, |
137 | ae0a5466 | Avi Kivity | MemoryRegion *pci_memory, |
138 | ae0a5466 | Avi Kivity | MemoryRegion *ram_memory); |
139 | 87ecb68b | pbrook | |
140 | 823e675a | Juan Quintela | /* piix4.c */
|
141 | b1d8e52e | blueswir1 | extern PCIDevice *piix4_dev;
|
142 | 142e9787 | Hervé Poussineau | int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn); |
143 | 87ecb68b | pbrook | |
144 | 87ecb68b | pbrook | /* vga.c */
|
145 | cb5a7aa8 | malc | enum vga_retrace_method {
|
146 | cb5a7aa8 | malc | VGA_RETRACE_DUMB, |
147 | cb5a7aa8 | malc | VGA_RETRACE_PRECISE |
148 | cb5a7aa8 | malc | }; |
149 | cb5a7aa8 | malc | |
150 | cb5a7aa8 | malc | extern enum vga_retrace_method vga_retrace_method; |
151 | 87ecb68b | pbrook | |
152 | a8170e5e | Avi Kivity | int isa_vga_mm_init(hwaddr vram_base,
|
153 | a8170e5e | Avi Kivity | hwaddr ctrl_base, int it_shift,
|
154 | be20f9e9 | Avi Kivity | MemoryRegion *address_space); |
155 | 87ecb68b | pbrook | |
156 | 87ecb68b | pbrook | /* ne2000.c */
|
157 | 48a18b3c | Hervé Poussineau | static inline bool isa_ne2000_init(ISABus *bus, int base, int irq, NICInfo *nd) |
158 | 60a14ad3 | Blue Swirl | { |
159 | 60a14ad3 | Blue Swirl | ISADevice *dev; |
160 | 87ecb68b | pbrook | |
161 | 60a14ad3 | Blue Swirl | qemu_check_nic_model(nd, "ne2k_isa");
|
162 | 60a14ad3 | Blue Swirl | |
163 | 48a18b3c | Hervé Poussineau | dev = isa_try_create(bus, "ne2k_isa");
|
164 | cd1b8a8b | Blue Swirl | if (!dev) {
|
165 | cd1b8a8b | Blue Swirl | return false; |
166 | cd1b8a8b | Blue Swirl | } |
167 | 60a14ad3 | Blue Swirl | qdev_prop_set_uint32(&dev->qdev, "iobase", base);
|
168 | 60a14ad3 | Blue Swirl | qdev_prop_set_uint32(&dev->qdev, "irq", irq);
|
169 | 60a14ad3 | Blue Swirl | qdev_set_nic_properties(&dev->qdev, nd); |
170 | 60a14ad3 | Blue Swirl | qdev_init_nofail(&dev->qdev); |
171 | cd1b8a8b | Blue Swirl | return true; |
172 | 60a14ad3 | Blue Swirl | } |
173 | 87ecb68b | pbrook | |
174 | cbc5b5f3 | Jordan Justen | /* pc_sysfw.c */
|
175 | cbc5b5f3 | Jordan Justen | void pc_system_firmware_init(MemoryRegion *rom_memory);
|
176 | cbc5b5f3 | Jordan Justen | |
177 | 4c5b10b7 | Jes Sorensen | /* e820 types */
|
178 | 4c5b10b7 | Jes Sorensen | #define E820_RAM 1 |
179 | 4c5b10b7 | Jes Sorensen | #define E820_RESERVED 2 |
180 | 4c5b10b7 | Jes Sorensen | #define E820_ACPI 3 |
181 | 4c5b10b7 | Jes Sorensen | #define E820_NVS 4 |
182 | 4c5b10b7 | Jes Sorensen | #define E820_UNUSABLE 5 |
183 | 4c5b10b7 | Jes Sorensen | |
184 | 4c5b10b7 | Jes Sorensen | int e820_add_entry(uint64_t, uint64_t, uint32_t);
|
185 | 4c5b10b7 | Jes Sorensen | |
186 | 87ecb68b | pbrook | #endif |