From 9cd1d1c1d5dd7fbad591f449c818c0f81a5586c3 Mon Sep 17 00:00:00 2001 From: klu2 Date: Sun, 28 Sep 2008 07:30:16 +0000 Subject: [PATCH] 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 --- MdePkg/Library/SecPeiDxeTimerLibCpu/X86TimerLib.c | 12 ++++++++---- 1 file 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 #include +#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); } -- 2.39.5