[tip:tools/kvm] kvm tools: Use constants for i8042 register numbers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  025f209f95783c8725602232491f0e58ce258a3c
Gitweb:     http://git.kernel.org/tip/025f209f95783c8725602232491f0e58ce258a3c
Author:     Pekka Enberg <penberg@xxxxxxxxxx>
AuthorDate: Thu, 2 Jun 2011 13:24:41 +0300
Committer:  Pekka Enberg <penberg@xxxxxxxxxx>
CommitDate: Thu, 2 Jun 2011 13:24:41 +0300

kvm tools: Use constants for i8042 register numbers

Cc: Ingo Molnar <mingo@xxxxxxx>
Cc: Sasha Levin <levinsasha928@xxxxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 tools/kvm/hw/i8042.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/tools/kvm/hw/i8042.c b/tools/kvm/hw/i8042.c
index 80f0d18..de0e73b 100644
--- a/tools/kvm/hw/i8042.c
+++ b/tools/kvm/hw/i8042.c
@@ -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);
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux