summaryrefslogtreecommitdiff
path: root/Nt32Pkg/CpuRuntimeDxe/Cpu.c
diff options
context:
space:
mode:
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2011-03-16 00:38:17 +0000
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2011-03-16 00:38:17 +0000
commit831ff057d7bbb269cbdf9ab77079492a11ca0aa0 (patch)
treed3d6fda1118731f0c04b9d63a219188d6c93337d /Nt32Pkg/CpuRuntimeDxe/Cpu.c
parent975e88157080fdd48f029e4623f5ee9a995bc472 (diff)
downloadedk2-platforms-831ff057d7bbb269cbdf9ab77079492a11ca0aa0.tar.xz
Add support for the GetTimerValue() to the CPU AP for NT32. This also requires some performance counter APIs to be added to the WinNtThunk Protocol.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11403 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Nt32Pkg/CpuRuntimeDxe/Cpu.c')
-rw-r--r--Nt32Pkg/CpuRuntimeDxe/Cpu.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/Nt32Pkg/CpuRuntimeDxe/Cpu.c b/Nt32Pkg/CpuRuntimeDxe/Cpu.c
index c2646e8808..bcce412a33 100644
--- a/Nt32Pkg/CpuRuntimeDxe/Cpu.c
+++ b/Nt32Pkg/CpuRuntimeDxe/Cpu.c
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -25,6 +25,7 @@ Abstract:
#include "CpuDriver.h"
+UINT64 mTimerPeriod;
CPU_ARCH_PROTOCOL_PRIVATE mCpuTemplate = {
CPU_ARCH_PROT_PRIVATE_SIGNATURE,
@@ -38,7 +39,7 @@ CPU_ARCH_PROTOCOL_PRIVATE mCpuTemplate = {
WinNtRegisterInterruptHandler,
WinNtGetTimerValue,
WinNtSetMemoryAttributes,
- 0,
+ 1,
4
},
{
@@ -321,11 +322,18 @@ Returns:
if (TimerValue == NULL) {
return EFI_INVALID_PARAMETER;
}
-
- //
- // No timer supported
- //
- return EFI_UNSUPPORTED;
+
+ if (TimerIndex != 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ gWinNt->QueryPerformanceCounter (TimerValue);
+
+ if (TimerPeriod != NULL) {
+ *TimerPeriod = mTimerPeriod;
+ }
+
+ return EFI_SUCCESS;
}
@@ -518,8 +526,19 @@ Returns:
--*/
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
+ UINT64 Frequency;
+ //
+ // Retrieve the frequency of the performance counter in Hz.
+ //
+ gWinNt->QueryPerformanceFrequency (&Frequency);
+
+ //
+ // Convert frequency in Hz to a clock period in femtoseconds.
+ //
+ mTimerPeriod = DivU64x64Remainder (1000000000000000, Frequency, NULL);
+
CpuUpdateSmbios ();
Status = gBS->InstallMultipleProtocolInterfaces (