diff options
author | lzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-06-19 14:43:33 +0000 |
---|---|---|
committer | lzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-06-19 14:43:33 +0000 |
commit | 26c0ba7799a6a735ecb8fd1a7757aeb8989e5cfa (patch) | |
tree | 644c02ccb6472b9e962f9deded8df9c58045f4e7 | |
parent | 23b0b155262644f0514b13d5c8f23f310e33d75b (diff) | |
download | edk2-platforms-26c0ba7799a6a735ecb8fd1a7757aeb8989e5cfa.tar.xz |
Align the perf data between FPDT and DP.
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13461 6f19259b-4bc3-4df7-8a09-765794883524
4 files changed, 94 insertions, 49 deletions
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c index 360760c48a..4b4333bd88 100644 --- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c +++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c @@ -1664,6 +1664,7 @@ BdsLibDoLegacyBoot ( {
EFI_STATUS Status;
EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
+ EFI_EVENT LegacyBootEvent;
Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **) &LegacyBios);
if (EFI_ERROR (Status)) {
@@ -1681,7 +1682,16 @@ BdsLibDoLegacyBoot ( // Write boot to OS performance data for legacy boot.
//
PERF_CODE (
- WriteBootToOsPerformanceData ();
+ //
+ // Create an event to be signalled when Legacy Boot occurs to write performance data.
+ //
+ Status = EfiCreateEventLegacyBootEx(
+ TPL_NOTIFY,
+ WriteBootToOsPerformanceData,
+ NULL,
+ &LegacyBootEvent
+ );
+ ASSERT_EFI_ERROR (Status);
);
DEBUG ((DEBUG_INFO | DEBUG_LOAD, "Legacy Boot: %S\n", Option->Description));
@@ -2219,10 +2229,9 @@ BdsLibBootViaBootOption ( LIST_ENTRY TempBootLists;
EFI_BOOT_LOGO_PROTOCOL *BootLogo;
- //
- // Record the performance data for End of BDS
- //
- PERF_END(NULL, "BDS", NULL, 0);
+ PERF_CODE (
+ AllocateMemoryForPerformanceData ();
+ );
*ExitDataSize = 0;
*ExitData = NULL;
@@ -2423,7 +2432,7 @@ BdsLibBootViaBootOption ( // Write boot to OS performance data for UEFI boot
//
PERF_CODE (
- WriteBootToOsPerformanceData ();
+ WriteBootToOsPerformanceData (NULL, NULL);
);
//
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h b/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h index 0eea67933a..7381670bf2 100644 --- a/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h +++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h @@ -87,16 +87,31 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. /**
- Allocates a block of memory and writes performance data of booting into it.
- OS can processing these record.
-
+ Allocates a block of memory to store performance data.
+
**/
VOID
-WriteBootToOsPerformanceData (
+AllocateMemoryForPerformanceData (
VOID
);
/**
+
+ Writes performance data of booting into the allocated memory.
+ OS can process these records.
+
+ @param Event The triggered event.
+ @param Context Context for this event.
+
+**/
+VOID
+EFIAPI
+WriteBootToOsPerformanceData (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ );
+
+/**
Get the headers (dos, image, optional header) from an image
@param Device SimpleFileSystem device handle
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/Performance.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/Performance.c index a883d051af..7e6d358d84 100644 --- a/IntelFrameworkModulePkg/Library/GenericBdsLib/Performance.c +++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/Performance.c @@ -3,7 +3,7 @@ performance, all the function will only include if the performance
switch is set.
-Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -19,6 +19,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. PERF_HEADER mPerfHeader;
PERF_DATA mPerfData;
EFI_PHYSICAL_ADDRESS mAcpiLowMemoryBase = 0x0FFFFFFFFULL;
+UINT32 mAcpiLowMemoryLength = 0x4000;
/**
Get the short verion of PDB file name to be
@@ -135,17 +136,55 @@ GetNameFromHandle ( /**
- Allocates a block of memory and writes performance data of booting into it.
- OS can processing these record.
-
+ Allocates a block of memory to store performance data.
+
**/
VOID
-WriteBootToOsPerformanceData (
+AllocateMemoryForPerformanceData (
VOID
)
{
+ EFI_STATUS Status;
+
+ if (mAcpiLowMemoryBase == 0x0FFFFFFFF) {
+ //
+ // Allocate a block of memory that contain performance data to OS
+ //
+ Status = gBS->AllocatePages (
+ AllocateMaxAddress,
+ EfiReservedMemoryType,
+ EFI_SIZE_TO_PAGES (mAcpiLowMemoryLength),
+ &mAcpiLowMemoryBase
+ );
+ if (!EFI_ERROR (Status)) {
+ gRT->SetVariable (
+ L"PerfDataMemAddr",
+ &gPerformanceProtocolGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
+ sizeof (EFI_PHYSICAL_ADDRESS),
+ &mAcpiLowMemoryBase
+ );
+ }
+ }
+}
+
+/**
+
+ Writes performance data of booting into the allocated memory.
+ OS can process these records.
+
+ @param Event The triggered event.
+ @param Context Context for this event.
+
+**/
+VOID
+EFIAPI
+WriteBootToOsPerformanceData (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
EFI_STATUS Status;
- UINT32 AcpiLowMemoryLength;
UINT32 LimitCount;
EFI_HANDLE *Handles;
UINTN NoHandles;
@@ -172,6 +211,15 @@ WriteBootToOsPerformanceData ( BOOLEAN *PerfEntriesAsDxeHandle;
//
+ // Record the performance data for End of BDS
+ //
+ PERF_END(NULL, "BDS", NULL, 0);
+
+ if (mAcpiLowMemoryBase == 0x0FFFFFFFF) {
+ return;
+ }
+
+ //
// Retrieve time stamp count as early as possible
//
Ticker = GetPerformanceCounter ();
@@ -208,27 +256,8 @@ WriteBootToOsPerformanceData ( return ;
}
-
- AcpiLowMemoryLength = 0x4000;
- if (mAcpiLowMemoryBase == 0x0FFFFFFFF) {
- //
- // Allocate a block of memory that contain performance data to OS
- //
- Status = gBS->AllocatePages (
- AllocateMaxAddress,
- EfiReservedMemoryType,
- EFI_SIZE_TO_PAGES (AcpiLowMemoryLength),
- &mAcpiLowMemoryBase
- );
- if (EFI_ERROR (Status)) {
- FreePool (Handles);
- return ;
- }
- }
-
-
Ptr = (UINT8 *) ((UINT32) mAcpiLowMemoryBase + sizeof (PERF_HEADER));
- LimitCount = (AcpiLowMemoryLength - sizeof (PERF_HEADER)) / sizeof (PERF_DATA);
+ LimitCount = (mAcpiLowMemoryLength - sizeof (PERF_HEADER)) / sizeof (PERF_DATA);
NumPerfEntries = 0;
LogEntryKey = 0;
@@ -346,13 +375,5 @@ Done: sizeof (PERF_HEADER)
);
- gRT->SetVariable (
- L"PerfDataMemAddr",
- &gPerformanceProtocolGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- sizeof (EFI_PHYSICAL_ADDRESS),
- &mAcpiLowMemoryBase
- );
-
return ;
}
diff --git a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c index f176f9b52b..4ff4c45ede 100644 --- a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c +++ b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c @@ -411,16 +411,16 @@ S3ResumeBootOs ( }
//
- // report status code on S3 resume
- //
- REPORT_STATUS_CODE (EFI_PROGRESS_CODE, EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_OS_WAKE);
-
- //
// Install EndOfPeiPpi
//
Status = PeiServicesInstallPpi (&mPpiListEndOfPeiTable);
ASSERT_EFI_ERROR (Status);
+ //
+ // report status code on S3 resume
+ //
+ REPORT_STATUS_CODE (EFI_PROGRESS_CODE, EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_OS_WAKE);
+
PERF_CODE (
WriteToOsS3PerformanceData ();
);
|