4 #include "qemu-common.h"
9 /* PC-style peripherals (also used by other machines). */
13 SerialState
*serial_init(int base
, qemu_irq irq
, int baudbase
,
14 CharDriverState
*chr
);
15 SerialState
*serial_mm_init (target_phys_addr_t base
, int it_shift
,
16 qemu_irq irq
, int baudbase
,
17 CharDriverState
*chr
, int ioregister
,
19 SerialState
*serial_isa_init(int index
, CharDriverState
*chr
);
20 void serial_set_frequency(SerialState
*s
, uint32_t frequency
);
24 typedef struct ParallelState ParallelState
;
25 ParallelState
*parallel_init(int index
, CharDriverState
*chr
);
26 ParallelState
*parallel_mm_init(target_phys_addr_t base
, int it_shift
, qemu_irq irq
, CharDriverState
*chr
);
30 typedef struct PicState2 PicState2
;
31 extern PicState2
*isa_pic
;
32 void pic_set_irq(int irq
, int level
);
33 void pic_set_irq_new(void *opaque
, int irq
, int level
);
34 qemu_irq
*i8259_init(qemu_irq parent_irq
);
35 int pic_read_irq(PicState2
*s
);
36 void pic_update_irq(PicState2
*s
);
37 uint32_t pic_intack_read(PicState2
*s
);
38 void pic_info(Monitor
*mon
);
39 void irq_info(Monitor
*mon
);
42 #define IOAPIC_NUM_PINS 0x18
44 typedef struct isa_irq_state
{
46 qemu_irq ioapic
[IOAPIC_NUM_PINS
];
49 void isa_irq_handler(void *opaque
, int n
, int level
);
53 #define PIT_FREQ 1193182
55 typedef struct PITState PITState
;
57 PITState
*pit_init(int base
, qemu_irq irq
);
58 void pit_set_gate(PITState
*pit
, int channel
, int val
);
59 int pit_get_gate(PITState
*pit
, int channel
);
60 int pit_get_initial_count(PITState
*pit
, int channel
);
61 int pit_get_mode(PITState
*pit
, int channel
);
62 int pit_get_out(PITState
*pit
, int channel
, int64_t current_time
);
64 void hpet_pit_disable(void);
65 void hpet_pit_enable(void);
68 static inline void vmport_init(void)
70 isa_create_simple("vmport");
72 void vmport_register(unsigned char command
, IOPortReadFunc
*func
, void *opaque
);
75 void *vmmouse_init(void *m
);
79 void i8042_init(qemu_irq kbd_irq
, qemu_irq mouse_irq
, uint32_t io_base
);
80 void i8042_mm_init(qemu_irq kbd_irq
, qemu_irq mouse_irq
,
81 target_phys_addr_t base
, ram_addr_t size
,
82 target_phys_addr_t mask
);
83 void i8042_isa_mouse_fake_event(void *opaque
);
84 void i8042_setup_a20_line(ISADevice
*dev
, qemu_irq
*a20_out
);
87 extern int fd_bootchk
;
89 void pc_register_ferr_irq(qemu_irq irq
);
90 void pc_cmos_set_s3_resume(void *opaque
, int irq
, int level
);
91 void pc_acpi_smi_interrupt(void *opaque
, int irq
, int level
);
93 void pc_cpus_init(const char *cpu_model
);
94 void pc_memory_init(ram_addr_t ram_size
,
95 const char *kernel_filename
,
96 const char *kernel_cmdline
,
97 const char *initrd_filename
,
98 ram_addr_t
*below_4g_mem_size_p
,
99 ram_addr_t
*above_4g_mem_size_p
);
100 qemu_irq
*pc_allocate_cpu_irq(void);
101 void pc_vga_init(PCIBus
*pci_bus
);
102 void pc_basic_device_init(qemu_irq
*isa_irq
,
103 FDCtrl
**floppy_controller
,
104 ISADevice
**rtc_state
);
105 void pc_init_ne2k_isa(NICInfo
*nd
);
106 void pc_cmos_init(ram_addr_t ram_size
, ram_addr_t above_4g_mem_size
,
107 const char *boot_device
,
108 BusState
*ide0
, BusState
*ide1
,
109 FDCtrl
*floppy_controller
, ISADevice
*s
);
110 void pc_pci_device_init(PCIBus
*pci_bus
);
112 typedef void (*cpu_set_smm_t
)(int smm
, void *arg
);
113 void cpu_smm_register(cpu_set_smm_t callback
, void *arg
);
116 extern int acpi_enabled
;
117 extern char *acpi_tables
;
118 extern size_t acpi_tables_len
;
120 void acpi_bios_init(void);
121 int acpi_table_add(const char *table_desc
);
125 i2c_bus
*piix4_pm_init(PCIBus
*bus
, int devfn
, uint32_t smb_io_base
,
126 qemu_irq sci_irq
, qemu_irq cmos_s3
, qemu_irq smi_irq
,
128 void piix4_smbus_register_device(SMBusDevice
*dev
, uint8_t addr
);
134 void pcspk_init(PITState
*);
135 int pcspk_audio_init(qemu_irq
*pic
);
138 struct PCII440FXState
;
139 typedef struct PCII440FXState PCII440FXState
;
141 PCIBus
*i440fx_init(PCII440FXState
**pi440fx_state
, int *piix_devfn
, qemu_irq
*pic
, ram_addr_t ram_size
);
142 void i440fx_init_memory_mappings(PCII440FXState
*d
);
145 extern PCIDevice
*piix4_dev
;
146 int piix4_init(PCIBus
*bus
, int devfn
);
149 enum vga_retrace_method
{
154 extern enum vga_retrace_method vga_retrace_method
;
156 int isa_vga_init(void);
157 int pci_vga_init(PCIBus
*bus
);
158 int isa_vga_mm_init(target_phys_addr_t vram_base
,
159 target_phys_addr_t ctrl_base
, int it_shift
);
162 void pci_cirrus_vga_init(PCIBus
*bus
);
163 void isa_cirrus_vga_init(void);
167 void isa_ne2000_init(int base
, int irq
, NICInfo
*nd
);
171 #define E820_RESERVED 2
174 #define E820_UNUSABLE 5
176 int e820_add_entry(uint64_t, uint64_t, uint32_t);