]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Nt32Pkg/CpuRuntimeDxe/Cpu.c
Update comments for VarOffset field in the dynamic create question function.
[mirror_edk2.git] / Nt32Pkg / CpuRuntimeDxe / Cpu.c
index 074781e6ffb38f05b6894d5c39d801c57e850f86..d15ac989eac545e5ba59c177b164ee4ec943605e 100644 (file)
@@ -1,7 +1,7 @@
 /**@file\r
 \r
-Copyright (c) 2006 - 2009, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
@@ -25,6 +25,7 @@ Abstract:
 \r
 #include "CpuDriver.h"\r
 \r
+UINT64  mTimerPeriod;\r
 \r
 CPU_ARCH_PROTOCOL_PRIVATE mCpuTemplate = {\r
   CPU_ARCH_PROT_PRIVATE_SIGNATURE,\r
@@ -38,7 +39,7 @@ CPU_ARCH_PROTOCOL_PRIVATE mCpuTemplate = {
     WinNtRegisterInterruptHandler,\r
     WinNtGetTimerValue,\r
     WinNtSetMemoryAttributes,\r
-    0,\r
+    1,\r
     4\r
   },\r
   {\r
@@ -321,11 +322,18 @@ Returns:
   if (TimerValue == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-\r
-  //\r
-  // No timer supported\r
-  //\r
-  return EFI_UNSUPPORTED;\r
+  \r
+  if (TimerIndex != 0) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+  \r
+  gWinNt->QueryPerformanceCounter ((LARGE_INTEGER *)TimerValue);\r
+  \r
+  if (TimerPeriod != NULL) {\r
+    *TimerPeriod = mTimerPeriod;\r
+  }\r
+  \r
+  return EFI_SUCCESS;\r
 }\r
 \r
 \r
@@ -394,7 +402,7 @@ LogSmbiosData (
   EFI_STATUS         Status;\r
   EFI_SMBIOS_HANDLE  SmbiosHandle;\r
   \r
-  SmbiosHandle = 0;\r
+  SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;\r
   Status = Smbios->Add (\r
                      Smbios,\r
                      NULL,\r
@@ -518,14 +526,25 @@ Returns:
 \r
 --*/\r
 {\r
-  EFI_STATUS                Status;\r
+  EFI_STATUS  Status;\r
+  UINT64      Frequency;\r
 \r
+  //\r
+  // Retrieve the frequency of the performance counter in Hz.\r
+  //  \r
+  gWinNt->QueryPerformanceFrequency ((LARGE_INTEGER *)&Frequency);\r
+  \r
+  //\r
+  // Convert frequency in Hz to a clock period in femtoseconds.\r
+  //\r
+  mTimerPeriod = DivU64x64Remainder (1000000000000000, Frequency, NULL);\r
+  \r
   CpuUpdateSmbios ();\r
 \r
   Status = gBS->InstallMultipleProtocolInterfaces (\r
                   &mCpuTemplate.Handle,\r
                   &gEfiCpuArchProtocolGuid,   &mCpuTemplate.Cpu,\r
-                  &gEfiCpuIoProtocolGuid,     &mCpuTemplate.CpuIo,\r
+                  &gEfiCpuIo2ProtocolGuid,    &mCpuTemplate.CpuIo,\r
                   NULL\r
                   );\r
   ASSERT_EFI_ERROR (Status);\r