From nobody Sun Feb 8 22:34:02 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+48241+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+48241+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1569635254; cv=none; d=zoho.com; s=zohoarc; b=Fkyuu6xwKYV+A+95kPDv3hMCX79/2ldu8dWJim1hQ2/UvcmM1obKsPaN5c3gS7o7qblxqM6eChzl2axo9LfaBR9pioBlMf7UR8+tXFj3rIBTkP0a4Q71QS3MTRNCiNSM0GVXKIVcb3XOhqL4DnIMk/aGIpRXMK8VpME3VAubsCI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569635254; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=sj30UD/QpAy3HRQkAmXhNdMsD2cBWrNYQKYVyBTUBrU=; b=INFkLrFmAU0p1xFe2mksHISs7J9olTepO/vJ4lbW4ew9u85l/IwhiO+/mowk1Ai9CV/joNKzfU0Vx5Eq1qvcVYSxJ2DO2yDzMhwIESXnlZoSJsOhE4h9dV/56F2xZwUiwXSrXTYzCkh2BvAth11FIp6vJbmdQdcTjrcmMl0qLhw= 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+48241+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 156963525494552.97961067684582; Fri, 27 Sep 2019 18:47:34 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id k5zgYY1788612xPPZLgUXqqm; Fri, 27 Sep 2019 18:47:34 -0700 X-Received: from mga01.intel.com (mga01.intel.com []) by groups.io with SMTP; Fri, 27 Sep 2019 18:47:34 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Sep 2019 18:47:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,557,1559545200"; d="scan'208";a="274005102" X-Received: from makuback-desk1.amr.corp.intel.com ([10.7.159.162]) by orsmga001.jf.intel.com with ESMTP; 27 Sep 2019 18:47:33 -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 V2 6/9] MdeModulePkg VariableInfo: Always consider RT DXE and SMM stats Date: Fri, 27 Sep 2019 18:47:14 -0700 Message-Id: <20190928014717.31372-7-michael.a.kubacki@intel.com> In-Reply-To: <20190928014717.31372-1-michael.a.kubacki@intel.com> References: <20190928014717.31372-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: zh1ON7D6FQeQomNrZzUdrxXux1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1569635254; bh=kYXN/aYua6le1COxDYt6aRZUVEugXZvN6SiDcAfQiA0=; h=Cc:Date:From:Reply-To:Subject:To; b=uysYy/d9p0RN03ZBOJPZ0sZNOzJEbFaxMKLawzq0Lu+6D6O64SVnploS+qVWvqYoiKN 6Y77iioBcSeOvKICI1gygMDPx92qCxHKzXZTciW5k5na3RBsD7pPOP/SKp/h1mJBS8PXz 3SgIP2IFMa88UW+hhaxoFLP7HZ6+68q3aXA= 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 Acked-by: Hao A Wu --- 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 (#48241): https://edk2.groups.io/g/devel/message/48241 Mute This Topic: https://groups.io/mt/34318590/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-