Merge commit 'ca77d175912f7d0b2296e8e3a803a0763c00bc0b' into upstream-merge
[qemu-kvm/markmc.git] / hw / pc.h
blob33288077dd49d92b45c5ab0c020a0487e0f02862
1 #ifndef HW_PC_H
2 #define HW_PC_H
4 #include "qemu-common.h"
6 /* PC-style peripherals (also used by other machines). */
8 /* serial.c */
10 SerialState *serial_init(int base, qemu_irq irq, int baudbase,
11 CharDriverState *chr);
12 SerialState *serial_mm_init (target_phys_addr_t base, int it_shift,
13 qemu_irq irq, int baudbase,
14 CharDriverState *chr, int ioregister);
15 SerialState *serial_isa_init(int index, CharDriverState *chr);
17 /* parallel.c */
19 typedef struct ParallelState ParallelState;
20 ParallelState *parallel_init(int index, CharDriverState *chr);
21 ParallelState *parallel_mm_init(target_phys_addr_t base, int it_shift, qemu_irq irq, CharDriverState *chr);
23 /* i8259.c */
25 typedef struct PicState2 PicState2;
26 extern PicState2 *isa_pic;
27 void pic_set_irq(int irq, int level);
28 void pic_set_irq_new(void *opaque, int irq, int level);
29 qemu_irq *i8259_init(qemu_irq parent_irq);
30 qemu_irq *kvm_i8259_init(qemu_irq parent_irq);
31 int pic_read_irq(PicState2 *s);
32 void pic_update_irq(PicState2 *s);
33 uint32_t pic_intack_read(PicState2 *s);
34 void pic_info(Monitor *mon);
35 void irq_info(Monitor *mon);
37 /* APIC */
38 typedef struct IOAPICState IOAPICState;
39 void apic_deliver_irq(uint8_t dest, uint8_t dest_mode,
40 uint8_t delivery_mode,
41 uint8_t vector_num, uint8_t polarity,
42 uint8_t trigger_mode);
43 int apic_init(CPUState *env);
44 int apic_accept_pic_intr(CPUState *env);
45 void apic_deliver_pic_intr(CPUState *env, int level);
46 int apic_get_interrupt(CPUState *env);
47 qemu_irq *ioapic_init(void);
48 void ioapic_set_irq(void *opaque, int vector, int level);
49 void apic_reset_irq_delivered(void);
50 int apic_get_irq_delivered(void);
51 void apic_set_irq_delivered(void);
53 /* i8254.c */
55 #define PIT_FREQ 1193182
57 typedef struct PITState PITState;
59 PITState *pit_init(int base, qemu_irq irq);
60 void pit_set_gate(PITState *pit, int channel, int val);
61 int pit_get_gate(PITState *pit, int channel);
62 int pit_get_initial_count(PITState *pit, int channel);
63 int pit_get_mode(PITState *pit, int channel);
64 int pit_get_out(PITState *pit, int channel, int64_t current_time);
66 /* i8254-kvm.c */
68 PITState *kvm_pit_init(int base, qemu_irq irq);
70 void hpet_disable_pit(void);
71 void hpet_enable_pit(void);
73 /* vmport.c */
74 void vmport_init(void);
75 void vmport_register(unsigned char command, IOPortReadFunc *func, void *opaque);
77 /* vmmouse.c */
78 void *vmmouse_init(void *m);
80 /* pckbd.c */
82 void i8042_init(qemu_irq kbd_irq, qemu_irq mouse_irq, uint32_t io_base);
83 void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
84 target_phys_addr_t base, ram_addr_t size,
85 target_phys_addr_t mask);
87 /* mc146818rtc.c */
89 typedef struct RTCState RTCState;
91 RTCState *rtc_init(int base_year);
92 void rtc_set_memory(RTCState *s, int addr, int val);
93 void rtc_set_date(RTCState *s, const struct tm *tm);
94 void cmos_set_s3_resume(void);
96 /* pc.c */
97 extern int fd_bootchk;
99 void ioport_set_a20(int enable);
100 int ioport_get_a20(void);
101 CPUState *pc_new_cpu(const char *cpu_model);
103 /* acpi.c */
104 extern int acpi_enabled;
105 extern char *acpi_tables;
106 extern size_t acpi_tables_len;
108 void acpi_bios_init(void);
109 int acpi_table_add(const char *table_desc);
111 /* acpi_piix.c */
112 i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
113 qemu_irq sci_irq);
114 void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr);
115 void piix4_acpi_system_hot_add_init(PCIBus *bus, const char *model);
117 /* hpet.c */
118 extern int no_hpet;
120 /* pcspk.c */
121 void pcspk_init(PITState *);
122 int pcspk_audio_init(qemu_irq *pic);
124 /* piix_pci.c */
125 /* config space register for IRQ routing */
126 #define PIIX_CONFIG_IRQ_ROUTE 0x60
128 struct PCII440FXState;
129 typedef struct PCII440FXState PCII440FXState;
131 PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn, qemu_irq *pic);
132 void i440fx_set_smm(PCII440FXState *d, int val);
133 void i440fx_init_memory_mappings(PCII440FXState *d);
135 /* piix4.c */
136 extern PCIDevice *piix4_dev;
137 int piix4_init(PCIBus *bus, int devfn);
139 int piix_get_irq(int pin);
141 int ipf_map_irq(PCIDevice *pci_dev, int irq_num);
143 /* vga.c */
144 enum vga_retrace_method {
145 VGA_RETRACE_DUMB,
146 VGA_RETRACE_PRECISE
149 extern enum vga_retrace_method vga_retrace_method;
151 int isa_vga_init(void);
152 int pci_vga_init(PCIBus *bus,
153 unsigned long vga_bios_offset, int vga_bios_size);
154 int isa_vga_mm_init(target_phys_addr_t vram_base,
155 target_phys_addr_t ctrl_base, int it_shift);
157 /* cirrus_vga.c */
158 void pci_cirrus_vga_init(PCIBus *bus);
159 void isa_cirrus_vga_init(void);
161 /* ne2000.c */
163 void isa_ne2000_init(int base, int irq, NICInfo *nd);
165 /* extboot.c */
167 void extboot_init(BlockDriverState *bs, int cmd);
169 int cpu_is_bsp(CPUState *env);
171 #endif