X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=EdkModulePkg%2FLibrary%2FDxeCorePerformanceLib%2FDxeCorePerformanceLib.c;h=5874902e2e37c0f6521a6bc3bb08a06887ca4bd7;hp=e4e7b3bb3b689080aa87e824d45cc60abc8d95ac;hb=410e0e9f02d5cba8a9eccb7da0b6ea75e4f462a4;hpb=4ba61e5e2a1b3cec7faaad36c252738f6f57f8a6 diff --git a/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c b/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c index e4e7b3bb3b..5874902e2e 100644 --- a/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c +++ b/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c @@ -118,7 +118,8 @@ GetGauge ( STATIC GAUGE_DATA_HEADER *mGaugeData; STATIC UINT32 mMaxGaugeRecords; -PERFORMANCE_PROTOCOL PerformanceInterface = { +EFI_HANDLE mHandle = NULL; +PERFORMANCE_PROTOCOL mPerformanceInterface = { StartGauge, EndGauge, GetGauge @@ -213,7 +214,6 @@ StartGauge ( UINTN GaugeDataSize; UINTN OldGaugeDataSize; GAUGE_DATA_HEADER *OldGaugeData; - EFI_STATUS Status; UINT32 Index; Index = mGaugeData->NumberOfEntries; @@ -223,21 +223,18 @@ StartGauge ( // OldGaugeData = mGaugeData; OldGaugeDataSize = sizeof (GAUGE_DATA_HEADER) + sizeof (GAUGE_DATA_ENTRY) * mMaxGaugeRecords; + mMaxGaugeRecords *= 2; GaugeDataSize = sizeof (GAUGE_DATA_HEADER) + sizeof (GAUGE_DATA_ENTRY) * mMaxGaugeRecords; - Status = gBS->AllocatePool ( - EfiBootServicesData, - GaugeDataSize, - (VOID **) &mGaugeData - ); - if (EFI_ERROR (Status)) { - return Status; + + mGaugeData = AllocateZeroPool (GaugeDataSize); + if (mGaugeData == NULL) { + return EFI_OUT_OF_RESOURCES; } // // Initialize new data arry and migrate old data one. // - mGaugeData = ZeroMem (mGaugeData, GaugeDataSize); - mGaugeData = CopyMem (mGaugeData, OldGaugeData, OldGaugeDataSize); + mGaugeData = CopyMem (mGaugeData, OldGaugeData, OldGaugeDataSize); gBS->FreePool (OldGaugeData); } @@ -423,31 +420,22 @@ DxeCorePerformanceLibConstructor ( ) { EFI_STATUS Status; - EFI_HANDLE Handle; - UINTN GaugeDataSize; // // Install the protocol interfaces. // - Handle = NULL; Status = gBS->InstallProtocolInterface ( - &Handle, + &mHandle, &gPerformanceProtocolGuid, EFI_NATIVE_INTERFACE, - &PerformanceInterface + &mPerformanceInterface ); ASSERT_EFI_ERROR (Status); mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + MAX_PEI_PERFORMANCE_LOG_ENTRIES; - GaugeDataSize = sizeof (GAUGE_DATA_HEADER) + sizeof (GAUGE_DATA_ENTRY) * mMaxGaugeRecords; - Status = gBS->AllocatePool ( - EfiBootServicesData, - GaugeDataSize, - (VOID **) &mGaugeData - ); - ASSERT_EFI_ERROR (Status); - ZeroMem (mGaugeData, GaugeDataSize); + mGaugeData = AllocateZeroPool (sizeof (GAUGE_DATA_HEADER) + (sizeof (GAUGE_DATA_ENTRY) * mMaxGaugeRecords)); + ASSERT (mGaugeData != NULL); InternalGetPeiPerformance ();