added PcdPlatformBusSpeed for BaseTimerLibLocalApic, thus this timer instance needn't depend on types of CPUs

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1909 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff
2006-11-07 08:43:22 +00:00
parent 1d940d05b5
commit b219108e51
6 changed files with 270 additions and 183 deletions

View File

@@ -35,6 +35,9 @@
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>DebugLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>PcdLib</Keyword>
</LibraryClass>
</LibraryClassDefinitions>
<SourceFiles>
<Filename SupArchList="IA32">x86TimerLib.c</Filename>
@@ -49,4 +52,11 @@
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
</Externs>
<PcdCoded>
<PcdEntry PcdItemType="FIXED_AT_BUILD" Usage="ALWAYS_CONSUMED">
<C_Name>PcdPlatformBusSpeed</C_Name>
<TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
<HelpText>This value is the Bus Speed on platform</HelpText>
</PcdEntry>
</PcdCoded>
</ModuleSurfaceArea>

View File

@@ -19,18 +19,9 @@
**/
//
// The following 2 arrays are used in calculating the frequency of local APIC
// The following array is used in calculating the frequency of local APIC
// timer. Refer to IA-32 developers' manual for more details.
//
GLOBAL_REMOVE_IF_UNREFERENCED
CONST UINT32 mTimerLibLocalApicFrequencies[] = {
100000000,
133000000,
200000000,
166000000
};
GLOBAL_REMOVE_IF_UNREFERENCED
CONST UINT8 mTimerLibLocalApicDivisor[] = {
0x02, 0x04, 0x08, 0x10,
@@ -73,7 +64,7 @@ InternalX86GetTimerFrequency (
)
{
return
mTimerLibLocalApicFrequencies[AsmMsrBitFieldRead32 (44, 16, 18)] /
PcdGet32(PcdPlatformBusSpeed) /
mTimerLibLocalApicDivisor[MmioBitFieldRead32 (ApicBase + 0x3e0, 0, 3)];
}
@@ -255,5 +246,5 @@ GetPerformanceCounterProperties (
*EndValue = 0;
}
return (UINT64)InternalX86GetTimerFrequency (ApicBase);
return PcdGet32(PcdPlatformBusSpeed);
}