]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Library/GenericBdsLib/Performance.c
Don't need call SAP measure GPT table, which can be covered in SAP implementation.
[mirror_edk2.git] / IntelFrameworkModulePkg / Library / GenericBdsLib / Performance.c
index 0e3f7936cd78de7b7ad9cc77a7a63ec253020411..119a6e46d24fc8e86ab9defdf88f2e4776904f7c 100644 (file)
@@ -3,7 +3,7 @@
   performance, all the function will only include if the performance\r
   switch is set.\r
 \r
-Copyright (c) 2004 - 2008, Intel Corporation. <BR>\r
+Copyright (c) 2004 - 2009, Intel Corporation. <BR>\r
 All rights reserved. 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
@@ -18,6 +18,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 PERF_HEADER               mPerfHeader;\r
 PERF_DATA                 mPerfData;\r
+EFI_PHYSICAL_ADDRESS      mAcpiLowMemoryBase = 0x0FFFFFFFFULL;\r
 \r
 /**\r
   Get the short verion of PDB file name to be\r
@@ -144,7 +145,6 @@ WriteBootToOsPerformanceData (
   )\r
 {\r
   EFI_STATUS                Status;\r
-  EFI_PHYSICAL_ADDRESS      AcpiLowMemoryBase;\r
   UINT32                    AcpiLowMemoryLength;\r
   UINT32                    LimitCount;\r
   EFI_HANDLE                *Handles;\r
@@ -166,7 +166,7 @@ WriteBootToOsPerformanceData (
   BOOLEAN                   CountUp;\r
 \r
   //\r
-  // Retrive time stamp count as early as possilbe\r
+  // Retrieve time stamp count as early as possible\r
   //\r
   Ticker  = GetPerformanceCounter ();\r
 \r
@@ -187,25 +187,6 @@ WriteBootToOsPerformanceData (
     CountUp            = FALSE;\r
   }\r
 \r
-  AcpiLowMemoryLength   = 0x2000;\r
-\r
-  //\r
-  // Allocate a block of memory that contain performance data to OS\r
-  //\r
-  Status = gBS->AllocatePages (\r
-                  AllocateAnyPages,\r
-                  EfiACPIReclaimMemory,\r
-                  EFI_SIZE_TO_PAGES (AcpiLowMemoryLength),\r
-                  &AcpiLowMemoryBase\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    return ;\r
-  }\r
-\r
-\r
-  Ptr                   = (UINT8 *) ((UINT32) AcpiLowMemoryBase + sizeof (PERF_HEADER));\r
-  LimitCount            = (AcpiLowMemoryLength - sizeof (PERF_HEADER)) / sizeof (PERF_DATA);\r
-\r
   //\r
   // Put Detailed performance data into memory\r
   //\r
@@ -218,9 +199,32 @@ WriteBootToOsPerformanceData (
                   &Handles\r
                   );\r
   if (EFI_ERROR (Status)) {\r
-    gBS->FreePages (AcpiLowMemoryBase, 1);\r
     return ;\r
   }\r
+\r
+\r
+  AcpiLowMemoryLength = 0x4000;\r
+  if (mAcpiLowMemoryBase == 0x0FFFFFFFF) {\r
+    //\r
+    // Allocate a block of memory that contain performance data to OS\r
+    //\r
+    Status = gBS->AllocatePages (\r
+                    AllocateMaxAddress,\r
+                    EfiReservedMemoryType,\r
+                    EFI_SIZE_TO_PAGES (AcpiLowMemoryLength),\r
+                    &mAcpiLowMemoryBase\r
+                    );\r
+    if (EFI_ERROR (Status)) {\r
+      FreePool (Handles);\r
+      return ;\r
+    }\r
+  }\r
+\r
+\r
+  Ptr        = (UINT8 *) ((UINT32) mAcpiLowMemoryBase + sizeof (PERF_HEADER));\r
+  LimitCount = (AcpiLowMemoryLength - sizeof (PERF_HEADER)) / sizeof (PERF_DATA);\r
+\r
+\r
   \r
   //\r
   // Get DXE drivers performance\r
@@ -296,20 +300,20 @@ Done:
   mPerfHeader.Signiture = PERFORMANCE_SIGNATURE;\r
 \r
   //\r
-  // Put performance data to ACPI memory\r
+  // Put performance data to Reserved memory\r
   //\r
   CopyMem (\r
-    (UINTN *) (UINTN) AcpiLowMemoryBase,\r
+    (UINTN *) (UINTN) mAcpiLowMemoryBase,\r
     &mPerfHeader,\r
     sizeof (PERF_HEADER)\r
     );\r
 \r
   gRT->SetVariable (\r
         L"PerfDataMemAddr",\r
-        &gEfiGenericPlatformVariableGuid,\r
+        &gPerformanceProtocolGuid,\r
         EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
         sizeof (EFI_PHYSICAL_ADDRESS),\r
-        &AcpiLowMemoryBase\r
+        &mAcpiLowMemoryBase\r
         );\r
 \r
   return ;\r