From nobody Mon Feb 9 10:47:54 2026 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+48923+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+48923+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1571076543; cv=none; d=zoho.com; s=zohoarc; b=MHfI0EpuRuOrJX/CxNGtYvDOGx0b8OjM8zTq3ZVPGQ6A/iRo4RGEVbXxRI0g/9+8hE6Z4fZF9n/E3Ya79EgZpZcLzKyK7Fl+chIcHRmeJ1spBJtrLywTLSN5uNgiYIdSU0Sb5nUMVzlx8XCz6RWCXx44wtjbFZbwFGMt7IaW/oM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571076543; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=6wZvpGNuxiH8c6Mht6RBxE+wXOZ5cknuq/G7ZfNKbkg=; b=d5aubOQl63u+BTtzqFAmb1XzvaymGd6ieI6wOV7k7i4va/My9Lp58e1SqFGzEDYj5Cr2rbL8Nc/LcprCwh8//64ZQJskoO69eboblt1jM/GPC99UgEAflgxJJSCSbxDHcEiUuP+mBq7TlmchD/pk3bTokj12suGBVb4Jww1ylmQ= 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+48923+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 1571076543299335.6165986607855; Mon, 14 Oct 2019 11:09:03 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 9WWZYY1788612xLCLNtmwL5y; Mon, 14 Oct 2019 11:09:02 -0700 X-Received: from mga04.intel.com (mga04.intel.com []) by mx.groups.io with SMTP id smtpd.web12.99.1571076535009144300 for ; Mon, 14 Oct 2019 11:09:02 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Oct 2019 11:09:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,296,1566889200"; d="scan'208";a="189094658" X-Received: from makuback-desk1.amr.corp.intel.com ([10.7.159.162]) by orsmga008.jf.intel.com with ESMTP; 14 Oct 2019 11:09:01 -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 V3 6/9] MdeModulePkg VariableInfo: Always consider RT DXE and SMM stats Date: Mon, 14 Oct 2019 11:08:43 -0700 Message-Id: <20191014180846.31660-7-michael.a.kubacki@intel.com> In-Reply-To: <20191014180846.31660-1-michael.a.kubacki@intel.com> References: <20191014180846.31660-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: j54L2UhexzOSBYCzCDpVWlBDx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1571076542; bh=BGuI6INdg/ZQplHukILJ+WfYBPPO2GigWOyaYDBlXN4=; h=Cc:Date:From:Reply-To:Subject:To; b=kb21UFe/kNUqFHHDk1sXzNL2rfqoey0Hhh6XtDrti83/TZfjXOdy9nZBP2LunyRXTPa qPn/3Y794Rnuw+7myP4/NHyyBEVizhBwDw8wc6HgbwRDv17paLSvAuBLA7r+LZmvsHrVd 66kfPfO+XdjUu2sjQi32kRIdUCR3kD1z42k= 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 (#48923): https://edk2.groups.io/g/devel/message/48923 Mute This Topic: https://groups.io/mt/34536811/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-