From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from cxsh.intel-email.com (cxsh.intel-email.com [121.46.250.151]) by mx.groups.io with SMTP id smtpd.web11.4601.1675402117164409534 for ; Thu, 02 Feb 2023 21:28:39 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@byosoft.com.cn header.s=cloud-union header.b=WDldikDc; spf=pass (domain: byosoft.com.cn, ip: 121.46.250.151, mailfrom: gaoliming@byosoft.com.cn) Received: from cxsh.intel-email.com (localhost [127.0.0.1]) by cxsh.intel-email.com (Postfix) with ESMTP id A3508DDA87C for ; Fri, 3 Feb 2023 13:28:33 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=byosoft.com.cn; s=cloud-union; t=1675402113; bh=iEoinC/QLah9faANYX1mjYXw1iRe6+XQH3njWkLCPIE=; h=From:To:Cc:References:In-Reply-To:Subject:Date; b=WDldikDc3eYH2UggViL53FDYAwsSoAtWZ8VrfUCDaKIsIdGtFUJoYc8T+BHeIV7mJ rBX+0j5rsU5Xwq0VjdybvzUbGUtPrfn/bFdNx/u60RgLpu9iPQWpHWDUvp6hLyvqi8 2Uis+YKAZOrfgEFuKbqJhuFMv0HDl8x2HcCJA4as= Received: from localhost (localhost [127.0.0.1]) by cxsh.intel-email.com (Postfix) with ESMTP id 9E167DDA87A for ; Fri, 3 Feb 2023 13:28:33 +0800 (CST) Received: from cxsh.intel-email.com (localhost [127.0.0.1]) by cxsh.intel-email.com (Postfix) with ESMTP id 43735DDA86A for ; Fri, 3 Feb 2023 13:28:33 +0800 (CST) Authentication-Results: cxsh.intel-email.com; none Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by cxsh.intel-email.com (Postfix) with SMTP id D1746DDA86C for ; Fri, 3 Feb 2023 13:28:29 +0800 (CST) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Fri, 03 Feb 2023 13:28:22 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , Cc: "'Michael Kinney'" , "'Jiewen Yao'" , "'Michael Kubacki'" , "'Sean Brogan'" , "'Rebecca Cran'" , "'Leif Lindholm'" , "'Sami Mujawar'" , "'Taylor Beebe'" References: <20230202112722.2200755-1-ardb@kernel.org> <20230202112722.2200755-2-ardb@kernel.org> In-Reply-To: <20230202112722.2200755-2-ardb@kernel.org> Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIIHYyIDEvM10gTWRlUGtnOiBBZGQgTWVtb3J5IEF0dHJpYnV0ZSBQcm90b2NvbCBkZWZpbml0aW9u?= Date: Fri, 3 Feb 2023 13:28:25 +0800 Message-ID: <032101d93790$56c83540$04589fc0$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQHYf7I1AxYG6HenwtpAZdb2Zs64GwFDF8uarrQIhYA= Sender: "gaoliming" Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Reviewed-by: Liming Gao > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: devel@edk2.groups.io = =B4=FA=B1=ED Ard > Biesheuvel > =B7=A2=CB=CD=CA=B1=BC=E4: 2023=C4=EA2=D4=C22=C8=D5 19:27 > =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io > =B3=AD=CB=CD: Ard Biesheuvel ; Michael Kinney > ; Liming Gao ; > Jiewen Yao ; Michael Kubacki > ; Sean Brogan > ; Rebecca Cran ; > Leif Lindholm ; Sami Mujawar > ; Taylor Beebe > =D6=F7=CC=E2: [edk2-devel] [PATCH v2 1/3] MdePkg: Add Memory Attribute = Protocol > definition >=20 > Add the Memory Attribute Protocol definition, which was adopted and > included in version 2.10 of the UEFI specification. >=20 > Link: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3519 > Signed-off-by: Ard Biesheuvel > --- > MdePkg/Include/Protocol/MemoryAttribute.h | 142 > ++++++++++++++++++++ > MdePkg/MdePkg.dec | 3 + > 2 files changed, 145 insertions(+) >=20 > diff --git a/MdePkg/Include/Protocol/MemoryAttribute.h > b/MdePkg/Include/Protocol/MemoryAttribute.h > new file mode 100644 > index 000000000000..ff930fb21aa6 > --- /dev/null > +++ b/MdePkg/Include/Protocol/MemoryAttribute.h > @@ -0,0 +1,142 @@ > +/** @file >=20 > + >=20 > + EFI Memory Attribute Protocol provides retrieval and update service >=20 > + for memory attributes in EFI environment. >=20 > + >=20 > + Copyright (c) 2021, Intel Corporation. All rights reserved.
>=20 > + Copyright (c) 2023, Google LLC. All rights reserved.
>=20 > + SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > + >=20 > +**/ >=20 > + >=20 > +#ifndef __EFI_MEMORY_ATTRIBUTE_H__ >=20 > +#define __EFI_MEMORY_ATTRIBUTE_H__ >=20 > + >=20 > +#define EFI_MEMORY_ATTRIBUTE_PROTOCOL_GUID \ >=20 > + { \ >=20 > + 0xf4560cf6, 0x40ec, 0x4b4a, { 0xa1, 0x92, 0xbf, 0x1d, 0x57, 0xd0, 0xb1, > 0x89 } \ >=20 > + } >=20 > + >=20 > +typedef struct _EFI_MEMORY_ATTRIBUTE_PROTOCOL > EFI_MEMORY_ATTRIBUTE_PROTOCOL; >=20 > + >=20 > +/** >=20 > + This function set given attributes of the memory region specified = by >=20 > + BaseAddress and Length. >=20 > + >=20 > + The valid Attributes is EFI_MEMORY_RP, EFI_MEMORY_XP, and > EFI_MEMORY_RO. >=20 > + >=20 > + @param This The > EFI_MEMORY_ATTRIBUTE_PROTOCOL instance. >=20 > + @param BaseAddress The physical address that is the start > address of >=20 > + a memory region. >=20 > + @param Length The size in bytes of the memory region. >=20 > + @param Attributes The bit mask of attributes to set for the > memory >=20 > + region. >=20 > + >=20 > + @retval EFI_SUCCESS The attributes were set for the > memory region. >=20 > + @retval EFI_INVALID_PARAMETER Length is zero. >=20 > + Attributes specified an illegal > combination of >=20 > + attributes that cannot be set > together. >=20 > + @retval EFI_UNSUPPORTED The processor does not support one > or more >=20 > + bytes of the memory resource range > specified >=20 > + by BaseAddress and Length. >=20 > + The bit mask of attributes is not > supported for >=20 > + the memory resource range > specified by >=20 > + BaseAddress and Length. >=20 > + @retval EFI_OUT_OF_RESOURCES Requested attributes cannot be > applied due to >=20 > + lack of system resources. >=20 > + @retval EFI_ACCESS_DENIED Attributes for the requested memory > region are >=20 > + controlled by system firmware and > cannot be >=20 > + updated via the protocol. >=20 > + >=20 > +**/ >=20 > +typedef >=20 > +EFI_STATUS >=20 > +(EFIAPI *EFI_SET_MEMORY_ATTRIBUTES)( >=20 > + IN EFI_MEMORY_ATTRIBUTE_PROTOCOL *This, >=20 > + IN EFI_PHYSICAL_ADDRESS BaseAddress, >=20 > + IN UINT64 Length, >=20 > + IN UINT64 Attributes >=20 > + ); >=20 > + >=20 > +/** >=20 > + This function clears given attributes of the memory region = specified by >=20 > + BaseAddress and Length. >=20 > + >=20 > + The valid Attributes is EFI_MEMORY_RP, EFI_MEMORY_XP, and > EFI_MEMORY_RO. >=20 > + >=20 > + @param This The > EFI_MEMORY_ATTRIBUTE_PROTOCOL instance. >=20 > + @param BaseAddress The physical address that is the start > address of >=20 > + a memory region. >=20 > + @param Length The size in bytes of the memory region. >=20 > + @param Attributes The bit mask of attributes to clear for = the > memory >=20 > + region. >=20 > + >=20 > + @retval EFI_SUCCESS The attributes were cleared for the > memory region. >=20 > + @retval EFI_INVALID_PARAMETER Length is zero. >=20 > + Attributes specified an illegal > combination of >=20 > + attributes that cannot be cleared > together. >=20 > + @retval EFI_UNSUPPORTED The processor does not support one > or more >=20 > + bytes of the memory resource range > specified >=20 > + by BaseAddress and Length. >=20 > + The bit mask of attributes is not > supported for >=20 > + the memory resource range > specified by >=20 > + BaseAddress and Length. >=20 > + @retval EFI_OUT_OF_RESOURCES Requested attributes cannot be > applied due to >=20 > + lack of system resources. >=20 > + @retval EFI_ACCESS_DENIED Attributes for the requested memory > region are >=20 > + controlled by system firmware and > cannot be >=20 > + updated via the protocol. >=20 > + >=20 > +**/ >=20 > +typedef >=20 > +EFI_STATUS >=20 > +(EFIAPI *EFI_CLEAR_MEMORY_ATTRIBUTES)( >=20 > + IN EFI_MEMORY_ATTRIBUTE_PROTOCOL *This, >=20 > + IN EFI_PHYSICAL_ADDRESS BaseAddress, >=20 > + IN UINT64 Length, >=20 > + IN UINT64 Attributes >=20 > + ); >=20 > + >=20 > +/** >=20 > + This function retrieves the attributes of the memory region = specified by >=20 > + BaseAddress and Length. If different attributes are got from = different part >=20 > + of the memory region, EFI_NO_MAPPING will be returned. >=20 > + >=20 > + @param This The > EFI_MEMORY_ATTRIBUTE_PROTOCOL instance. >=20 > + @param BaseAddress The physical address that is the start > address of >=20 > + a memory region. >=20 > + @param Length The size in bytes of the memory region. >=20 > + @param Attributes Pointer to attributes returned. >=20 > + >=20 > + @retval EFI_SUCCESS The attributes got for the memory > region. >=20 > + @retval EFI_INVALID_PARAMETER Length is zero. >=20 > + Attributes is NULL. >=20 > + @retval EFI_NO_MAPPING Attributes are not consistent cross > the memory >=20 > + region. >=20 > + @retval EFI_UNSUPPORTED The processor does not support one > or more >=20 > + bytes of the memory resource range > specified >=20 > + by BaseAddress and Length. >=20 > + >=20 > +**/ >=20 > +typedef >=20 > +EFI_STATUS >=20 > +(EFIAPI *EFI_GET_MEMORY_ATTRIBUTES)( >=20 > + IN EFI_MEMORY_ATTRIBUTE_PROTOCOL *This, >=20 > + IN EFI_PHYSICAL_ADDRESS BaseAddress, >=20 > + IN UINT64 Length, >=20 > + OUT UINT64 *Attributes >=20 > + ); >=20 > + >=20 > +/// >=20 > +/// EFI Memory Attribute Protocol provides services to retrieve or = update >=20 > +/// attribute of memory in the EFI environment. >=20 > +/// >=20 > +struct _EFI_MEMORY_ATTRIBUTE_PROTOCOL { >=20 > + EFI_GET_MEMORY_ATTRIBUTES GetMemoryAttributes; >=20 > + EFI_SET_MEMORY_ATTRIBUTES SetMemoryAttributes; >=20 > + EFI_CLEAR_MEMORY_ATTRIBUTES ClearMemoryAttributes; >=20 > +}; >=20 > + >=20 > +extern EFI_GUID gEfiMemoryAttributeProtocolGuid; >=20 > + >=20 > +#endif >=20 > diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec > index 3d08f20d15b0..a8658403c8fd 100644 > --- a/MdePkg/MdePkg.dec > +++ b/MdePkg/MdePkg.dec > @@ -1915,6 +1915,9 @@ [Protocols] > ## Include/Protocol/RedfishDiscover.h >=20 > gEfiRedfishDiscoverProtocolGuid =3D { 0x5db12509, 0x4550, = 0x4347, > { 0x96, 0xb3, 0x73, 0xc0, 0xff, 0x6e, 0x86, 0x9f }} >=20 >=20 >=20 > + ## Include/Protocol/MemoryAttribute.h >=20 > + gEfiMemoryAttributeProtocolGuid =3D { 0xf4560cf6, 0x40ec, 0x4b4a, { = 0xa1, > 0x92, 0xbf, 0x1d, 0x57, 0xd0, 0xb1, 0x89 }} >=20 > + >=20 > # >=20 > # Protocols defined in Shell2.0 >=20 > # >=20 > -- > 2.39.0 >=20 >=20 >=20 > -=3D-=3D-=3D-=3D-=3D-=3D > Groups.io Links: You receive all messages sent to this group. > View/Reply Online (#99466): = https://edk2.groups.io/g/devel/message/99466 > Mute This Topic: https://groups.io/mt/96697936/4905953 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub > [gaoliming@byosoft.com.cn] > -=3D-=3D-=3D-=3D-=3D-=3D >=20