Add PcdFastPS2Detection to improve PS2 keyboard driver start performance.
Signed-off-by: Li Elvin <elvin.li@intel.com> Reviewed-by: Yao Jiewen<jiewen.yao@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13820 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -1519,6 +1519,7 @@ InitKeyboard (
|
|||||||
// Perform a read to cleanup the Status Register's
|
// Perform a read to cleanup the Status Register's
|
||||||
// output buffer full bits within MAX TRY times
|
// output buffer full bits within MAX TRY times
|
||||||
//
|
//
|
||||||
|
if ((KeyReadStatusRegister (ConsoleIn) & KEYBOARD_STATUS_REGISTER_HAS_OUTPUT_DATA)) {
|
||||||
while (!EFI_ERROR (Status) && TryTime < KEYBOARD_MAX_TRY) {
|
while (!EFI_ERROR (Status) && TryTime < KEYBOARD_MAX_TRY) {
|
||||||
Status = KeyboardRead (ConsoleIn, &CommandByte);
|
Status = KeyboardRead (ConsoleIn, &CommandByte);
|
||||||
TryTime ++;
|
TryTime ++;
|
||||||
@ -1530,6 +1531,7 @@ InitKeyboard (
|
|||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// We should disable mouse interface during the initialization process
|
// We should disable mouse interface during the initialization process
|
||||||
// since mouse device output could block keyboard device output in the
|
// since mouse device output could block keyboard device output in the
|
||||||
@ -1543,6 +1545,7 @@ InitKeyboard (
|
|||||||
// time initialization
|
// time initialization
|
||||||
//
|
//
|
||||||
if ((KeyReadStatusRegister (ConsoleIn) & KEYBOARD_STATUS_REGISTER_SYSTEM_FLAG) != 0) {
|
if ((KeyReadStatusRegister (ConsoleIn) & KEYBOARD_STATUS_REGISTER_SYSTEM_FLAG) != 0) {
|
||||||
|
if (!PcdGetBool (PcdFastPS2Detection)) {
|
||||||
//
|
//
|
||||||
// 8042 controller is already setup (by myself or by mouse driver):
|
// 8042 controller is already setup (by myself or by mouse driver):
|
||||||
// See whether mouse interface is already enabled
|
// See whether mouse interface is already enabled
|
||||||
@ -1570,7 +1573,9 @@ InitKeyboard (
|
|||||||
} else {
|
} else {
|
||||||
mEnableMouseInterface = TRUE;
|
mEnableMouseInterface = TRUE;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
mEnableMouseInterface = FALSE;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// 8042 controller is not setup yet:
|
// 8042 controller is not setup yet:
|
||||||
@ -1580,6 +1585,7 @@ InitKeyboard (
|
|||||||
//
|
//
|
||||||
// Disable keyboard and mouse interfaces
|
// Disable keyboard and mouse interfaces
|
||||||
//
|
//
|
||||||
|
if (!PcdGetBool (PcdFastPS2Detection)) {
|
||||||
Status = KeyboardCommand (ConsoleIn, KEYBOARD_8042_COMMAND_DISABLE_KEYBOARD_INTERFACE);
|
Status = KeyboardCommand (ConsoleIn, KEYBOARD_8042_COMMAND_DISABLE_KEYBOARD_INTERFACE);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
KeyboardError (ConsoleIn, L"\n\r");
|
KeyboardError (ConsoleIn, L"\n\r");
|
||||||
@ -1611,6 +1617,7 @@ InitKeyboard (
|
|||||||
KeyboardError (ConsoleIn, L"8042 controller self test failed!\n\r");
|
KeyboardError (ConsoleIn, L"8042 controller self test failed!\n\r");
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// Don't enable mouse interface later
|
// Don't enable mouse interface later
|
||||||
//
|
//
|
||||||
@ -1865,11 +1872,11 @@ CheckKeyboardConnect (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINTN WaitForValueTimeOutBcakup;
|
UINTN WaitForValueTimeOutBcakup;
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
|
||||||
//
|
//
|
||||||
// enable keyboard itself and wait for its ack
|
// enable keyboard itself and wait for its ack
|
||||||
// If can't receive ack, Keyboard should not be connected.
|
// If can't receive ack, Keyboard should not be connected.
|
||||||
//
|
//
|
||||||
|
if (!PcdGetBool (PcdFastPS2Detection)) {
|
||||||
Status = KeyboardWrite (
|
Status = KeyboardWrite (
|
||||||
ConsoleIn,
|
ConsoleIn,
|
||||||
KEYBOARD_KBEN
|
KEYBOARD_KBEN
|
||||||
@ -1894,5 +1901,8 @@ CheckKeyboardConnect (
|
|||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
} else {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,6 +263,7 @@ KbdControllerDriverStart (
|
|||||||
//
|
//
|
||||||
// Return code is ignored on purpose.
|
// Return code is ignored on purpose.
|
||||||
//
|
//
|
||||||
|
if (!PcdGetBool (PcdFastPS2Detection)) {
|
||||||
KeyboardRead (ConsoleIn, &Data);
|
KeyboardRead (ConsoleIn, &Data);
|
||||||
if ((KeyReadStatusRegister (ConsoleIn) & (KBC_PARE | KBC_TIM)) == (KBC_PARE | KBC_TIM)) {
|
if ((KeyReadStatusRegister (ConsoleIn) & (KBC_PARE | KBC_TIM)) == (KBC_PARE | KBC_TIM)) {
|
||||||
//
|
//
|
||||||
@ -273,6 +274,7 @@ KbdControllerDriverStart (
|
|||||||
StatusCode = EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_NOT_DETECTED;
|
StatusCode = EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_NOT_DETECTED;
|
||||||
goto ErrorExit;
|
goto ErrorExit;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Setup the WaitForKey event
|
// Setup the WaitForKey event
|
||||||
|
@ -68,6 +68,9 @@
|
|||||||
[FeaturePcd]
|
[FeaturePcd]
|
||||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPs2KbdExtendedVerification
|
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPs2KbdExtendedVerification
|
||||||
|
|
||||||
|
[Pcd]
|
||||||
|
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdFastPS2Detection
|
||||||
|
|
||||||
# [Event]
|
# [Event]
|
||||||
# ##
|
# ##
|
||||||
# # Event will be signaled for WaitForKey event.
|
# # Event will be signaled for WaitForKey event.
|
||||||
|
@ -1037,6 +1037,7 @@ BiosKeyboardReset (
|
|||||||
// if not skip step 4&5 and jump to step 6 to selftest KBC and report this
|
// if not skip step 4&5 and jump to step 6 to selftest KBC and report this
|
||||||
// else go step 4
|
// else go step 4
|
||||||
//
|
//
|
||||||
|
if (!PcdGetBool (PcdFastPS2Detection)) {
|
||||||
if ((KeyReadStatusRegister (BiosKeyboardPrivate) & KBC_STSREG_VIA64_SYSF) != 0) {
|
if ((KeyReadStatusRegister (BiosKeyboardPrivate) & KBC_STSREG_VIA64_SYSF) != 0) {
|
||||||
//
|
//
|
||||||
// 4
|
// 4
|
||||||
@ -1095,7 +1096,6 @@ BiosKeyboardReset (
|
|||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// 6
|
// 6
|
||||||
@ -1128,6 +1128,7 @@ BiosKeyboardReset (
|
|||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// 7
|
// 7
|
||||||
// Disable Mouse interface, enable Keyboard interface and declare selftest success
|
// Disable Mouse interface, enable Keyboard interface and declare selftest success
|
||||||
@ -1321,6 +1322,7 @@ BiosKeyboardReset (
|
|||||||
// Done for validating keyboard. Enable keyboard (via KBC)
|
// Done for validating keyboard. Enable keyboard (via KBC)
|
||||||
// and recover the command byte to proper value
|
// and recover the command byte to proper value
|
||||||
//
|
//
|
||||||
|
if (!PcdGetBool (PcdFastPS2Detection)) {
|
||||||
Status = KeyboardCommand (
|
Status = KeyboardCommand (
|
||||||
BiosKeyboardPrivate,
|
BiosKeyboardPrivate,
|
||||||
KBC_CMDREG_VIA64_KB_ENABLE
|
KBC_CMDREG_VIA64_KB_ENABLE
|
||||||
@ -1330,6 +1332,7 @@ BiosKeyboardReset (
|
|||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// 14
|
// 14
|
||||||
@ -1674,6 +1677,7 @@ CheckKeyboardConnect (
|
|||||||
// enable keyboard itself and wait for its ack
|
// enable keyboard itself and wait for its ack
|
||||||
// If can't receive ack, Keyboard should not be connected.
|
// If can't receive ack, Keyboard should not be connected.
|
||||||
//
|
//
|
||||||
|
if (!PcdGetBool (PcdFastPS2Detection)) {
|
||||||
Status = KeyboardWrite (
|
Status = KeyboardWrite (
|
||||||
BiosKeyboardPrivate,
|
BiosKeyboardPrivate,
|
||||||
KBC_INPBUF_VIA60_KBEN
|
KBC_INPBUF_VIA60_KBEN
|
||||||
@ -1701,8 +1705,10 @@ CheckKeyboardConnect (
|
|||||||
);
|
);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
} else {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,3 +69,6 @@
|
|||||||
|
|
||||||
[FeaturePcd]
|
[FeaturePcd]
|
||||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPs2KbdExtendedVerification|FALSE
|
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPs2KbdExtendedVerification|FALSE
|
||||||
|
|
||||||
|
[Pcd]
|
||||||
|
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdFastPS2Detection
|
@ -220,3 +220,6 @@
|
|||||||
# The value should be a multiple of 4KB.
|
# The value should be a multiple of 4KB.
|
||||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdHighPmmMemorySize|0x400000|UINT32|0x3000000a
|
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdHighPmmMemorySize|0x400000|UINT32|0x3000000a
|
||||||
|
|
||||||
|
## This PCD specifies whether to use the optimized timing for best PS2 detection performance.
|
||||||
|
# Note this PCD could be set to TRUE for best boot performance and set to FALSE for best device compatibility.
|
||||||
|
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdFastPS2Detection|FALSE|BOOLEAN|0x3000000b
|
Reference in New Issue
Block a user