From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (NAM02-BL2-obe.outbound.protection.outlook.com [40.107.75.108]) by mx.groups.io with SMTP id smtpd.web11.386.1588787605034068221 for ; Wed, 06 May 2020 10:53:25 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=PUEPlW1H; spf=pass (domain: microsoft.com, ip: 40.107.75.108, mailfrom: bret.barkelew@microsoft.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oPrxRWD51MFs/isZtabHgAitfndasgecd1eyIHHQ97XgssOUMorGXkCU6vFwzd8q9yglLmJb5nAV77yABjN3M19vrlVSLqMpnevcJ0jjo4T4VLl4IOoRtcje5sRRh/4ZtdID7vml5BrcjqR5mPphFiXmi20MvS0i7hijih6g8nEj141fO3GnQgJ1299V1hVieHb/qJKw+FYyM2V+1ZIPE1wioU6PrqoBxAHahHwb59C2wGmftxRXzuRiXttA5CMM0Hv4mPqGb10ubZTF70jluEFAbVqiwJGVsH7xgClucJv1UfLNhqiM4z4co4bQfPABbZkgH3KCYieF8wcQED4AIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AeEbIg5tQQw+bqBLT9t0SWxAbeWNykGju6Kxl1E+e3k=; b=mvBjFONm+2pDf6LFDx8YFR61PshYjrS+nTlnM28FFZ8y3vfE8VjhMtkDIG1VXtJsrpvyviOiERF7g/QmNZbssA1WWK1TWkAPSRXsdEUbyE5E1/9YWSEA1K4PkzCv9DZ4C2wdBHC0YH99ZAQxqKmzb7xS5Ul61zXjmklyxuF9ClnpZ2y1arh6F3h8mLbOhu19KIeGPTaGSVZHRnM4B1JAEv9/Di/FIs+DS/pZwSwuEDB/PeeCG8wJWdRy3l87LOv3wjO2CxKk0OWKzt1nkogzMGmGgGL5ydS80C7mjPVFAGlzDlvRKpBiCuBzDvnpAwHZepM47PKXSacyaisq2HFU1g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AeEbIg5tQQw+bqBLT9t0SWxAbeWNykGju6Kxl1E+e3k=; b=PUEPlW1H66uSieRROfuKYOFi17puYp3NPkkI579qTA9RgeVmIwfMmwDIeUODGUBKqFEr+1p0bG+I104Ga06lr140TQh4xuMBFYUdV8zas1F4nD45teggEph4OuWh/3L0Ua9Cvi+he2iPuTpFBtlbH0CW55NqXHKaK+JHOW3BIws= Received: from CY4PR21MB0743.namprd21.prod.outlook.com (2603:10b6:903:b2::9) by CY4PR21MB0776.namprd21.prod.outlook.com (2603:10b6:903:b8::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.9; Wed, 6 May 2020 17:53:22 +0000 Received: from CY4PR21MB0743.namprd21.prod.outlook.com ([fe80::90d:10d9:c5bc:5318]) by CY4PR21MB0743.namprd21.prod.outlook.com ([fe80::90d:10d9:c5bc:5318%11]) with mapi id 15.20.2979.017; Wed, 6 May 2020 17:53:22 +0000 From: "Bret Barkelew" To: "devel@edk2.groups.io" , "ard.biesheuvel@arm.com" CC: Ard Biesheuvel , "Kinney, Michael D" , Liming Gao , Jian J Wang , Hao A Wu , Leif Lindholm , Sami Mujawar , "Yao, Jiewen" Subject: Re: [EXTERNAL] [edk2-devel] [PATCH resend 4/7] MdeModulePkg/VariableInfo: switch to MM communicate 2 protocol Thread-Topic: [EXTERNAL] [edk2-devel] [PATCH resend 4/7] MdeModulePkg/VariableInfo: switch to MM communicate 2 protocol Thread-Index: AQHWI8u1WHbzLN7gkE+elZTXd3HuzaibVqvH Date: Wed, 6 May 2020 17:53:22 +0000 Message-ID: References: <20200506172734.2475-1-ard.biesheuvel@arm.com>,<20200506172734.2475-5-ard.biesheuvel@arm.com> In-Reply-To: <20200506172734.2475-5-ard.biesheuvel@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2020-05-06T17:52:37.7870891Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Privileged authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=microsoft.com; x-originating-ip: [174.21.83.205] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 4c079eaf-233c-4bb1-d2f2-08d7f1e65ea5 x-ms-traffictypediagnostic: CY4PR21MB0776:|CY4PR21MB0776: x-ld-processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5516; x-forefront-prvs: 03950F25EC x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: po6HSEVaqeYPa18lmzvk8mFAcTZsXPZ5PKgMgHsHK8yEpvrSADYiysVQ+IPNXBjxDsEbVQSAAyyBffr4pHFUkXEKEBebNWg6gBt282g44Eg7JZpcgH9fs2lAskmFLjiY3YYyhCdeqHusTBWuaoqq642i3d0uhrFvah9hsUaRKYvSipuhm1Qire2+3f7p9IZOeZ6atkvYAOVyylCPWVPpljnv5qQhoqxNv2lyqdkyIKr2c7+fcTqckUS38oN4mznyMsK84LqfxSDXOsJGYWEkKcaH/Eyw6o3tasecI9lZRHTh46EMhxLLhAd54fB0MFERq6nIEaJLwWgpqHziZ05HMypeTAZ8fJwaJbXXxyRgR1tNYQGmVQHvG3Ma0+zuJZ7YYUJZuxNgjo6Nu3ytxJaUpJMResB/2pB0qfYb+WjoRDEOtE+CSAGIvlwKY+6OkYBmQgb+E8LQY2xUnAPMHMLAhW6DNqoSghEjTxtlCb9TYZhA4623lnKH/pizjlHEg6trL+IhVOYLnCc3JJfF0968jXCBNKVN7ETuF/KweTS0bL/uzgwGuD+gOA+emitcY3KOpWcLNXUVFe+ujrh1slWiPHjAjsy0rqV29ir20SH1tuI= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR21MB0743.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(376002)(396003)(39860400002)(136003)(366004)(346002)(33430700001)(71200400001)(8676002)(166002)(478600001)(10290500003)(55016002)(9686003)(53546011)(186003)(26005)(7696005)(6506007)(2906002)(33656002)(4326008)(86362001)(5660300002)(66476007)(66556008)(66946007)(8990500004)(64756008)(66446008)(76116006)(82960400001)(8936002)(82950400001)(966005)(91956017)(54906003)(316002)(33440700001)(110136005)(52536014);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: T0CUJtao3l/TqTJgDYZjiIm79FdQRsMDhS6viHwmFxiDLwMtXHFSuaDUiCp9fj8bII7aZBABlV5VexcCeqnW9jpSenvBvMQapge9SuzfrQdg4GmF/VtMoag5vBAviUB6qsdJCil1yEDqbulkSehnc6wcke8Y/eFYXCgdPfjFFcvbr3c+NN34ywu+0JIzTsyqsGn6G7zjlwE0fH7b7uhh6AeWWKY2CVlyHNjH8fdHOZzUSCzWO4324kye3kvqltSPORORilUM/tJmYlqpxUsviJe36KDjHmBNL5vwQbQRp7QGCeQsJ3Df2VFkk3eq3nZgJWS8sdW1/8he802MtCRoVnDM+wpqLOntb1r1Vq/8XWHHev2QCQdmIbft7jJWrtJycFxCZ1m6aRhZyZhOT9iwzri7YWHo1ZwA777f+yr1+zJNB2lSir668+bft6bndlxXcRoRThGlz5+FuESl9X0kw5E2w/+8IYABOaJEqX5ohT7StD42cfKjPp3zE2/A/iFzqsW6mnz+9Y7YpDgecm/JwAPv1/MtxZOuSHLE0FMbyF7rum7TmOis7xSyDOaBlpCKRmS97uYO04han3mwzRu1Y6thcb62CHjkvObPMuNQUNczxX/3PZjusmbWrNvZJbJ3HzKTD4e5R6JFjHcuIW1C+Mk+L5uuvjTolqKj9JRPa3F2DJHShjhYNPNVOOeQvnpGVrGB3MF8EYIPJeNGEsykmRKI3bjhcN2XP5IZn38OJx3eCBzJzbIRl/3YAz9eS8KrU6sgsC1oBtlf87uHACjAZfvyvK6z+BLeA9tTIh4iyF0= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c079eaf-233c-4bb1-d2f2-08d7f1e65ea5 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 May 2020 17:53:22.7263 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 3CYLk083R8MGGD7JjuXHvb/QAnPk89kZwFpCy9nokjj5vQWrJidNdGXNKL6Guxa8pVmZKD6Q40mU+0mu/eqNxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0776 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_CY4PR21MB074356320F9FE1A4698C13CDEFA40CY4PR21MB0743namp_" --_000_CY4PR21MB074356320F9FE1A4698C13CDEFA40CY4PR21MB0743namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Note that the VariablePolicy code that is still out for review also uses Mm= communication and would need to be updated if it lands first. - Bret From: Ard Biesheuvel via groups.io Sent: Wednesday, May 6, 2020 10:28 AM To: devel@edk2.groups.io Cc: Ard Biesheuvel; Kinney, Michael D; Liming Gao; Jia= n J Wang; Hao A Wu= ; Leif Lindholm; Sami Mujawar; Yao, Jiewen Subject: [EXTERNAL] [edk2-devel] [PATCH resend 4/7] MdeModulePkg/VariableI= nfo: switch to MM communicate 2 protocol Switch to the new MM communicate 2 protocol which supports both traditional and standalone MM. Signed-off-by: Ard Biesheuvel --- MdeModulePkg/Application/VariableInfo/VariableInfo.c | 19 +++++++++++--= ------ MdeModulePkg/Application/VariableInfo/VariableInfo.inf | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/MdeModulePkg/Application/VariableInfo/VariableInfo.c b/MdeMod= ulePkg/Application/VariableInfo/VariableInfo.c index c04ba182132f..a7df365b5895 100644 --- a/MdeModulePkg/Application/VariableInfo/VariableInfo.c +++ b/MdeModulePkg/Application/VariableInfo/VariableInfo.c @@ -20,10 +20,10 @@ #include #include #include -#include +#include #include -EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication =3D NULL; +EFI_MM_COMMUNICATION2_PROTOCOL *mMmCommunication2 =3D NULL; /** This function get the variable statistics data from SMM variable driver= . @@ -41,7 +41,7 @@ EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication =3D N= ULL; EFI_STATUS EFIAPI GetVariableStatisticsData ( - IN OUT EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader, + IN OUT EFI_MM_COMMUNICATE_HEADER *SmmCommunicateHeader, IN OUT UINTN *SmmCommunicateSize ) { @@ -49,12 +49,15 @@ GetVariableStatisticsData ( SMM_VARIABLE_COMMUNICATE_HEADER *SmmVariableFunctionHeader; CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gEfiSmmVariableProtocolGu= id); - SmmCommunicateHeader->MessageLength =3D *SmmCommunicateSize - OFFSET_OF= (EFI_SMM_COMMUNICATE_HEADER, Data); + SmmCommunicateHeader->MessageLength =3D *SmmCommunicateSize - OFFSET_OF= (EFI_MM_COMMUNICATE_HEADER, Data); SmmVariableFunctionHeader =3D (SMM_VARIABLE_COMMUNICATE_HEADER *) &SmmC= ommunicateHeader->Data[0]; SmmVariableFunctionHeader->Function =3D SMM_VARIABLE_FUNCTION_GET_STATI= STICS; - Status =3D mSmmCommunication->Communicate (mSmmCommunication, SmmCommun= icateHeader, SmmCommunicateSize); + Status =3D mMmCommunication2->Communicate (mMmCommunication2, + SmmCommunicateHeader, + SmmCommunicateHeader, + SmmCommunicateSize); ASSERT_EFI_ERROR (Status); Status =3D SmmVariableFunctionHeader->ReturnStatus; @@ -76,7 +79,7 @@ PrintInfoFromSmm ( { EFI_STATUS Status; VARIABLE_INFO_ENTRY *VariableInfo; - EFI_SMM_COMMUNICATE_HEADER *CommBuffer; + EFI_MM_COMMUNICATE_HEADER *CommBuffer; UINTN RealCommSize; UINTN CommSize; SMM_VARIABLE_COMMUNICATE_HEADER *FunctionHeader; @@ -92,7 +95,7 @@ PrintInfoFromSmm ( return Status; } - Status =3D gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL= , (VOID **) &mSmmCommunication); + Status =3D gBS->LocateProtocol (&gEfiMmCommunication2ProtocolGuid, NULL= , (VOID **) &mMmCommunication2); if (EFI_ERROR (Status)) { return Status; } @@ -117,7 +120,7 @@ PrintInfoFromSmm ( if (Size > MaxSize) { MaxSize =3D Size; RealCommSize =3D MaxSize; - CommBuffer =3D (EFI_SMM_COMMUNICATE_HEADER *) (UINTN) Entry->Ph= ysicalStart; + CommBuffer =3D (EFI_MM_COMMUNICATE_HEADER *) (UINTN) Entry->Phy= sicalStart; } } } diff --git a/MdeModulePkg/Application/VariableInfo/VariableInfo.inf b/MdeM= odulePkg/Application/VariableInfo/VariableInfo.inf index 0706ea2ead59..f7c533b54641 100644 --- a/MdeModulePkg/Application/VariableInfo/VariableInfo.inf +++ b/MdeModulePkg/Application/VariableInfo/VariableInfo.inf @@ -41,7 +41,7 @@ [LibraryClasses] MemoryAllocationLib [Protocols] - gEfiSmmCommunicationProtocolGuid ## SOMETIMES_CONSUMES + gEfiMmCommunication2ProtocolGuid ## SOMETIMES_CONSUMES ## UNDEFINED # Used to do smm communication ## SOMETIMES_CONSUMES -- 2.17.1 --_000_CY4PR21MB074356320F9FE1A4698C13CDEFA40CY4PR21MB0743namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Note that the VariablePolicy code that is still out= for review also uses Mm communication and would need to be updated if it l= ands first.

 

- Bret

 

From: Ard Biesheuvel via groups= .io
Sent: Wednesday, May 6, 2020 10:28 AM
To: devel@edk2.groups.io
Cc:
Ard Biesheuvel; <= a href=3D"mailto:michael.d.kinney@intel.com"> Kinney, Michael D; Liming Gao<= /a>; Jian J Wang; Hao A Wu; Leif Lindholm; Sami Mujawar; Yao, Jiewen
Subject: [EXTERNAL] [edk2-devel] [PATCH resend 4/7] MdeModulePkg/Va= riableInfo: switch to MM communicate 2 protocol

 

Switch to the new MM= communicate 2 protocol which supports both
traditional and standalone MM.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
---
 MdeModulePkg/Application/VariableInfo/VariableInfo.c   | 1= 9 +++++++++++--------
 MdeModulePkg/Application/VariableInfo/VariableInfo.inf |  2 = 3;-
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/MdeModulePkg/Application/VariableInfo/VariableInfo.c b/MdeMod= ulePkg/Application/VariableInfo/VariableInfo.c
index c04ba182132f..a7df365b5895 100644
--- a/MdeModulePkg/Application/VariableInfo/VariableInfo.c
+++ b/MdeModulePkg/Application/VariableInfo/VariableInfo.c
@@ -20,10 +20,10 @@
 #include <Guid/VariableFormat.h>
 #include <Guid/SmmVariableCommon.h>
 #include <Guid/PiSmmCommunicationRegionTable.h>
-#include <Protocol/SmmCommunication.h>
+#include <Protocol/MmCommunication2.h>
 #include <Protocol/SmmVariable.h>
 
-EFI_SMM_COMMUNICATION_PROTOCOL  *mSmmCommunication =3D NULL;
+EFI_MM_COMMUNICATION2_PROTOCOL  *mMmCommunication2 =3D NULL;
 
 /**
   This function get the variable statistics data from SMM varia= ble driver.
@@ -41,7 +41,7 @@ EFI_SMM_COMMUNICATION_PROTOCOL  *mSmmCommunicat= ion =3D NULL;
 EFI_STATUS
 EFIAPI
 GetVariableStatisticsData (
-  IN OUT  EFI_SMM_COMMUNICATE_HEADER  *SmmCommunicateHeade= r,
+  IN OUT  EFI_MM_COMMUNICATE_HEADER   *SmmCommuni= cateHeader,
   IN OUT  UINTN       &= nbsp;           &nbs= p;   *SmmCommunicateSize
   )
 {
@@ -49,12 +49,15 @@ GetVariableStatisticsData (
   SMM_VARIABLE_COMMUNICATE_HEADER     *SmmV= ariableFunctionHeader;
 
   CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gEfi= SmmVariableProtocolGuid);
-  SmmCommunicateHeader->MessageLength =3D *SmmCommunicateSize - O= FFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data);
+  SmmCommunicateHeader->MessageLength =3D *SmmCommunicateSize= - OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data);
 
   SmmVariableFunctionHeader =3D (SMM_VARIABLE_COMMUNICATE_HEADE= R *) &SmmCommunicateHeader->Data[0];
   SmmVariableFunctionHeader->Function =3D SMM_VARIABLE_FUNCT= ION_GET_STATISTICS;
 
-  Status =3D mSmmCommunication->Communicate (mSmmCommunication, S= mmCommunicateHeader, SmmCommunicateSize);
+  Status =3D mMmCommunication2->Communicate (mMmCommunication= 2,
+           &nb= sp;            =             &nb= sp;      SmmCommunicateHeader,
+           &nb= sp;            =             &nb= sp;      SmmCommunicateHeader,
+           &nb= sp;            =             &nb= sp;      SmmCommunicateSize);
   ASSERT_EFI_ERROR (Status);
 
   Status =3D SmmVariableFunctionHeader->ReturnStatus;
@@ -76,7 +79,7 @@ PrintInfoFromSmm (
 {
   EFI_STATUS        &nb= sp;            =             &nb= sp;   Status;
   VARIABLE_INFO_ENTRY       =             &nb= sp;        *VariableInfo;
-  EFI_SMM_COMMUNICATE_HEADER      &nbs= p;            &= nbsp; *CommBuffer;
+  EFI_MM_COMMUNICATE_HEADER      &= nbsp;           &nbs= p;   *CommBuffer;
   UINTN         &n= bsp;            = ;            &n= bsp;       RealCommSize;
   UINTN         &n= bsp;            = ;            &n= bsp;       CommSize;
   SMM_VARIABLE_COMMUNICATE_HEADER     =            *FunctionHeade= r;
@@ -92,7 +95,7 @@ PrintInfoFromSmm (
     return Status;
   }
 
-  Status =3D gBS->LocateProtocol (&gEfiSmmCommunicationProtoc= olGuid, NULL, (VOID **) &mSmmCommunication);
+  Status =3D gBS->LocateProtocol (&gEfiMmCommunication2Pr= otocolGuid, NULL, (VOID **) &mMmCommunication2);
   if (EFI_ERROR (Status)) {
     return Status;
   }
@@ -117,7 +120,7 @@ PrintInfoFromSmm (
         if (Size > MaxSize) {<= br>            MaxSize =3D S= ize;
           RealCommSize = = =3D MaxSize;
-          CommBuffer =3D (EF= I_SMM_COMMUNICATE_HEADER *) (UINTN) Entry->PhysicalStart;
+          CommBuffer =3D= (EFI_MM_COMMUNICATE_HEADER *) (UINTN) Entry->PhysicalStart;
         }
       }
     }
diff --git a/MdeModulePkg/Application/VariableInfo/VariableInfo.inf b/MdeM= odulePkg/Application/VariableInfo/VariableInfo.inf
index 0706ea2ead59..f7c533b54641 100644
--- a/MdeModulePkg/Application/VariableInfo/VariableInfo.inf
+++ b/MdeModulePkg/Application/VariableInfo/VariableInfo.inf @@ -41,7 +41,7 @@ [LibraryClasses]
   MemoryAllocationLib
 
 [Protocols]
-  gEfiSmmCommunicationProtocolGuid   ## SOMETIMES_CONSUMES=
+  gEfiMmCommunication2ProtocolGuid   ## SOMETIMES_CONS= UMES
 
   ## UNDEFINED        &= nbsp;   # Used to do smm communication
   ## SOMETIMES_CONSUMES
--
2.17.1


 

--_000_CY4PR21MB074356320F9FE1A4698C13CDEFA40CY4PR21MB0743namp_--