From nobody Thu Apr 25 17:32:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+96520+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96520+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1669065679; cv=none; d=zohomail.com; s=zohoarc; b=LrYj7Ex0Lo4fVVBofpKcgaj38+Zu8HmvdXk8YcsTeZt1UFcHd9sxf0bp1a+R7AQtVEdPR38sAM0Wy+SVc6f1LmuCzC486CZ79l4uwR8lnIVErbDE/sUSQvhpnshe+lAc/po8yI55eNSkOvPPgsAYZHbIUFbrxRHg+bmSvlT9Yu4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669065679; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=EJ2e7OKsryEnvmcmqOmVqxKR8AFxD+gyDBcNs30awy4=; b=Eh+ARxVF9fPN4WI7sBbrMDdNaLW1QzIXjant8zlMEKKECYhnC15cazBXiLH2wiTy2B3jw8dTXmA842LAkLJ19apGn3oOFbFZeBgDUrhAubRvC4TSYMBZIOI1A0EEqDz9B0ywBpWSaXvGJmaLXuz/u5Hg5dCuOPDAdulMn9PTaQY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96520+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1669065679913362.7067226441459; Mon, 21 Nov 2022 13:21:19 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id PpNKYY1788612xrwgApVHgqr; Mon, 21 Nov 2022 13:21:18 -0800 X-Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web11.34448.1669023299715331080 for ; Mon, 21 Nov 2022 01:34:59 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10537"; a="377776427" X-IronPort-AV: E=Sophos;i="5.96,180,1665471600"; d="scan'208";a="377776427" X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2022 01:34:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10537"; a="618764211" X-IronPort-AV: E=Sophos;i="5.96,180,1665471600"; d="scan'208";a="618764211" X-Received: from shwdedfd003.ccr.corp.intel.com ([10.239.163.23]) by orsmga006.jf.intel.com with ESMTP; 21 Nov 2022 01:34:57 -0800 From: "Zhenhua Yang" To: devel@edk2.groups.io Cc: Ray Ni , Zhichao Gao , Star Zeng Subject: [edk2-devel] [AddResetEnd v1] ShellPkg/DpDynamicCommand: Add ResetEnd support in DP command Date: Mon, 21 Nov 2022 17:34:56 +0800 Message-Id: <20221121093456.2251-1-zhenhua.yang@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,Zhenhua.Yang@intel.com X-Gm-Message-State: zuK7VG1o7108onqkSdazHd7Px1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1669065678; bh=PVl4wedupDB/5f7w2QKdzDf28t7KLIi5rU2u4RyZdLA=; h=Cc:Date:From:Reply-To:Subject:To; b=aMwb0EfdK3nOHL0nrBmo4X2Gj0g34lTu6EUqO4xW/MG+LFmQvOx8MLUqyEUEMUBzNAD omWzS0WS0iONuoxkNzIZTRA3MxPusKlRo79zk39hZhdSowtA/AOhg1GaDFOVtnsExs4fr BI1Ez0qh4Puqooy/UbOX6KSGufqlmK4bt08= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1669065681946100010 Content-Type: text/plain; charset="utf-8" From: zhenhuay DP command should be able to parse the FPDT ACPI table and dump the ResetEnd which was logged at the beginning of the firmware image execution. So that DP can calculate SEC phase time duration start from the beginning of firmware image execution. Cc: Ray Ni Cc: Zhichao Gao Cc: Star Zeng Signed-off-by: zhenhuay Reviewed-by: Zhichao Gao --- ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c | 14 ++++++++++++++ ShellPkg/DynamicCommand/DpDynamicCommand/DpTrace.c | 9 +++++++++ ShellPkg/DynamicCommand/DpDynamicCommand/Dp.uni | 1 + ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h | 1 + 4 files changed, 25 insertions(+) diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c b/ShellPkg/Dynam= icCommand/DpDynamicCommand/Dp.c index 1799ab176a..512a146da6 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c @@ -57,6 +57,7 @@ UINT8 *mBootPerformanceTable; UINTN mBootPerformanceTableSize; BOOLEAN mPeiPhase =3D FALSE; BOOLEAN mDxePhase =3D FALSE; +UINT64 mResetEnd =3D 0; =20 PERF_SUMMARY_DATA SummaryData =3D { 0 }; ///< Create the SummaryDa= ta structure and init. to ZERO. MEASUREMENT_RECORD *mMeasurementList =3D NULL; @@ -542,6 +543,8 @@ BuildMeasurementList ( { EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER *RecordHeader; UINT8 *PerformanceTablePtr; + UINT8 *BasicBootTablePtr; + UINT64 ResetEnd; UINT16 StartProgressId; UINTN TableLength; UINT8 *StartRecordEvent; @@ -552,6 +555,17 @@ BuildMeasurementList ( return EFI_OUT_OF_RESOURCES; } =20 + // + // Update the ResetEnd which was logged at the beginning of firmware ima= ge execution + // + TableLength =3D sizeof (EFI_ACPI_5_0_FPDT_PERFORMANCE_TABLE_HEADER= ); + BasicBootTablePtr =3D (mBootPerformanceTable + TableLength); + ResetEnd =3D ((EFI_ACPI_5_0_FPDT_FIRMWARE_BASIC_BOOT_RECORD *)B= asicBootTablePtr)->ResetEnd; + + if (ResetEnd > 0) { + mResetEnd =3D ResetEnd; + } + TableLength =3D sizeof (BOOT_PERFORMANCE_TABLE); PerformanceTablePtr =3D (mBootPerformanceTable + TableLength); =20 diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpTrace.c b/ShellPkg/= DynamicCommand/DpDynamicCommand/DpTrace.c index 0abb8797ec..9c0a9a06a1 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpTrace.c +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpTrace.c @@ -548,6 +548,15 @@ ProcessPhases ( =20 Total =3D 0; =20 + // print Reset End if it's valid + // + if (SecTime > mResetEnd) { + SecTime =3D SecTime - mResetEnd; // Calculate sec t= ime duration start from the beginning of firmware image execution + ElapsedTime =3D DurationInMicroSeconds (mResetEnd); // Calculate elaps= ed time in microseconds + Total +=3D DivU64x32 (ElapsedTime, 1000); // Accumulate time= in milliseconds + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_RESET_END), mDpHii= Handle, ElapsedTime); + } + // print SEC phase duration time // if (SecTime > 0) { diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.uni b/ShellPkg/Dyn= amicCommand/DpDynamicCommand/Dp.uni index 8d8700573e..ef2e7708b8 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.uni +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.uni @@ -41,6 +41,7 @@ #string STR_DP_TIMER_PROPERTIES #language en-US "System Performanc= e Timer counts %s from 0x%Lx to 0x%Lx\n" #string STR_DP_VERBOSE_THRESHOLD #language en-US "Measurements less= than %,Ld microseconds are not displayed.\n" #string STR_DP_SECTION_PHASES #language en-US "Major Phases" +#string STR_DP_RESET_END #language en-US " Reset End: = %L8d (us)\n" #string STR_DP_SEC_PHASE #language en-US " SEC Phase Durat= ion: %L8d (us)\n" #string STR_DP_PHASE_BDSTO #language en-US " BDS Time= out: %L8d (ms) included in BDS Duration\n" #string STR_DP_PHASE_DURATION #language en-US "%5a Phase Duratio= n: %L8d (ms)\n" diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h b/ShellP= kg/DynamicCommand/DpDynamicCommand/DpInternal.h index 39878c6085..97f47f2960 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpInternal.h @@ -28,6 +28,7 @@ extern UINT8 *mBootPerformanceTable; extern UINTN mBootPerformanceTableLength; extern MEASUREMENT_RECORD *mMeasurementList; extern UINTN mMeasurementNum; +extern UINT64 mResetEnd; =20 extern PERF_SUMMARY_DATA SummaryData; ///< Create the SummaryData stru= cture and init. to ZERO. =20 --=20 2.31.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96520): https://edk2.groups.io/g/devel/message/96520 Mute This Topic: https://groups.io/mt/95182514/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-