fixed assumption 32bit Local Apic timer counter.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7266 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff 2009-01-14 03:05:45 +00:00
parent 6ef5ab88d7
commit 1553d07363
2 changed files with 10 additions and 2 deletions

View File

@ -49,6 +49,7 @@
[LibraryClasses.IA32, LibraryClasses.X64]
PcdLib
IoLib
DebugLib
[LibraryClasses.IPF]
PalLib

View File

@ -17,9 +17,10 @@
#include <Library/BaseLib.h>
#include <Library/IoLib.h>
#include <Library/PcdLib.h>
#include <Library/DebugLib.h>
#define APIC_LVTERR 0x370
#define APIC_TMICT 0x380
#define APIC_TMICT 0x380
#define APIC_TMCCT 0x390
#define APIC_TDCR 0x3e0
@ -115,7 +116,9 @@ InternalX86Delay (
// Delay > 2^31 could not be handled by this function
// Timer wrap-arounds are handled correctly by this function
//
while (InternalX86GetTimerTick (ApicBase) - Ticks >= 0);
while (((UINT32)(InternalX86GetTimerTick (ApicBase) - Ticks) & GetPowerOfTwo32 ((MmioRead32 (ApicBase + APIC_TMICT)))) == 0) {
CpuPause ();
}
}
/**
@ -238,6 +241,10 @@ GetPerformanceCounterProperties (
if (StartValue != NULL) {
*StartValue = MmioRead32 (ApicBase + APIC_TMICT);
//
// make sure StartValue is all 1s from High Bit
//
ASSERT ((*StartValue & (*StartValue + 1)) == 0);
}
if (EndValue != NULL) {