summaryrefslogtreecommitdiff
path: root/payloads/libpayload/drivers/i8042/keyboard.c
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2018-06-29 09:24:54 -0700
committerPatrick Georgi <pgeorgi@google.com>2018-07-02 07:32:33 +0000
commit1299dc107dca75a586f05ebdeaf99ba6a974a5e7 (patch)
tree23c89d6fb4ba6bba3fc1ea570b6db6cc6850464f /payloads/libpayload/drivers/i8042/keyboard.c
parent118fb60b3a67d43aa71fc5cffb9b424d118866d9 (diff)
downloadcoreboot-1299dc107dca75a586f05ebdeaf99ba6a974a5e7.tar.xz
payloads/libpayload/drivers/i8042: Add macros for i8042 commands
This change adds macros for commands (written to 0x64) and keyboard commands (written to 0x60) for 8042 controller. BUG=b:110024487 Change-Id: I74b2388d048e35b5bdf5bd862d0975e88f1bd6af Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://review.coreboot.org/27289 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'payloads/libpayload/drivers/i8042/keyboard.c')
-rw-r--r--payloads/libpayload/drivers/i8042/keyboard.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/payloads/libpayload/drivers/i8042/keyboard.c b/payloads/libpayload/drivers/i8042/keyboard.c
index af44e016ee..d5606a3893 100644
--- a/payloads/libpayload/drivers/i8042/keyboard.c
+++ b/payloads/libpayload/drivers/i8042/keyboard.c
@@ -32,7 +32,8 @@
#include <libpayload-config.h>
#include <libpayload.h>
-#define I8042_CMD_DIS_KB 0xad
+#include "i8042.h"
+
#define POWER_BUTTON 0x90
struct layout_maps {
@@ -203,12 +204,12 @@ unsigned char keyboard_get_scancode(void)
case 0x3a:
if (modifier & KB_MOD_CAPSLOCK) {
modifier &= ~KB_MOD_CAPSLOCK;
- if (keyboard_cmd(0xed))
- keyboard_cmd(0 << 2);
+ if (keyboard_cmd(I8042_KBCMD_SET_MODE_IND))
+ keyboard_cmd(I8042_MODE_CAPS_LOCK_OFF);
} else {
modifier |= KB_MOD_CAPSLOCK;
- if (keyboard_cmd(0xed))
- keyboard_cmd(1 << 2);
+ if (keyboard_cmd(I8042_KBCMD_SET_MODE_IND))
+ keyboard_cmd(I8042_MODE_CAPS_LOCK_ON);
}
break;
}
@@ -304,19 +305,19 @@ void keyboard_init(void)
keyboard_getchar();
/* Enable first PS/2 port */
- i8042_cmd(0xae);
+ i8042_cmd(I8042_CMD_EN_KB);
/* Set scancode set 1 */
- ret = keyboard_cmd(0xf0);
+ ret = keyboard_cmd(I8042_KBCMD_SET_SCANCODE);
if (!ret)
return;
- ret = keyboard_cmd(0x01);
+ ret = keyboard_cmd(I8042_SCANCODE_SET_1);
if (!ret)
return;
/* Enable scanning */
- ret = keyboard_cmd(0xf4);
+ ret = keyboard_cmd(I8042_KBCMD_EN);
if (!ret)
return;