From nobody Wed Dec 25 13:39:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1510291173619765.6330444572945; Thu, 9 Nov 2017 21:19:33 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A334B2034D839; Thu, 9 Nov 2017 21:15:29 -0800 (PST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 97DA821B00DC4 for ; Thu, 9 Nov 2017 21:15:27 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP; 09 Nov 2017 21:19:29 -0800 Received: from jwang36-mobl2.ccr.corp.intel.com ([10.239.192.51]) by fmsmga001.fm.intel.com with ESMTP; 09 Nov 2017 21:19:28 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=jian.j.wang@intel.com; receiver=edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,372,1505804400"; d="scan'208";a="1059496" From: Jian J Wang To: edk2-devel@lists.01.org Date: Fri, 10 Nov 2017 13:19:19 +0800 Message-Id: <20171110051924.14064-3-jian.j.wang@intel.com> X-Mailer: git-send-email 2.14.1.windows.1 In-Reply-To: <20171110051924.14064-1-jian.j.wang@intel.com> References: <20171110051924.14064-1-jian.j.wang@intel.com> Subject: [edk2] [PATCH v5 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: , Cc: Ruiyu Ni , Jiewen Yao , Eric Dong , Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" > v5 > a. Remove EFI wording in comment for SMM memory attribute protocol. > b. Change parameter modifier from IN to OUT The new protocol gEdkiiSmmMemoryAttributeProtocolGuid is intended for PiSmmCore to be able to change memory page attributes for the sake of heap guard feature. This protocol provides three interfaces to get/set/clear page attribute. struct _EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL { EDKII_SMM_GET_MEMORY_ATTRIBUTES GetMemoryAttributes; EDKII_SMM_SET_MEMORY_ATTRIBUTES SetMemoryAttributes; EDKII_SMM_CLEAR_MEMORY_ATTRIBUTES ClearMemoryAttributes; }; 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 Reviewed-by: Jiewen Yao Regression-tested-by: Laszlo Ersek --- MdeModulePkg/Include/Protocol/SmmMemoryAttribute.h | 136 +++++++++++++++++= ++++ 1 file changed, 136 insertions(+) create mode 100644 MdeModulePkg/Include/Protocol/SmmMemoryAttribute.h diff --git a/MdeModulePkg/Include/Protocol/SmmMemoryAttribute.h b/MdeModule= Pkg/Include/Protocol/SmmMemoryAttribute.h new file mode 100644 index 0000000000..a8c10c07b4 --- /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 BS= D License + which accompanies this distribution. The full text of the license may b= e 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 IMP= LIED. + +**/ + +#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_ATTRI= BUTE_PROTOCOL; + +/** + This function set given attributes of the memory region specified by + BaseAddress and Length. + + @param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instan= ce. + @param BaseAddress The physical address that is the start address= 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 memo= ry + region. + + @retval EFI_SUCCESS The attributes were set for the memory reg= ion. + @retval EFI_INVALID_PARAMETER Length is zero. + Attributes specified an illegal combinatio= n of + attributes that cannot be set together. + @retval EFI_UNSUPPORTED The processor does not support one or more + bytes of the memory resource range specifi= ed + by BaseAddress and Length. + The bit mask of attributes is not support = 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 instan= ce. + @param BaseAddress The physical address that is the start address= 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 memo= ry + region. + + @retval EFI_SUCCESS The attributes were set for the memory reg= ion. + @retval EFI_INVALID_PARAMETER Length is zero. + Attributes specified an illegal combinatio= n of + attributes that cannot be set together. + @retval EFI_UNSUPPORTED The processor does not support one or more + bytes of the memory resource range specifi= ed + by BaseAddress and Length. + The bit mask of attributes is not support = 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 p= art + of the memory region, EFI_NO_MAPPING will be returned. + + @param This The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instan= ce. + @param BaseAddress The physical address that is the start address= 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 me= mory + region. + @retval EFI_UNSUPPORTED The processor does not support one or more + bytes of the memory resource range specifi= ed + by BaseAddress and Length. + The bit mask of attributes is not support = 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, + OUT UINT64 *Attributes + ); + +/// +/// SMM Memory Attribute Protocol provides services to retrieve or update +/// attribute of memory 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 --=20 2.14.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel