summaryrefslogtreecommitdiffstats
path: root/IntelFrameworkModulePkg/Library
diff options
context:
space:
mode:
authorlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>2012-06-19 14:43:33 +0000
committerlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>2012-06-19 14:43:33 +0000
commit26c0ba7799a6a735ecb8fd1a7757aeb8989e5cfa (patch)
tree644c02ccb6472b9e962f9deded8df9c58045f4e7 /IntelFrameworkModulePkg/Library
parent23b0b155262644f0514b13d5c8f23f310e33d75b (diff)
downloadedk2-26c0ba7799a6a735ecb8fd1a7757aeb8989e5cfa.tar.gz
edk2-26c0ba7799a6a735ecb8fd1a7757aeb8989e5cfa.tar.bz2
edk2-26c0ba7799a6a735ecb8fd1a7757aeb8989e5cfa.zip
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
Diffstat (limited to 'IntelFrameworkModulePkg/Library')
-rw-r--r--IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c21
-rw-r--r--IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h23
-rw-r--r--IntelFrameworkModulePkg/Library/GenericBdsLib/Performance.c89
3 files changed, 89 insertions, 44 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 ;
}