]> git.proxmox.com Git - qemu.git/blame - hw/pc.h
Merge remote branch 'kwolf/for-anthony' into staging
[qemu.git] / hw / pc.h
CommitLineData
87ecb68b
PB
1#ifndef HW_PC_H
2#define HW_PC_H
376253ec
AL
3
4#include "qemu-common.h"
35bed8ee 5#include "ioport.h"
845773ab
IY
6#include "isa.h"
7#include "fdc.h"
376253ec 8
87ecb68b
PB
9/* PC-style peripherals (also used by other machines). */
10
11/* serial.c */
12
b6cd0ea1
AJ
13SerialState *serial_init(int base, qemu_irq irq, int baudbase,
14 CharDriverState *chr);
c227f099 15SerialState *serial_mm_init (target_phys_addr_t base, int it_shift,
b6cd0ea1 16 qemu_irq irq, int baudbase,
2d48377a
BS
17 CharDriverState *chr, int ioregister,
18 int be);
ac0be998 19SerialState *serial_isa_init(int index, CharDriverState *chr);
038eaf82 20void serial_set_frequency(SerialState *s, uint32_t frequency);
87ecb68b
PB
21
22/* parallel.c */
23
24typedef struct ParallelState ParallelState;
021f0674 25ParallelState *parallel_init(int index, CharDriverState *chr);
c227f099 26ParallelState *parallel_mm_init(target_phys_addr_t base, int it_shift, qemu_irq irq, CharDriverState *chr);
87ecb68b
PB
27
28/* i8259.c */
29
30typedef struct PicState2 PicState2;
31extern PicState2 *isa_pic;
32void pic_set_irq(int irq, int level);
33void pic_set_irq_new(void *opaque, int irq, int level);
34qemu_irq *i8259_init(qemu_irq parent_irq);
87ecb68b
PB
35int pic_read_irq(PicState2 *s);
36void pic_update_irq(PicState2 *s);
37uint32_t pic_intack_read(PicState2 *s);
376253ec
AL
38void pic_info(Monitor *mon);
39void irq_info(Monitor *mon);
87ecb68b 40
845773ab 41/* ISA */
96051119
BS
42#define IOAPIC_NUM_PINS 0x18
43
845773ab
IY
44typedef struct isa_irq_state {
45 qemu_irq *i8259;
96051119 46 qemu_irq ioapic[IOAPIC_NUM_PINS];
845773ab
IY
47} IsaIrqState;
48
49void isa_irq_handler(void *opaque, int n, int level);
50
87ecb68b
PB
51/* i8254.c */
52
53#define PIT_FREQ 1193182
54
55typedef struct PITState PITState;
56
57PITState *pit_init(int base, qemu_irq irq);
58void pit_set_gate(PITState *pit, int channel, int val);
59int pit_get_gate(PITState *pit, int channel);
60int pit_get_initial_count(PITState *pit, int channel);
61int pit_get_mode(PITState *pit, int channel);
62int pit_get_out(PITState *pit, int channel, int64_t current_time);
63
bf4f74c0
AJ
64void hpet_pit_disable(void);
65void hpet_pit_enable(void);
66
87ecb68b 67/* vmport.c */
26fb5e48 68void vmport_init(void);
87ecb68b
PB
69void vmport_register(unsigned char command, IOPortReadFunc *func, void *opaque);
70
71/* vmmouse.c */
72void *vmmouse_init(void *m);
73
74/* pckbd.c */
75
76void i8042_init(qemu_irq kbd_irq, qemu_irq mouse_irq, uint32_t io_base);
77void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
c227f099
AL
78 target_phys_addr_t base, ram_addr_t size,
79 target_phys_addr_t mask);
956a3e6b
BS
80void i8042_isa_mouse_fake_event(void *opaque);
81void i8042_setup_a20_line(ISADevice *dev, qemu_irq *a20_out);
87ecb68b 82
87ecb68b
PB
83/* pc.c */
84extern int fd_bootchk;
85
8e78eb28 86void pc_register_ferr_irq(qemu_irq irq);
845773ab
IY
87void pc_cmos_set_s3_resume(void *opaque, int irq, int level);
88void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
89
90void pc_cpus_init(const char *cpu_model);
91void pc_memory_init(ram_addr_t ram_size,
92 const char *kernel_filename,
93 const char *kernel_cmdline,
94 const char *initrd_filename,
95 ram_addr_t *below_4g_mem_size_p,
96 ram_addr_t *above_4g_mem_size_p);
97qemu_irq *pc_allocate_cpu_irq(void);
98void pc_vga_init(PCIBus *pci_bus);
99void pc_basic_device_init(qemu_irq *isa_irq,
100 FDCtrl **floppy_controller,
1d914fa0 101 ISADevice **rtc_state);
845773ab
IY
102void pc_init_ne2k_isa(NICInfo *nd);
103#ifdef HAS_AUDIO
104void pc_audio_init (PCIBus *pci_bus, qemu_irq *pic);
105#endif
106void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
c0897e0c
MA
107 const char *boot_device,
108 BusState *ide0, BusState *ide1,
1d914fa0 109 FDCtrl *floppy_controller, ISADevice *s);
845773ab 110void pc_pci_device_init(PCIBus *pci_bus);
8e78eb28 111
f885f1ea
IY
112typedef void (*cpu_set_smm_t)(int smm, void *arg);
113void cpu_smm_register(cpu_set_smm_t callback, void *arg);
114
87ecb68b
PB
115/* acpi.c */
116extern int acpi_enabled;
80deece2
BS
117extern char *acpi_tables;
118extern size_t acpi_tables_len;
119
9d5e77a2
IY
120void acpi_bios_init(void);
121int acpi_table_add(const char *table_desc);
122
123/* acpi_piix.c */
53b67b30 124
cf7a2fe2 125i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
53b67b30
BS
126 qemu_irq sci_irq, qemu_irq cmos_s3, qemu_irq smi_irq,
127 int kvm_enabled);
87ecb68b 128void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr);
87ecb68b 129
16b29ae1
AL
130/* hpet.c */
131extern int no_hpet;
132
87ecb68b
PB
133/* pcspk.c */
134void pcspk_init(PITState *);
22d83b14 135int pcspk_audio_init(qemu_irq *pic);
87ecb68b
PB
136
137/* piix_pci.c */
0a3bacf3
JQ
138struct PCII440FXState;
139typedef struct PCII440FXState PCII440FXState;
140
97679527 141PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn, qemu_irq *pic, ram_addr_t ram_size);
0a3bacf3 142void i440fx_init_memory_mappings(PCII440FXState *d);
87ecb68b 143
823e675a 144/* piix4.c */
b1d8e52e 145extern PCIDevice *piix4_dev;
87ecb68b
PB
146int piix4_init(PCIBus *bus, int devfn);
147
148/* vga.c */
cb5a7aa8 149enum vga_retrace_method {
150 VGA_RETRACE_DUMB,
151 VGA_RETRACE_PRECISE
152};
153
154extern enum vga_retrace_method vga_retrace_method;
87ecb68b 155
fbe1b595
PB
156int isa_vga_init(void);
157int pci_vga_init(PCIBus *bus,
87ecb68b 158 unsigned long vga_bios_offset, int vga_bios_size);
c227f099
AL
159int isa_vga_mm_init(target_phys_addr_t vram_base,
160 target_phys_addr_t ctrl_base, int it_shift);
87ecb68b
PB
161
162/* cirrus_vga.c */
fbe1b595
PB
163void pci_cirrus_vga_init(PCIBus *bus);
164void isa_cirrus_vga_init(void);
87ecb68b 165
87ecb68b
PB
166/* ne2000.c */
167
9453c5bc 168void isa_ne2000_init(int base, int irq, NICInfo *nd);
87ecb68b 169
4c5b10b7
JS
170/* e820 types */
171#define E820_RAM 1
172#define E820_RESERVED 2
173#define E820_ACPI 3
174#define E820_NVS 4
175#define E820_UNUSABLE 5
176
177int e820_add_entry(uint64_t, uint64_t, uint32_t);
178
87ecb68b 179#endif