mirror of https://github.com/acidanthera/audk.git
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:
parent
6ef5ab88d7
commit
1553d07363
|
@ -49,6 +49,7 @@
|
||||||
[LibraryClasses.IA32, LibraryClasses.X64]
|
[LibraryClasses.IA32, LibraryClasses.X64]
|
||||||
PcdLib
|
PcdLib
|
||||||
IoLib
|
IoLib
|
||||||
|
DebugLib
|
||||||
|
|
||||||
[LibraryClasses.IPF]
|
[LibraryClasses.IPF]
|
||||||
PalLib
|
PalLib
|
||||||
|
|
|
@ -17,9 +17,10 @@
|
||||||
#include <Library/BaseLib.h>
|
#include <Library/BaseLib.h>
|
||||||
#include <Library/IoLib.h>
|
#include <Library/IoLib.h>
|
||||||
#include <Library/PcdLib.h>
|
#include <Library/PcdLib.h>
|
||||||
|
#include <Library/DebugLib.h>
|
||||||
|
|
||||||
#define APIC_LVTERR 0x370
|
#define APIC_LVTERR 0x370
|
||||||
#define APIC_TMICT 0x380
|
#define APIC_TMICT 0x380
|
||||||
#define APIC_TMCCT 0x390
|
#define APIC_TMCCT 0x390
|
||||||
#define APIC_TDCR 0x3e0
|
#define APIC_TDCR 0x3e0
|
||||||
|
|
||||||
|
@ -115,7 +116,9 @@ InternalX86Delay (
|
||||||
// Delay > 2^31 could not be handled by this function
|
// Delay > 2^31 could not be handled by this function
|
||||||
// Timer wrap-arounds are handled correctly 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) {
|
if (StartValue != NULL) {
|
||||||
*StartValue = MmioRead32 (ApicBase + APIC_TMICT);
|
*StartValue = MmioRead32 (ApicBase + APIC_TMICT);
|
||||||
|
//
|
||||||
|
// make sure StartValue is all 1s from High Bit
|
||||||
|
//
|
||||||
|
ASSERT ((*StartValue & (*StartValue + 1)) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EndValue != NULL) {
|
if (EndValue != NULL) {
|
||||||
|
|
Loading…
Reference in New Issue