mirror of https://github.com/acidanthera/audk.git
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:
parent
e8c758dc92
commit
4ccfd30544
|
@ -1519,6 +1519,7 @@ InitKeyboard (
|
|||
// Perform a read to cleanup the Status Register's
|
||||
// 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) {
|
||||
Status = KeyboardRead (ConsoleIn, &CommandByte);
|
||||
TryTime ++;
|
||||
|
@ -1530,6 +1531,7 @@ InitKeyboard (
|
|||
Status = EFI_DEVICE_ERROR;
|
||||
goto Done;
|
||||
}
|
||||
}
|
||||
//
|
||||
// We should disable mouse interface during the initialization process
|
||||
// since mouse device output could block keyboard device output in the
|
||||
|
@ -1543,6 +1545,7 @@ InitKeyboard (
|
|||
// time initialization
|
||||
//
|
||||
if ((KeyReadStatusRegister (ConsoleIn) & KEYBOARD_STATUS_REGISTER_SYSTEM_FLAG) != 0) {
|
||||
if (!PcdGetBool (PcdFastPS2Detection)) {
|
||||
//
|
||||
// 8042 controller is already setup (by myself or by mouse driver):
|
||||
// See whether mouse interface is already enabled
|
||||
|
@ -1570,7 +1573,9 @@ InitKeyboard (
|
|||
} else {
|
||||
mEnableMouseInterface = TRUE;
|
||||
}
|
||||
|
||||
} else {
|
||||
mEnableMouseInterface = FALSE;
|
||||
}
|
||||
} else {
|
||||
//
|
||||
// 8042 controller is not setup yet:
|
||||
|
@ -1580,6 +1585,7 @@ InitKeyboard (
|
|||
//
|
||||
// Disable keyboard and mouse interfaces
|
||||
//
|
||||
if (!PcdGetBool (PcdFastPS2Detection)) {
|
||||
Status = KeyboardCommand (ConsoleIn, KEYBOARD_8042_COMMAND_DISABLE_KEYBOARD_INTERFACE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
KeyboardError (ConsoleIn, L"\n\r");
|
||||
|
@ -1611,6 +1617,7 @@ InitKeyboard (
|
|||
KeyboardError (ConsoleIn, L"8042 controller self test failed!\n\r");
|
||||
goto Done;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Don't enable mouse interface later
|
||||
//
|
||||
|
@ -1865,11 +1872,11 @@ CheckKeyboardConnect (
|
|||
EFI_STATUS Status;
|
||||
UINTN WaitForValueTimeOutBcakup;
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
//
|
||||
// enable keyboard itself and wait for its ack
|
||||
// If can't receive ack, Keyboard should not be connected.
|
||||
//
|
||||
if (!PcdGetBool (PcdFastPS2Detection)) {
|
||||
Status = KeyboardWrite (
|
||||
ConsoleIn,
|
||||
KEYBOARD_KBEN
|
||||
|
@ -1894,5 +1901,8 @@ CheckKeyboardConnect (
|
|||
}
|
||||
|
||||
return TRUE;
|
||||
} else {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -263,6 +263,7 @@ KbdControllerDriverStart (
|
|||
//
|
||||
// Return code is ignored on purpose.
|
||||
//
|
||||
if (!PcdGetBool (PcdFastPS2Detection)) {
|
||||
KeyboardRead (ConsoleIn, &Data);
|
||||
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;
|
||||
goto ErrorExit;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Setup the WaitForKey event
|
||||
|
|
|
@ -68,6 +68,9 @@
|
|||
[FeaturePcd]
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPs2KbdExtendedVerification
|
||||
|
||||
[Pcd]
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdFastPS2Detection
|
||||
|
||||
# [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
|
||||
// else go step 4
|
||||
//
|
||||
if (!PcdGetBool (PcdFastPS2Detection)) {
|
||||
if ((KeyReadStatusRegister (BiosKeyboardPrivate) & KBC_STSREG_VIA64_SYSF) != 0) {
|
||||
//
|
||||
// 4
|
||||
|
@ -1095,7 +1096,6 @@ BiosKeyboardReset (
|
|||
Status = EFI_DEVICE_ERROR;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
} else {
|
||||
//
|
||||
// 6
|
||||
|
@ -1128,6 +1128,7 @@ BiosKeyboardReset (
|
|||
goto Exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// 7
|
||||
// Disable Mouse interface, enable Keyboard interface and declare selftest success
|
||||
|
@ -1321,6 +1322,7 @@ BiosKeyboardReset (
|
|||
// Done for validating keyboard. Enable keyboard (via KBC)
|
||||
// and recover the command byte to proper value
|
||||
//
|
||||
if (!PcdGetBool (PcdFastPS2Detection)) {
|
||||
Status = KeyboardCommand (
|
||||
BiosKeyboardPrivate,
|
||||
KBC_CMDREG_VIA64_KB_ENABLE
|
||||
|
@ -1330,6 +1332,7 @@ BiosKeyboardReset (
|
|||
Status = EFI_DEVICE_ERROR;
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// 14
|
||||
|
@ -1674,6 +1677,7 @@ CheckKeyboardConnect (
|
|||
// enable keyboard itself and wait for its ack
|
||||
// If can't receive ack, Keyboard should not be connected.
|
||||
//
|
||||
if (!PcdGetBool (PcdFastPS2Detection)) {
|
||||
Status = KeyboardWrite (
|
||||
BiosKeyboardPrivate,
|
||||
KBC_INPBUF_VIA60_KBEN
|
||||
|
@ -1701,8 +1705,10 @@ CheckKeyboardConnect (
|
|||
);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
} else {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -69,3 +69,6 @@
|
|||
|
||||
[FeaturePcd]
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPs2KbdExtendedVerification|FALSE
|
||||
|
||||
[Pcd]
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdFastPS2Detection
|
|
@ -220,3 +220,6 @@
|
|||
# The value should be a multiple of 4KB.
|
||||
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
|
Loading…
Reference in New Issue