summaryrefslogtreecommitdiff
path: root/MdePkg/Library
diff options
context:
space:
mode:
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2008-09-28 07:30:16 +0000
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2008-09-28 07:30:16 +0000
commit9cd1d1c1d5dd7fbad591f449c818c0f81a5586c3 (patch)
treecba9c3b0e83f3f08c35fc22856a8ce1e51ff5ea8 /MdePkg/Library
parent3bb398eb6413eedbec1ce7e7452ad043c599b983 (diff)
downloadedk2-platforms-9cd1d1c1d5dd7fbad591f449c818c0f81a5586c3.tar.xz
Use macro instead of hard code value for timer register address in local APIC
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6065 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library')
-rw-r--r--MdePkg/Library/SecPeiDxeTimerLibCpu/X86TimerLib.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/MdePkg/Library/SecPeiDxeTimerLibCpu/X86TimerLib.c b/MdePkg/Library/SecPeiDxeTimerLibCpu/X86TimerLib.c
index 81b4c90297..2c6a92bf03 100644
--- a/MdePkg/Library/SecPeiDxeTimerLibCpu/X86TimerLib.c
+++ b/MdePkg/Library/SecPeiDxeTimerLibCpu/X86TimerLib.c
@@ -18,6 +18,10 @@
#include <Library/IoLib.h>
#include <Library/PcdLib.h>
+#define APIC_LVTERR 0x370
+#define APIC_TMICT 0x380
+#define APIC_TMCCT 0x390
+#define APIC_TDCR 0x3e0
//
// The following array is used in calculating the frequency of local APIC
@@ -62,7 +66,7 @@ InternalX86GetTimerFrequency (
{
return
PcdGet32(PcdFSBClock) /
- mTimerLibLocalApicDivisor[MmioBitFieldRead32 (ApicBase + 0x3e0, 0, 3)];
+ mTimerLibLocalApicDivisor[MmioBitFieldRead32 (ApicBase + APIC_TDCR, 0, 3)];
}
/**
@@ -79,7 +83,7 @@ InternalX86GetTimerTick (
IN UINTN ApicBase
)
{
- return MmioRead32 (ApicBase + 0x390);
+ return MmioRead32 (ApicBase + APIC_TMCCT);
}
/**
@@ -232,12 +236,12 @@ GetPerformanceCounterProperties (
ApicBase = InternalX86GetApicBase ();
if (StartValue != NULL) {
- *StartValue = MmioRead32 (ApicBase + 0x380);
+ *StartValue = MmioRead32 (ApicBase + APIC_TMICT);
}
if (EndValue != NULL) {
*EndValue = 0;
}
- return (UINT64) InternalX86GetTimerFrequency (ApicBase);;
+ return (UINT64) InternalX86GetTimerFrequency (ApicBase);
}