From nobody Fri Nov 1 14:30:42 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 1516679297530263.175676450275; Mon, 22 Jan 2018 19:48:17 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 45EF52034A8A2; Mon, 22 Jan 2018 19:42:49 -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 4E0D122333762 for ; Mon, 22 Jan 2018 19:42:48 -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:14 -0800 Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by orsmga008.jf.intel.com with ESMTP; 22 Jan 2018 19:48:13 -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="12262547" From: Dandan Bi To: edk2-devel@lists.01.org Date: Tue, 23 Jan 2018 11:47:32 +0800 Message-Id: <1516679255-12328-6-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 5/8] MdeModulePkg/FirmwarePerformancePei:Add FPDT records for S3 phase 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" Add FPDT records into boot performance table for S3 phase Cc: Liming Gao Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi --- .../FirmwarePerformancePei.c | 59 ++++++++++++++++++= +++- .../FirmwarePerformancePei.inf | 5 +- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/Fi= rmwarePerformancePei.c b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDat= aTablePei/FirmwarePerformancePei.c index e4800b7..e81f96c 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwareP= erformancePei.c +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwareP= erformancePei.c @@ -3,11 +3,11 @@ Data Table in S3 resume boot mode. =20 This module register report status code listener to collect performance = data for S3 Resume Performance Record on S3 resume boot path. =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 @@ -17,20 +17,24 @@ **/ =20 #include =20 #include +#include =20 #include +#include +#include =20 #include #include #include #include #include #include #include +#include =20 /** Report status code listener for PEI. This is used to record the performa= nce data for S3 FullResume in FPDT. =20 @@ -68,10 +72,17 @@ FpdtStatusCodeListenerPei ( S3_PERFORMANCE_TABLE *AcpiS3PerformanceTable; EFI_ACPI_5_0_FPDT_S3_RESUME_RECORD *AcpiS3ResumeRecord; UINT64 S3ResumeTotal; EFI_ACPI_5_0_FPDT_S3_SUSPEND_RECORD S3SuspendRecord; EFI_ACPI_5_0_FPDT_S3_SUSPEND_RECORD *AcpiS3SuspendRecord; + EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariableServices; + UINT8 *BootPerformanceTable; + FIRMWARE_PERFORMANCE_VARIABLE PerformanceVariable; + EFI_HOB_GUID_TYPE *GuidHob; + PEI_EXT_FIRMWARE_PERF_HEADER *PeiPerformanceLogHeader; + UINT8 *FirmwarePerformanceData; + UINT8 *FirmwarePerformanceTablePtr; =20 // // Check whether status code is what we are interested in. // if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) !=3D EFI_PROGRESS_CODE) || @@ -128,10 +139,56 @@ FpdtStatusCodeListenerPei ( AcpiS3SuspendRecord->SuspendEnd =3D S3SuspendRecord.SuspendEnd; =20 DEBUG ((EFI_D_INFO, "FPDT: S3 Suspend Performance - SuspendStart =3D %ld= \n", AcpiS3SuspendRecord->SuspendStart)); DEBUG ((EFI_D_INFO, "FPDT: S3 Suspend Performance - SuspendEnd =3D %ld= \n", AcpiS3SuspendRecord->SuspendEnd)); =20 + Status =3D PeiServicesLocatePpi ( + &gEfiPeiReadOnlyVariable2PpiGuid, + 0, + NULL, + (VOID **) &VariableServices + ); + ASSERT_EFI_ERROR (Status); + + // + // Update S3 boot records into the basic boot performance table. + // + VarSize =3D sizeof (PerformanceVariable); + Status =3D VariableServices->GetVariable ( + VariableServices, + EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME, + &gEfiFirmwarePerformanceGuid, + NULL, + &VarSize, + &PerformanceVariable + ); + if (EFI_ERROR (Status)) { + return Status; + } + BootPerformanceTable =3D (UINT8*) (UINTN) PerformanceVariable.BootPerfor= manceTablePointer; + + // + // Dump PEI boot records + // + FirmwarePerformanceTablePtr =3D (BootPerformanceTable + sizeof (BOOT_PER= FORMANCE_TABLE)); + GuidHob =3D GetFirstGuidHob (&gEdkiiExtendedFirmwarePerformanceGuid); + while (GuidHob !=3D NULL) { + FirmwarePerformanceData =3D GET_GUID_HOB_DATA (GuidHob); + PeiPerformanceLogHeader =3D (PEI_EXT_FIRMWARE_PERF_HEADER *) FirmwareP= erformanceData; + + CopyMem (FirmwarePerformanceTablePtr, FirmwarePerformanceData + sizeof= (PEI_EXT_FIRMWARE_PERF_HEADER), (UINTN)(PeiPerformanceLogHeader->SizeOfAll= Entries)); + + GuidHob =3D GetNextGuidHob (&gEdkiiExtendedFirmwarePerformanceGuid, GE= T_NEXT_HOB (GuidHob)); + + FirmwarePerformanceTablePtr +=3D (UINTN)(PeiPerformanceLogHeader->Size= OfAllEntries); + } + + // + // Update Table length. + // + ((BOOT_PERFORMANCE_TABLE *) BootPerformanceTable)->Header.Length =3D (UI= NT32)((UINTN)FirmwarePerformanceTablePtr - (UINTN)BootPerformanceTable); + return EFI_SUCCESS; } =20 /** Main entry for Firmware Performance Data Table PEIM. diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/Fi= rmwarePerformancePei.inf b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceD= ataTablePei/FirmwarePerformancePei.inf index 53b45a2..703caf4 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwareP= erformancePei.inf +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwareP= erformancePei.inf @@ -4,11 +4,11 @@ # In S3 resume boot mode, it updates S3 Resume Performance Record in ACPI= Firmware Performance Data Table. # # This module register report status code listener to collect performance= data # for S3 Resume Performance Record on S3 resume boot path. # -# 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 B= SD License # which accompanies this distribution. The full text of the license may = be found at # http://opensource.org/licenses/bsd-license.php # =20 @@ -46,18 +46,21 @@ DebugLib TimerLib BaseMemoryLib LockBoxLib PcdLib + HobLib =20 [Ppis] gEfiPeiRscHandlerPpiGuid ## CONSUMES + gEfiPeiReadOnlyVariable2PpiGuid ## CONSUMES =20 [Guids] ## SOMETIMES_CONSUMES ## UNDEFINED # RestoreLockBox gEfiFirmwarePerformanceGuid gFirmwarePerformanceS3PointerGuid ## SOMETIMES_CONSUMES ## U= NDEFINED # RestoreLockBox + gEdkiiExtendedFirmwarePerformanceGuid ## SOMETIMES_CONSUMES ## H= OB =20 [FeaturePcd] gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwarePerformanceDataTableS3Support = ## CONSUMES =20 [Depex] --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel