-\r
-//\r
-// The following array is used in calculating the frequency of local APIC\r
-// timer. Refer to IA-32 developers' manual for more details.\r
-//\r
-GLOBAL_REMOVE_IF_UNREFERENCED\r
-CONST UINT8 mTimerLibLocalApicDivisor[] = {\r
- 0x02, 0x04, 0x08, 0x10,\r
- 0x02, 0x04, 0x08, 0x10,\r
- 0x20, 0x40, 0x80, 0x01,\r
- 0x20, 0x40, 0x80, 0x01\r
-};\r
-\r
-/**\r
- Internal function to retrieve the base address of local APIC.\r
-\r
- Internal function to retrieve the base address of local APIC.\r
-\r
- @return The base address of local APIC\r
-\r
-**/\r
-UINTN\r
-InternalX86GetApicBase (\r
- VOID\r
- )\r
-{\r
- return (UINTN)AsmMsrBitFieldRead64 (27, 12, 35) << 12;\r
-}\r
-\r
-/**\r
- Internal function to return the frequency of the local APIC timer.\r
-\r
- Internal function to return the frequency of the local APIC timer.\r
-\r
- @param ApicBase The base address of memory mapped registers of local APIC.\r
-\r
- @return The frequency of the timer in Hz.\r
-\r
-**/\r
-UINT32\r
-InternalX86GetTimerFrequency (\r
- IN UINTN ApicBase\r
- )\r
-{\r
- return\r
- PcdGet32(PcdFSBClock) /\r
- mTimerLibLocalApicDivisor[MmioBitFieldRead32 (ApicBase + 0x3e0, 0, 3)];\r
-}\r