aboutsummaryrefslogtreecommitdiff
path: root/hw/pc.c
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2010-05-22 07:59:01 +0000
committerBlue Swirl <blauwirbel@gmail.com>2010-05-22 07:59:01 +0000
commit956a3e6bb7386de48b642d4fee11f7f86a2fcf9a (patch)
tree8d9be8c251241710f00d158ef536c9b5badcccce /hw/pc.c
parent9e42382fc14b999126f8cabb32761eb98153fd1b (diff)
downloadqemu-956a3e6bb7386de48b642d4fee11f7f86a2fcf9a.zip
qemu-956a3e6bb7386de48b642d4fee11f7f86a2fcf9a.tar.gz
qemu-956a3e6bb7386de48b642d4fee11f7f86a2fcf9a.tar.bz2
Compile pckbd only once
Use a qemu_irq to indicate A20 line changes. Move I/O port 92 to pckbd.c. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw/pc.c')
-rw-r--r--hw/pc.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/hw/pc.c b/hw/pc.c
index 7715b17..d2fb9be 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -365,26 +365,12 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
rtc_set_memory(s, 0x39, val);
}
-void ioport_set_a20(int enable)
+static void handle_a20_line_change(void *opaque, int irq, int level)
{
- /* XXX: send to all CPUs ? */
- cpu_x86_set_a20(first_cpu, enable);
-}
-
-int ioport_get_a20(void)
-{
- return ((first_cpu->a20_mask >> 20) & 1);
-}
-
-static void ioport92_write(void *opaque, uint32_t addr, uint32_t val)
-{
- ioport_set_a20((val >> 1) & 1);
- /* XXX: bit 0 is fast reset */
-}
+ CPUState *cpu = opaque;
-static uint32_t ioport92_read(void *opaque, uint32_t addr)
-{
- return ioport_get_a20() << 1;
+ /* XXX: send to all CPUs ? */
+ cpu_x86_set_a20(cpu, level);
}
/***********************************************************/
@@ -935,6 +921,8 @@ void pc_basic_device_init(qemu_irq *isa_irq,
int i;
DriveInfo *fd[MAX_FD];
PITState *pit;
+ qemu_irq *a20_line;
+ ISADevice *i8042;
register_ioport_write(0x80, 1, 1, ioport80_write, NULL);
@@ -944,9 +932,6 @@ void pc_basic_device_init(qemu_irq *isa_irq,
qemu_register_boot_set(pc_boot_set, *rtc_state);
- register_ioport_read(0x92, 1, 1, ioport92_read, NULL);
- register_ioport_write(0x92, 1, 1, ioport92_write, NULL);
-
pit = pit_init(0x40, isa_reserve_irq(0));
pcspk_init(pit);
if (!no_hpet) {
@@ -965,7 +950,11 @@ void pc_basic_device_init(qemu_irq *isa_irq,
}
}
- isa_create_simple("i8042");
+ a20_line = qemu_allocate_irqs(handle_a20_line_change, first_cpu, 1);
+ i8042 = isa_create_simple("i8042");
+ i8042_setup_a20_line(i8042, a20_line);
+ vmmouse_init(i8042);
+
DMA_init(0);
for(i = 0; i < MAX_FD; i++) {