]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/UefiBootManagerLib: Remove the useless perf codes
authorDandan Bi <dandan.bi@intel.com>
Wed, 24 Jan 2018 05:36:09 +0000 (13:36 +0800)
committerStar Zeng <star.zeng@intel.com>
Mon, 12 Feb 2018 03:36:14 +0000 (11:36 +0800)
V2: Just update the commit message to reference the hash value of
new performance infrastructure.

Our new performance infrastructure (edk2 trunk commit hash value:
SHA-1: 73fef64f14d1b97ae9bd4705df3becc022391eba ~
SHA-1: 115eae650bfd2be2c2bc37360f4a755065e774c4) can support to
dump performance date form ACPI table in OS. So we can remove
the old perf code to write performance data to OS.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c [deleted file]
MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf

index 64042338eab0b575f610075e581c18f620fdc651..ce19ae4006604a9cc80261bda04e0254b949fd12 100644 (file)
@@ -27,6 +27,29 @@ EFI_BOOT_MANAGER_LEGACY_BOOT                 mBmLegacyBoot              = NULL;
 EFI_GUID mBmHardDriveBootVariableGuid = { 0xfab7e9e1, 0x39dd, 0x4f2b, { 0x84, 0x08, 0xe2, 0x0e, 0x90, 0x6c, 0xb6, 0xde } };\r
 EFI_GUID mBmAutoCreateBootOptionGuid  = { 0x8108ac4e, 0x9f11, 0x4d59, { 0x85, 0x0e, 0xe2, 0x1a, 0x52, 0x2c, 0x59, 0xb2 } };\r
 \r
+/**\r
+\r
+  End Perf entry of BDS\r
+\r
+  @param  Event                 The triggered event.\r
+  @param  Context               Context for this event.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+BmEndOfBdsPerfCode (\r
+  IN EFI_EVENT  Event,\r
+  IN VOID       *Context\r
+  )\r
+{\r
+  //\r
+  // Record the performance data for End of BDS\r
+  //\r
+  PERF_END(NULL, "BDS", NULL, 0);\r
+\r
+  return ;\r
+}\r
+\r
 /**\r
   The function registers the legacy boot support capabilities.\r
 \r
@@ -1830,7 +1853,7 @@ EfiBootManagerBoot (
         //\r
         Status = EfiCreateEventLegacyBootEx(\r
                    TPL_NOTIFY,\r
-                   BmWriteBootToOsPerformanceData,\r
+                   BmEndOfBdsPerfCode,\r
                    NULL, \r
                    &LegacyBootEvent\r
                    );\r
@@ -1871,7 +1894,7 @@ EfiBootManagerBoot (
   // Write boot to OS performance data for UEFI boot\r
   //\r
   PERF_CODE (\r
-    BmWriteBootToOsPerformanceData (NULL, NULL);\r
+    BmEndOfBdsPerfCode (NULL, NULL);\r
   );\r
 \r
   REPORT_STATUS_CODE (EFI_PROGRESS_CODE, PcdGet32 (PcdProgressCodeOsLoaderStart));\r
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c b/MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c
deleted file mode 100644 (file)
index 4d4495b..0000000
+++ /dev/null
@@ -1,317 +0,0 @@
-/** @file\r
-  This file include the file which can help to get the system\r
-  performance, all the function will only include if the performance\r
-  switch is set.\r
-\r
-Copyright (c) 2004 - 2017, 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 "InternalBm.h"\r
-\r
-PERF_HEADER               mBmPerfHeader;\r
-PERF_DATA                 mBmPerfData;\r
-EFI_PHYSICAL_ADDRESS      mBmAcpiLowMemoryBase = 0x0FFFFFFFFULL;\r
-\r
-/**\r
-  Get the short verion of PDB file name to be\r
-  used in performance data logging.\r
-\r
-  @param PdbFileName     The long PDB file name.\r
-  @param GaugeString     The output string to be logged by performance logger.\r
-  @param StringSize      The buffer size of GaugeString in bytes.\r
-\r
-**/\r
-VOID\r
-BmGetShortPdbFileName (\r
-  IN  CONST CHAR8  *PdbFileName,\r
-  OUT       CHAR8  *GaugeString,\r
-  IN        UINTN   StringSize\r
-  )\r
-{\r
-  UINTN Index;\r
-  UINTN Index1;\r
-  UINTN StartIndex;\r
-  UINTN EndIndex;\r
-\r
-  if (PdbFileName == NULL) {\r
-    AsciiStrCpyS (GaugeString, StringSize, " ");\r
-  } else {\r
-    StartIndex = 0;\r
-    for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++)\r
-      ;\r
-\r
-    for (Index = 0; PdbFileName[Index] != 0; Index++) {\r
-      if ((PdbFileName[Index] == '\\') || (PdbFileName[Index] == '/')) {\r
-        StartIndex = Index + 1;\r
-      }\r
-\r
-      if (PdbFileName[Index] == '.') {\r
-        EndIndex = Index;\r
-      }\r
-    }\r
-\r
-    Index1 = 0;\r
-    for (Index = StartIndex; Index < EndIndex; Index++) {\r
-      GaugeString[Index1] = PdbFileName[Index];\r
-      Index1++;\r
-      if (Index1 == StringSize - 1) {\r
-        break;\r
-      }\r
-    }\r
-\r
-    GaugeString[Index1] = 0;\r
-  }\r
-\r
-  return ;\r
-}\r
-\r
-/**\r
-  Get the name from the Driver handle, which can be a handle with\r
-  EFI_LOADED_IMAGE_PROTOCOL or EFI_DRIVER_BINDING_PROTOCOL installed.\r
-  This name can be used in performance data logging.\r
-\r
-  @param Handle          Driver handle.\r
-  @param GaugeString     The output string to be logged by performance logger.\r
-  @param StringSize      The buffer size of GaugeString in bytes.\r
-\r
-**/\r
-VOID\r
-BmGetNameFromHandle (\r
-  IN  EFI_HANDLE     Handle,\r
-  OUT CHAR8          *GaugeString,\r
-  IN  UINTN          StringSize\r
-  )\r
-{\r
-  EFI_STATUS                  Status;\r
-  EFI_LOADED_IMAGE_PROTOCOL   *Image;\r
-  CHAR8                       *PdbFileName;\r
-  EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;\r
-\r
-  AsciiStrCpyS (GaugeString, StringSize, " ");\r
-\r
-  //\r
-  // Get handle name from image protocol\r
-  //\r
-  Status = gBS->HandleProtocol (\r
-                  Handle,\r
-                  &gEfiLoadedImageProtocolGuid,\r
-                  (VOID **) &Image\r
-                  );\r
-\r
-  if (EFI_ERROR (Status)) {\r
-    Status = gBS->OpenProtocol (\r
-                    Handle,\r
-                    &gEfiDriverBindingProtocolGuid,\r
-                    (VOID **) &DriverBinding,\r
-                    NULL,\r
-                    NULL,\r
-                    EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
-                    );\r
-    if (EFI_ERROR (Status)) {\r
-      return ;\r
-    }\r
-    //\r
-    // Get handle name from image protocol\r
-    //\r
-    Status = gBS->HandleProtocol (\r
-                    DriverBinding->ImageHandle,\r
-                    &gEfiLoadedImageProtocolGuid,\r
-                    (VOID **) &Image\r
-                    );\r
-  }\r
-\r
-  PdbFileName = PeCoffLoaderGetPdbPointer (Image->ImageBase);\r
-\r
-  if (PdbFileName != NULL) {\r
-    BmGetShortPdbFileName (PdbFileName, GaugeString, StringSize);\r
-  }\r
-\r
-  return ;\r
-}\r
-\r
-/**\r
-\r
-  Writes performance data of booting into the allocated memory.\r
-  OS can process these records.\r
-\r
-  @param  Event                 The triggered event.\r
-  @param  Context               Context for this event.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-BmWriteBootToOsPerformanceData (\r
-  IN EFI_EVENT  Event,\r
-  IN VOID       *Context\r
-  )\r
-{\r
-  EFI_STATUS                Status;\r
-  UINT32                    LimitCount;\r
-  EFI_HANDLE                *Handles;\r
-  UINTN                     NoHandles;\r
-  CHAR8                     GaugeString[PERF_TOKEN_SIZE];\r
-  UINT8                     *Ptr;\r
-  UINT32                    Index;\r
-  UINT64                    Ticker;\r
-  UINT64                    Freq;\r
-  UINT32                    Duration;\r
-  UINTN                     LogEntryKey;\r
-  CONST VOID                *Handle;\r
-  CONST CHAR8               *Token;\r
-  CONST CHAR8               *Module;\r
-  UINT64                    StartTicker;\r
-  UINT64                    EndTicker;\r
-  UINT64                    StartValue;\r
-  UINT64                    EndValue;\r
-  BOOLEAN                   CountUp;\r
-  UINTN                     VarSize;\r
-  BOOLEAN                   Found;\r
-\r
-  //\r
-  // Record the performance data for End of BDS\r
-  //\r
-  PERF_END(NULL, "BDS", NULL, 0);\r
-\r
-  //\r
-  // Retrieve time stamp count as early as possible\r
-  //\r
-  Ticker  = GetPerformanceCounter ();\r
-\r
-  Freq    = GetPerformanceCounterProperties (&StartValue, &EndValue);\r
-  \r
-  Freq    = DivU64x32 (Freq, 1000);\r
-\r
-  mBmPerfHeader.CpuFreq = Freq;\r
-\r
-  //\r
-  // Record BDS raw performance data\r
-  //\r
-  if (EndValue >= StartValue) {\r
-    mBmPerfHeader.BDSRaw = Ticker - StartValue;\r
-    CountUp            = TRUE;\r
-  } else {\r
-    mBmPerfHeader.BDSRaw = StartValue - Ticker;\r
-    CountUp            = FALSE;\r
-  }\r
-\r
-  //\r
-  // Reset the entry count\r
-  //\r
-  mBmPerfHeader.Count = 0;\r
-\r
-  if (mBmAcpiLowMemoryBase == 0x0FFFFFFFF) {\r
-    VarSize = sizeof (EFI_PHYSICAL_ADDRESS);\r
-    Status = gRT->GetVariable (\r
-                    L"PerfDataMemAddr",\r
-                    &gPerformanceProtocolGuid,\r
-                    NULL,\r
-                    &VarSize,\r
-                    &mBmAcpiLowMemoryBase\r
-                    );\r
-    if (EFI_ERROR (Status)) {\r
-      //\r
-      // Fail to get the variable, return.\r
-      //\r
-      return;\r
-    }\r
-  }\r
-\r
-  //\r
-  // Put Detailed performance data into memory\r
-  //\r
-  Handles = NULL;\r
-  Status = gBS->LocateHandleBuffer (\r
-                  AllHandles,\r
-                  NULL,\r
-                  NULL,\r
-                  &NoHandles,\r
-                  &Handles\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    return ;\r
-  }\r
-\r
-  Ptr        = (UINT8 *) ((UINT32) mBmAcpiLowMemoryBase + sizeof (PERF_HEADER));\r
-  LimitCount = (UINT32) (PERF_DATA_MAX_LENGTH - sizeof (PERF_HEADER)) / sizeof (PERF_DATA);\r
-\r
-  //\r
-  // Get performance data\r
-  //\r
-  LogEntryKey = 0;\r
-  while ((LogEntryKey = GetPerformanceMeasurement (\r
-                          LogEntryKey,\r
-                          &Handle,\r
-                          &Token,\r
-                          &Module,\r
-                          &StartTicker,\r
-                          &EndTicker)) != 0) {\r
-    if (EndTicker != 0) {\r
-      if (StartTicker == 1) {\r
-        StartTicker = StartValue;\r
-      }\r
-      if (EndTicker == 1) {\r
-        EndTicker = StartValue;\r
-      }\r
-      Ticker = CountUp ? (EndTicker - StartTicker) : (StartTicker - EndTicker);\r
-\r
-      Duration = (UINT32) DivU64x32 (Ticker, (UINT32) Freq);\r
-      if (Duration == 0) {\r
-        continue;\r
-      }\r
-\r
-      ZeroMem (&mBmPerfData, sizeof (PERF_DATA));\r
-\r
-      mBmPerfData.Duration = Duration;\r
-\r
-      //\r
-      // See if the Handle is in the handle buffer\r
-      //\r
-      Found = FALSE;\r
-      for (Index = 0; Index < NoHandles; Index++) {\r
-        if (Handle == Handles[Index]) {\r
-          BmGetNameFromHandle (Handles[Index], GaugeString, PERF_TOKEN_SIZE);\r
-          AsciiStrCpyS (mBmPerfData.Token, PERF_TOKEN_SIZE, GaugeString);\r
-          Found = TRUE;\r
-          break;\r
-        }\r
-      }\r
-\r
-      if (!Found) {\r
-        AsciiStrnCpyS (mBmPerfData.Token, PERF_TOKEN_SIZE, Token, PERF_TOKEN_LENGTH);\r
-      }\r
-\r
-      CopyMem (Ptr, &mBmPerfData, sizeof (PERF_DATA));\r
-      Ptr += sizeof (PERF_DATA);\r
-\r
-      mBmPerfHeader.Count++;\r
-      if (mBmPerfHeader.Count == LimitCount) {\r
-        goto Done;\r
-      }\r
-    }\r
-  }\r
-\r
-Done:\r
-\r
-  FreePool (Handles);\r
-\r
-  mBmPerfHeader.Signiture = PERFORMANCE_SIGNATURE;\r
-\r
-  //\r
-  // Put performance data to Reserved memory\r
-  //\r
-  CopyMem (\r
-    (UINTN *) (UINTN) mBmAcpiLowMemoryBase,\r
-    &mBmPerfHeader,\r
-    sizeof (PERF_HEADER)\r
-    );\r
-\r
-  return ;\r
-}\r
index 0224bd34a9ed92fbfc7e4bcdfe29bae91916d1f0..ed0cd16ef322b350b07fe471068de34d7edd10b0 100644 (file)
@@ -51,7 +51,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Guid/MemoryTypeInformation.h>\r
 #include <Guid/FileInfo.h>\r
 #include <Guid/GlobalVariable.h>\r
-#include <Guid/Performance.h>\r
 #include <Guid/StatusCodeDataTypeVariable.h>\r
 \r
 #include <Library/PrintLib.h>\r
@@ -184,22 +183,6 @@ BmGetFreeOptionNumber (
   OUT UINT16                            *FreeOptionNumber\r
   );\r
 \r
-/**\r
-\r
-  Writes performance data of booting into the allocated memory.\r
-  OS can process these records.\r
-\r
-  @param  Event                 The triggered event.\r
-  @param  Context               Context for this event.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-BmWriteBootToOsPerformanceData (\r
-  IN EFI_EVENT  Event,\r
-  IN VOID       *Context\r
-  );\r
-\r
 /**\r
   This routine adjust the memory information for different memory type and \r
   save them into the variables for next boot. It resets the system when\r
index ad4901db5713f8ab78d982615100c360669f0709..1adffd70d06abac04849b31353eb7624221a2442 100644 (file)
@@ -5,7 +5,7 @@
 #  manipulation, hotkey registration, UEFI boot, connect/disconnect, console\r
 #  manipulation, driver health checking and etc.\r
 #\r
-#  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
 #  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -33,7 +33,6 @@
 #\r
 \r
 [Sources]\r
-  BmPerformance.c\r
   BmConnect.c\r
   BmMisc.c\r
   BmConsole.c\r
@@ -86,7 +85,6 @@
   ## SOMETIMES_CONSUMES ## Variable:L"ErrOut" (The device path of error out device)\r
   gEfiGlobalVariableGuid\r
 \r
-  gPerformanceProtocolGuid                      ## SOMETIMES_CONSUMES ## Variable:L"PerfDataMemAddr" (The ACPI address of performance data)\r
   gEdkiiStatusCodeDataTypeVariableGuid          ## SOMETIMES_CONSUMES ## GUID\r
   gEfiDiskInfoAhciInterfaceGuid                 ## SOMETIMES_CONSUMES ## GUID\r
   gEfiDiskInfoIdeInterfaceGuid                  ## SOMETIMES_CONSUMES ## GUID\r