summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>2011-08-17 07:30:34 +0000
committerlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>2011-08-17 07:30:34 +0000
commit4ae5165ce62a930c531af098c3e8676840c18123 (patch)
treebeb9b70385337757d36318049053a8c8ebd6b485
parent46171fb68efc7de9659e45e2dc075d8ead61b854 (diff)
downloadedk2-platforms-4ae5165ce62a930c531af098c3e8676840c18123.tar.xz
Allocate memory buffer to store TscFrequency, and InstallConfigurationTable with the pointer to this buffer.
Signed-off-by: lzeng14 Reviewed-by: lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12151 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.c17
-rw-r--r--PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.inf1
2 files changed, 12 insertions, 6 deletions
diff --git a/PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.c b/PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.c
index 95f265558c..3e7e0254a6 100644
--- a/PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.c
+++ b/PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.c
@@ -38,6 +38,7 @@
#include <Library/PciLib.h>
#include <Library/PcdLib.h>
#include <Library/UefiLib.h>
+#include <Library/DebugLib.h>
#include <Guid/TscFrequency.h>
@@ -117,15 +118,19 @@ DxeTscTimerLibConstructor (
}
EndTSC = AsmReadTsc(); // TSC value 1ms later
- mTscFrequency = MultU64x32 (
- (EndTSC - StartTSC), // Number of TSC counts in 1ms
- 1000 // Number of ms in a second
- );
+ Status = gBS->AllocatePool (EfiBootServicesData, sizeof (UINT64), &TscFrequency);
+ ASSERT_EFI_ERROR (Status);
+
+ *TscFrequency = MultU64x32 (
+ (EndTSC - StartTSC), // Number of TSC counts in 1ms
+ 1000 // Number of ms in a second
+ );
//
- // mTscFrequency is now equal to the number of TSC counts per second, install system configuration table for it.
+ // TscFrequency now points to the number of TSC counts per second, install system configuration table for it.
//
- gBS->InstallConfigurationTable (&gEfiTscFrequencyGuid, &mTscFrequency);
+ gBS->InstallConfigurationTable (&gEfiTscFrequencyGuid, TscFrequency);
+ mTscFrequency = *TscFrequency;
return EFI_SUCCESS;
}
diff --git a/PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.inf b/PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.inf
index 28978d78c7..8d2e6cf8bb 100644
--- a/PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.inf
+++ b/PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.inf
@@ -49,6 +49,7 @@
IoLib
BaseLib
UefiLib
+ DebugLib
[Guids]
gEfiTscFrequencyGuid ## CONSUMES ## System Configuration Table