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:
@ -1037,95 +1037,96 @@ BiosKeyboardReset (
|
||||
// if not skip step 4&5 and jump to step 6 to selftest KBC and report this
|
||||
// else go step 4
|
||||
//
|
||||
if ((KeyReadStatusRegister (BiosKeyboardPrivate) & KBC_STSREG_VIA64_SYSF) != 0) {
|
||||
//
|
||||
// 4
|
||||
// CheckMouseStatus to decide enable it later or not
|
||||
//
|
||||
//
|
||||
// Read the command byte of KBC
|
||||
//
|
||||
Status = KeyboardCommand (
|
||||
BiosKeyboardPrivate,
|
||||
KBC_CMDREG_VIA64_CMDBYTE_R
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Status = KeyboardRead (
|
||||
BiosKeyboardPrivate,
|
||||
&CommandByte
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
goto Exit;
|
||||
}
|
||||
//
|
||||
// Check mouse enabled or not before
|
||||
//
|
||||
if ((CommandByte & KB_CMMBYTE_DISABLE_AUX) != 0) {
|
||||
MouseEnable = FALSE;
|
||||
if (!PcdGetBool (PcdFastPS2Detection)) {
|
||||
if ((KeyReadStatusRegister (BiosKeyboardPrivate) & KBC_STSREG_VIA64_SYSF) != 0) {
|
||||
//
|
||||
// 4
|
||||
// CheckMouseStatus to decide enable it later or not
|
||||
//
|
||||
//
|
||||
// Read the command byte of KBC
|
||||
//
|
||||
Status = KeyboardCommand (
|
||||
BiosKeyboardPrivate,
|
||||
KBC_CMDREG_VIA64_CMDBYTE_R
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Status = KeyboardRead (
|
||||
BiosKeyboardPrivate,
|
||||
&CommandByte
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
goto Exit;
|
||||
}
|
||||
//
|
||||
// Check mouse enabled or not before
|
||||
//
|
||||
if ((CommandByte & KB_CMMBYTE_DISABLE_AUX) != 0) {
|
||||
MouseEnable = FALSE;
|
||||
} else {
|
||||
MouseEnable = TRUE;
|
||||
}
|
||||
//
|
||||
// 5
|
||||
// disable mouse (via KBC) and Keyborad device
|
||||
//
|
||||
Status = KeyboardCommand (
|
||||
BiosKeyboardPrivate,
|
||||
KBC_CMDREG_VIA64_AUX_DISABLE
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Status = KeyboardCommand (
|
||||
BiosKeyboardPrivate,
|
||||
KBC_CMDREG_VIA64_KB_DISABLE
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
goto Exit;
|
||||
}
|
||||
} else {
|
||||
MouseEnable = TRUE;
|
||||
}
|
||||
//
|
||||
// 5
|
||||
// disable mouse (via KBC) and Keyborad device
|
||||
//
|
||||
Status = KeyboardCommand (
|
||||
BiosKeyboardPrivate,
|
||||
KBC_CMDREG_VIA64_AUX_DISABLE
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Status = KeyboardCommand (
|
||||
BiosKeyboardPrivate,
|
||||
KBC_CMDREG_VIA64_KB_DISABLE
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
} else {
|
||||
//
|
||||
// 6
|
||||
// KBC Self Test
|
||||
//
|
||||
//
|
||||
// Report a Progress Code for performing a self test on the keyboard controller
|
||||
//
|
||||
REPORT_STATUS_CODE (
|
||||
EFI_PROGRESS_CODE,
|
||||
EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_PC_SELF_TEST
|
||||
);
|
||||
|
||||
Status = KeyboardCommand (
|
||||
BiosKeyboardPrivate,
|
||||
KBC_CMDREG_VIA64_KBC_SLFTEST
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Status = KeyboardWaitForValue (
|
||||
BiosKeyboardPrivate,
|
||||
KBC_CMDECHO_KBCSLFTEST_OK,
|
||||
KEYBOARD_WAITFORVALUE_TIMEOUT
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
goto Exit;
|
||||
//
|
||||
// 6
|
||||
// KBC Self Test
|
||||
//
|
||||
//
|
||||
// Report a Progress Code for performing a self test on the keyboard controller
|
||||
//
|
||||
REPORT_STATUS_CODE (
|
||||
EFI_PROGRESS_CODE,
|
||||
EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_PC_SELF_TEST
|
||||
);
|
||||
|
||||
Status = KeyboardCommand (
|
||||
BiosKeyboardPrivate,
|
||||
KBC_CMDREG_VIA64_KBC_SLFTEST
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
Status = KeyboardWaitForValue (
|
||||
BiosKeyboardPrivate,
|
||||
KBC_CMDECHO_KBCSLFTEST_OK,
|
||||
KEYBOARD_WAITFORVALUE_TIMEOUT
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
@ -1321,14 +1322,16 @@ BiosKeyboardReset (
|
||||
// Done for validating keyboard. Enable keyboard (via KBC)
|
||||
// and recover the command byte to proper value
|
||||
//
|
||||
Status = KeyboardCommand (
|
||||
BiosKeyboardPrivate,
|
||||
KBC_CMDREG_VIA64_KB_ENABLE
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
goto Exit;
|
||||
if (!PcdGetBool (PcdFastPS2Detection)) {
|
||||
Status = KeyboardCommand (
|
||||
BiosKeyboardPrivate,
|
||||
KBC_CMDREG_VIA64_KB_ENABLE
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
goto Exit;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@ -1674,35 +1677,38 @@ CheckKeyboardConnect (
|
||||
// enable keyboard itself and wait for its ack
|
||||
// If can't receive ack, Keyboard should not be connected.
|
||||
//
|
||||
Status = KeyboardWrite (
|
||||
BiosKeyboardPrivate,
|
||||
KBC_INPBUF_VIA60_KBEN
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((EFI_D_ERROR, "[KBD]CheckKeyboardConnect - Keyboard enable failed!\n"));
|
||||
REPORT_STATUS_CODE (
|
||||
EFI_ERROR_CODE | EFI_ERROR_MINOR,
|
||||
EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_CONTROLLER_ERROR
|
||||
);
|
||||
return FALSE;
|
||||
if (!PcdGetBool (PcdFastPS2Detection)) {
|
||||
Status = KeyboardWrite (
|
||||
BiosKeyboardPrivate,
|
||||
KBC_INPBUF_VIA60_KBEN
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((EFI_D_ERROR, "[KBD]CheckKeyboardConnect - Keyboard enable failed!\n"));
|
||||
REPORT_STATUS_CODE (
|
||||
EFI_ERROR_CODE | EFI_ERROR_MINOR,
|
||||
EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_CONTROLLER_ERROR
|
||||
);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = KeyboardWaitForValue (
|
||||
BiosKeyboardPrivate,
|
||||
KBC_CMDECHO_ACK,
|
||||
KEYBOARD_WAITFORVALUE_TIMEOUT
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((EFI_D_ERROR, "[KBD]CheckKeyboardConnect - Timeout!\n"));
|
||||
REPORT_STATUS_CODE (
|
||||
EFI_ERROR_CODE | EFI_ERROR_MINOR,
|
||||
EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_CONTROLLER_ERROR
|
||||
);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
} else {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Status = KeyboardWaitForValue (
|
||||
BiosKeyboardPrivate,
|
||||
KBC_CMDECHO_ACK,
|
||||
KEYBOARD_WAITFORVALUE_TIMEOUT
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((EFI_D_ERROR, "[KBD]CheckKeyboardConnect - Timeout!\n"));
|
||||
REPORT_STATUS_CODE (
|
||||
EFI_ERROR_CODE | EFI_ERROR_MINOR,
|
||||
EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_CONTROLLER_ERROR
|
||||
);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user