]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/SecPeiDxeTimerLibCpu/IpfTimerLib.c
Since PciXXXReadBuffer/PciXXXWriteBuffer does not check the alignment of user buffer...
[mirror_edk2.git] / MdePkg / Library / SecPeiDxeTimerLibCpu / IpfTimerLib.c
index 42c8511dde18f07c89e47acf20bbf9c1e03bb517..cb5c6d4b739ce4c5f328ddad01ddbfaea873003b 100644 (file)
@@ -10,8 +10,6 @@
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-  Module Name:  IpfTimerLib.c\r
-\r
 **/\r
 \r
 #include <Base.h>\r
@@ -20,6 +18,7 @@
 #include <Library/IoLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/PcdLib.h>\r
+#include <Library/PalCallLib.h>\r
 \r
 \r
 /**\r
@@ -154,13 +153,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
@@ -169,5 +161,16 @@ GetPerformanceCounterProperties (
     *EndValue = (UINT64)(-1);\r
   }\r
 \r
+  PalRet = PalCall (PAL_FREQ_BASE, 0, 0, 0);\r
+  if (PalRet.Status != 0) {\r
+    return 1000000;\r
+  }\r
+  BaseFrequence = PalRet.r9;\r
+\r
+  PalRet = PalCall (PAL_FREQ_RATIOS, 0, 0, 0);\r
+  if (PalRet.Status != 0) {\r
+    return 1000000;\r
+  }\r
+\r
   return BaseFrequence * (PalRet.r11 >> 32) / (UINT32)PalRet.r11;\r
 }\r