/** @file\r
BDS Lib functions which relate with create or process the boot option.\r
\r
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2013, 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
LIST_ENTRY TempBootLists;\r
EFI_BOOT_LOGO_PROTOCOL *BootLogo;\r
\r
- PERF_CODE (\r
- AllocateMemoryForPerformanceData ();\r
- );\r
-\r
*ExitDataSize = 0;\r
*ExitData = NULL;\r
\r
#endif\r
#endif\r
\r
-/**\r
-\r
- Allocates a block of memory to store performance data.\r
-\r
-**/\r
-VOID\r
-AllocateMemoryForPerformanceData (\r
- VOID\r
- );\r
-\r
/**\r
\r
Writes performance data of booting into the allocated memory.\r
performance, all the function will only include if the performance\r
switch is set.\r
\r
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2013, 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
PERF_HEADER mPerfHeader;\r
PERF_DATA mPerfData;\r
EFI_PHYSICAL_ADDRESS mAcpiLowMemoryBase = 0x0FFFFFFFFULL;\r
-UINT32 mAcpiLowMemoryLength = 0x4000;\r
\r
/**\r
Get the short verion of PDB file name to be\r
return ;\r
}\r
\r
-/**\r
-\r
- Allocates a block of memory to store performance data.\r
-\r
-**/\r
-VOID\r
-AllocateMemoryForPerformanceData (\r
- VOID\r
- )\r
-{\r
- EFI_STATUS Status;\r
-\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 (mAcpiLowMemoryLength),\r
- &mAcpiLowMemoryBase\r
- );\r
- if (!EFI_ERROR (Status)) {\r
- gRT->SetVariable (\r
- L"PerfDataMemAddr",\r
- &gPerformanceProtocolGuid,\r
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
- sizeof (EFI_PHYSICAL_ADDRESS),\r
- &mAcpiLowMemoryBase\r
- );\r
- }\r
- }\r
-}\r
-\r
/**\r
\r
Writes performance data of booting into the allocated memory.\r
// List of flags indicating PerfEntry contains DXE handle\r
//\r
BOOLEAN *PerfEntriesAsDxeHandle;\r
+ UINTN VarSize;\r
\r
//\r
// Record the performance data for End of BDS\r
//\r
PERF_END(NULL, "BDS", NULL, 0);\r
\r
- if (mAcpiLowMemoryBase == 0x0FFFFFFFF) {\r
- return;\r
- }\r
-\r
//\r
// Retrieve time stamp count as early as possible\r
//\r
CountUp = FALSE;\r
}\r
\r
+ if (mAcpiLowMemoryBase == 0x0FFFFFFFF) {\r
+ VarSize = sizeof (EFI_PHYSICAL_ADDRESS);\r
+ Status = gRT->GetVariable (\r
+ L"PerfDataMemAddr",\r
+ &gPerformanceProtocolGuid,\r
+ NULL,\r
+ &VarSize,\r
+ &mAcpiLowMemoryBase\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
}\r
\r
Ptr = (UINT8 *) ((UINT32) mAcpiLowMemoryBase + sizeof (PERF_HEADER));\r
- LimitCount = (mAcpiLowMemoryLength - sizeof (PERF_HEADER)) / sizeof (PERF_DATA);\r
+ LimitCount = (UINT32) (PERF_DATA_MAX_LENGTH - sizeof (PERF_HEADER)) / sizeof (PERF_DATA);\r
\r
NumPerfEntries = 0;\r
LogEntryKey = 0;\r
#include <Guid/LegacyDevOrder.h>\r
#include <Guid/BdsHii.h>\r
#include <Guid/ConnectConInEvent.h>\r
+#include <Guid/Performance.h>\r
#include <Protocol/GenericMemoryTest.h>\r
#include <Protocol/FormBrowser2.h>\r
#include <Protocol/HiiConfigAccess.h>\r
#include <Library/CapsuleLib.h>\r
#include <Library/HiiLib.h>\r
#include <Library/DevicePathLib.h>\r
-#include <Library/PcdLib.h>\r
#include <Library/UefiHiiServicesLib.h>\r
\r
#include <Library/GenericBdsLib.h>\r
\r
}\r
\r
+/**\r
+\r
+ Allocate a block of memory that will contain performance data to OS.\r
+\r
+**/\r
+VOID\r
+BdsAllocateMemoryForPerformanceData (\r
+ VOID\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_PHYSICAL_ADDRESS AcpiLowMemoryBase;\r
+ EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock;\r
+\r
+ AcpiLowMemoryBase = 0x0FFFFFFFFULL;\r
+\r
+ //\r
+ // Allocate a block of memory that will contain performance data to OS.\r
+ //\r
+ Status = gBS->AllocatePages (\r
+ AllocateMaxAddress,\r
+ EfiReservedMemoryType,\r
+ EFI_SIZE_TO_PAGES (PERF_DATA_MAX_LENGTH),\r
+ &AcpiLowMemoryBase\r
+ );\r
+ if (!EFI_ERROR (Status)) {\r
+ //\r
+ // Save the pointer to variable for use in S3 resume.\r
+ //\r
+ Status = gRT->SetVariable (\r
+ L"PerfDataMemAddr",\r
+ &gPerformanceProtocolGuid,\r
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+ sizeof (EFI_PHYSICAL_ADDRESS),\r
+ &AcpiLowMemoryBase\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+ //\r
+ // Mark L"PerfDataMemAddr" variable to read-only if the Variable Lock protocol exists\r
+ //\r
+ Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **) &VariableLock);\r
+ if (!EFI_ERROR (Status)) {\r
+ Status = VariableLock->RequestToLock (VariableLock, L"PerfDataMemAddr", &gPerformanceProtocolGuid);\r
+ ASSERT_EFI_ERROR (Status);\r
+ }\r
+ }\r
+}\r
+\r
/**\r
\r
Service routine for BdsInstance->Entry(). Devices are connected, the\r
PERF_END (NULL, "DXE", NULL, 0);\r
PERF_START (NULL, "BDS", NULL, 0);\r
\r
+ PERF_CODE (\r
+ BdsAllocateMemoryForPerformanceData ();\r
+ );\r
+\r
//\r
// Initialize the global system boot option and driver option\r
//\r
* performance protocol interfaces.\r
* performance variables. \r
\r
-Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials are licensed and made available under \r
the terms and conditions of the BSD License that accompanies this distribution. \r
The full text of the license may be found at\r
#define PERF_TOKEN_SIZE 28\r
#define PERF_TOKEN_LENGTH (PERF_TOKEN_SIZE - 1)\r
#define PERF_PEI_ENTRY_MAX_NUM 50\r
+#define PERF_DATA_MAX_LENGTH 0x4000\r
\r
typedef struct {\r
CHAR8 Token[PERF_TOKEN_SIZE];\r