From nobody Tue Nov 26 16:36:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+49826+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+49826+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1572629974; cv=none; d=zoho.com; s=zohoarc; b=om9qW/tCpiuWXl5IjfPRfd84FozFugr/AGQ6Z96LZh9mEDkAU28Hv2Pf9Pn2YYcceCfoEjzIYGpS7fusm4Nq9pQkNezsXjb3sql0FZ6K3znn+z4+vUyBmpBOj4xOD/tmJjtpzGlOD9xbi4orf9pBkmp5e9dIOfVfG02ni5Rah6Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572629974; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=G4gbVE4tKGnaZKHf6Os98Ni62Az6fILVvoRNmbfMM20=; b=jhu2b5EzVWVKJ8wjjx5Eqa6gDjHeKeQoAbDd9xYGssZ5y0ea/upfgpSlhaf7Vw4oPWFMrXNq14/+I1khborjhPbxpkykeYRYADB7jeKzcnyh73L24nnZ5hKDP05SMNyueGNhf6VQrDdadwTKH4bXji07jQl//eaPF1arOIwskpI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+49826+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1572629974548166.7170306209282; Fri, 1 Nov 2019 10:39:34 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id QDu4YY1788612x8S1QF37Ro8; Fri, 01 Nov 2019 10:39:34 -0700 X-Received: from mga09.intel.com (mga09.intel.com []) by mx.groups.io with SMTP id smtpd.web11.79.1572629732142986416 for ; Fri, 01 Nov 2019 10:35:35 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Nov 2019 10:35:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,256,1569308400"; d="scan'208";a="204559565" X-Received: from makuback-desk1.amr.corp.intel.com ([10.7.159.162]) by orsmga006.jf.intel.com with ESMTP; 01 Nov 2019 10:35:35 -0700 From: "Kubacki, Michael A" To: devel@edk2.groups.io Cc: Dandan Bi , Ard Biesheuvel , Eric Dong , Laszlo Ersek , Liming Gao , Michael D Kinney , Ray Ni , Jian J Wang , Hao A Wu , Jiewen Yao Subject: [edk2-devel] [PATCH V7 06/10] MdeModulePkg VariableInfo: Always consider RT DXE and SMM stats Date: Fri, 1 Nov 2019 10:34:53 -0700 Message-Id: <20191101173457.11956-7-michael.a.kubacki@intel.com> In-Reply-To: <20191101173457.11956-1-michael.a.kubacki@intel.com> References: <20191101173457.11956-1-michael.a.kubacki@intel.com> Precedence: Bulk List-Unsubscribe: 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,michael.a.kubacki@intel.com X-Gm-Message-State: GB7B8kBH4Ox37vwpHriDZzcnx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1572629974; bh=skZf6xtzDWkcF4icSQBbqTizDmP6sI0Qn2u4fKO4FR0=; h=Cc:Date:From:Reply-To:Subject:To; b=jw4oKXevfzUNZBeSCQVubhpM94e04FXiuoXLe5AkWDTdC3iBLaWY9Q1Q79xDF2cQMqt 3zMsK/U4cfFeTQ7m8UqXATSurEdQZ4iwXkmqrY96whP28Q+HomsA/ElvK2i5CxHaeqW5r wOf2JIdTrbSt/UW0wY0IYkES7HoMZws9wfo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2220 The current VariableInfo application only checks for variable statistics from SMM if the variable information entries are not present in the UEFI System Configuration table as published by the DXE UEFI variable driver (VariableRuntimeDxe). This change first checks for variable information entries in the UEFI System Configuration but always checks for entries in SMM as well. If the SMM variable driver is not present, an instance of EFI_SMM_VARIABLE_PROTOCOL will not be found and the search for SMM variable statistics will be aborted (an SW SMI to get variable statistics will not be triggered). In the case variable statistics are provided by both a Runtime DXE driver (e.g. VariableSmmRuntimeDxe) and a SMM driver (VariableSmm), this change will clearly identify statistics from each respective driver. Cc: Dandan Bi Cc: Ard Biesheuvel Cc: Eric Dong Cc: Laszlo Ersek Cc: Liming Gao Cc: Michael D Kinney Cc: Ray Ni Cc: Jian J Wang Cc: Hao A Wu Cc: Jiewen Yao Signed-off-by: Michael Kubacki --- MdeModulePkg/Application/VariableInfo/VariableInfo.c | 37 ++++++++++------= ---- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/MdeModulePkg/Application/VariableInfo/VariableInfo.c b/MdeModu= lePkg/Application/VariableInfo/VariableInfo.c index f213471e9a..c04ba18213 100644 --- a/MdeModulePkg/Application/VariableInfo/VariableInfo.c +++ b/MdeModulePkg/Application/VariableInfo/VariableInfo.c @@ -3,7 +3,7 @@ this utility will print out the statistics information. You can use cons= ole redirection to capture the data. =20 - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -126,7 +126,7 @@ PrintInfoFromSmm ( ASSERT (CommBuffer !=3D NULL); ZeroMem (CommBuffer, RealCommSize); =20 - Print (L"Non-Volatile SMM Variables:\n"); + Print (L"SMM Driver Non-Volatile Variables:\n"); do { CommSize =3D RealCommSize; Status =3D GetVariableStatisticsData (CommBuffer, &CommSize); @@ -155,7 +155,7 @@ PrintInfoFromSmm ( } } while (TRUE); =20 - Print (L"Volatile SMM Variables:\n"); + Print (L"SMM Driver Volatile Variables:\n"); ZeroMem (CommBuffer, RealCommSize); do { CommSize =3D RealCommSize; @@ -207,24 +207,18 @@ UefiMain ( IN EFI_SYSTEM_TABLE *SystemTable ) { - EFI_STATUS Status; + EFI_STATUS RuntimeDxeStatus; + EFI_STATUS SmmStatus; VARIABLE_INFO_ENTRY *VariableInfo; VARIABLE_INFO_ENTRY *Entry; =20 - Status =3D EfiGetSystemConfigurationTable (&gEfiVariableGuid, (VOID **)&= Entry); - if (EFI_ERROR (Status) || (Entry =3D=3D NULL)) { - Status =3D EfiGetSystemConfigurationTable (&gEfiAuthenticatedVariableG= uid, (VOID **)&Entry); + RuntimeDxeStatus =3D EfiGetSystemConfigurationTable (&gEfiVariableGuid, = (VOID **) &Entry); + if (EFI_ERROR (RuntimeDxeStatus) || (Entry =3D=3D NULL)) { + RuntimeDxeStatus =3D EfiGetSystemConfigurationTable (&gEfiAuthenticate= dVariableGuid, (VOID **) &Entry); } =20 - if (EFI_ERROR (Status) || (Entry =3D=3D NULL)) { - Status =3D PrintInfoFromSmm (); - if (!EFI_ERROR (Status)) { - return Status; - } - } - - if (!EFI_ERROR (Status) && (Entry !=3D NULL)) { - Print (L"Non-Volatile EFI Variables:\n"); + if (!EFI_ERROR (RuntimeDxeStatus) && (Entry !=3D NULL)) { + Print (L"Runtime DXE Driver Non-Volatile EFI Variables:\n"); VariableInfo =3D Entry; do { if (!VariableInfo->Volatile) { @@ -242,7 +236,7 @@ UefiMain ( VariableInfo =3D VariableInfo->Next; } while (VariableInfo !=3D NULL); =20 - Print (L"Volatile EFI Variables:\n"); + Print (L"Runtime DXE Driver Volatile EFI Variables:\n"); VariableInfo =3D Entry; do { if (VariableInfo->Volatile) { @@ -258,14 +252,19 @@ UefiMain ( } VariableInfo =3D VariableInfo->Next; } while (VariableInfo !=3D NULL); + } =20 - } else { + SmmStatus =3D PrintInfoFromSmm (); + + if (EFI_ERROR (RuntimeDxeStatus) && EFI_ERROR (SmmStatus)) { Print (L"Warning: Variable Dxe/Smm driver doesn't enable the feature o= f statistical information!\n"); Print (L"If you want to see this info, please:\n"); Print (L" 1. Set PcdVariableCollectStatistics as TRUE\n"); Print (L" 2. Rebuild Variable Dxe/Smm driver\n"); Print (L" 3. Run \"VariableInfo\" cmd again\n"); + + return EFI_NOT_FOUND; } =20 - return Status; + return EFI_SUCCESS; } --=20 2.16.2.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 (#49826): https://edk2.groups.io/g/devel/message/49826 Mute This Topic: https://groups.io/mt/40450376/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-