Add a PcdPs2KbdExtendedVerification to let user to choose whether extend reset for keyboard driver in start (). Add more debug information in the driver.
Signed-off-by: li-elvin Reviewed-by: mdkinney git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12207 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -332,7 +332,7 @@ KbdControllerDriverStart (
|
|||||||
//
|
//
|
||||||
// Reset the keyboard device
|
// Reset the keyboard device
|
||||||
//
|
//
|
||||||
Status = ConsoleIn->ConInEx.Reset (&ConsoleIn->ConInEx, TRUE);
|
Status = ConsoleIn->ConInEx.Reset (&ConsoleIn->ConInEx, FeaturePcdGet (PcdPs2KbdExtendedVerification));
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
StatusCode = EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_NOT_DETECTED;
|
StatusCode = EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_NOT_DETECTED;
|
||||||
|
@ -33,6 +33,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#include <Library/BaseLib.h>
|
#include <Library/BaseLib.h>
|
||||||
#include <Library/BaseMemoryLib.h>
|
#include <Library/BaseMemoryLib.h>
|
||||||
#include <Library/TimerLib.h>
|
#include <Library/TimerLib.h>
|
||||||
|
#include <Library/PcdLib.h>
|
||||||
|
|
||||||
//
|
//
|
||||||
// Global Variables
|
// Global Variables
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# The keyboard type implemented follows IBM compatible PS2 protocol, with Scan Codes Set 1.
|
# The keyboard type implemented follows IBM compatible PS2 protocol, with Scan Codes Set 1.
|
||||||
#
|
#
|
||||||
# This dirver directly uses IsaIo protocol service to support KeyBoard work.
|
# This dirver directly uses IsaIo protocol service to support KeyBoard work.
|
||||||
# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -56,6 +56,7 @@
|
|||||||
BaseLib
|
BaseLib
|
||||||
BaseMemoryLib
|
BaseMemoryLib
|
||||||
TimerLib
|
TimerLib
|
||||||
|
PcdLib
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiPs2PolicyProtocolGuid # PROTOCOL TO_START
|
gEfiPs2PolicyProtocolGuid # PROTOCOL TO_START
|
||||||
@ -64,6 +65,9 @@
|
|||||||
gEfiSimpleTextInputExProtocolGuid # PROTOCOL BY_START
|
gEfiSimpleTextInputExProtocolGuid # PROTOCOL BY_START
|
||||||
gEfiDevicePathProtocolGuid # PROTOCOL TO_START
|
gEfiDevicePathProtocolGuid # PROTOCOL TO_START
|
||||||
|
|
||||||
|
[FeaturePcd]
|
||||||
|
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPs2KbdExtendedVerification
|
||||||
|
|
||||||
# [Event]
|
# [Event]
|
||||||
# ##
|
# ##
|
||||||
# # Event will be signaled for WaitForKey event.
|
# # Event will be signaled for WaitForKey event.
|
||||||
|
@ -361,10 +361,10 @@ BiosKeyboardDriverBindingStart (
|
|||||||
//
|
//
|
||||||
Status = BiosKeyboardPrivate->SimpleTextInputEx.Reset (
|
Status = BiosKeyboardPrivate->SimpleTextInputEx.Reset (
|
||||||
&BiosKeyboardPrivate->SimpleTextInputEx,
|
&BiosKeyboardPrivate->SimpleTextInputEx,
|
||||||
FALSE
|
FeaturePcdGet (PcdPs2KbdExtendedVerification)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "[KBD]Reset Failed. Status - %r\n", Status));
|
||||||
StatusCode = EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_NOT_DETECTED;
|
StatusCode = EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_NOT_DETECTED;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
@ -436,6 +436,7 @@ BiosKeyboardDriverBindingStart (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DEBUG ((EFI_D_INFO, "[KBD]Extended keystrokes supported by CSM16 - %02x\n", (UINTN)BiosKeyboardPrivate->ExtendedKeyboard));
|
||||||
//
|
//
|
||||||
// Install protocol interfaces for the keyboard device.
|
// Install protocol interfaces for the keyboard device.
|
||||||
//
|
//
|
||||||
@ -1679,6 +1680,12 @@ CheckKeyboardConnect (
|
|||||||
KBC_INPBUF_VIA60_KBEN
|
KBC_INPBUF_VIA60_KBEN
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "[KBD]CheckKeyboardConnect - Keyboard enable failed!\n"));
|
||||||
|
REPORT_STATUS_CODE_WITH_DEVICE_PATH (
|
||||||
|
EFI_ERROR_CODE | EFI_ERROR_MINOR,
|
||||||
|
EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_CONTROLLER_ERROR,
|
||||||
|
BiosKeyboardPrivate->DevicePath
|
||||||
|
);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1689,6 +1696,12 @@ CheckKeyboardConnect (
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "[KBD]CheckKeyboardConnect - Timeout!\n"));
|
||||||
|
REPORT_STATUS_CODE_WITH_DEVICE_PATH (
|
||||||
|
EFI_ERROR_CODE | EFI_ERROR_MINOR,
|
||||||
|
EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_CONTROLLER_ERROR,
|
||||||
|
BiosKeyboardPrivate->DevicePath
|
||||||
|
);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1763,6 +1776,13 @@ BiosKeyboardTimerHandler (
|
|||||||
|
|
||||||
KeyData.Key.ScanCode = (UINT16) Regs.H.AH;
|
KeyData.Key.ScanCode = (UINT16) Regs.H.AH;
|
||||||
KeyData.Key.UnicodeChar = (UINT16) Regs.H.AL;
|
KeyData.Key.UnicodeChar = (UINT16) Regs.H.AL;
|
||||||
|
DEBUG ((
|
||||||
|
EFI_D_INFO,
|
||||||
|
"[KBD]INT16 returns EFI_INPUT_KEY.ScanCode - %x, EFI_INPUT_KEY.UnicodeChar - %x\n",
|
||||||
|
KeyData.Key.ScanCode,
|
||||||
|
KeyData.Key.UnicodeChar
|
||||||
|
));
|
||||||
|
|
||||||
KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID;
|
KeyData.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID;
|
||||||
KeyData.KeyState.KeyToggleState = EFI_TOGGLE_STATE_VALID;
|
KeyData.KeyState.KeyToggleState = EFI_TOGGLE_STATE_VALID;
|
||||||
//
|
//
|
||||||
@ -1801,6 +1821,40 @@ BiosKeyboardTimerHandler (
|
|||||||
KbFlag1 = *((UINT8 *) (UINTN) 0x417); // read the STATUS FLAGS 1
|
KbFlag1 = *((UINT8 *) (UINTN) 0x417); // read the STATUS FLAGS 1
|
||||||
KbFlag2 = *((UINT8 *) (UINTN) 0x418); // read STATUS FLAGS 2
|
KbFlag2 = *((UINT8 *) (UINTN) 0x418); // read STATUS FLAGS 2
|
||||||
|
|
||||||
|
DEBUG_CODE (
|
||||||
|
{
|
||||||
|
if ((KbFlag1 & KB_CAPS_LOCK_BIT) == KB_CAPS_LOCK_BIT) {
|
||||||
|
DEBUG ((EFI_D_INFO, "[KBD]Caps Lock Key is pressed.\n"));
|
||||||
|
}
|
||||||
|
if ((KbFlag1 & KB_NUM_LOCK_BIT) == KB_NUM_LOCK_BIT) {
|
||||||
|
DEBUG ((EFI_D_INFO, "[KBD]Num Lock Key is pressed.\n"));
|
||||||
|
}
|
||||||
|
if ((KbFlag1 & KB_SCROLL_LOCK_BIT) == KB_SCROLL_LOCK_BIT) {
|
||||||
|
DEBUG ((EFI_D_INFO, "[KBD]Scroll Lock Key is pressed.\n"));
|
||||||
|
}
|
||||||
|
if ((KbFlag1 & KB_ALT_PRESSED) == KB_ALT_PRESSED) {
|
||||||
|
if ((KbFlag2 & KB_LEFT_ALT_PRESSED) == KB_LEFT_ALT_PRESSED) {
|
||||||
|
DEBUG ((EFI_D_INFO, "[KBD]Left Alt Key is pressed.\n"));
|
||||||
|
} else {
|
||||||
|
DEBUG ((EFI_D_INFO, "[KBD]Right Alt Key is pressed.\n"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((KbFlag1 & KB_CTRL_PRESSED) == KB_CTRL_PRESSED) {
|
||||||
|
if ((KbFlag2 & KB_LEFT_CTRL_PRESSED) == KB_LEFT_CTRL_PRESSED) {
|
||||||
|
DEBUG ((EFI_D_INFO, "[KBD]Left Ctrl Key is pressed.\n"));
|
||||||
|
} else {
|
||||||
|
DEBUG ((EFI_D_INFO, "[KBD]Right Ctrl Key is pressed.\n"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((KbFlag1 & KB_LEFT_SHIFT_PRESSED) == KB_LEFT_SHIFT_PRESSED) {
|
||||||
|
DEBUG ((EFI_D_INFO, "[KBD]Left Shift Key is pressed.\n"));
|
||||||
|
}
|
||||||
|
if ((KbFlag1 & KB_RIGHT_SHIFT_PRESSED) == KB_RIGHT_SHIFT_PRESSED) {
|
||||||
|
DEBUG ((EFI_D_INFO, "[KBD]Right Shift Key is pressed.\n"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Record toggle state
|
// Record toggle state
|
||||||
//
|
//
|
||||||
@ -1864,6 +1918,13 @@ BiosKeyboardTimerHandler (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEBUG ((
|
||||||
|
EFI_D_INFO,
|
||||||
|
"[KBD]Convert to EFI Scan Code, EFI_INPUT_KEY.ScanCode - %x, EFI_INPUT_KEY.UnicodeChar - %x\n",
|
||||||
|
KeyData.Key.ScanCode,
|
||||||
|
KeyData.Key.UnicodeChar
|
||||||
|
));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Need not return associated shift state if a class of printable characters that
|
// Need not return associated shift state if a class of printable characters that
|
||||||
// are normally adjusted by shift modifiers.
|
// are normally adjusted by shift modifiers.
|
||||||
@ -1872,6 +1933,7 @@ BiosKeyboardTimerHandler (
|
|||||||
if ((KeyData.Key.UnicodeChar >= L'A' && KeyData.Key.UnicodeChar <= L'Z') ||
|
if ((KeyData.Key.UnicodeChar >= L'A' && KeyData.Key.UnicodeChar <= L'Z') ||
|
||||||
(KeyData.Key.UnicodeChar >= L'a' && KeyData.Key.UnicodeChar <= L'z')
|
(KeyData.Key.UnicodeChar >= L'a' && KeyData.Key.UnicodeChar <= L'z')
|
||||||
) {
|
) {
|
||||||
|
DEBUG ((EFI_D_INFO, "[KBD]Shift key with a~z are pressed, remove shift state in EFI_KEY_STATE.\n"));
|
||||||
KeyData.KeyState.KeyShiftState &= ~(EFI_LEFT_SHIFT_PRESSED | EFI_RIGHT_SHIFT_PRESSED);
|
KeyData.KeyState.KeyShiftState &= ~(EFI_LEFT_SHIFT_PRESSED | EFI_RIGHT_SHIFT_PRESSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#include <Library/UefiBootServicesTableLib.h>
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
#include <Library/MemoryAllocationLib.h>
|
#include <Library/MemoryAllocationLib.h>
|
||||||
#include <Library/BaseLib.h>
|
#include <Library/BaseLib.h>
|
||||||
|
#include <Library/PcdLib.h>
|
||||||
|
|
||||||
//
|
//
|
||||||
// Driver Binding Externs
|
// Driver Binding Externs
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# Ps2 Keyboard driver by using Legacy Bios protocol service and IsaIo protocol service.
|
# Ps2 Keyboard driver by using Legacy Bios protocol service and IsaIo protocol service.
|
||||||
# This dirver uses legacy INT16 to get the key stroke status.
|
# This dirver uses legacy INT16 to get the key stroke status.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions
|
# are licensed and made available under the terms and conditions
|
||||||
@ -57,6 +57,7 @@
|
|||||||
UefiLib
|
UefiLib
|
||||||
DebugLib
|
DebugLib
|
||||||
BaseLib
|
BaseLib
|
||||||
|
PcdLib
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiIsaIoProtocolGuid # PROTOCOL TO_START
|
gEfiIsaIoProtocolGuid # PROTOCOL TO_START
|
||||||
@ -66,3 +67,5 @@
|
|||||||
gEfiPs2PolicyProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiPs2PolicyProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
|
||||||
|
[FeaturePcd]
|
||||||
|
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPs2KbdExtendedVerification|FALSE
|
@ -91,6 +91,9 @@
|
|||||||
# If TRUE, CSM support is enclosed for ACPI S3 Save.
|
# If TRUE, CSM support is enclosed for ACPI S3 Save.
|
||||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPlatformCsmSupport|TRUE|BOOLEAN|0x00010044
|
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPlatformCsmSupport|TRUE|BOOLEAN|0x00010044
|
||||||
|
|
||||||
|
## This PCD specifies whether PS2 keyboard does a extended verification during start.
|
||||||
|
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPs2KbdExtendedVerification|TRUE|BOOLEAN|0x00010045
|
||||||
|
|
||||||
[PcdsFixedAtBuild]
|
[PcdsFixedAtBuild]
|
||||||
## FFS filename to find the default BMP Logo file.
|
## FFS filename to find the default BMP Logo file.
|
||||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile |{ 0x99, 0x8b, 0xB2, 0x7B, 0xBB, 0x61, 0xD5, 0x11, 0x9A, 0x5D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }|VOID*|0x40000003
|
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile |{ 0x99, 0x8b, 0xB2, 0x7B, 0xBB, 0x61, 0xD5, 0x11, 0x9A, 0x5D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }|VOID*|0x40000003
|
||||||
|
Reference in New Issue
Block a user