summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/SecPeiDxeTimerLibCpu
diff options
context:
space:
mode:
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2007-08-27 01:01:44 +0000
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2007-08-27 01:01:44 +0000
commit580ad4a03d84ba7a97f10a27c3838c178227b685 (patch)
tree9b5bec9c70ff068ff98a755964f6f988d45d62c1 /MdePkg/Library/SecPeiDxeTimerLibCpu
parent055a4a3d795b1ba5f00ba9a3241a5b8fde41b141 (diff)
downloadedk2-580ad4a03d84ba7a97f10a27c3838c178227b685.tar.gz
edk2-580ad4a03d84ba7a97f10a27c3838c178227b685.tar.bz2
edk2-580ad4a03d84ba7a97f10a27c3838c178227b685.zip
Handle case when PAL calls 13 or 14 may not be available.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3708 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/SecPeiDxeTimerLibCpu')
-rw-r--r--MdePkg/Library/SecPeiDxeTimerLibCpu/IpfTimerLib.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/MdePkg/Library/SecPeiDxeTimerLibCpu/IpfTimerLib.c b/MdePkg/Library/SecPeiDxeTimerLibCpu/IpfTimerLib.c
index 8d3c3fd6f3..9fe33ec134 100644
--- a/MdePkg/Library/SecPeiDxeTimerLibCpu/IpfTimerLib.c
+++ b/MdePkg/Library/SecPeiDxeTimerLibCpu/IpfTimerLib.c
@@ -152,13 +152,6 @@ GetPerformanceCounterProperties (
PAL_CALL_RETURN PalRet;
UINT64 BaseFrequence;
- PalRet = PalCallStatic (NULL, 13, 0, 0, 0);
- ASSERT (PalRet.Status == 0);
- BaseFrequence = PalRet.r9;
-
- PalRet = PalCallStatic (NULL, 14, 0, 0, 0);
- ASSERT (PalRet.Status == 0);
-
if (StartValue != NULL) {
*StartValue = 0;
}
@@ -167,5 +160,16 @@ GetPerformanceCounterProperties (
*EndValue = (UINT64)(-1);
}
+ PalRet = PalCallStatic (NULL, 13, 0, 0, 0);
+ if (PalRet.Status != 0) {
+ return 1000000;
+ }
+ BaseFrequence = PalRet.r9;
+
+ PalRet = PalCallStatic (NULL, 14, 0, 0, 0);
+ if (PalRet.Status != 0) {
+ return 1000000;
+ }
+
return BaseFrequence * (PalRet.r11 >> 32) / (UINT32)PalRet.r11;
}