mirror of
https://github.com/clearlinux/kvmtool.git
synced 2026-09-05 13:11:44 +00:00
kvm tools: Use constants for i8042 register numbers
Cc: Ingo Molnar <mingo@elte.hu> Cc: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
This commit is contained in:
committed by
Will Deacon
parent
ca379b8386
commit
67307cddc8
+13
-4
@@ -10,9 +10,18 @@
|
||||
#include <rfb/rfb.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* IRQs
|
||||
*/
|
||||
#define KBD_IRQ 1
|
||||
#define AUX_IRQ 12
|
||||
|
||||
/*
|
||||
* Registers
|
||||
*/
|
||||
#define I8042_DATA_REG 0x60
|
||||
#define I8042_COMMAND_REG 0x64
|
||||
|
||||
#define CMD_READ_MODE 0x20
|
||||
#define CMD_WRITE_MODE 0x60
|
||||
#define CMD_WRITE_AUX_BUF 0xD3
|
||||
@@ -438,7 +447,7 @@ static bool kbd_in(struct ioport *ioport, struct kvm *kvm, u16 port, void *data,
|
||||
{
|
||||
u32 result;
|
||||
|
||||
if (port == 0x64) {
|
||||
if (port == I8042_COMMAND_REG) {
|
||||
result = kbd_read_status();
|
||||
ioport__write8(data, (char)result);
|
||||
} else {
|
||||
@@ -453,7 +462,7 @@ static bool kbd_in(struct ioport *ioport, struct kvm *kvm, u16 port, void *data,
|
||||
*/
|
||||
static bool kbd_out(struct ioport *ioport, struct kvm *kvm, u16 port, void *data, int size, u32 count)
|
||||
{
|
||||
if (port == 0x64)
|
||||
if (port == I8042_COMMAND_REG)
|
||||
kbd_write_command(*((u32 *)data));
|
||||
else
|
||||
kbd_write_data(*((u32 *)data));
|
||||
@@ -470,6 +479,6 @@ void kbd__init(struct kvm *kvm)
|
||||
{
|
||||
kbd_reset();
|
||||
state.kvm = kvm;
|
||||
ioport__register(0x60, &kbd_ops, 2, NULL);
|
||||
ioport__register(0x64, &kbd_ops, 2, NULL);
|
||||
ioport__register(I8042_DATA_REG, &kbd_ops, 2, NULL);
|
||||
ioport__register(I8042_COMMAND_REG, &kbd_ops, 2, NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user