From nobody Fri Nov 1 14:43:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1516679300516167.71573558197122; Mon, 22 Jan 2018 19:48:20 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id AFBCB222CF1CA; Mon, 22 Jan 2018 19:42:51 -0800 (PST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4F55822333762 for ; Mon, 22 Jan 2018 19:42:50 -0800 (PST) Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jan 2018 19:48:16 -0800 Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by orsmga008.jf.intel.com with ESMTP; 22 Jan 2018 19:48:15 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.intel.com; envelope-from=dandan.bi@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,399,1511856000"; d="scan'208";a="12262560" From: Dandan Bi To: edk2-devel@lists.01.org Date: Tue, 23 Jan 2018 11:47:33 +0800 Message-Id: <1516679255-12328-7-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1516679255-12328-1-git-send-email-dandan.bi@intel.com> References: <1516679255-12328-1-git-send-email-dandan.bi@intel.com> Subject: [edk2] [patch 6/8] MdeModulePkg/FirmwarePerfDxe:Enhance for new pref infrastructure X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Star Zeng , Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 1. Remove the macro EXTENSION_RECORD_SIZE, since the extension size can be got through PcdExtFpdtBootRecordPadSize. 2. Hook EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT to install ACPI table 3. Copy SMM record according to the allocated size Cc: Liming Gao Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi --- .../FirmwarePerformanceDxe.c | 58 ++++++------------= ---- 1 file changed, 16 insertions(+), 42 deletions(-) diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/Fi= rmwarePerformanceDxe.c b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDat= aTableDxe/FirmwarePerformanceDxe.c index b004cac..0de6bfa 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwareP= erformanceDxe.c +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwareP= erformanceDxe.c @@ -3,11 +3,11 @@ =20 This module register report status code listener to collect performance = data for Firmware Basic Boot Performance Record and other boot performance re= cords,=20 and install FPDT to ACPI table. =20 - Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License which accompanies this distribution. The full text of the license may b= e found at http://opensource.org/licenses/bsd-license.php =20 @@ -40,12 +40,11 @@ #include #include #include #include =20 -#define EXTENSION_RECORD_SIZE 0x10000 -#define SMM_BOOT_RECORD_COMM_SIZE OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, D= ata) + sizeof(SMM_BOOT_RECORD_COMMUNICATE) +#define SMM_BOOT_RECORD_COMM_SIZE (OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, = Data) + sizeof(SMM_BOOT_RECORD_COMMUNICATE)) =20 EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol =3D NULL; =20 BOOLEAN mLockBoxReady =3D FALSE; EFI_EVENT mReadyToBootEvent; @@ -419,11 +418,15 @@ InstallFirmwarePerformanceDataTable ( SmmCommData->BootRecordSize =3D ReservedMemSize - SMM_BOOT_REC= ORD_COMM_SIZE; while (SmmCommData->BootRecordOffset < SmmBootRecordDataSize) { Status =3D Communication->Communicate (Communication, SmmBootR= ecordCommBuffer, &CommSize); ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR(SmmCommData->ReturnStatus); - CopyMem ((UINT8 *) SmmBootRecordData + SmmCommData->BootRecord= Offset, SmmCommData->BootRecordData, SmmCommData->BootRecordSize); + if (SmmCommData->BootRecordOffset + SmmCommData->BootRecordSiz= e > SmmBootRecordDataSize) { + CopyMem ((UINT8 *) SmmBootRecordData + SmmCommData->BootReco= rdOffset, SmmCommData->BootRecordData, SmmBootRecordDataSize - SmmCommData-= >BootRecordOffset); + } else { + CopyMem ((UINT8 *) SmmBootRecordData + SmmCommData->BootReco= rdOffset, SmmCommData->BootRecordData, SmmCommData->BootRecordSize); + } SmmCommData->BootRecordOffset =3D SmmCommData->BootRecordOffse= t + SmmCommData->BootRecordSize; } } } } @@ -567,33 +570,10 @@ InstallFirmwarePerformanceDataTable ( =20 return EFI_SUCCESS; } =20 /** - Notify function for event group EFI_EVENT_GROUP_READY_TO_BOOT. This is u= sed to - install the Firmware Performance Data Table. - - @param[in] Event The Event that is being processed. - @param[in] Context The Event Context. - -**/ -VOID -EFIAPI -FpdtReadyToBootEventNotify ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - if (mAcpiBootPerformanceTable =3D=3D NULL) { - // - // ACPI Firmware Performance Data Table not installed yet, install it = now. - // - InstallFirmwarePerformanceDataTable (); - } -} - -/** Report status code listener of FPDT. This is used to collect performance= data for OsLoaderLoadImageStart and OsLoaderStartImageStart in FPDT. =20 @param[in] CodeType Indicates the type of status code being = reported. @param[in] Value Describes the current status of a hardwa= re or software entity. @@ -697,22 +677,29 @@ FpdtStatusCodeListenerDxe ( DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ResetEnd = =3D %ld\n", mAcpiBootPerformanceTable->BasicBoot.ResetEnd)); DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - OsLoaderLoadImageStart = =3D 0\n")); DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - OsLoaderStartImageStart = =3D %ld\n", mAcpiBootPerformanceTable->BasicBoot.OsLoaderStartImageStart)); DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ExitBootServicesEntry = =3D 0\n")); DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ExitBootServicesExit = =3D 0\n")); + } else if (Value =3D=3D (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_R= EADY_TO_BOOT_EVENT)) { + if (mAcpiBootPerformanceTable =3D=3D NULL) { + // + // ACPI Firmware Performance Data Table not installed yet, install i= t now. + // + InstallFirmwarePerformanceDataTable (); + } } else if (Data !=3D NULL && CompareGuid (&Data->Type, &gEfiFirmwarePerf= ormanceGuid)) { // // Append one or more Boot records // if (mAcpiBootPerformanceTable =3D=3D NULL) { // // Append Boot records before FPDT ACPI table is installed.=20 // if (mBootRecordSize + Data->Size > mBootRecordMaxSize) { - mBootRecordBuffer =3D ReallocatePool (mBootRecordSize, mBootRecord= Size + Data->Size + EXTENSION_RECORD_SIZE, mBootRecordBuffer); + mBootRecordBuffer =3D ReallocatePool (mBootRecordSize, mBootRecord= Size + Data->Size + PcdGet32 (PcdExtFpdtBootRecordPadSize), mBootRecordBuff= er); ASSERT (mBootRecordBuffer !=3D NULL); - mBootRecordMaxSize =3D mBootRecordSize + Data->Size + EXTENSION_RE= CORD_SIZE; + mBootRecordMaxSize =3D mBootRecordSize + Data->Size + PcdGet32 (Pc= dExtFpdtBootRecordPadSize); } // // Save boot record into the temp memory space. // CopyMem (mBootRecordBuffer + mBootRecordSize, Data + 1, Data->Size); @@ -851,23 +838,10 @@ FirmwarePerformanceDxeEntryPoint ( &mExitBootServicesEvent ); ASSERT_EFI_ERROR (Status); =20 // - // Create ready to boot event to install ACPI FPDT table. - // - Status =3D gBS->CreateEventEx ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - FpdtReadyToBootEventNotify, - NULL, - &gEfiEventReadyToBootGuid, - &mReadyToBootEvent - ); - ASSERT_EFI_ERROR (Status); - - // // Retrieve GUID HOB data that contains the ResetEnd. // GuidHob =3D GetFirstGuidHob (&gEfiFirmwarePerformanceGuid); if (GuidHob !=3D NULL) { Performance =3D (FIRMWARE_SEC_PERFORMANCE *) GET_GUID_HOB_DATA (GuidHo= b); --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel