diff options
author | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-05-16 02:00:34 +0000 |
---|---|---|
committer | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-05-16 02:00:34 +0000 |
commit | e812318638dbee1bf9a1eea65d46a07c502127ab (patch) | |
tree | 012ceb0ae4b140d716c7187648347dd094d32dde /IntelFrameworkModulePkg/Bus/Isa | |
parent | 4ff492c312d1b3a69116f7d15e564170f481891d (diff) | |
download | edk2-platforms-e812318638dbee1bf9a1eea65d46a07c502127ab.tar.xz |
Update PS/2 keyboard driver to return scan code for Pause key.
Signed-off-by: vanjeff
Reviewed-by: niruiyu
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11657 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg/Bus/Isa')
-rw-r--r-- | IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c | 226 | ||||
-rw-r--r-- | IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h | 2 |
2 files changed, 121 insertions, 107 deletions
diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c b/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c index fa0f53b742..93fdf6d94f 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c +++ b/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c @@ -15,7 +15,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "Ps2Keyboard.h"
struct {
- UINT8 ScanCode; ///< follows value defined in Scan Code Set1
+ UINT16 ScanCode; ///< follows value defined in Scan Code Set1
UINT16 EfiScanCode;
CHAR16 UnicodeChar;
CHAR16 ShiftUnicodeChar;
@@ -549,7 +549,13 @@ ConvertKeyboardScanCodeToEfiKey[] = { SCAN_NULL,
0x0000,
0x0000
- },
+ },
+ {
+ 0x1D45, //Pause key
+ SCAN_PAUSE,
+ 0x0000,
+ 0x0000
+ },
{
TABLE_END,
TABLE_END,
@@ -1152,8 +1158,9 @@ KeyGetchar ( )
{
EFI_STATUS Status;
- UINT8 ScanCode;
+ UINT16 ScanCode;
BOOLEAN Extended;
+ BOOLEAN Extended1;
UINTN Index;
EFI_KEY_DATA KeyData;
LIST_ENTRY *Link;
@@ -1163,20 +1170,18 @@ KeyGetchar ( //
UINT8 ScancodeArr[4];
UINT32 ScancodeArrPos;
- //
- // point to the current position in ScancodeArr
- //
-
- Extended = FALSE;
- ScancodeArrPos = 0;
//
// Check if there are enough bytes of scancode representing a single key
// available in the buffer
//
while (TRUE) {
-
+ Extended = FALSE;
+ Extended1 = FALSE;
Status = GetScancodeBufHead (&ConsoleIn->ScancodeQueue, 1, ScancodeArr);
+ //
+ // point to the current position in ScancodeArr
+ //
ScancodeArrPos = 0;
if (EFI_ERROR (Status)) {
return ;
@@ -1195,7 +1200,7 @@ KeyGetchar ( // if present, ignore them
//
if (ScancodeArr[ScancodeArrPos] == SCANCODE_EXTENDED1) {
-
+ Extended1 = TRUE;
Status = GetScancodeBufHead (&ConsoleIn->ScancodeQueue, 2, ScancodeArr);
ScancodeArrPos = 1;
@@ -1209,9 +1214,6 @@ KeyGetchar ( if (EFI_ERROR (Status)) {
return ;
}
-
- PopScancodeBufHead (&ConsoleIn->ScancodeQueue, 3, ScancodeArr);
- return ;
}
//
// if we reach this position, scancodes for a key is in buffer now,pop them
@@ -1220,104 +1222,114 @@ KeyGetchar ( if (EFI_ERROR (Status)) {
return ;
}
- //
- // store the last available byte, this byte of scancode will be checked
- //
- ScanCode = ScancodeArr[ScancodeArrPos];
- //
- // Check for special keys and update the driver state.
- //
- switch (ScanCode) {
-
- case SCANCODE_CTRL_MAKE:
- ConsoleIn->Ctrl = TRUE;
- break;
-
- case SCANCODE_CTRL_BREAK:
- ConsoleIn->Ctrl = FALSE;
- break;
-
- case SCANCODE_ALT_MAKE:
- ConsoleIn->Alt = TRUE;
- break;
-
- case SCANCODE_ALT_BREAK:
- ConsoleIn->Alt = FALSE;
- break;
-
- case SCANCODE_LEFT_SHIFT_MAKE:
- if (!Extended) {
- ConsoleIn->Shift = TRUE;
- ConsoleIn->LeftShift = TRUE;
- }
- break;
- case SCANCODE_RIGHT_SHIFT_MAKE:
- if (!Extended) {
- ConsoleIn->Shift = TRUE;
- ConsoleIn->RightShift = TRUE;
+ if (!Extended1) {
+ //
+ // store the last available byte, this byte of scancode will be checked
+ //
+ ScanCode = ScancodeArr[ScancodeArrPos];
+
+ //
+ // Check for special keys and update the driver state.
+ //
+ switch (ScanCode) {
+
+ case SCANCODE_CTRL_MAKE:
+ ConsoleIn->Ctrl = TRUE;
+ break;
+
+ case SCANCODE_CTRL_BREAK:
+ ConsoleIn->Ctrl = FALSE;
+ break;
+
+ case SCANCODE_ALT_MAKE:
+ ConsoleIn->Alt = TRUE;
+ break;
+
+ case SCANCODE_ALT_BREAK:
+ ConsoleIn->Alt = FALSE;
+ break;
+
+ case SCANCODE_LEFT_SHIFT_MAKE:
+ if (!Extended) {
+ ConsoleIn->Shift = TRUE;
+ ConsoleIn->LeftShift = TRUE;
+ }
+ break;
+ case SCANCODE_RIGHT_SHIFT_MAKE:
+ if (!Extended) {
+ ConsoleIn->Shift = TRUE;
+ ConsoleIn->RightShift = TRUE;
+ }
+ break;
+
+ case SCANCODE_LEFT_SHIFT_BREAK:
+ if (!Extended) {
+ ConsoleIn->Shift = FALSE;
+ ConsoleIn->LeftShift = FALSE;
+ } else {
+ ConsoleIn->SysReq = FALSE;
+ }
+ break;
+ case SCANCODE_RIGHT_SHIFT_BREAK:
+ if (!Extended) {
+ ConsoleIn->Shift = FALSE;
+ ConsoleIn->RightShift = FALSE;
+ }
+ break;
+
+ case SCANCODE_LEFT_LOGO_MAKE:
+ ConsoleIn->LeftLogo = TRUE;
+ break;
+ case SCANCODE_LEFT_LOGO_BREAK:
+ ConsoleIn->LeftLogo = FALSE;
+ break;
+ case SCANCODE_RIGHT_LOGO_MAKE:
+ ConsoleIn->RightLogo = TRUE;
+ break;
+ case SCANCODE_RIGHT_LOGO_BREAK:
+ ConsoleIn->RightLogo = FALSE;
+ break;
+ case SCANCODE_MENU_MAKE:
+ ConsoleIn->Menu = TRUE;
+ break;
+ case SCANCODE_MENU_BREAK:
+ ConsoleIn->Menu = FALSE;
+ break;
+ case SCANCODE_SYS_REQ_MAKE:
+ if (Extended) {
+ ConsoleIn->SysReq = TRUE;
+ }
+ break;
+ case SCANCODE_CAPS_LOCK_MAKE:
+ ConsoleIn->CapsLock = (BOOLEAN)!ConsoleIn->CapsLock;
+ UpdateStatusLights (ConsoleIn);
+ break;
+ case SCANCODE_NUM_LOCK_MAKE:
+ ConsoleIn->NumLock = (BOOLEAN)!ConsoleIn->NumLock;
+ UpdateStatusLights (ConsoleIn);
+ break;
+ case SCANCODE_SCROLL_LOCK_MAKE:
+ ConsoleIn->ScrollLock = (BOOLEAN)!ConsoleIn->ScrollLock;
+ UpdateStatusLights (ConsoleIn);
+ break;
}
- break;
-
- case SCANCODE_LEFT_SHIFT_BREAK:
- if (!Extended) {
- ConsoleIn->Shift = FALSE;
- ConsoleIn->LeftShift = FALSE;
+ //
+ // If this is above the valid range, ignore it
+ //
+ if (ScanCode >= SCANCODE_MAX_MAKE) {
+ continue;
} else {
- ConsoleIn->SysReq = FALSE;
- }
- break;
- case SCANCODE_RIGHT_SHIFT_BREAK:
- if (!Extended) {
- ConsoleIn->Shift = FALSE;
- ConsoleIn->RightShift = FALSE;
- }
- break;
-
- case SCANCODE_LEFT_LOGO_MAKE:
- ConsoleIn->LeftLogo = TRUE;
- break;
- case SCANCODE_LEFT_LOGO_BREAK:
- ConsoleIn->LeftLogo = FALSE;
- break;
- case SCANCODE_RIGHT_LOGO_MAKE:
- ConsoleIn->RightLogo = TRUE;
- break;
- case SCANCODE_RIGHT_LOGO_BREAK:
- ConsoleIn->RightLogo = FALSE;
- break;
- case SCANCODE_MENU_MAKE:
- ConsoleIn->Menu = TRUE;
- break;
- case SCANCODE_MENU_BREAK:
- ConsoleIn->Menu = FALSE;
- break;
- case SCANCODE_SYS_REQ_MAKE:
- if (Extended) {
- ConsoleIn->SysReq = TRUE;
+ break;
}
- case SCANCODE_CAPS_LOCK_MAKE:
- ConsoleIn->CapsLock = (BOOLEAN)!ConsoleIn->CapsLock;
- UpdateStatusLights (ConsoleIn);
- break;
-
- case SCANCODE_NUM_LOCK_MAKE:
- ConsoleIn->NumLock = (BOOLEAN)!ConsoleIn->NumLock;
- UpdateStatusLights (ConsoleIn);
- break;
-
- case SCANCODE_SCROLL_LOCK_MAKE:
- ConsoleIn->ScrollLock = (BOOLEAN)!ConsoleIn->ScrollLock;
- UpdateStatusLights (ConsoleIn);
- break;
- }
- //
- // If this is a BREAK Key or above the valid range, ignore it
- //
- if (ScanCode >= SCANCODE_MAX_MAKE) {
- continue;
} else {
- break;
+ //
+ // Store the last 2 available byte to check if it is Pause key
+ //
+ ScanCode = (UINT16) (ScancodeArr[ScancodeArrPos] + (ScancodeArr[ScancodeArrPos - 1] << 8));
+ if (ScanCode == SCANCODE_PAUSE_MAKE) {
+ break;
+ }
}
}
diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h b/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h index 7cf90caa6f..cf311d8d76 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h +++ b/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h @@ -182,6 +182,8 @@ InstallPs2KeyboardDriver ( #define SCANCODE_SYS_REQ_MAKE 0x37
#define SCANCODE_MAX_MAKE 0x60
+#define SCANCODE_PAUSE_MAKE 0x1D45
+
#define KEYBOARD_STATUS_REGISTER_HAS_OUTPUT_DATA BIT0 ///< 0 - Output register has no data; 1 - Output register has data
#define KEYBOARD_STATUS_REGISTER_HAS_INPUT_DATA BIT1 ///< 0 - Input register has no data; 1 - Input register has data
#define KEYBOARD_STATUS_REGISTER_SYSTEM_FLAG BIT2 ///< Set to 0 after power on reset
|