summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe
diff options
context:
space:
mode:
authorgikidy <gikidy@6f19259b-4bc3-4df7-8a09-765794883524>2009-06-05 03:25:09 +0000
committergikidy <gikidy@6f19259b-4bc3-4df7-8a09-765794883524>2009-06-05 03:25:09 +0000
commit007c18f5b7a3a105d212443ec6b4245c46006c80 (patch)
tree74f5738296950325f0b963d33ad38c4f012556e4 /IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe
parent502bfcef5c0535f473e15a3fed04419182509b5f (diff)
downloadedk2-platforms-007c18f5b7a3a105d212443ec6b4245c46006c80.tar.xz
Enhance Ps2Mouse and Ps2Keyboard driver and fix for random hangs in System waiting for the Key if no KBC is present.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8473 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe')
-rw-r--r--IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/Ps2Mouse.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/Ps2Mouse.c b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/Ps2Mouse.c
index 32b527c72c..084c3244ae 100644
--- a/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/Ps2Mouse.c
+++ b/IntelFrameworkModulePkg/Bus/Isa/Ps2MouseDxe/Ps2Mouse.c
@@ -228,6 +228,18 @@ PS2MouseDriverStart (
// Initialize keyboard controller if necessary
//
IsaIo->Io.Read (IsaIo, EfiIsaIoWidthUint8, KBC_CMD_STS_PORT, 1, &Data);
+ //
+ // Fix for random hangs in System waiting for the Key if no KBC is present in BIOS.
+ //
+ if ((Data & (KBC_PARE | KBC_TIM)) == (KBC_PARE | KBC_TIM)) {
+ //
+ // If nobody decodes KBC I/O port, it will read back as 0xFF.
+ // Check the Time-Out and Parity bit to see if it has an active KBC in system
+ //
+ Status = EFI_DEVICE_ERROR;
+ StatusCode = EFI_PERIPHERAL_MOUSE | EFI_P_EC_NOT_DETECTED;
+ goto ErrorExit;
+ }
if ((Data & KBC_SYSF) != KBC_SYSF) {
Status = KbcSelfTest (IsaIo);
if (EFI_ERROR (Status)) {
@@ -329,7 +341,9 @@ PS2MouseDriverStart (
ErrorExit:
- KbcDisableAux (IsaIo);
+ if (Status != EFI_DEVICE_ERROR) {
+ KbcDisableAux (IsaIo);
+ }
if (StatusCode != 0) {
REPORT_STATUS_CODE_WITH_DEVICE_PATH (
@@ -350,13 +364,16 @@ ErrorExit:
if ((MouseDev != NULL) && (MouseDev->ControllerNameTable != NULL)) {
FreeUnicodeStringTable (MouseDev->ControllerNameTable);
}
- //
- // Since there will be no timer handler for mouse input any more,
- // exhaust input data just in case there is still mouse data left
- //
- EmptyStatus = EFI_SUCCESS;
- while (!EFI_ERROR (EmptyStatus)) {
- EmptyStatus = In8042Data (IsaIo, &Data);
+
+ if (Status != EFI_DEVICE_ERROR) {
+ //
+ // Since there will be no timer handler for mouse input any more,
+ // exhaust input data just in case there is still mouse data left
+ //
+ EmptyStatus = EFI_SUCCESS;
+ while (!EFI_ERROR (EmptyStatus)) {
+ EmptyStatus = In8042Data (IsaIo, &Data);
+ }
}
if (MouseDev != NULL) {