]> git.proxmox.com Git - mirror_edk2.git/commitdiff
TscTimerLib in PerformancePkg is a BASE type library, which should be used by any...
authorlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 15 Feb 2011 02:02:06 +0000 (02:02 +0000)
committerlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 15 Feb 2011 02:02:06 +0000 (02:02 +0000)
But its constructor uses the global variable mTscFrequency to store frequency, which doesn't work on XIP PEIM.
Split it to two LIBs for PEI and DXE separately.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11312 6f19259b-4bc3-4df7-8a09-765794883524

PerformancePkg/Include/Guid/PerformancePkgTokenSpace.h [new file with mode: 0644]
PerformancePkg/Include/Guid/TscFrequency.h [new file with mode: 0644]
PerformancePkg/Include/Ich/GenericIch.h
PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.c [new file with mode: 0644]
PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.inf [new file with mode: 0644]
PerformancePkg/Library/PeiTscTimerLib/PeiTscTimerLib.c [new file with mode: 0644]
PerformancePkg/Library/PeiTscTimerLib/PeiTscTimerLib.inf [new file with mode: 0644]
PerformancePkg/Library/TscTimerLib/TscTimerLib.c [deleted file]
PerformancePkg/Library/TscTimerLib/TscTimerLib.inf [deleted file]
PerformancePkg/PerformancePkg.dec
PerformancePkg/PerformancePkg.dsc

diff --git a/PerformancePkg/Include/Guid/PerformancePkgTokenSpace.h b/PerformancePkg/Include/Guid/PerformancePkgTokenSpace.h
new file mode 100644 (file)
index 0000000..86dfe87
--- /dev/null
@@ -0,0 +1,25 @@
+/** @file\r
+  GUID for PerformancePkg PCD Token Space \r
+\r
+  Copyright (c) 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
+\r
+  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
+**/\r
+\r
+#ifndef _PERFORMANCEPKG_TOKEN_SPACE_GUID_H_\r
+#define _PERFORMANCEPKG_TOKEN_SPACE_GUID_H_\r
+\r
+#define PERFORMANCEPKG_TOKEN_SPACE_GUID \\r
+  { \\r
+    0x669346ef, 0xFDad, 0x4aeb, { 0x08, 0xa6, 0x21, 0x46, 0x2d, 0x3f, 0xef, 0x7d } \\r
+  }\r
+\r
+extern EFI_GUID gPerformancePkgTokenSpaceGuid;\r
+\r
+#endif\r
diff --git a/PerformancePkg/Include/Guid/TscFrequency.h b/PerformancePkg/Include/Guid/TscFrequency.h
new file mode 100644 (file)
index 0000000..f7c4a1c
--- /dev/null
@@ -0,0 +1,25 @@
+/** @file\r
+  GUID for TSC frequency\r
+\r
+  Copyright (c) 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
+\r
+  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
+**/\r
+\r
+#ifndef _TSC_FREQUENCY_GUID_H_\r
+#define _TSC_FREQUENCY_GUID_H_\r
+\r
+#define EFI_TSC_FREQUENCY_GUID \\r
+  { \\r
+    0xdba6a7e3, 0xbb57, 0x4be7, { 0x8a, 0xf8, 0xd5, 0x78, 0xdb, 0x7e, 0x56, 0x87 } \\r
+  }\r
+\r
+extern EFI_GUID gEfiTscFrequencyGuid;\r
+\r
+#endif\r
index 8df74e16260e0bd7d908463a12d367fc2319263e..697ea049ee9a4ba8cd00644fab1d1841df8d9315 100644 (file)
@@ -3,7 +3,7 @@
 \r
   These definitions should work for any version of Ich.\r
 \r
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 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
@@ -35,6 +35,7 @@ Definitions beginning with "V_" are meaningful values of bits within the registe
 /// IchAcpiCntr   Control for the ICH's ACPI Counter.\r
 ///@{\r
 #define R_ICH_LPC_ACPI_BASE                   0x40\r
+#define   B_ICH_LPC_ACPI_BASE_BAR                 0x0000FF80\r
 #define R_ICH_LPC_ACPI_CNT                    0x44\r
 #define   B_ICH_LPC_ACPI_CNT_ACPI_EN              0x80\r
 ///@}\r
diff --git a/PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.c b/PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.c
new file mode 100644 (file)
index 0000000..f8a4b68
--- /dev/null
@@ -0,0 +1,266 @@
+/** @file\r
+  A Dxe Timer Library implementation which uses the Time Stamp Counter in the processor.\r
+\r
+  For Pentium 4 processors, Intel Xeon processors (family [0FH], models [03H and higher]);\r
+    for Intel Core Solo and Intel Core Duo processors (family [06H], model [0EH]);\r
+    for the Intel Xeon processor 5100 series and Intel Core 2 Duo processors (family [06H], model [0FH]);\r
+    for Intel Core 2 and Intel Xeon processors (family [06H], display_model [17H]);\r
+    for Intel Atom processors (family [06H], display_model [1CH]):\r
+  the time-stamp counter increments at a constant rate.\r
+  That rate may be set by the maximum core-clock to bus-clock ratio of the processor or may be set by\r
+  the maximum resolved frequency at which the processor is booted. The maximum resolved frequency may\r
+  differ from the maximum qualified frequency of the processor.\r
+\r
+  The specific processor configuration determines the behavior. Constant TSC behavior ensures that the\r
+  duration of each clock tick is uniform and supports the use of the TSC as a wall clock timer even if\r
+  the processor core changes frequency. This is the architectural behavior moving forward.\r
+\r
+  A Processor's support for invariant TSC is indicated by CPUID.0x80000007.EDX[8].\r
+\r
+  Copyright (c) 2009 - 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
+\r
+  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
+**/\r
+\r
+#include <PiDxe.h>\r
+#include <Ich/GenericIch.h>\r
+\r
+#include <Library/TimerLib.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/IoLib.h>\r
+#include <Library/PciLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <Library/HobLib.h>\r
+\r
+#include <Guid/TscFrequency.h>\r
+\r
+UINT64   mTscFrequency;\r
+\r
+/** The constructor function determines the actual TSC frequency.\r
+\r
+  First, Get TSC frequency from TSC frequency GUID HOB,\r
+  If the HOB is not found, calculate it.\r
+\r
+  The TSC counting frequency is determined by comparing how far it counts\r
+  during a 1ms period as determined by the ACPI timer. The ACPI timer is\r
+  used because it counts at a known frequency.\r
+  If ACPI I/O space not enabled, this function will enable it. Then the\r
+  TSC is sampled, followed by waiting for 3579 clocks of the ACPI timer, or 1ms.\r
+  The TSC is then sampled again. The difference multiplied by 1000 is the TSC\r
+  frequency. There will be a small error because of the overhead of reading\r
+  the ACPI timer. An attempt is made to determine and compensate for this error.\r
+  This function will always return EFI_SUCCESS.\r
+\r
+  @retval EFI_SUCCESS   The constructor always returns EFI_SUCCESS.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DxeTscTimerLibConstructor (\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
+  )\r
+{\r
+  EFI_HOB_GUID_TYPE       *GuidHob;\r
+  VOID        *DataInHob;\r
+  UINT64      StartTSC;\r
+  UINT64      EndTSC;\r
+  UINT32      TimerAddr;\r
+  UINT32      Ticks;\r
+\r
+  //\r
+  // Get TSC frequency from TSC frequency GUID HOB.\r
+  //\r
+  GuidHob = GetFirstGuidHob (&gEfiTscFrequencyGuid);\r
+  if (GuidHob != NULL) {\r
+    DataInHob = GET_GUID_HOB_DATA (GuidHob);\r
+    mTscFrequency = * (UINT64 *) DataInHob;\r
+    return EFI_SUCCESS;\r
+  }\r
+\r
+  //\r
+  // TSC frequency GUID HOB is not found, calculate it.\r
+  //\r
+\r
+  //\r
+  // If ACPI I/O space is not enabled yet, program ACPI I/O base address and enable it.\r
+  //\r
+  if ((PciRead8 (PCI_ICH_LPC_ADDRESS (R_ICH_LPC_ACPI_CNT)) & B_ICH_LPC_ACPI_CNT_ACPI_EN) == 0) {\r
+    PciWrite16 (PCI_ICH_LPC_ADDRESS (R_ICH_LPC_ACPI_BASE), PcdGet16 (PcdPerfPkgAcpiIoPortBaseAddress));\r
+    PciOr8 (PCI_ICH_LPC_ADDRESS (R_ICH_LPC_ACPI_CNT), B_ICH_LPC_ACPI_CNT_ACPI_EN);\r
+  }\r
+\r
+  //\r
+  // ACPI I/O space should be enabled now, locate the ACPI Timer.\r
+  // ACPI I/O base address maybe have be initialized by other driver with different value,\r
+  // So get it from PCI space directly.\r
+  //\r
+  TimerAddr = ((PciRead16 (PCI_ICH_LPC_ADDRESS (R_ICH_LPC_ACPI_BASE))) & B_ICH_LPC_ACPI_BASE_BAR) + R_ACPI_PM1_TMR;\r
+  Ticks    = IoRead32 (TimerAddr) + (3579);   // Set Ticks to 1ms in the future\r
+  StartTSC = AsmReadTsc();                    // Get base value for the TSC\r
+  //\r
+  // Wait until the ACPI timer has counted 1ms.\r
+  // Timer wrap-arounds are handled correctly by this function.\r
+  // When the current ACPI timer value is greater than 'Ticks', the while loop will exit.\r
+  //\r
+  while (((Ticks - IoRead32 (TimerAddr)) & BIT23) == 0) {\r
+    CpuPause();\r
+  }\r
+  EndTSC = AsmReadTsc();    // TSC value 1ms later\r
+\r
+  mTscFrequency =   MultU64x32 (\r
+                      (EndTSC - StartTSC),    // Number of TSC counts in 1ms\r
+                      1000                    // Number of ms in a second\r
+                    );\r
+  //\r
+  // mTscFrequency is now equal to the number of TSC counts per second\r
+  //\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**  Stalls the CPU for at least the given number of ticks.\r
+\r
+  Stalls the CPU for at least the given number of ticks. It's invoked by\r
+  MicroSecondDelay() and NanoSecondDelay().\r
+\r
+  @param[in]  Delay     A period of time to delay in ticks.\r
+\r
+**/\r
+VOID\r
+InternalX86Delay (\r
+  IN      UINT64                    Delay\r
+  )\r
+{\r
+  UINT64                             Ticks;\r
+\r
+  //\r
+  // The target timer count is calculated here\r
+  //\r
+  Ticks = AsmReadTsc() + Delay;\r
+\r
+  //\r
+  // Wait until time out\r
+  // Timer wrap-arounds are NOT handled correctly by this function.\r
+  // Thus, this function must be called within 10 years of reset since\r
+  // Intel guarantees a minimum of 10 years before the TSC wraps.\r
+  //\r
+  while (AsmReadTsc() <= Ticks) CpuPause();\r
+}\r
+\r
+/**  Stalls the CPU for at least the specified number of MicroSeconds.\r
+\r
+  @param[in]  MicroSeconds  The minimum number of microseconds to delay.\r
+\r
+  @return The value of MicroSeconds input.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+MicroSecondDelay (\r
+  IN      UINTN                     MicroSeconds\r
+  )\r
+{\r
+  InternalX86Delay (\r
+    DivU64x32 (\r
+      MultU64x64 (\r
+        mTscFrequency,\r
+        MicroSeconds\r
+      ),\r
+      1000000u\r
+    )\r
+  );\r
+  return MicroSeconds;\r
+}\r
+\r
+/**  Stalls the CPU for at least the specified number of NanoSeconds.\r
+\r
+  @param[in]  NanoSeconds The minimum number of nanoseconds to delay.\r
+\r
+  @return The value of NanoSeconds input.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+NanoSecondDelay (\r
+  IN      UINTN                     NanoSeconds\r
+  )\r
+{\r
+  InternalX86Delay (\r
+    DivU64x32 (\r
+      MultU64x32 (\r
+        mTscFrequency,\r
+        (UINT32)NanoSeconds\r
+      ),\r
+    1000000000u\r
+    )\r
+  );\r
+  return NanoSeconds;\r
+}\r
+\r
+/**  Retrieves the current value of the 64-bit free running Time-Stamp counter.\r
+\r
+  The time-stamp counter (as implemented in the P6 family, Pentium, Pentium M,\r
+  Pentium 4, Intel Xeon, Intel Core Solo and Intel Core Duo processors and\r
+  later processors) is a 64-bit counter that is set to 0 following a RESET of\r
+  the processor.  Following a RESET, the counter increments even when the\r
+  processor is halted by the HLT instruction or the external STPCLK# pin. Note\r
+  that the assertion of the external DPSLP# pin may cause the time-stamp\r
+  counter to stop.\r
+\r
+  The properties of the counter can be retrieved by the\r
+  GetPerformanceCounterProperties() function.\r
+\r
+  @return The current value of the free running performance counter.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+GetPerformanceCounter (\r
+  VOID\r
+  )\r
+{\r
+  return AsmReadTsc();\r
+}\r
+\r
+/**  Retrieves the 64-bit frequency in Hz and the range of performance counter\r
+  values.\r
+\r
+  If StartValue is not NULL, then the value that the performance counter starts\r
+  with, 0x0, is returned in StartValue. If EndValue is not NULL, then the value\r
+  that the performance counter end with, 0xFFFFFFFFFFFFFFFF, is returned in\r
+  EndValue.\r
+\r
+  The 64-bit frequency of the performance counter, in Hz, is always returned.\r
+  To determine average processor clock frequency, Intel recommends the use of\r
+  EMON logic to count processor core clocks over the period of time for which\r
+  the average is required.\r
+\r
+\r
+  @param[out]   StartValue  Pointer to where the performance counter's starting value is saved, or NULL.\r
+  @param[out]   EndValue    Pointer to where the performance counter's ending value is saved, or NULL.\r
+\r
+  @return The frequency in Hz.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+GetPerformanceCounterProperties (\r
+  OUT      UINT64                    *StartValue,  OPTIONAL\r
+  OUT      UINT64                    *EndValue     OPTIONAL\r
+  )\r
+{\r
+  if (StartValue != NULL) {\r
+    *StartValue = 0;\r
+  }\r
+  if (EndValue != NULL) {\r
+    *EndValue = 0xFFFFFFFFFFFFFFFFull;\r
+  }\r
+\r
+  return mTscFrequency;\r
+}\r
diff --git a/PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.inf b/PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.inf
new file mode 100644 (file)
index 0000000..88a6cb9
--- /dev/null
@@ -0,0 +1,56 @@
+#/** @file\r
+#  Dxe Timer Library which uses the Time Stamp Counter in the processor.\r
+#\r
+#  A version of the Timer Library using the processor's TSC.\r
+#  The time stamp counter in newer processors may support an enhancement, referred to as invariant TSC.\r
+#  The invariant TSC runs at a constant rate in all ACPI P-, C-. and T-states.\r
+#  This is the architectural behavior moving forward.\r
+#  TSC reads are much more efficient and do not incur the overhead associated with a ring transition or\r
+#  access to a platform resource.\r
+#\r
+#  Copyright (c) 2009 - 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
+#  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
+#**/\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = DxeTscTimerLib\r
+  FILE_GUID                      = 95ab030f-b4fd-4ee4-92a5-9e04e87634d9\r
+  MODULE_TYPE                    = DXE_DRIVER\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = TimerLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE\r
+\r
+  CONSTRUCTOR                    = DxeTscTimerLibConstructor\r
+\r
+\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64\r
+#\r
+\r
+[Sources.common]\r
+  DxeTscTimerLib.c\r
+\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  PerformancePkg/PerformancePkg.dec\r
+\r
+\r
+[LibraryClasses]\r
+  PcdLib\r
+  PciLib\r
+  IoLib\r
+  BaseLib\r
+  HobLib\r
+\r
+[Guids]\r
+  gEfiTscFrequencyGuid                          ## SOMETIMES_CONSUMES ## Hob\r
+\r
+[Pcd.common]\r
+  gPerformancePkgTokenSpaceGuid.PcdPerfPkgAcpiIoPortBaseAddress\r
diff --git a/PerformancePkg/Library/PeiTscTimerLib/PeiTscTimerLib.c b/PerformancePkg/Library/PeiTscTimerLib/PeiTscTimerLib.c
new file mode 100644 (file)
index 0000000..be6b66e
--- /dev/null
@@ -0,0 +1,265 @@
+/** @file\r
+  A Pei Timer Library implementation which uses the Time Stamp Counter in the processor.\r
+\r
+  For Pentium 4 processors, Intel Xeon processors (family [0FH], models [03H and higher]);\r
+    for Intel Core Solo and Intel Core Duo processors (family [06H], model [0EH]);\r
+    for the Intel Xeon processor 5100 series and Intel Core 2 Duo processors (family [06H], model [0FH]);\r
+    for Intel Core 2 and Intel Xeon processors (family [06H], display_model [17H]);\r
+    for Intel Atom processors (family [06H], display_model [1CH]):\r
+  the time-stamp counter increments at a constant rate.\r
+  That rate may be set by the maximum core-clock to bus-clock ratio of the processor or may be set by\r
+  the maximum resolved frequency at which the processor is booted. The maximum resolved frequency may\r
+  differ from the maximum qualified frequency of the processor.\r
+\r
+  The specific processor configuration determines the behavior. Constant TSC behavior ensures that the\r
+  duration of each clock tick is uniform and supports the use of the TSC as a wall clock timer even if\r
+  the processor core changes frequency. This is the architectural behavior moving forward.\r
+\r
+  A Processor's support for invariant TSC is indicated by CPUID.0x80000007.EDX[8].\r
+\r
+  Copyright (c) 2009 - 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
+\r
+  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
+**/\r
+\r
+#include <PiPei.h>\r
+#include <Ich/GenericIch.h>\r
+\r
+#include <Library/TimerLib.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/IoLib.h>\r
+#include <Library/PciLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <Library/HobLib.h>\r
+\r
+#include <Guid/TscFrequency.h>\r
+\r
+/**  Get TSC frequency from TSC frequency GUID HOB, if the HOB is not found, build it.\r
+\r
+  The TSC counting frequency is determined by comparing how far it counts\r
+  during a 1ms period as determined by the ACPI timer. The ACPI timer is\r
+  used because it counts at a known frequency.\r
+  If ACPI I/O space not enabled, this function will enable it. Then the\r
+  TSC is sampled, followed by waiting for 3579 clocks of the ACPI timer, or 1ms.\r
+  The TSC is then sampled again. The difference multiplied by 1000 is the TSC\r
+  frequency. There will be a small error because of the overhead of reading\r
+  the ACPI timer.\r
+\r
+  @return The number of TSC counts per second.\r
+\r
+**/\r
+UINT64\r
+InternalGetTscFrequency (\r
+  VOID\r
+  )\r
+{\r
+  EFI_HOB_GUID_TYPE       *GuidHob;\r
+  VOID        *DataInHob;\r
+  UINT64      StartTSC;\r
+  UINT64      EndTSC;\r
+  UINT32      TimerAddr;\r
+  UINT32      Ticks;\r
+  UINT64      TscFrequency;\r
+\r
+  //\r
+  // Get TSC frequency from TSC frequency GUID HOB.\r
+  //\r
+  GuidHob = GetFirstGuidHob (&gEfiTscFrequencyGuid);\r
+  if (GuidHob != NULL) {\r
+    DataInHob = GET_GUID_HOB_DATA (GuidHob);\r
+    TscFrequency = * (UINT64 *) DataInHob;\r
+    return TscFrequency;\r
+  }\r
+\r
+  //\r
+  // TSC frequency GUID HOB is not found, build it.\r
+  //\r
+\r
+  //\r
+  // If ACPI I/O space is not enabled yet, program ACPI I/O base address and enable it.\r
+  //\r
+  if ((PciRead8 (PCI_ICH_LPC_ADDRESS (R_ICH_LPC_ACPI_CNT)) & B_ICH_LPC_ACPI_CNT_ACPI_EN) == 0) {\r
+    PciWrite16 (PCI_ICH_LPC_ADDRESS (R_ICH_LPC_ACPI_BASE), PcdGet16 (PcdPerfPkgAcpiIoPortBaseAddress));\r
+    PciOr8 (PCI_ICH_LPC_ADDRESS (R_ICH_LPC_ACPI_CNT), B_ICH_LPC_ACPI_CNT_ACPI_EN);\r
+  }\r
+\r
+  //\r
+  // ACPI I/O space should be enabled now, locate the ACPI Timer.\r
+  // ACPI I/O base address maybe have be initialized by other driver with different value,\r
+  // So get it from PCI space directly.\r
+  //\r
+  TimerAddr = ((PciRead16 (PCI_ICH_LPC_ADDRESS (R_ICH_LPC_ACPI_BASE))) & B_ICH_LPC_ACPI_BASE_BAR) + R_ACPI_PM1_TMR;\r
+  Ticks    = IoRead32 (TimerAddr) + (3579);   // Set Ticks to 1ms in the future\r
+  StartTSC = AsmReadTsc();                    // Get base value for the TSC\r
+  //\r
+  // Wait until the ACPI timer has counted 1ms.\r
+  // Timer wrap-arounds are handled correctly by this function.\r
+  // When the current ACPI timer value is greater than 'Ticks', the while loop will exit.\r
+  //\r
+  while (((Ticks - IoRead32 (TimerAddr)) & BIT23) == 0) {\r
+    CpuPause();\r
+  }\r
+  EndTSC = AsmReadTsc();    // TSC value 1ms later\r
+\r
+  TscFrequency =   MultU64x32 (\r
+                      (EndTSC - StartTSC),    // Number of TSC counts in 1ms\r
+                      1000                    // Number of ms in a second\r
+                    );\r
+  //\r
+  // TscFrequency is now equal to the number of TSC counts per second, build GUID HOB for it.\r
+  //\r
+  BuildGuidDataHob (\r
+    &gEfiTscFrequencyGuid,\r
+    &TscFrequency,\r
+    sizeof (UINT64)\r
+    );\r
+\r
+  return TscFrequency;\r
+}\r
+\r
+/**  Stalls the CPU for at least the given number of ticks.\r
+\r
+  Stalls the CPU for at least the given number of ticks. It's invoked by\r
+  MicroSecondDelay() and NanoSecondDelay().\r
+\r
+  @param[in]  Delay     A period of time to delay in ticks.\r
+\r
+**/\r
+VOID\r
+InternalX86Delay (\r
+  IN      UINT64                    Delay\r
+  )\r
+{\r
+  UINT64                             Ticks;\r
+\r
+  //\r
+  // The target timer count is calculated here\r
+  //\r
+  Ticks = AsmReadTsc() + Delay;\r
+\r
+  //\r
+  // Wait until time out\r
+  // Timer wrap-arounds are NOT handled correctly by this function.\r
+  // Thus, this function must be called within 10 years of reset since\r
+  // Intel guarantees a minimum of 10 years before the TSC wraps.\r
+  //\r
+  while (AsmReadTsc() <= Ticks) CpuPause();\r
+}\r
+\r
+/**  Stalls the CPU for at least the specified number of MicroSeconds.\r
+\r
+  @param[in]  MicroSeconds  The minimum number of microseconds to delay.\r
+\r
+  @return The value of MicroSeconds input.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+MicroSecondDelay (\r
+  IN      UINTN                     MicroSeconds\r
+  )\r
+{\r
+  InternalX86Delay (\r
+    DivU64x32 (\r
+      MultU64x64 (\r
+        InternalGetTscFrequency (),\r
+        MicroSeconds\r
+      ),\r
+      1000000u\r
+    )\r
+  );\r
+  return MicroSeconds;\r
+}\r
+\r
+/**  Stalls the CPU for at least the specified number of NanoSeconds.\r
+\r
+  @param[in]  NanoSeconds The minimum number of nanoseconds to delay.\r
+\r
+  @return The value of NanoSeconds input.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+NanoSecondDelay (\r
+  IN      UINTN                     NanoSeconds\r
+  )\r
+{\r
+  InternalX86Delay (\r
+    DivU64x32 (\r
+      MultU64x32 (\r
+        InternalGetTscFrequency (),\r
+        (UINT32)NanoSeconds\r
+      ),\r
+    1000000000u\r
+    )\r
+  );\r
+  return NanoSeconds;\r
+}\r
+\r
+/**  Retrieves the current value of the 64-bit free running Time-Stamp counter.\r
+\r
+  The time-stamp counter (as implemented in the P6 family, Pentium, Pentium M,\r
+  Pentium 4, Intel Xeon, Intel Core Solo and Intel Core Duo processors and\r
+  later processors) is a 64-bit counter that is set to 0 following a RESET of\r
+  the processor.  Following a RESET, the counter increments even when the\r
+  processor is halted by the HLT instruction or the external STPCLK# pin. Note\r
+  that the assertion of the external DPSLP# pin may cause the time-stamp\r
+  counter to stop.\r
+\r
+  The properties of the counter can be retrieved by the\r
+  GetPerformanceCounterProperties() function.\r
+\r
+  @return The current value of the free running performance counter.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+GetPerformanceCounter (\r
+  VOID\r
+  )\r
+{\r
+  return AsmReadTsc();\r
+}\r
+\r
+/**  Retrieves the 64-bit frequency in Hz and the range of performance counter\r
+  values.\r
+\r
+  If StartValue is not NULL, then the value that the performance counter starts\r
+  with, 0x0, is returned in StartValue. If EndValue is not NULL, then the value\r
+  that the performance counter end with, 0xFFFFFFFFFFFFFFFF, is returned in\r
+  EndValue.\r
+\r
+  The 64-bit frequency of the performance counter, in Hz, is always returned.\r
+  To determine average processor clock frequency, Intel recommends the use of\r
+  EMON logic to count processor core clocks over the period of time for which\r
+  the average is required.\r
+\r
+\r
+  @param[out]   StartValue  Pointer to where the performance counter's starting value is saved, or NULL.\r
+  @param[out]   EndValue    Pointer to where the performance counter's ending value is saved, or NULL.\r
+\r
+  @return The frequency in Hz.\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+GetPerformanceCounterProperties (\r
+  OUT      UINT64                    *StartValue,  OPTIONAL\r
+  OUT      UINT64                    *EndValue     OPTIONAL\r
+  )\r
+{\r
+  if (StartValue != NULL) {\r
+    *StartValue = 0;\r
+  }\r
+  if (EndValue != NULL) {\r
+    *EndValue = 0xFFFFFFFFFFFFFFFFull;\r
+  }\r
+\r
+  return InternalGetTscFrequency ();\r
+}\r
diff --git a/PerformancePkg/Library/PeiTscTimerLib/PeiTscTimerLib.inf b/PerformancePkg/Library/PeiTscTimerLib/PeiTscTimerLib.inf
new file mode 100644 (file)
index 0000000..3c10519
--- /dev/null
@@ -0,0 +1,54 @@
+#/** @file\r
+#  Pei Timer Library which uses the Time Stamp Counter in the processor.\r
+#\r
+#  A version of the Timer Library using the processor's TSC.\r
+#  The time stamp counter in newer processors may support an enhancement, referred to as invariant TSC.\r
+#  The invariant TSC runs at a constant rate in all ACPI P-, C-. and T-states.\r
+#  This is the architectural behavior moving forward.\r
+#  TSC reads are much more efficient and do not incur the overhead associated with a ring transition or\r
+#  access to a platform resource.\r
+#\r
+#  Copyright (c) 2009 - 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
+#  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
+#**/\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = PeiTscTimerLib\r
+  FILE_GUID                      = 342C36C0-15DF-43b4-9EC9-FBF748BFB3D1\r
+  MODULE_TYPE                    = PEIM\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = TimerLib|SEC PEIM PEI_CORE\r
+\r
+\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64\r
+#\r
+\r
+[Sources.common]\r
+  PeiTscTimerLib.c\r
+\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  PerformancePkg/PerformancePkg.dec\r
+\r
+\r
+[LibraryClasses]\r
+  PcdLib\r
+  PciLib\r
+  IoLib\r
+  BaseLib\r
+  HobLib\r
+\r
+[Guids]\r
+  gEfiTscFrequencyGuid                          ## PRODUCES ## Hob\r
+\r
+[Pcd.common]\r
+  gPerformancePkgTokenSpaceGuid.PcdPerfPkgAcpiIoPortBaseAddress\r
diff --git a/PerformancePkg/Library/TscTimerLib/TscTimerLib.c b/PerformancePkg/Library/TscTimerLib/TscTimerLib.c
deleted file mode 100644 (file)
index 69d93ce..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-/** @file\r
-  A Timer Library implementation which uses the Time Stamp Counter in the processor.\r
-\r
-  For Pentium 4 processors, Intel Xeon processors (family [0FH], models [03H and higher]);\r
-    for Intel Core Solo and Intel Core Duo processors (family [06H], model [0EH]);\r
-    for the Intel Xeon processor 5100 series and Intel Core 2 Duo processors (family [06H], model [0FH]);\r
-    for Intel Core 2 and Intel Xeon processors (family [06H], display_model [17H]);\r
-    for Intel Atom processors (family [06H], display_model [1CH]):\r
-  the time-stamp counter increments at a constant rate.\r
-  That rate may be set by the maximum core-clock to bus-clock ratio of the processor or may be set by\r
-  the maximum resolved frequency at which the processor is booted. The maximum resolved frequency may\r
-  differ from the maximum qualified frequency of the processor.\r
-\r
-  The specific processor configuration determines the behavior. Constant TSC behavior ensures that the\r
-  duration of each clock tick is uniform and supports the use of the TSC as a wall clock timer even if\r
-  the processor core changes frequency.  This is the architectural behavior moving forward.\r
-\r
-  A Processor's support for invariant TSC is indicated by CPUID.0x80000007.EDX[8].\r
-\r
-  Copyright (c) 2009 - 2010, 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
-\r
-  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
-**/\r
-\r
-#include <Base.h>\r
-#include <Ich/GenericIch.h>\r
-\r
-#include <Library/TimerLib.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/IoLib.h>\r
-#include <Library/PciLib.h>\r
-#include <Library/PcdLib.h>\r
-\r
-STATIC UINT64   mTscFrequency;\r
-\r
-/** The constructor function determines the actual TSC frequency.\r
-\r
-  The TSC counting frequency is determined by comparing how far it counts\r
-  during a 1ms period as determined by the ACPI timer.  The ACPI timer is\r
-  used because it counts at a known frequency.\r
-  If ACPI I/O space not enabled, this function will enable it.  Then the\r
-  TSC is sampled, followed by waiting for 3579 clocks of the ACPI timer, or 1ms.\r
-  The TSC is then sampled again. The difference multiplied by 1000 is the TSC\r
-  frequency.  There will be a small error because of the overhead of reading\r
-  the ACPI timer.  An attempt is made to determine and compensate for this error.\r
-  This function will always return RETURN_SUCCESS.\r
-\r
-  @retval RETURN_SUCCESS   The constructor always returns RETURN_SUCCESS.\r
-\r
-**/\r
-RETURN_STATUS\r
-EFIAPI\r
-TscTimerLibConstructor (\r
-  VOID\r
-  )\r
-{\r
-  UINT64      StartTSC;\r
-  UINT64      EndTSC;\r
-  UINT32      TimerAddr;\r
-  UINT32      Ticks;\r
-\r
-  //\r
-  // If ACPI I/O space is not enabled yet, program ACPI I/O base address and enable it.\r
-  //\r
-  if ((PciRead8 (PCI_ICH_LPC_ADDRESS (R_ICH_LPC_ACPI_CNT)) & B_ICH_LPC_ACPI_CNT_ACPI_EN) == 0) {\r
-    PciWrite16 (PCI_ICH_LPC_ADDRESS (R_ICH_LPC_ACPI_BASE), PcdGet16 (PcdPerfPkgAcpiIoPortBaseAddress));\r
-    PciOr8 (PCI_ICH_LPC_ADDRESS (R_ICH_LPC_ACPI_CNT), B_ICH_LPC_ACPI_CNT_ACPI_EN);\r
-  }\r
-\r
-  TimerAddr = PcdGet16 (PcdPerfPkgAcpiIoPortBaseAddress) + R_ACPI_PM1_TMR;  // Locate the ACPI Timer\r
-  Ticks    = IoRead32( TimerAddr) + (3579);   // Set Ticks to 1ms in the future\r
-  StartTSC = AsmReadTsc();                    // Get base value for the TSC\r
-  //\r
-  // Wait until the ACPI timer has counted 1ms.\r
-  // Timer wrap-arounds are handled correctly by this function.\r
-  // When the current ACPI timer value is greater than 'Ticks', the while loop will exit.\r
-  //\r
-  while (((Ticks - IoRead32( TimerAddr)) & BIT23) == 0) {\r
-    CpuPause();\r
-  }\r
-  EndTSC = AsmReadTsc();    // TSC value 1ms later\r
-\r
-  mTscFrequency =   MultU64x32 (\r
-                      (EndTSC - StartTSC),    // Number of TSC counts in 1ms\r
-                      1000                    // Number of ms in a second\r
-                    );\r
-  //\r
-  // mTscFrequency is now equal to the number of TSC counts per second\r
-  //\r
-  return RETURN_SUCCESS;\r
-}\r
-\r
-/**  Stalls the CPU for at least the given number of ticks.\r
-\r
-  Stalls the CPU for at least the given number of ticks. It's invoked by\r
-  MicroSecondDelay() and NanoSecondDelay().\r
-\r
-  @param[in]  Delay     A period of time to delay in ticks.\r
-\r
-**/\r
-VOID\r
-InternalX86Delay (\r
-  IN      UINT64                    Delay\r
-  )\r
-{\r
-  UINT64                             Ticks;\r
-\r
-  //\r
-  // The target timer count is calculated here\r
-  //\r
-  Ticks = AsmReadTsc() + Delay;\r
-\r
-  //\r
-  // Wait until time out\r
-  // Timer wrap-arounds are NOT handled correctly by this function.\r
-  // Thus, this function must be called within 10 years of reset since\r
-  // Intel guarantees a minimum of 10 years before the TSC wraps.\r
-  //\r
-  while (AsmReadTsc() <= Ticks) CpuPause();\r
-}\r
-\r
-/**  Stalls the CPU for at least the specified number of MicroSeconds.\r
-\r
-  @param[in]  MicroSeconds  The minimum number of microseconds to delay.\r
-\r
-  @return The value of MicroSeconds input.\r
-\r
-**/\r
-UINTN\r
-EFIAPI\r
-MicroSecondDelay (\r
-  IN      UINTN                     MicroSeconds\r
-  )\r
-{\r
-  InternalX86Delay (\r
-    DivU64x32 (\r
-      MultU64x64 (\r
-        mTscFrequency,\r
-        MicroSeconds\r
-      ),\r
-      1000000u\r
-    )\r
-  );\r
-  return MicroSeconds;\r
-}\r
-\r
-/**  Stalls the CPU for at least the specified number of NanoSeconds.\r
-\r
-  @param[in]  NanoSeconds The minimum number of nanoseconds to delay.\r
-\r
-  @return The value of NanoSeconds input.\r
-\r
-**/\r
-UINTN\r
-EFIAPI\r
-NanoSecondDelay (\r
-  IN      UINTN                     NanoSeconds\r
-  )\r
-{\r
-  InternalX86Delay (\r
-    DivU64x32 (\r
-      MultU64x32 (\r
-        mTscFrequency,\r
-        (UINT32)NanoSeconds\r
-      ),\r
-    1000000000u\r
-    )\r
-  );\r
-  return NanoSeconds;\r
-}\r
-\r
-/**  Retrieves the current value of the 64-bit free running Time-Stamp counter.\r
-\r
-  The time-stamp counter (as implemented in the P6 family, Pentium, Pentium M,\r
-  Pentium 4, Intel Xeon, Intel Core Solo and Intel Core Duo processors and\r
-  later processors) is a 64-bit counter that is set to 0 following a RESET of\r
-  the processor.  Following a RESET, the counter increments even when the\r
-  processor is halted by the HLT instruction or the external STPCLK# pin. Note\r
-  that the assertion of the external DPSLP# pin may cause the time-stamp\r
-  counter to stop.\r
-\r
-  The properties of the counter can be retrieved by the\r
-  GetPerformanceCounterProperties() function.\r
-\r
-  @return The current value of the free running performance counter.\r
-\r
-**/\r
-UINT64\r
-EFIAPI\r
-GetPerformanceCounter (\r
-  VOID\r
-  )\r
-{\r
-  return AsmReadTsc();\r
-}\r
-\r
-/**  Retrieves the 64-bit frequency in Hz and the range of performance counter\r
-  values.\r
-\r
-  If StartValue is not NULL, then the value that the performance counter starts\r
-  with, 0x0, is returned in StartValue. If EndValue is not NULL, then the value\r
-  that the performance counter end with, 0xFFFFFFFFFFFFFFFF, is returned in\r
-  EndValue.\r
-\r
-  The 64-bit frequency of the performance counter, in Hz, is always returned.\r
-  To determine average processor clock frequency, Intel recommends the use of\r
-  EMON logic to count processor core clocks over the period of time for which\r
-  the average is required.\r
-\r
-\r
-  @param[out]   StartValue  Pointer to where the performance counter's starting value is saved, or NULL.\r
-  @param[out]   EndValue    Pointer to where the performance counter's ending value is saved, or NULL.\r
-\r
-  @return The frequency in Hz.\r
-\r
-**/\r
-UINT64\r
-EFIAPI\r
-GetPerformanceCounterProperties (\r
-  OUT      UINT64                    *StartValue,  OPTIONAL\r
-  OUT      UINT64                    *EndValue     OPTIONAL\r
-  )\r
-{\r
-  if (StartValue != NULL) {\r
-    *StartValue = 0;\r
-  }\r
-  if (EndValue != NULL) {\r
-    *EndValue = 0xFFFFFFFFFFFFFFFFull;\r
-  }\r
-\r
-  return mTscFrequency;\r
-}\r
diff --git a/PerformancePkg/Library/TscTimerLib/TscTimerLib.inf b/PerformancePkg/Library/TscTimerLib/TscTimerLib.inf
deleted file mode 100644 (file)
index 7c17ecd..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#/** @file\r
-#  Timer Library which uses the Time Stamp Counter in the processor.\r
-#\r
-#  A version of the Timer Library using the processor's TSC.\r
-#  The time stamp counter in newer processors may support an enhancement, referred to as invariant TSC.\r
-#  The invariant TSC runs at a constant rate in all ACPI P-, C-. and T-states.\r
-#  This is the architectural behavior moving forward.\r
-#  TSC reads are much more efficient and do not incur the overhead associated with a ring transition or\r
-#  access to a platform resource.\r
-#\r
-#  Copyright (c) 2009 - 2010, 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
-#  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
-#**/\r
-\r
-[Defines]\r
-  INF_VERSION                    = 0x00010005\r
-  BASE_NAME                      = TscTimerLib\r
-  FILE_GUID                      = 95ab030f-b4fd-4ee4-92a5-9e04e87634d9\r
-  MODULE_TYPE                    = BASE\r
-  VERSION_STRING                 = 1.0\r
-  LIBRARY_CLASS                  = TimerLib\r
-\r
-  CONSTRUCTOR                    = TscTimerLibConstructor\r
-\r
-\r
-#\r
-#  VALID_ARCHITECTURES           = IA32 X64\r
-#\r
-\r
-[Sources.common]\r
-  TscTimerLib.c\r
-\r
-\r
-[Packages]\r
-  MdePkg/MdePkg.dec\r
-  PerformancePkg/PerformancePkg.dec\r
-\r
-\r
-[LibraryClasses]\r
-  PcdLib\r
-  PciLib\r
-  IoLib\r
-  BaseLib\r
-\r
-[Pcd.common]\r
-  gPerformancePkgTokenSpaceGuid.PcdPerfPkgAcpiIoPortBaseAddress\r
index 52091b6b3b116e99624135c37476f8d82cc75b8f..44f1f109e0c10a2df3c0c724d29a694dbc4b8fd9 100644 (file)
@@ -2,7 +2,7 @@
 # Build description file to generate Shell DP application and\r
 # Performance Libraries.\r
 #\r
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2009 - 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
@@ -28,6 +28,9 @@
   # 669346ef-fdad-4aeb-a608-7def3f2d4621\r
   gPerformancePkgTokenSpaceGuid       = { 0x669346ef, 0xFDad, 0x4aeb, { 0x08, 0xa6, 0x21, 0x46, 0x2d, 0x3f, 0xef, 0x7d }}\r
 \r
+  ## Include/Guid/TscFrequency.h\r
+  gEfiTscFrequencyGuid                = { 0xdba6a7e3, 0xbb57, 0x4be7, { 0x8a, 0xf8, 0xd5, 0x78, 0xdb, 0x7e, 0x56, 0x87 }}\r
+\r
 [PcdsFixedAtBuild.common]\r
   ##  The base address of the ACPI registers within the ICH PCI space.\r
   #   This space must be 128-byte aligned.\r
index 414c17e8cd29baa1b306de60fef59726e6a62189..ea3838794869f0756c1317ce9f4e0104691c27c1 100644 (file)
@@ -1,7 +1,7 @@
 #/** @file\r
 # Build description file to generate Shell DP application.\r
 #\r
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2009 - 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
@@ -35,6 +35,7 @@
   UefiLib|MdePkg/Library/UefiLib/UefiLib.inf\r
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf\r
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf\r
+  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf\r
   MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf\r
   UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf\r
   UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf\r
   # that is different than the one below.\r
   #\r
   # TimerLib|MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf\r
-  TimerLib|PerformancePkg/Library/TscTimerLib/TscTimerLib.inf\r
+  TimerLib|PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.inf\r
 \r
 [LibraryClasses.IPF]\r
   PalLib|MdePkg/Library/UefiPalLib/UefiPalLib.inf\r
   TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf\r
 \r
 [Components.IA32, Components.X64]\r
-  PerformancePkg/Library/TscTimerLib/TscTimerLib.inf\r
+  PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.inf\r
+  PerformancePkg/Library/PeiTscTimerLib/PeiTscTimerLib.inf\r
 \r
 [Components]\r
   PerformancePkg/Dp_App/Dp.inf\r