mirror of https://github.com/acidanthera/audk.git
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
This commit is contained in:
parent
3bb398eb64
commit
9cd1d1c1d5
|
@ -18,6 +18,10 @@
|
||||||
#include <Library/IoLib.h>
|
#include <Library/IoLib.h>
|
||||||
#include <Library/PcdLib.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
|
// The following array is used in calculating the frequency of local APIC
|
||||||
|
@ -62,7 +66,7 @@ InternalX86GetTimerFrequency (
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
PcdGet32(PcdFSBClock) /
|
PcdGet32(PcdFSBClock) /
|
||||||
mTimerLibLocalApicDivisor[MmioBitFieldRead32 (ApicBase + 0x3e0, 0, 3)];
|
mTimerLibLocalApicDivisor[MmioBitFieldRead32 (ApicBase + APIC_TDCR, 0, 3)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,7 +83,7 @@ InternalX86GetTimerTick (
|
||||||
IN UINTN ApicBase
|
IN UINTN ApicBase
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return MmioRead32 (ApicBase + 0x390);
|
return MmioRead32 (ApicBase + APIC_TMCCT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -232,12 +236,12 @@ GetPerformanceCounterProperties (
|
||||||
ApicBase = InternalX86GetApicBase ();
|
ApicBase = InternalX86GetApicBase ();
|
||||||
|
|
||||||
if (StartValue != NULL) {
|
if (StartValue != NULL) {
|
||||||
*StartValue = MmioRead32 (ApicBase + 0x380);
|
*StartValue = MmioRead32 (ApicBase + APIC_TMICT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EndValue != NULL) {
|
if (EndValue != NULL) {
|
||||||
*EndValue = 0;
|
*EndValue = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (UINT64) InternalX86GetTimerFrequency (ApicBase);;
|
return (UINT64) InternalX86GetTimerFrequency (ApicBase);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue