From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=jian.j.wang@intel.com; receiver=edk2-devel@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id CD58E21B00DC1 for ; Wed, 8 Nov 2017 21:50:07 -0800 (PST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Nov 2017 21:54:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,368,1505804400"; d="scan'208";a="171468039" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga005.jf.intel.com with ESMTP; 08 Nov 2017 21:54:08 -0800 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 8 Nov 2017 21:54:08 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 8 Nov 2017 21:54:07 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.159]) with mapi id 14.03.0319.002; Thu, 9 Nov 2017 13:54:06 +0800 From: "Wang, Jian J" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: "Dong, Eric" , "Yao, Jiewen" , "Ni, Ruiyu" Thread-Topic: [PATCH v4 2/7] MdeModulePkg/SmmMemoryAttribute.h: Add new protocol definitions Thread-Index: AQHTTuqOxqeTZgBbTkKEN+DiKZP95KMLkD8QgAAP4lA= Date: Thu, 9 Nov 2017 05:54:05 +0000 Message-ID: References: <20171027061140.17160-1-jian.j.wang@intel.com> <20171027061140.17160-3-jian.j.wang@intel.com> <0C09AFA07DD0434D9E2A0C6AEB0483103B9B369C@shsmsx102.ccr.corp.intel.com> In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103B9B369C@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYmQxOTExNzktOGIzNi00MjQxLWJiZTItZGIwM2I2ZGIwNjAyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJwM21GXC9keURBaEpKQXIzclI2ejNLN2RSdFZcL1lxd3dcL3FSMWpCSzdzRHlCalg3eDBST2xDeWFzUjFUbk45VUF1In0= x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v4 2/7] MdeModulePkg/SmmMemoryAttribute.h: Add new protocol definitions X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Nov 2017 05:50:08 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Good catch. "EFI" should be removed and "IN" should be "OUT". Thanks for th= e feedback. > -----Original Message----- > From: Zeng, Star > Sent: Thursday, November 09, 2017 1:13 PM > To: Wang, Jian J ; edk2-devel@lists.01.org > Cc: Dong, Eric ; Yao, Jiewen ;= Ni, > Ruiyu ; Zeng, Star > Subject: RE: [PATCH v4 2/7] MdeModulePkg/SmmMemoryAttribute.h: Add new > protocol definitions >=20 > Suggest to use " SMM Memory Attribute Protocol " instead of " EFI SMM > Memory Attribute Protocol " in the comments. >=20 > Should "+ IN UINT64 *Attributes" be "+ OU= T UINT64 > *Attributes" for EDKII_SMM_GET_MEMORY_ATTRIBUTES? >=20 > Thanks, > Star > -----Original Message----- > From: Wang, Jian J > Sent: Friday, October 27, 2017 2:12 PM > To: edk2-devel@lists.01.org > Cc: Zeng, Star ; Dong, Eric ; Y= ao, > Jiewen ; Ni, Ruiyu > Subject: [PATCH v4 2/7] MdeModulePkg/SmmMemoryAttribute.h: Add new > protocol definitions >=20 > The new protocol gEdkiiSmmMemoryAttributeProtocolGuid is intended for > PiSmmCore to be able to change memory page attributes for the sake of hea= p > guard feature. >=20 > This protocol provides three interfaces to get/set/clear page attribute. >=20 > struct _EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL { > EDKII_SMM_GET_MEMORY_ATTRIBUTES GetMemoryAttributes; > EDKII_SMM_SET_MEMORY_ATTRIBUTES SetMemoryAttributes; > EDKII_SMM_CLEAR_MEMORY_ATTRIBUTES ClearMemoryAttributes; > }; >=20 > Cc: Star Zeng > Cc: Eric Dong > Cc: Jiewen Yao > Cc: Ruiyu Ni > Suggested-by: Ayellet Wolman > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Jian J Wang > --- > MdeModulePkg/Include/Protocol/SmmMemoryAttribute.h | 136 > +++++++++++++++++++++ > 1 file changed, 136 insertions(+) > create mode 100644 MdeModulePkg/Include/Protocol/SmmMemoryAttribute.h >=20 > diff --git a/MdeModulePkg/Include/Protocol/SmmMemoryAttribute.h > b/MdeModulePkg/Include/Protocol/SmmMemoryAttribute.h > new file mode 100644 > index 0000000000..20e145c2dc > --- /dev/null > +++ b/MdeModulePkg/Include/Protocol/SmmMemoryAttribute.h > @@ -0,0 +1,136 @@ > +/** @file > + EFI SMM Memory Attribute Protocol provides retrieval and update > +service > + for memory attributes in EFI SMM environment. > + > + Copyright (c) 2017, Intel Corporation. All rights reserved.
This > + program and the accompanying materials are licensed and made > + available under the terms and conditions of the BSD License which > + accompanies this distribution. The full text of the license may be > + found at http://opensource.org/licenses/bsd-license.php > + > + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > + > +**/ > + > +#ifndef __SMM_MEMORYATTRIBUTE_H__ > +#define __SMM_MEMORYATTRIBUTE_H__ > + > +//{69B792EA-39CE-402D-A2A6-F721DE351DFE} > +#define EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL_GUID \ > + { \ > + 0x69b792ea, 0x39ce, 0x402d, { 0xa2, 0xa6, 0xf7, 0x21, 0xde, 0x35, > +0x1d, 0xfe } \ > + } > + > +typedef struct _EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL > +EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL; > + > +/** > + This function set given attributes of the memory region specified by > + BaseAddress and Length. > + > + @param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL > instance. > + @param BaseAddress The physical address that is the start addre= ss of > + a memory region. > + @param Length The size in bytes of the memory region. > + @param Attributes The bit mask of attributes to set for the me= mory > + region. > + > + @retval EFI_SUCCESS The attributes were set for the memory r= egion. > + @retval EFI_INVALID_PARAMETER Length is zero. > + Attributes specified an illegal combinat= ion of > + attributes that cannot be set together. > + @retval EFI_UNSUPPORTED The processor does not support one or mo= re > + bytes of the memory resource range speci= fied > + by BaseAddress and Length. > + The bit mask of attributes is not suppor= t for > + the memory resource range specified by > + BaseAddress and Length. > + > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *EDKII_SMM_SET_MEMORY_ATTRIBUTES)( > + IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This, > + IN EFI_PHYSICAL_ADDRESS BaseAddress, > + IN UINT64 Length, > + IN UINT64 Attributes > + ); > + > +/** > + This function clears given attributes of the memory region specified > +by > + BaseAddress and Length. > + > + @param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL > instance. > + @param BaseAddress The physical address that is the start addre= ss of > + a memory region. > + @param Length The size in bytes of the memory region. > + @param Attributes The bit mask of attributes to set for the me= mory > + region. > + > + @retval EFI_SUCCESS The attributes were set for the memory r= egion. > + @retval EFI_INVALID_PARAMETER Length is zero. > + Attributes specified an illegal combinat= ion of > + attributes that cannot be set together. > + @retval EFI_UNSUPPORTED The processor does not support one or mo= re > + bytes of the memory resource range speci= fied > + by BaseAddress and Length. > + The bit mask of attributes is not suppor= t for > + the memory resource range specified by > + BaseAddress and Length. > + > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *EDKII_SMM_CLEAR_MEMORY_ATTRIBUTES)( > + IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This, > + IN EFI_PHYSICAL_ADDRESS BaseAddress, > + IN UINT64 Length, > + IN UINT64 Attributes > + ); > + > +/** > + This function retrieve the attributes of the memory region specified > +by > + BaseAddress and Length. If different attributes are got from > +different part > + of the memory region, EFI_NO_MAPPING will be returned. > + > + @param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL > instance. > + @param BaseAddress The physical address that is the start addre= ss of > + a memory region. > + @param Length The size in bytes of the memory region. > + @param Attributes Pointer to attributes returned. > + > + @retval EFI_SUCCESS The attributes got for the memory region= . > + @retval EFI_INVALID_PARAMETER Length is zero. > + Attributes is NULL. > + @retval EFI_NO_MAPPING Attributes are not consistent cross the > memory > + region. > + @retval EFI_UNSUPPORTED The processor does not support one or mo= re > + bytes of the memory resource range speci= fied > + by BaseAddress and Length. > + The bit mask of attributes is not suppor= t for > + the memory resource range specified by > + BaseAddress and Length. > + > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *EDKII_SMM_GET_MEMORY_ATTRIBUTES)( > + IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This, > + IN EFI_PHYSICAL_ADDRESS BaseAddress, > + IN UINT64 Length, > + IN UINT64 *Attributes > + ); > + > +/// > +/// EFI SMM Memory Attribute Protocol provides services to retrieve or > +update /// memory attribute in the EFI SMM environment. > +/// > +struct _EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL { > + EDKII_SMM_GET_MEMORY_ATTRIBUTES GetMemoryAttributes; > + EDKII_SMM_SET_MEMORY_ATTRIBUTES SetMemoryAttributes; > + EDKII_SMM_CLEAR_MEMORY_ATTRIBUTES ClearMemoryAttributes; > +}; > + > +extern EFI_GUID gEdkiiSmmMemoryAttributeProtocolGuid; > + > +#endif > -- > 2.14.1.windows.1