mirror of https://github.com/acidanthera/audk.git
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
This commit is contained in:
parent
23b0b15526
commit
26c0ba7799
|
@ -1664,6 +1664,7 @@ BdsLibDoLegacyBoot (
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
|
EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
|
||||||
|
EFI_EVENT LegacyBootEvent;
|
||||||
|
|
||||||
Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **) &LegacyBios);
|
Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **) &LegacyBios);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
@ -1681,7 +1682,16 @@ BdsLibDoLegacyBoot (
|
||||||
// Write boot to OS performance data for legacy boot.
|
// Write boot to OS performance data for legacy boot.
|
||||||
//
|
//
|
||||||
PERF_CODE (
|
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));
|
DEBUG ((DEBUG_INFO | DEBUG_LOAD, "Legacy Boot: %S\n", Option->Description));
|
||||||
|
@ -2219,10 +2229,9 @@ BdsLibBootViaBootOption (
|
||||||
LIST_ENTRY TempBootLists;
|
LIST_ENTRY TempBootLists;
|
||||||
EFI_BOOT_LOGO_PROTOCOL *BootLogo;
|
EFI_BOOT_LOGO_PROTOCOL *BootLogo;
|
||||||
|
|
||||||
//
|
PERF_CODE (
|
||||||
// Record the performance data for End of BDS
|
AllocateMemoryForPerformanceData ();
|
||||||
//
|
);
|
||||||
PERF_END(NULL, "BDS", NULL, 0);
|
|
||||||
|
|
||||||
*ExitDataSize = 0;
|
*ExitDataSize = 0;
|
||||||
*ExitData = NULL;
|
*ExitData = NULL;
|
||||||
|
@ -2423,7 +2432,7 @@ BdsLibBootViaBootOption (
|
||||||
// Write boot to OS performance data for UEFI boot
|
// Write boot to OS performance data for UEFI boot
|
||||||
//
|
//
|
||||||
PERF_CODE (
|
PERF_CODE (
|
||||||
WriteBootToOsPerformanceData ();
|
WriteBootToOsPerformanceData (NULL, NULL);
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -87,15 +87,30 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
Allocates a block of memory and writes performance data of booting into it.
|
Allocates a block of memory to store performance data.
|
||||||
OS can processing these record.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
WriteBootToOsPerformanceData (
|
AllocateMemoryForPerformanceData (
|
||||||
VOID
|
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
|
Get the headers (dos, image, optional header) from an image
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
performance, all the function will only include if the performance
|
performance, all the function will only include if the performance
|
||||||
switch is set.
|
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
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
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_HEADER mPerfHeader;
|
||||||
PERF_DATA mPerfData;
|
PERF_DATA mPerfData;
|
||||||
EFI_PHYSICAL_ADDRESS mAcpiLowMemoryBase = 0x0FFFFFFFFULL;
|
EFI_PHYSICAL_ADDRESS mAcpiLowMemoryBase = 0x0FFFFFFFFULL;
|
||||||
|
UINT32 mAcpiLowMemoryLength = 0x4000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the short verion of PDB file name to be
|
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.
|
Allocates a block of memory to store performance data.
|
||||||
OS can processing these record.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
WriteBootToOsPerformanceData (
|
AllocateMemoryForPerformanceData (
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT32 AcpiLowMemoryLength;
|
|
||||||
|
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 LimitCount;
|
UINT32 LimitCount;
|
||||||
EFI_HANDLE *Handles;
|
EFI_HANDLE *Handles;
|
||||||
UINTN NoHandles;
|
UINTN NoHandles;
|
||||||
|
@ -171,6 +210,15 @@ WriteBootToOsPerformanceData (
|
||||||
//
|
//
|
||||||
BOOLEAN *PerfEntriesAsDxeHandle;
|
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
|
// Retrieve time stamp count as early as possible
|
||||||
//
|
//
|
||||||
|
@ -208,27 +256,8 @@ WriteBootToOsPerformanceData (
|
||||||
return ;
|
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));
|
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;
|
NumPerfEntries = 0;
|
||||||
LogEntryKey = 0;
|
LogEntryKey = 0;
|
||||||
|
@ -346,13 +375,5 @@ Done:
|
||||||
sizeof (PERF_HEADER)
|
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 ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -410,17 +410,17 @@ S3ResumeBootOs (
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// report status code on S3 resume
|
|
||||||
//
|
|
||||||
REPORT_STATUS_CODE (EFI_PROGRESS_CODE, EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_OS_WAKE);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Install EndOfPeiPpi
|
// Install EndOfPeiPpi
|
||||||
//
|
//
|
||||||
Status = PeiServicesInstallPpi (&mPpiListEndOfPeiTable);
|
Status = PeiServicesInstallPpi (&mPpiListEndOfPeiTable);
|
||||||
ASSERT_EFI_ERROR (Status);
|
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 (
|
PERF_CODE (
|
||||||
WriteToOsS3PerformanceData ();
|
WriteToOsS3PerformanceData ();
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue