diff options
author | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-11-21 05:55:40 +0000 |
---|---|---|
committer | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-11-21 05:55:40 +0000 |
commit | 05f89b17b88f7356b8112593c2ad46feff9d755d (patch) | |
tree | afb4f29b81e878aec5a12d58710a98a8ed3a961c | |
parent | d4a20ec9dc608d2d3daf03cf68154230e04819f3 (diff) | |
download | edk2-platforms-05f89b17b88f7356b8112593c2ad46feff9d755d.tar.xz |
1. Add Max Try Times check to clear Ps2Kbd status register. If exceed the max try times, the device may be error.
2. To follow PI spec, PciCfg PPI doesn't require ASSERT for the unalign PCI IO access.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6659 6f19259b-4bc3-4df7-8a09-765794883524
4 files changed, 32 insertions, 8 deletions
diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c b/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c index 7fa0fb4d21..973cf24afb 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c +++ b/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c @@ -1642,18 +1642,20 @@ InitKeyboard ( EFI_STATUS Status1;
UINT8 CommandByte;
EFI_PS2_POLICY_PROTOCOL *Ps2Policy;
+ UINT32 TryTime;
- Status = EFI_SUCCESS;
+ Status = EFI_SUCCESS;
mEnableMouseInterface = TRUE;
+ TryTime = 0;
//
// Get Ps2 policy to set this
//
- Status = gBS->LocateProtocol (
- &gEfiPs2PolicyProtocolGuid,
- NULL,
- (VOID **) &Ps2Policy
- );
+ gBS->LocateProtocol (
+ &gEfiPs2PolicyProtocolGuid,
+ NULL,
+ (VOID **) &Ps2Policy
+ );
REPORT_STATUS_CODE_WITH_DEVICE_PATH (
EFI_PROGRESS_CODE,
@@ -1663,10 +1665,18 @@ InitKeyboard ( //
// Perform a read to cleanup the Status Register's
- // output buffer full bits
+ // output buffer full bits within MAX TRY times
//
- while (!EFI_ERROR (Status)) {
+ while (!EFI_ERROR (Status) && TryTime < KEYBOARD_MAX_TRY) {
Status = KeyboardRead (ConsoleIn, &CommandByte);
+ TryTime ++;
+ }
+ //
+ // Exceed the max try times. The device may be error.
+ //
+ if (TryTime == KEYBOARD_MAX_TRY) {
+ Status = EFI_DEVICE_ERROR;
+ goto Done;
}
//
// We should disable mouse interface during the initialization process
diff --git a/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h b/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h index 95c036d740..d7cf700efa 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h +++ b/IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h @@ -155,6 +155,7 @@ InstallPs2KeyboardDriver ( #define KEYBOARD_KBEN 0xF4
#define KEYBOARD_CMDECHO_ACK 0xFA
+#define KEYBOARD_MAX_TRY 256 // 256
#define KEYBOARD_TIMEOUT 65536 // 0.07s
#define KEYBOARD_WAITFORVALUE_TIMEOUT 1000000 // 1s
#define KEYBOARD_BAT_TIMEOUT 4000000 // 4s
diff --git a/IntelFrameworkModulePkg/Universal/PcatSingleSegmentPciCfgPei/PcatSingleSegmentPciCfgPei.inf b/IntelFrameworkModulePkg/Universal/PcatSingleSegmentPciCfgPei/PcatSingleSegmentPciCfgPei.inf index 010d840210..eb29457ebd 100644 --- a/IntelFrameworkModulePkg/Universal/PcatSingleSegmentPciCfgPei/PcatSingleSegmentPciCfgPei.inf +++ b/IntelFrameworkModulePkg/Universal/PcatSingleSegmentPciCfgPei/PcatSingleSegmentPciCfgPei.inf @@ -55,6 +55,13 @@ gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPciCfgDisable
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPciCfg2Disable
+[FixedPcd.common]
+ ##
+ # Disable ASSERT for unalign PCI IO access according to PI Volume 1 and PeiCis Spec
+ # Spec has not this requirement.
+ ##
+ gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0E
+
[Depex]
TRUE
diff --git a/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PcatSingleSegmentPciCfg2Pei.inf b/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PcatSingleSegmentPciCfg2Pei.inf index 6bb9d897bd..516d212728 100644 --- a/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PcatSingleSegmentPciCfg2Pei.inf +++ b/MdeModulePkg/Universal/PcatSingleSegmentPciCfg2Pei/PcatSingleSegmentPciCfg2Pei.inf @@ -51,3 +51,9 @@ [Depex]
TRUE
+[FixedPcd.common]
+ ##
+ # Disable ASSERT for unalign PCI IO access according to PI Spec Volume 1
+ # Spec has not this requirement.
+ ##
+ gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0E
|