]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/SecPeiDxeTimerLibCpu/IpfTimerLib.c
Handle case when PAL calls 13 or 14 may not be available.
[mirror_edk2.git] / MdePkg / Library / SecPeiDxeTimerLibCpu / IpfTimerLib.c
index 8d3c3fd6f327766e091a0bc424da310a832eb4cb..9fe33ec134ebe346a6e9a2b3867ad058d24651a1 100644 (file)
@@ -152,13 +152,6 @@ GetPerformanceCounterProperties (
   PAL_CALL_RETURN                   PalRet;\r
   UINT64                            BaseFrequence;\r
 \r
-  PalRet = PalCallStatic (NULL, 13, 0, 0, 0);\r
-  ASSERT (PalRet.Status == 0);\r
-  BaseFrequence = PalRet.r9;\r
-\r
-  PalRet = PalCallStatic (NULL, 14, 0, 0, 0);\r
-  ASSERT (PalRet.Status == 0);\r
-\r
   if (StartValue != NULL) {\r
     *StartValue = 0;\r
   }\r
@@ -167,5 +160,16 @@ GetPerformanceCounterProperties (
     *EndValue = (UINT64)(-1);\r
   }\r
 \r
+  PalRet = PalCallStatic (NULL, 13, 0, 0, 0);\r
+  if (PalRet.Status != 0) {\r
+    return 1000000;\r
+  }\r
+  BaseFrequence = PalRet.r9;\r
+\r
+  PalRet = PalCallStatic (NULL, 14, 0, 0, 0);\r
+  if (PalRet.Status != 0) {\r
+    return 1000000;\r
+  }\r
+\r
   return BaseFrequence * (PalRet.r11 >> 32) / (UINT32)PalRet.r11;\r
 }\r