mirror of https://github.com/acidanthera/audk.git
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
This commit is contained in:
parent
46171fb68e
commit
4ae5165ce6
|
@ -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
|
||||
);
|
||||
//
|
||||
// mTscFrequency is now equal to the number of TSC counts per second, install system configuration table for it.
|
||||
//
|
||||
gBS->InstallConfigurationTable (&gEfiTscFrequencyGuid, &mTscFrequency);
|
||||
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
|
||||
);
|
||||
//
|
||||
// TscFrequency now points to the number of TSC counts per second, install system configuration table for it.
|
||||
//
|
||||
gBS->InstallConfigurationTable (&gEfiTscFrequencyGuid, TscFrequency);
|
||||
|
||||
mTscFrequency = *TscFrequency;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
IoLib
|
||||
BaseLib
|
||||
UefiLib
|
||||
DebugLib
|
||||
|
||||
[Guids]
|
||||
gEfiTscFrequencyGuid ## CONSUMES ## System Configuration Table
|
||||
|
|
Loading…
Reference in New Issue