]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Use macro instead of hard code value for timer register address in local APIC
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 28 Sep 2008 07:30:16 +0000 (07:30 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 28 Sep 2008 07:30:16 +0000 (07:30 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6065 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Library/SecPeiDxeTimerLibCpu/X86TimerLib.c

index 81b4c902979f9ed1bc9d6514c70852031607ad2a..2c6a92bf0372a03ca554fbf1f2864277d9effb67 100644 (file)
 #include <Library/IoLib.h>\r
 #include <Library/PcdLib.h>\r
 \r
+#define APIC_LVTERR     0x370\r
+#define APIC_TMICT      0x380   \r
+#define APIC_TMCCT      0x390\r
+#define APIC_TDCR       0x3e0\r
 \r
 //\r
 // The following array is used in calculating the frequency of local APIC\r
@@ -62,7 +66,7 @@ InternalX86GetTimerFrequency (
 {\r
   return\r
     PcdGet32(PcdFSBClock) /\r
-    mTimerLibLocalApicDivisor[MmioBitFieldRead32 (ApicBase + 0x3e0, 0, 3)];\r
+    mTimerLibLocalApicDivisor[MmioBitFieldRead32 (ApicBase + APIC_TDCR, 0, 3)];\r
 }\r
 \r
 /**\r
@@ -79,7 +83,7 @@ InternalX86GetTimerTick (
   IN      UINTN                     ApicBase\r
   )\r
 {\r
-  return MmioRead32 (ApicBase + 0x390);\r
+  return MmioRead32 (ApicBase + APIC_TMCCT);\r
 }\r
 \r
 /**\r
@@ -232,12 +236,12 @@ GetPerformanceCounterProperties (
   ApicBase = InternalX86GetApicBase ();\r
 \r
   if (StartValue != NULL) {\r
-    *StartValue = MmioRead32 (ApicBase + 0x380);\r
+    *StartValue = MmioRead32 (ApicBase + APIC_TMICT);\r
   }\r
 \r
   if (EndValue != NULL) {\r
     *EndValue = 0;\r
   }\r
 \r
-  return (UINT64) InternalX86GetTimerFrequency (ApicBase);;\r
+  return (UINT64) InternalX86GetTimerFrequency (ApicBase);\r
 }\r