Support it_shift for mmapped pckbd.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2691 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
8ecc791352
commit
8035529250
34
hw/pckbd.c
34
hw/pckbd.c
@ -125,6 +125,7 @@ typedef struct KBDState {
|
|||||||
qemu_irq irq_kbd;
|
qemu_irq irq_kbd;
|
||||||
qemu_irq irq_mouse;
|
qemu_irq irq_mouse;
|
||||||
target_phys_addr_t base;
|
target_phys_addr_t base;
|
||||||
|
int it_shift;
|
||||||
} KBDState;
|
} KBDState;
|
||||||
|
|
||||||
KBDState kbd_state;
|
KBDState kbd_state;
|
||||||
@ -384,21 +385,28 @@ uint32_t kbd_mm_readb (void *opaque, target_phys_addr_t addr)
|
|||||||
{
|
{
|
||||||
KBDState *s = opaque;
|
KBDState *s = opaque;
|
||||||
|
|
||||||
if (addr == s->base)
|
switch ((addr - s->base) >> s->it_shift) {
|
||||||
return kbd_read_data(s, 0);
|
case 0:
|
||||||
else
|
return kbd_read_data(s, 0) & 0xff;
|
||||||
return kbd_read_status(s, 0);
|
case 1:
|
||||||
|
return kbd_read_status(s, 0) & 0xff;
|
||||||
|
default:
|
||||||
|
return 0xff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void kbd_mm_writeb (void *opaque,
|
void kbd_mm_writeb (void *opaque, target_phys_addr_t addr, uint32_t value)
|
||||||
target_phys_addr_t addr, uint32_t value)
|
|
||||||
{
|
{
|
||||||
KBDState *s = opaque;
|
KBDState *s = opaque;
|
||||||
|
|
||||||
if (addr == s->base)
|
switch ((addr - s->base) >> s->it_shift) {
|
||||||
kbd_write_data(s, 0, value);
|
case 0:
|
||||||
else
|
kbd_write_data(s, 0, value & 0xff);
|
||||||
kbd_write_command(s, 0, value);
|
break;
|
||||||
|
case 1:
|
||||||
|
kbd_write_command(s, 0, value & 0xff);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static CPUReadMemoryFunc *kbd_mm_read[] = {
|
static CPUReadMemoryFunc *kbd_mm_read[] = {
|
||||||
@ -413,7 +421,8 @@ static CPUWriteMemoryFunc *kbd_mm_write[] = {
|
|||||||
&kbd_mm_writeb,
|
&kbd_mm_writeb,
|
||||||
};
|
};
|
||||||
|
|
||||||
void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, target_ulong base, int it_shift)
|
void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, target_ulong base,
|
||||||
|
int it_shift)
|
||||||
{
|
{
|
||||||
KBDState *s = &kbd_state;
|
KBDState *s = &kbd_state;
|
||||||
int s_io_memory;
|
int s_io_memory;
|
||||||
@ -421,11 +430,12 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, target_ulong base, int
|
|||||||
s->irq_kbd = kbd_irq;
|
s->irq_kbd = kbd_irq;
|
||||||
s->irq_mouse = mouse_irq;
|
s->irq_mouse = mouse_irq;
|
||||||
s->base = base;
|
s->base = base;
|
||||||
|
s->it_shift = it_shift;
|
||||||
|
|
||||||
kbd_reset(s);
|
kbd_reset(s);
|
||||||
register_savevm("pckbd", 0, 3, kbd_save, kbd_load, s);
|
register_savevm("pckbd", 0, 3, kbd_save, kbd_load, s);
|
||||||
s_io_memory = cpu_register_io_memory(0, kbd_mm_read, kbd_mm_write, s);
|
s_io_memory = cpu_register_io_memory(0, kbd_mm_read, kbd_mm_write, s);
|
||||||
cpu_register_physical_memory(base & ~(TARGET_PAGE_SIZE - 1), TARGET_PAGE_SIZE, s_io_memory);
|
cpu_register_physical_memory(base, 8 << it_shift, s_io_memory);
|
||||||
|
|
||||||
s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s);
|
s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s);
|
||||||
s->mouse = ps2_mouse_init(kbd_update_aux_irq, s);
|
s->mouse = ps2_mouse_init(kbd_update_aux_irq, s);
|
||||||
|
Loading…
Reference in New Issue
Block a user