From nobody Fri May 3 21:08:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+51982+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51982+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1575647096; cv=none; d=zohomail.com; s=zohoarc; b=GeAN+AXsBYOTG8gPW0lGQqotYkEY1A0DWGN4XCU6lHo5UVIKVoXs1mN4e0BImin4u/O8DerMYiKz4EQ0gWSlDT1Db5TtBvY0vxe5RH28xaGlErC3+kyKtHDkvR28Scjq1NzG/1mX4stjuw1o3NzDtmqNAf93NxKWxUpj2CldwcU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575647096; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=rmNWsyFcN07pVggyX+Wi/e5FhNwHHJxJMRHF3un12Q4=; b=Codlp2ZzeHi/s5C/m96kicxyz8Ej9Py9mkKCRfh6hCEHcJmN0Bz68cj+T1stXQO+NMHkBJw61B/5ULC5knIlOC7qquxoT9uix8QJXbJs5NGi8LOY9+1qSDDJyl/5IJDh08YBbvj8PcU6TkXpUBDJToyMqFfhYSP1paucGeleRss= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51982+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1575647096069268.3701413309906; Fri, 6 Dec 2019 07:44:56 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Fri, 06 Dec 2019 07:44:55 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.5278.1575646185155062209 for ; Fri, 06 Dec 2019 07:29:45 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C22E8DA7; Fri, 6 Dec 2019 07:29:44 -0800 (PST) X-Received: from e123331-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 731423F718; Fri, 6 Dec 2019 07:29:43 -0800 (PST) From: Ard Biesheuvel To: devel@edk2.groups.io Cc: Ard Biesheuvel , Michael D Kinney , Leif Lindholm , Liming Gao , Hao A Wu , Eric Dong , Ray Ni , Achin Gupta , Jiewen Yao Subject: [edk2-devel] [PATCH 1/7] MdePkg: introduce MM communicate 2 protocol Date: Fri, 6 Dec 2019 15:29:40 +0000 Message-Id: <20191206152946.624-2-ard.biesheuvel@arm.com> In-Reply-To: <20191206152946.624-1-ard.biesheuvel@arm.com> References: <20191206152946.624-1-ard.biesheuvel@arm.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,ard.biesheuvel@arm.com X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1575647095; bh=yYGUA3ylw+6YXSLqisUUvCRkLhW/0f+itS2qYngOoSw=; h=Cc:Date:From:Reply-To:Subject:To; b=EyziqegJ6h/x8sZOgDoBtwPKkP6rYNlCuWagH3JXac3qIXA5Ky4pG82CjDeJCJkBlfp p2SQRzy5axDXCv5H4wZw3xK6kWx4Isk2zfJEApiW1akzncF4gobjwvwrvo6UeS2s3ioTQ oNf0/dh3RllO/uCud+yfIQWY0D4Akcujtqo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Ard Biesheuvel Add the protocol definition of the MM communicate 2 protocol, which is introduced in version 1.7 errata A of the PI spec. Signed-off-by: Ard Biesheuvel --- MdePkg/Include/Protocol/MmCommunication2.h | 69 ++++++++++++++++++++ MdePkg/MdePkg.dec | 7 ++ 2 files changed, 76 insertions(+) diff --git a/MdePkg/Include/Protocol/MmCommunication2.h b/MdePkg/Include/Pr= otocol/MmCommunication2.h new file mode 100644 index 000000000000..05f56dcae53e --- /dev/null +++ b/MdePkg/Include/Protocol/MmCommunication2.h @@ -0,0 +1,69 @@ +/** @file + EFI MM Communication Protocol 2 as defined in the PI 1.7 errata A specif= ication. + + This protocol provides a means of communicating between drivers outside = of MM and MMI + handlers inside of MM. + + Copyright (c) 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2019, Arm Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _MM_COMMUNICATION2_H_ +#define _MM_COMMUNICATION2_H_ + +#include + +#define EFI_MM_COMMUNICATION2_PROTOCOL_GUID \ + { \ + 0x378daedc, 0xf06b, 0x4446, { 0x83, 0x14, 0x40, 0xab, 0x93, 0x3c, 0x87= , 0xa3 } \ + } + +typedef struct _EFI_MM_COMMUNICATION2_PROTOCOL EFI_MM_COMMUNICATION2_PROT= OCOL; + +/** + Communicates with a registered handler. + + This function provides a service to send and receive messages from a reg= istered UEFI service. + + @param[in] This The EFI_MM_COMMUNICATION_PROTOCOL instanc= e. + @param[in] CommBufferPhysical Physical address of the MM communication = buffer + @param[in] CommBufferVirtual Virtual address of the MM communication b= uffer + @param[in] CommSize The size of the data buffer being passed = in. On exit, the size of data + being returned. Zero if the handler does = not wish to reply with any data. + This parameter is optional and may be NUL= L. + + @retval EFI_SUCCESS The message was successfully posted. + @retval EFI_INVALID_PARAMETER CommBufferPhysical was NULL or CommBuffer= Virtual was NULL. + @retval EFI_BAD_BUFFER_SIZE The buffer is too large for the MM implem= entation. + If this error is returned, the MessageLen= gth field + in the CommBuffer header or the integer p= ointed by + CommSize, are updated to reflect the maxi= mum payload + size the implementation can accommodate. + @retval EFI_ACCESS_DENIED The CommunicateBuffer parameter or CommSi= ze parameter, + if not omitted, are in address range that= cannot be + accessed by the MM environment. + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_MM_COMMUNICATE2)( + IN CONST EFI_MM_COMMUNICATION2_PROTOCOL *This, + IN OUT VOID *CommBufferPhysical, + IN OUT VOID *CommBufferVirtual, + IN OUT UINTN *CommSize OPTIONAL + ); + +/// +/// EFI MM Communication Protocol provides runtime services for communicat= ing +/// between DXE drivers and a registered MMI handler. +/// +struct _EFI_MM_COMMUNICATION2_PROTOCOL { + EFI_MM_COMMUNICATE2 Communicate; +}; + +extern EFI_GUID gEfiMmCommunication2ProtocolGuid; + +#endif + diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index d022cc5e3ef2..93037e0e6c61 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -1276,6 +1276,13 @@ [Protocols] ## Include/Protocol/SpiSmmNorFlash.h gEfiSpiSmmNorFlashProtocolGuid =3D { 0xaab18f19, 0xfe14, 0x4666,= { 0x86, 0x04, 0x87, 0xff, 0x6d, 0x66, 0x2c, 0x9a }} =20 + # + # Protocols defined in PI 1.7. + # + + ## Include/Protocol/MmCommunication2.h + gEfiMmCommunication2ProtocolGuid =3D { 0x378daedc, 0xf06b, 0x4446, { 0x= 83, 0x14, 0x40, 0xab, 0x93, 0x3c, 0x87, 0xa3 }} + # # Protocols defined in UEFI2.1/UEFI2.0/EFI1.1 # --=20 2.17.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 (#51982): https://edk2.groups.io/g/devel/message/51982 Mute This Topic: https://groups.io/mt/67497124/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- From nobody Fri May 3 21:08:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+51979+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51979+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1575647095; cv=none; d=zohomail.com; s=zohoarc; b=hZ+Y+uS+VfDh3xs7uo9O1wysbNTFyoXF2FGmm9qqQZQYNlSk4p0G48VK8InKrROlOSg2g8tdZe38cfQqp03+4x8I7LPM0SadqN1uYTsjGt9xyTJ1MpeuMY357Vmi1//NhzOV7dIFhanYtAl+RIXlN5R0z0pdRGMnGKE4SSd0TKo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575647095; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=7jKavuG8NE0mCSyZrCotuLIZNoLLhyQJCAGMH39T0Ig=; b=dgCj5QG+dqcZA63TZ0/Oczf8K0eYcQfzGV//84ZPShxGtS9IJBIzQZTjWyjeUhZ9ygwanc6f9imzTDro1KsaQ18+0VwosY29LamoKZXKbBml5PXbvkud9a5a7E2bAMO3vxrfJvjoTPRfVewj/dumsqVJcrgLZdB/hunn59YuSio= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51979+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1575647095184936.1586590988725; Fri, 6 Dec 2019 07:44:55 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Fri, 06 Dec 2019 07:44:54 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.5248.1575646186807335411 for ; Fri, 06 Dec 2019 07:29:46 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 576C231B; Fri, 6 Dec 2019 07:29:46 -0800 (PST) X-Received: from e123331-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 036A73F718; Fri, 6 Dec 2019 07:29:44 -0800 (PST) From: Ard Biesheuvel To: devel@edk2.groups.io Cc: Ard Biesheuvel , Michael D Kinney , Leif Lindholm , Liming Gao , Hao A Wu , Eric Dong , Ray Ni , Achin Gupta , Jiewen Yao Subject: [edk2-devel] [PATCH 2/7] MdeModulePkg/SmmIpl: expose MM communicate 2 protocol Date: Fri, 6 Dec 2019 15:29:41 +0000 Message-Id: <20191206152946.624-3-ard.biesheuvel@arm.com> In-Reply-To: <20191206152946.624-1-ard.biesheuvel@arm.com> References: <20191206152946.624-1-ard.biesheuvel@arm.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,ard.biesheuvel@arm.com X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1575647094; bh=LdXGd4kXtOilaEEGG/91L0AnJ6xIXe2JMlGOS/4TNy4=; h=Cc:Date:From:Reply-To:Subject:To; b=WvH/Qrbd/Ez9rh6BWJrM0Qzn3SMiWriJC68ehBkIQ2Cz4jQC4Ww7WO60tEKApRAUdOr AJH/+QhnF7RSF1UUbU6fZmz4K/+/+1cmq1Z47UxA5patQx2Yd0g+SLDZC5+AUjjc0qaR/ c7xp3EJF8qd2SO7yH4FaAhFn022Iu5uQDJQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Ard Biesheuvel The MM communicate 2 protocol was introduced to factor out the mismatch between traditional MM, which requires the physical address of the MM buffer to be passed, and standalone MM, which copies the MM communicate buffer data into a separate buffer, requiring the virtual address. For this reason, MM communicate 2 carries both addresses, allowing the implementation to decide which address it needs. This hides this implementation detail from the callers of the protocol, which simply passes both addresses without having to reason about what the implementation of the protocol actually needs. Note that the old version of the protocol is retained, in order to support existing implementations that don't require this flexibility. Signed-off-by: Ard Biesheuvel --- MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c | 79 ++++++++++++++++++++ MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf | 1 + 2 files changed, 80 insertions(+) diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c b/MdeModulePkg/Core/PiS= mmCore/PiSmmIpl.c index 1cf8c93227a3..d86b8b4a6a29 100644 --- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c @@ -10,6 +10,7 @@ =20 #include #include +#include #include #include #include @@ -118,6 +119,39 @@ SmmCommunicationCommunicate ( IN OUT UINTN *CommSize OPTIONAL ); =20 +/** + Communicates with a registered handler. + + This function provides a service to send and receive messages from a reg= istered UEFI service. + + @param[in] This The EFI_MM_COMMUNICATION_PROTOCOL instanc= e. + @param[in] CommBufferPhysical Physical address of the MM communication = buffer + @param[in] CommBufferVirtual Virtual address of the MM communication b= uffer + @param[in] CommSize The size of the data buffer being passed = in. On exit, the size of data + being returned. Zero if the handler does = not wish to reply with any data. + This parameter is optional and may be NUL= L. + + @retval EFI_SUCCESS The message was successfully posted. + @retval EFI_INVALID_PARAMETER The CommBuffer was NULL. + @retval EFI_BAD_BUFFER_SIZE The buffer is too large for the MM implem= entation. + If this error is returned, the MessageLen= gth field + in the CommBuffer header or the integer p= ointed by + CommSize, are updated to reflect the maxi= mum payload + size the implementation can accommodate. + @retval EFI_ACCESS_DENIED The CommunicateBuffer parameter or CommSi= ze parameter, + if not omitted, are in address range that= cannot be + accessed by the MM environment. + +**/ +EFI_STATUS +EFIAPI +SmmCommunicationMmCommunicate2 ( + IN CONST EFI_MM_COMMUNICATION2_PROTOCOL *This, + IN OUT VOID *CommBufferPhysical, + IN OUT VOID *CommBufferVirtual, + IN OUT UINTN *CommSize OPTIONAL + ); + /** Event notification that is fired every time a gEfiSmmConfigurationProtoc= ol installs. =20 @@ -240,6 +274,13 @@ EFI_SMM_COMMUNICATION_PROTOCOL mSmmCommunication =3D { SmmCommunicationCommunicate }; =20 +// +// PI 1.7 MM Communication Protocol 2 instance +// +EFI_MM_COMMUNICATION2_PROTOCOL mMmCommunication2 =3D { + SmmCommunicationMmCommunicate2 +}; + // // SMM Core Private Data structure that contains the data shared between // the SMM IPL and the SMM Core. @@ -576,6 +617,44 @@ SmmCommunicationCommunicate ( return (Status =3D=3D EFI_SUCCESS) ? EFI_SUCCESS : EFI_NOT_FOUND; } =20 +/** + Communicates with a registered handler. + + This function provides a service to send and receive messages from a reg= istered UEFI service. + + @param[in] This The EFI_MM_COMMUNICATION_PROTOCOL instanc= e. + @param[in] CommBufferPhysical Physical address of the MM communication = buffer + @param[in] CommBufferVirtual Virtual address of the MM communication b= uffer + @param[in] CommSize The size of the data buffer being passed = in. On exit, the size of data + being returned. Zero if the handler does = not wish to reply with any data. + This parameter is optional and may be NUL= L. + + @retval EFI_SUCCESS The message was successfully posted. + @retval EFI_INVALID_PARAMETER The CommBuffer was NULL. + @retval EFI_BAD_BUFFER_SIZE The buffer is too large for the MM implem= entation. + If this error is returned, the MessageLen= gth field + in the CommBuffer header or the integer p= ointed by + CommSize, are updated to reflect the maxi= mum payload + size the implementation can accommodate. + @retval EFI_ACCESS_DENIED The CommunicateBuffer parameter or CommSi= ze parameter, + if not omitted, are in address range that= cannot be + accessed by the MM environment. + +**/ +EFI_STATUS +EFIAPI +SmmCommunicationMmCommunicate2 ( + IN CONST EFI_MM_COMMUNICATION2_PROTOCOL *This, + IN OUT VOID *CommBufferPhysical, + IN OUT VOID *CommBufferVirtual, + IN OUT UINTN *CommSize OPTIONAL + ) +{ + return SmmCommunicationCommunicate (&mSmmCommunication, + CommBufferPhysical, + CommSize); +} + /** Event notification that is fired when GUIDed Event Group is signaled. =20 diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf b/MdeModulePkg/Core/P= iSmmCore/PiSmmIpl.inf index b6b1bbcdac51..0a05d593522e 100644 --- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf @@ -50,6 +50,7 @@ [LibraryClasses] [Protocols] gEfiSmmBase2ProtocolGuid ## PRODUCES gEfiSmmCommunicationProtocolGuid ## PRODUCES + gEfiMmCommunication2ProtocolGuid ## PRODUCES gEfiSmmAccess2ProtocolGuid ## CONSUMES ## NOTIFY ## CONSUMES --=20 2.17.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 (#51979): https://edk2.groups.io/g/devel/message/51979 Mute This Topic: https://groups.io/mt/67497118/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- From nobody Fri May 3 21:08:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+51980+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51980+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1575647095; cv=none; d=zohomail.com; s=zohoarc; b=VpmAo0IUAKMMrOvg5UilP9+FjS4O/08TQE5GeppElpcS7U98pfeyYgboROnSYqWpulBK7JWRTnbNDsr53i5BQhK7+jFO5lPFFyQwyIaAmOF0qdKYIvkG7tOSaA8sFgrtoBhJEKkyEE1krIFR+jYUeHTIe3AZIezC5dDmt6R0tVU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575647095; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=MM67lpkBSn3itmODdE+qpYrE6mRZSnRgsw2P+NddJgQ=; b=ix57ubY4SzIcfcVG8gQO2xJP69n+6RRa1qNcNgxnUsJJn+X2eNv6iAAebjPM1Ag1SVxQzfIHs7ZmsJCJKlBkNmteOvjOmqo9wcf0V5Ty7PN8lOYy60B7jyXG+FfXBGfQR4Bz2ZyObSlOYECe14csAKJDDkHgW8v3PKcxpa2Dj6c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51980+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1575647095588837.7356490266388; Fri, 6 Dec 2019 07:44:55 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Fri, 06 Dec 2019 07:44:54 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.5281.1575646188266530888 for ; Fri, 06 Dec 2019 07:29:48 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DB991DA7; Fri, 6 Dec 2019 07:29:47 -0800 (PST) X-Received: from e123331-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8C58B3F718; Fri, 6 Dec 2019 07:29:46 -0800 (PST) From: Ard Biesheuvel To: devel@edk2.groups.io Cc: Ard Biesheuvel , Michael D Kinney , Leif Lindholm , Liming Gao , Hao A Wu , Eric Dong , Ray Ni , Achin Gupta , Jiewen Yao Subject: [edk2-devel] [PATCH 3/7] ArmPkg/MmCommunicationDxe: expose MM Communicate 2 protocol Date: Fri, 6 Dec 2019 15:29:42 +0000 Message-Id: <20191206152946.624-4-ard.biesheuvel@arm.com> In-Reply-To: <20191206152946.624-1-ard.biesheuvel@arm.com> References: <20191206152946.624-1-ard.biesheuvel@arm.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,ard.biesheuvel@arm.com X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1575647094; bh=GH4TSBsshKQgfb1D3WQsCIf2t6LIoXnWL2qA/bTsqug=; h=Cc:Date:From:Reply-To:Subject:To; b=lXczAvZ8+gRzPUodrNhOe5aC5H2hwTRYpAmhC6GIRHeY0cpHrPnYtW3kfFJp5e/hrKt HRZPL/KBoGS5SQL9w+S9OTZc1ieXQ/7Qnc3G2QC72iZUSdMaS7geyKbNeCjwNzkSs8sgU kztdKKnSIoYKjhcXcaVS6C1sYt2rJZ6TzhA= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Ard Biesheuvel Implement the new MmCommunication2 protocol which supports the use of standalone MM at runtime inside an address space that has been virtually remapped by the OS. Note that the implementation of the old MM Communicate protocol is removed: it never worked correctly so there is no point in keeping it. Signed-off-by: Ard Biesheuvel --- ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c | 79 +++++++++------= ----- ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf | 6 +- 2 files changed, 40 insertions(+), 45 deletions(-) diff --git a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c b/ArmPkg/D= rivers/MmCommunicationDxe/MmCommunication.c index d06dcc4d2080..dc2af35f8617 100644 --- a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c +++ b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.c @@ -1,6 +1,6 @@ /** @file =20 - Copyright (c) 2016-2018, ARM Limited. All rights reserved. + Copyright (c) 2016-2019, ARM Limited. All rights reserved. =20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -16,7 +16,7 @@ #include #include =20 -#include +#include =20 #include =20 @@ -39,39 +39,34 @@ STATIC EFI_HANDLE mMmCommunicateHandle; /** Communicates with a registered handler. =20 - This function provides an interface to send and receive messages to the - Standalone MM environment on behalf of UEFI services. This function is = part - of the MM Communication Protocol that may be called in physical mode pri= or to - SetVirtualAddressMap() and in virtual mode after SetVirtualAddressMap(). + This function provides a service to send and receive messages from a reg= istered UEFI service. =20 - @param[in] This The EFI_MM_COMMUNICATION_PROTOCOL - instance. - @param[in, out] CommBuffer A pointer to the buffer to convey - into MMRAM. - @param[in, out] CommSize The size of the data buffer being - passed in. This is optional. + @param[in] This The EFI_MM_COMMUNICATION_PROTOCOL instanc= e. + @param[in] CommBufferPhysical Physical address of the MM communication = buffer + @param[in] CommBufferVirtual Virtual address of the MM communication b= uffer + @param[in] CommSize The size of the data buffer being passed = in. On exit, the size of data + being returned. Zero if the handler does = not wish to reply with any data. + This parameter is optional and may be NUL= L. + + @retval EFI_SUCCESS The message was successfully posted. + @retval EFI_INVALID_PARAMETER CommBufferPhysical was NULL or CommBuffer= Virtual was NULL. + @retval EFI_BAD_BUFFER_SIZE The buffer is too large for the MM implem= entation. + If this error is returned, the MessageLen= gth field + in the CommBuffer header or the integer p= ointed by + CommSize, are updated to reflect the maxi= mum payload + size the implementation can accommodate. + @retval EFI_ACCESS_DENIED The CommunicateBuffer parameter or CommSi= ze parameter, + if not omitted, are in address range that= cannot be + accessed by the MM environment. =20 - @retval EFI_SUCCESS The message was successfully posted. - @retval EFI_INVALID_PARAMETER The CommBuffer was NULL. - @retval EFI_BAD_BUFFER_SIZE The buffer size is incorrect for the= MM - implementation. If this error is - returned, the MessageLength field in - the CommBuffer header or the integer - pointed by CommSize are updated to r= eflect - the maximum payload size the - implementation can accommodate. - @retval EFI_ACCESS_DENIED The CommunicateBuffer parameter - or CommSize parameter, if not omitte= d, - are in address range that cannot be - accessed by the MM environment **/ -STATIC EFI_STATUS EFIAPI -MmCommunicationCommunicate ( - IN CONST EFI_MM_COMMUNICATION_PROTOCOL *This, - IN OUT VOID *CommBuffer, - IN OUT UINTN *CommSize OPTIONAL +MmCommunication2Communicate ( + IN CONST EFI_MM_COMMUNICATION2_PROTOCOL *This, + IN OUT VOID *CommBufferPhysical, + IN OUT VOID *CommBufferVirtual, + IN OUT UINTN *CommSize OPTIONAL ) { EFI_MM_COMMUNICATE_HEADER *CommunicateHeader; @@ -87,11 +82,11 @@ MmCommunicationCommunicate ( // // Check parameters // - if (CommBuffer =3D=3D NULL) { + if (CommBufferVirtual =3D=3D NULL) { return EFI_INVALID_PARAMETER; } =20 - CommunicateHeader =3D CommBuffer; + CommunicateHeader =3D CommBufferVirtual; // CommBuffer is a mandatory parameter. Hence, Rely on // MessageLength + Header to ascertain the // total size of the communication payload rather than @@ -136,7 +131,7 @@ MmCommunicationCommunicate ( CommunicateSmcArgs.Arg1 =3D 0; =20 // Copy Communication Payload - CopyMem ((VOID *)mNsCommBuffMemRegion.VirtualBase, CommBuffer, BufferSiz= e); + CopyMem ((VOID *)mNsCommBuffMemRegion.VirtualBase, CommBufferVirtual, Bu= fferSize); =20 // comm_buffer_address (64-bit physical address) CommunicateSmcArgs.Arg2 =3D (UINTN)mNsCommBuffMemRegion.PhysicalBase; @@ -149,7 +144,7 @@ MmCommunicationCommunicate ( =20 switch (CommunicateSmcArgs.Arg0) { case ARM_SMC_MM_RET_SUCCESS: - ZeroMem (CommBuffer, BufferSize); + ZeroMem (CommBufferVirtual, BufferSize); // On successful return, the size of data being returned is inferred f= rom // MessageLength + Header. CommunicateHeader =3D (EFI_MM_COMMUNICATE_HEADER *)mNsCommBuffMemRegio= n.VirtualBase; @@ -158,7 +153,7 @@ MmCommunicationCommunicate ( sizeof (CommunicateHeader->MessageLength); =20 CopyMem ( - CommBuffer, + CommBufferVirtual, (VOID *)mNsCommBuffMemRegion.VirtualBase, BufferSize ); @@ -191,8 +186,8 @@ MmCommunicationCommunicate ( // // MM Communication Protocol instance // -EFI_MM_COMMUNICATION_PROTOCOL mMmCommunication =3D { - MmCommunicationCommunicate +STATIC EFI_MM_COMMUNICATION2_PROTOCOL mMmCommunication2 =3D { + MmCommunication2Communicate }; =20 /** @@ -275,7 +270,7 @@ GetMmCompatibility () **/ EFI_STATUS EFIAPI -MmCommunicationInitialize ( +MmCommunication2Initialize ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) @@ -325,9 +320,9 @@ MmCommunicationInitialize ( // Install the communication protocol Status =3D gBS->InstallProtocolInterface ( &mMmCommunicateHandle, - &gEfiMmCommunicationProtocolGuid, + &gEfiMmCommunication2ProtocolGuid, EFI_NATIVE_INTERFACE, - &mMmCommunication + &mMmCommunication2 ); if (EFI_ERROR(Status)) { DEBUG ((DEBUG_ERROR, "MmCommunicationInitialize: " @@ -351,8 +346,8 @@ MmCommunicationInitialize ( =20 gBS->UninstallProtocolInterface ( mMmCommunicateHandle, - &gEfiMmCommunicationProtocolGuid, - &mMmCommunication + &gEfiMmCommunication2ProtocolGuid, + &mMmCommunication2 ); =20 CleanAddedMemorySpace: diff --git a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf b/ArmPkg= /Drivers/MmCommunicationDxe/MmCommunication.inf index 450fc9bb5414..9612cfbe5b6c 100644 --- a/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf +++ b/ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf @@ -2,7 +2,7 @@ # # DXE MM Communicate driver # -# Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. +# Copyright (c) 2016 - 2019, ARM Limited. All rights reserved. # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -14,7 +14,7 @@ [Defines] FILE_GUID =3D 09EE81D3-F15E-43F4-85B4-CB9873DA5D6B MODULE_TYPE =3D DXE_RUNTIME_DRIVER VERSION_STRING =3D 1.0 - ENTRY_POINT =3D MmCommunicationInitialize + ENTRY_POINT =3D MmCommunication2Initialize =20 # # The following is for reference only and not required by @@ -40,7 +40,7 @@ [LibraryClasses] UefiDriverEntryPoint =20 [Protocols] - gEfiMmCommunicationProtocolGuid ## PRODUCES + gEfiMmCommunication2ProtocolGuid ## PRODUCES =20 [Pcd.common] gArmTokenSpaceGuid.PcdMmBufferBase --=20 2.17.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 (#51980): https://edk2.groups.io/g/devel/message/51980 Mute This Topic: https://groups.io/mt/67497119/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- From nobody Fri May 3 21:08:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+51983+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51983+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1575647096; cv=none; d=zohomail.com; s=zohoarc; b=Iv31/pW7CJPoKB9rZ6QRSC01DSxT0QKwlylCDb7hAQTeRH0iZBVMRFcY0P7Dr6El5GJbnvc+h+w8VfsL/yathsfIzG4ncfRtD+MorP9OicQSwZXOY5uQKybA528wSkK0ixksRcwVyTt3rO1gB9eKIiDUzgr8LloKUXPLmSO4XGA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575647096; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=QzwxREdw6MAgvraWn4K+Z5bfZUeIq0mAWXE4UDeyoDA=; b=LRhKpvj0oLvh48F/1IUQtexetC1Ec8LB/0jb9KwvGONCUnXcIIXLJHCyYywwRX1yrRL63MTFItTqjmMpGCr/8YIfyQxDv54zC2Q4YmdsJoXWpVVD2RdEFROkyCHqzeFLv8nWP7uHr/zJ2q+swi+Kw+VWssMAOzHsXsfBH7XCP/k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51983+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1575647096543535.5762786092344; Fri, 6 Dec 2019 07:44:56 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Fri, 06 Dec 2019 07:44:55 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.5249.1575646189745760030 for ; Fri, 06 Dec 2019 07:29:49 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6C00831B; Fri, 6 Dec 2019 07:29:49 -0800 (PST) X-Received: from e123331-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 1C21E3F718; Fri, 6 Dec 2019 07:29:48 -0800 (PST) From: Ard Biesheuvel To: devel@edk2.groups.io Cc: Ard Biesheuvel , Michael D Kinney , Leif Lindholm , Liming Gao , Hao A Wu , Eric Dong , Ray Ni , Achin Gupta , Jiewen Yao Subject: [edk2-devel] [PATCH 4/7] MdeModulePkg/VariableInfo: switch to MM communicate 2 protocol Date: Fri, 6 Dec 2019 15:29:43 +0000 Message-Id: <20191206152946.624-5-ard.biesheuvel@arm.com> In-Reply-To: <20191206152946.624-1-ard.biesheuvel@arm.com> References: <20191206152946.624-1-ard.biesheuvel@arm.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,ard.biesheuvel@arm.com X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1575647095; bh=pZOFT6j28fAc+8xrkhAiL4ltFu+ItQLEIrn6LDMRShw=; h=Cc:Date:From:Reply-To:Subject:To; b=wQYTGIhTs046Rnpa9hHWm31emDGqLXgoD4rPBfdTkhoS8MeNY0F8SY4Q09ywQUk0Oth SSYE8FUhpFRRvAstwovHRJ6mKgUBVjpGvhbTW1SudiXAsJWTofVo9fGDdkvnlUu/mXU8o k9QiPMCSb9sRglCu9kAeDmUg+XxYyVXaH2Y= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Ard Biesheuvel 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/MdeModu= lePkg/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 =20 -EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication =3D NULL; +EFI_MM_COMMUNICATION2_PROTOCOL *mMmCommunication2 =3D NULL; =20 /** This function get the variable statistics data from SMM variable driver. @@ -41,7 +41,7 @@ EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication =3D NU= LL; 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; =20 CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gEfiSmmVariableProtocolGui= d); - SmmCommunicateHeader->MessageLength =3D *SmmCommunicateSize - OFFSET_OF = (EFI_SMM_COMMUNICATE_HEADER, Data); + SmmCommunicateHeader->MessageLength =3D *SmmCommunicateSize - OFFSET_OF = (EFI_MM_COMMUNICATE_HEADER, Data); =20 SmmVariableFunctionHeader =3D (SMM_VARIABLE_COMMUNICATE_HEADER *) &SmmCo= mmunicateHeader->Data[0]; SmmVariableFunctionHeader->Function =3D SMM_VARIABLE_FUNCTION_GET_STATIS= TICS; =20 - Status =3D mSmmCommunication->Communicate (mSmmCommunication, SmmCommuni= cateHeader, SmmCommunicateSize); + Status =3D mMmCommunication2->Communicate (mMmCommunication2, + SmmCommunicateHeader, + SmmCommunicateHeader, + SmmCommunicateSize); ASSERT_EFI_ERROR (Status); =20 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; } =20 - 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->Phy= sicalStart; + CommBuffer =3D (EFI_MM_COMMUNICATE_HEADER *) (UINTN) Entry->Phys= icalStart; } } } diff --git a/MdeModulePkg/Application/VariableInfo/VariableInfo.inf b/MdeMo= dulePkg/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 =20 [Protocols] - gEfiSmmCommunicationProtocolGuid ## SOMETIMES_CONSUMES + gEfiMmCommunication2ProtocolGuid ## SOMETIMES_CONSUMES =20 ## UNDEFINED # Used to do smm communication ## SOMETIMES_CONSUMES --=20 2.17.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 (#51983): https://edk2.groups.io/g/devel/message/51983 Mute This Topic: https://groups.io/mt/67497127/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- From nobody Fri May 3 21:08:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+51984+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51984+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1575647096; cv=none; d=zohomail.com; s=zohoarc; b=QirbJjQs0U/cM/CrLem1D9kLOaMb6EjKfwbx9D3wHxFF5hHXiLsHOu82tSfK1ZMNUOfOVt2M2gukRSXLb3FbVGwTYysGcxK/qaYkOyDf1PJ4YSw8zzxkrP8bXHw27b6tkNqRzOmeJkH164AXeSX9op4JEZSDVOV5Klj75Zo5lQI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575647096; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=9KwdKPv2bXSDGhtSDyvx3pM1R4rt+LwcN5CJQuBQsag=; b=IeCGhRvzkvOMtah0JGHvWlyo9Qr220oURc3OjvyPSDK1x6EFImkljAT3o8/tNKemPfCZ5qZlFbZkguLdMDJhXVgN+knd9iDgaYgKctlpeaL1dGsTIcGbe1sgzsQTRVCLAThv4RdM4C/X/sYn58/4xM7i0y/fgEzxOv2HPuXVE1o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51984+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1575647096068966.8605027345646; Fri, 6 Dec 2019 07:44:56 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Fri, 06 Dec 2019 07:44:55 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.5118.1575646191543794360 for ; Fri, 06 Dec 2019 07:29:51 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EF578DA7; Fri, 6 Dec 2019 07:29:50 -0800 (PST) X-Received: from e123331-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 9FD093F718; Fri, 6 Dec 2019 07:29:49 -0800 (PST) From: Ard Biesheuvel To: devel@edk2.groups.io Cc: Ard Biesheuvel , Michael D Kinney , Leif Lindholm , Liming Gao , Hao A Wu , Eric Dong , Ray Ni , Achin Gupta , Jiewen Yao Subject: [edk2-devel] [PATCH 5/7] MdeModulePkg/FaultTolerantWriteSmmDxe: switch to MM communicate 2 protocol Date: Fri, 6 Dec 2019 15:29:44 +0000 Message-Id: <20191206152946.624-6-ard.biesheuvel@arm.com> In-Reply-To: <20191206152946.624-1-ard.biesheuvel@arm.com> References: <20191206152946.624-1-ard.biesheuvel@arm.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,ard.biesheuvel@arm.com X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1575647095; bh=9iNBqMFXoVsILn/k0soMEeyU+eqJGMKVcCOVaXYWgsM=; h=Cc:Date:From:Reply-To:Subject:To; b=c4n7hhMMHuKJyMaLbuGgnKuVT7m7rL7fJEBR0kraAuVGO69Si5zVg8IoJRQQ2cdpn9B L3hq6ZGaj6P6XV5Q5w8hIfAEyStzmoprCOTv2BZUj1dl4cOW3HxXrosxnt2yhLgl0UuEf dF7x2OGGbFBRstVYKtSQUzj0d2hTP0qyJqw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Ard Biesheuvel Switch to the new MM communicate 2 protocol which supports both traditional and standalone MM. Signed-off-by: Ard Biesheuvel --- MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmCommon.h= | 2 +- MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe.c = | 25 +++++++++++--------- MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe.h = | 2 +- MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe.inf = | 4 ++-- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrit= eSmmCommon.h b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWr= iteSmmCommon.h index 4546a1b445b9..5f0eec0506ed 100644 --- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmCom= mon.h +++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmCom= mon.h @@ -29,7 +29,7 @@ typedef struct { /// /// Size of SMM communicate header, without including the payload. /// -#define SMM_COMMUNICATE_HEADER_SIZE (OFFSET_OF (EFI_SMM_COMMUNICATE_HEADE= R, Data)) +#define SMM_COMMUNICATE_HEADER_SIZE (OFFSET_OF (EFI_MM_COMMUNICATE_HEADER= , Data)) =20 /// /// Size of SMM FTW communicate function header, without including the pay= load. diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrit= eSmmDxe.c b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite= SmmDxe.c index 6e3eb3b58b09..24c20950296d 100644 --- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe= .c +++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe= .c @@ -11,7 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include "FaultTolerantWriteSmmDxe.h" =20 EFI_HANDLE mHandle =3D NULL; -EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication =3D NULL; +EFI_MM_COMMUNICATION2_PROTOCOL *mMmCommunication2 =3D NULL; UINTN mPrivateDataSize =3D 0; =20 EFI_FAULT_TOLERANT_WRITE_PROTOCOL mFaultTolerantWriteDriver =3D { @@ -40,7 +40,7 @@ InitCommunicateBuffer ( IN UINTN Function ) { - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; + EFI_MM_COMMUNICATE_HEADER *SmmCommunicateHeader; SMM_FTW_COMMUNICATE_FUNCTION_HEADER *SmmFtwFunctionHeader; =20 // @@ -74,7 +74,7 @@ InitCommunicateBuffer ( **/ EFI_STATUS SendCommunicateBuffer ( - IN OUT EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader, + IN OUT EFI_MM_COMMUNICATE_HEADER *SmmCommunicateHeader, IN UINTN DataSize ) { @@ -83,7 +83,10 @@ SendCommunicateBuffer ( SMM_FTW_COMMUNICATE_FUNCTION_HEADER *SmmFtwFunctionHeader; =20 CommSize =3D DataSize + SMM_COMMUNICATE_HEADER_SIZE + SMM_FTW_COMMUNICAT= E_HEADER_SIZE; - Status =3D mSmmCommunication->Communicate (mSmmCommunication, SmmCommuni= cateHeader, &CommSize); + Status =3D mMmCommunication2->Communicate (mMmCommunication2, + SmmCommunicateHeader, + SmmCommunicateHeader, + &CommSize); ASSERT_EFI_ERROR (Status); =20 SmmFtwFunctionHeader =3D (SMM_FTW_COMMUNICATE_FUNCTION_HEADER *) SmmComm= unicateHeader->Data; @@ -148,7 +151,7 @@ FtwGetMaxBlockSize ( { EFI_STATUS Status; UINTN PayloadSize; - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; + EFI_MM_COMMUNICATE_HEADER *SmmCommunicateHeader; SMM_FTW_GET_MAX_BLOCK_SIZE_HEADER *SmmFtwBlockSizeHeader; =20 // @@ -204,7 +207,7 @@ FtwAllocate ( { EFI_STATUS Status; UINTN PayloadSize; - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; + EFI_MM_COMMUNICATE_HEADER *SmmCommunicateHeader; SMM_FTW_ALLOCATE_HEADER *SmmFtwAllocateHeader; =20 // @@ -270,7 +273,7 @@ FtwWrite ( { EFI_STATUS Status; UINTN PayloadSize; - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; + EFI_MM_COMMUNICATE_HEADER *SmmCommunicateHeader; SMM_FTW_WRITE_HEADER *SmmFtwWriteHeader; =20 // @@ -336,7 +339,7 @@ FtwRestart ( { EFI_STATUS Status; UINTN PayloadSize; - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; + EFI_MM_COMMUNICATE_HEADER *SmmCommunicateHeader; SMM_FTW_RESTART_HEADER *SmmFtwRestartHeader; =20 // @@ -381,7 +384,7 @@ FtwAbort ( ) { EFI_STATUS Status; - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; + EFI_MM_COMMUNICATE_HEADER *SmmCommunicateHeader; =20 // // Initialize the communicate buffer. @@ -438,7 +441,7 @@ FtwGetLastWrite ( { EFI_STATUS Status; UINTN PayloadSize; - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; + EFI_MM_COMMUNICATE_HEADER *SmmCommunicateHeader; SMM_FTW_GET_LAST_WRITE_HEADER *SmmFtwGetLastWriteHeader; =20 // @@ -501,7 +504,7 @@ SmmFtwReady ( return; } =20 - Status =3D gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL,= (VOID **) &mSmmCommunication); + Status =3D gBS->LocateProtocol (&gEfiMmCommunication2ProtocolGuid, NULL,= (VOID **) &mMmCommunication2); ASSERT_EFI_ERROR (Status); =20 // diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrit= eSmmDxe.h b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite= SmmDxe.h index 22df9103d21a..a15644abd731 100644 --- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe= .h +++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe= .h @@ -13,7 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =20 #include =20 -#include +#include =20 #include #include diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrit= eSmmDxe.inf b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWri= teSmmDxe.inf index f5dc4bb4fee3..f0dd829653f1 100644 --- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe= .inf +++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe= .inf @@ -45,7 +45,7 @@ [LibraryClasses] =20 [Protocols] gEfiFaultTolerantWriteProtocolGuid ## PRODUCES - gEfiSmmCommunicationProtocolGuid ## CONSUMES + gEfiMmCommunication2ProtocolGuid ## CONSUMES ## NOTIFY ## UNDEFINED # Used to do smm communication ## CONSUMES @@ -53,7 +53,7 @@ [Protocols] gEfiFirmwareVolumeBlockProtocolGuid ## CONSUMES =20 [Depex] - gEfiSmmCommunicationProtocolGuid + gEfiMmCommunication2ProtocolGuid =20 [UserExtensions.TianoCore."ExtraFiles"] FaultTolerantWriteSmmDxeExtra.uni --=20 2.17.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 (#51984): https://edk2.groups.io/g/devel/message/51984 Mute This Topic: https://groups.io/mt/67497130/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- From nobody Fri May 3 21:08:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+51985+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51985+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1575647096; cv=none; d=zohomail.com; s=zohoarc; b=dFSf+H2LPHhkz30uOC6NF585TWnZlIEVawJP2zTnhWeIUybXYurAhKCcUzaz9cfM1/zPEFCap8hs3WsACYgckZyUEa4b2rbvztT/RZ7DN7IPk8Nh61oJL4Qm4C8sXxVzl3vpCk22Dl8RI1ByIpca2NFB7nm3RdTCle2DhtuFZNw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575647096; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=2TmGiiKcgQ24RLaNg7vk0jBrCVGR1B6mMc3XqGImOZ4=; b=YaDzEOKbpUmn9rrN0FaztUstGpAX067hsZyvo5FeRCZyyGpzQlrYqIAVCh7IBclzbYpvyZnqUN4Uoha9TwmO4IlsFq3jhtOizOPDQiMFDZlzG1QQcQDTml+yBxwFfCg9Sja71+zh/hkQ4/bj9xRYWxrWGcolhS84zdPO9j5YYMY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51985+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 157564709688551.20067352942294; Fri, 6 Dec 2019 07:44:56 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Fri, 06 Dec 2019 07:44:55 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.5284.1575646192978530450 for ; Fri, 06 Dec 2019 07:29:53 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8121E31B; Fri, 6 Dec 2019 07:29:52 -0800 (PST) X-Received: from e123331-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2FE0D3F718; Fri, 6 Dec 2019 07:29:51 -0800 (PST) From: Ard Biesheuvel To: devel@edk2.groups.io Cc: Ard Biesheuvel , Michael D Kinney , Leif Lindholm , Liming Gao , Hao A Wu , Eric Dong , Ray Ni , Achin Gupta , Jiewen Yao Subject: [edk2-devel] [PATCH 6/7] MdeModulePkg/VariableSmmRuntimeDxe: switch to MM communicate 2 protocol Date: Fri, 6 Dec 2019 15:29:45 +0000 Message-Id: <20191206152946.624-7-ard.biesheuvel@arm.com> In-Reply-To: <20191206152946.624-1-ard.biesheuvel@arm.com> References: <20191206152946.624-1-ard.biesheuvel@arm.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,ard.biesheuvel@arm.com X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1575647095; bh=MzaFIiQp2N8FxO/a0CCsBHOaG8UwQb+QhD5SEkZNIcQ=; h=Cc:Date:From:Reply-To:Subject:To; b=ZC03/F9ZMnbxPaSVWbm2zwugAyo78tMIxKJfNBx5eKck7lEWal677DQU26stLNE4CvD dBTe0sU6qmBpiv/9JVhnukZsp47I7v7cOo4oSG/+spmsT3/Wt8fCY5fMpZGbtjZ99wCeN ltaXZs3bVgPCPJ63q6Vt/W5M71fITejet9M= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Ard Biesheuvel Switch to the new MM communicate 2 protocol which supports both traditional and standalone MM. Signed-off-by: Ard Biesheuvel --- MdeModulePkg/Include/Guid/SmmVariableCommon.h | 6 = +-- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c | 39 = +++++++++++--------- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf | 4 = +- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/MdeModulePkg/Include/Guid/SmmVariableCommon.h b/MdeModulePkg/I= nclude/Guid/SmmVariableCommon.h index ceef44dfd2d7..8ddc94b92da6 100644 --- a/MdeModulePkg/Include/Guid/SmmVariableCommon.h +++ b/MdeModulePkg/Include/Guid/SmmVariableCommon.h @@ -20,7 +20,7 @@ extern EFI_GUID gSmmVariableWriteGuid; // // This structure is used for SMM variable. the collected statistics data = is saved in SMRAM. It can be got from // SMI handler. The communication buffer should be: -// EFI_SMM_COMMUNICATE_HEADER + SMM_VARIABLE_COMMUNICATE_HEADER + payload. +// EFI_MM_COMMUNICATE_HEADER + SMM_VARIABLE_COMMUNICATE_HEADER + payload. // typedef struct { UINTN Function; @@ -53,7 +53,7 @@ typedef struct { // #define SMM_VARIABLE_FUNCTION_EXIT_BOOT_SERVICE 6 // -// The payload for this function is VARIABLE_INFO_ENTRY. The GUID in EFI_S= MM_COMMUNICATE_HEADER +// The payload for this function is VARIABLE_INFO_ENTRY. The GUID in EFI_M= M_COMMUNICATE_HEADER // is gEfiSmmVariableProtocolGuid. // #define SMM_VARIABLE_FUNCTION_GET_STATISTICS 7 @@ -81,7 +81,7 @@ typedef struct { /// /// Size of SMM communicate header, without including the payload. /// -#define SMM_COMMUNICATE_HEADER_SIZE (OFFSET_OF (EFI_SMM_COMMUNICATE_HEADE= R, Data)) +#define SMM_COMMUNICATE_HEADER_SIZE (OFFSET_OF (EFI_MM_COMMUNICATE_HEADER= , Data)) =20 /// /// Size of SMM variable communicate header, without including the payload. diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeD= xe.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c index 2cf0ed32ae55..c6777ec46d17 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c @@ -20,7 +20,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include -#include +#include #include #include #include @@ -44,7 +44,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent EFI_HANDLE mHandle =3D NULL; EFI_SMM_VARIABLE_PROTOCOL *mSmmVariable =3D NULL; EFI_EVENT mVirtualAddressChangeEvent =3D NULL; -EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication =3D NULL; +EFI_MM_COMMUNICATION2_PROTOCOL *mMmCommunication2 =3D NULL; UINT8 *mVariableBuffer =3D NULL; UINT8 *mVariableBufferPhysical =3D NULL; VARIABLE_INFO_ENTRY *mVariableInfo =3D NULL; @@ -209,7 +209,7 @@ InitCommunicateBuffer ( IN UINTN Function ) { - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; + EFI_MM_COMMUNICATE_HEADER *SmmCommunicateHeader; SMM_VARIABLE_COMMUNICATE_HEADER *SmmVariableFunctionHeader; =20 =20 @@ -217,7 +217,7 @@ InitCommunicateBuffer ( return EFI_INVALID_PARAMETER; } =20 - SmmCommunicateHeader =3D (EFI_SMM_COMMUNICATE_HEADER *) mVariableBuffer; + SmmCommunicateHeader =3D (EFI_MM_COMMUNICATE_HEADER *) mVariableBuffer; CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gEfiSmmVariableProtocolGui= d); SmmCommunicateHeader->MessageLength =3D DataSize + SMM_VARIABLE_COMMUNIC= ATE_HEADER_SIZE; =20 @@ -247,14 +247,17 @@ SendCommunicateBuffer ( { EFI_STATUS Status; UINTN CommSize; - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; + EFI_MM_COMMUNICATE_HEADER *SmmCommunicateHeader; SMM_VARIABLE_COMMUNICATE_HEADER *SmmVariableFunctionHeader; =20 CommSize =3D DataSize + SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMU= NICATE_HEADER_SIZE; - Status =3D mSmmCommunication->Communicate (mSmmCommunication, mVariableB= ufferPhysical, &CommSize); + Status =3D mMmCommunication2->Communicate (mMmCommunication2, + mVariableBufferPhysical, + mVariableBuffer, + &CommSize); ASSERT_EFI_ERROR (Status); =20 - SmmCommunicateHeader =3D (EFI_SMM_COMMUNICATE_HEADER *) mVariableBu= ffer; + SmmCommunicateHeader =3D (EFI_MM_COMMUNICATE_HEADER *) mVariableBuf= fer; SmmVariableFunctionHeader =3D (SMM_VARIABLE_COMMUNICATE_HEADER *)SmmComm= unicateHeader->Data; return SmmVariableFunctionHeader->ReturnStatus; } @@ -1307,7 +1310,7 @@ VariableAddressChangeEvent ( ) { EfiConvertPointer (0x0, (VOID **) &mVariableBuffer); - EfiConvertPointer (0x0, (VOID **) &mSmmCommunication); + EfiConvertPointer (0x0, (VOID **) &mMmCommunication2); EfiConvertPointer (EFI_OPTIONAL_PTR, (VOID **) &mVariableRuntimeHobCache= Buffer); EfiConvertPointer (EFI_OPTIONAL_PTR, (VOID **) &mVariableRuntimeNvCacheB= uffer); EfiConvertPointer (EFI_OPTIONAL_PTR, (VOID **) &mVariableRuntimeVolatile= CacheBuffer); @@ -1330,7 +1333,7 @@ GetVariablePayloadSize ( { EFI_STATUS Status; SMM_VARIABLE_COMMUNICATE_GET_PAYLOAD_SIZE *SmmGetPayloadSize; - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; + EFI_MM_COMMUNICATE_HEADER *SmmCommunicateHeader; SMM_VARIABLE_COMMUNICATE_HEADER *SmmVariableFunctionHeader; UINTN CommSize; UINT8 *CommBuffer; @@ -1355,7 +1358,7 @@ GetVariablePayloadSize ( goto Done; } =20 - SmmCommunicateHeader =3D (EFI_SMM_COMMUNICATE_HEADER *) CommBuffer; + SmmCommunicateHeader =3D (EFI_MM_COMMUNICATE_HEADER *) CommBuffer; CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gEfiSmmVariableProtocolGui= d); SmmCommunicateHeader->MessageLength =3D SMM_VARIABLE_COMMUNICATE_HEADER_= SIZE + sizeof (SMM_VARIABLE_COMMUNICATE_GET_PAYLOAD_SIZE); =20 @@ -1366,7 +1369,7 @@ GetVariablePayloadSize ( // // Send data to SMM. // - Status =3D mSmmCommunication->Communicate (mSmmCommunication, CommBuffer= , &CommSize); + Status =3D mMmCommunication2->Communicate (mMmCommunication2, CommBuffer= , CommBuffer, &CommSize); ASSERT_EFI_ERROR (Status); =20 Status =3D SmmVariableFunctionHeader->ReturnStatus; @@ -1411,7 +1414,7 @@ GetRuntimeCacheInfo ( { EFI_STATUS Status; SMM_VARIABLE_COMMUNICATE_GET_RUNTIME_CACHE_INFO *SmmGetRuntimeCacheI= nfo; - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeade= r; + EFI_MM_COMMUNICATE_HEADER *SmmCommunicateHeade= r; SMM_VARIABLE_COMMUNICATE_HEADER *SmmVariableFunction= Header; UINTN CommSize; UINT8 *CommBuffer; @@ -1432,7 +1435,7 @@ GetRuntimeCacheInfo ( CommSize =3D SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEAD= ER_SIZE + sizeof (SMM_VARIABLE_COMMUNICATE_GET_RUNTIME_CACHE_INFO); ZeroMem (CommBuffer, CommSize); =20 - SmmCommunicateHeader =3D (EFI_SMM_COMMUNICATE_HEADER *) CommBuffer; + SmmCommunicateHeader =3D (EFI_MM_COMMUNICATE_HEADER *) CommBuffer; CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gEfiSmmVariableProtocolGui= d); SmmCommunicateHeader->MessageLength =3D SMM_VARIABLE_COMMUNICATE_HEADER_= SIZE + sizeof (SMM_VARIABLE_COMMUNICATE_GET_RUNTIME_CACHE_INFO); =20 @@ -1443,7 +1446,7 @@ GetRuntimeCacheInfo ( // // Send data to SMM. // - Status =3D mSmmCommunication->Communicate (mSmmCommunication, CommBuffer= , &CommSize); + Status =3D mMmCommunication2->Communicate (mMmCommunication2, CommBuffer= , CommBuffer, &CommSize); ASSERT_EFI_ERROR (Status); if (CommSize <=3D SMM_VARIABLE_COMMUNICATE_HEADER_SIZE) { Status =3D EFI_BAD_BUFFER_SIZE; @@ -1484,7 +1487,7 @@ SendRuntimeVariableCacheContextToSmm ( { EFI_STATUS Status; SMM_VARIABLE_COMMUNICATE_RUNTIME_VARIABLE_CACHE_CONTEXT *SmmRuntimeVar= CacheContext; - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicat= eHeader; + EFI_MM_COMMUNICATE_HEADER *SmmCommunicat= eHeader; SMM_VARIABLE_COMMUNICATE_HEADER *SmmVariableFu= nctionHeader; UINTN CommSize; UINT8 *CommBuffer; @@ -1505,7 +1508,7 @@ SendRuntimeVariableCacheContextToSmm ( CommSize =3D SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEAD= ER_SIZE + sizeof (SMM_VARIABLE_COMMUNICATE_RUNTIME_VARIABLE_CACHE_CONTEXT); ZeroMem (CommBuffer, CommSize); =20 - SmmCommunicateHeader =3D (EFI_SMM_COMMUNICATE_HEADER *) CommBuffer; + SmmCommunicateHeader =3D (EFI_MM_COMMUNICATE_HEADER *) CommBuffer; CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gEfiSmmVariableProtocolGui= d); SmmCommunicateHeader->MessageLength =3D SMM_VARIABLE_COMMUNICATE_HEADER_= SIZE + sizeof (SMM_VARIABLE_COMMUNICATE_RUNTIME_VARIABLE_CACHE_CONTEXT); =20 @@ -1523,7 +1526,7 @@ SendRuntimeVariableCacheContextToSmm ( // // Send data to SMM. // - Status =3D mSmmCommunication->Communicate (mSmmCommunication, CommBuffer= , &CommSize); + Status =3D mMmCommunication2->Communicate (mMmCommunication2, CommBuffer= , CommBuffer, &CommSize); ASSERT_EFI_ERROR (Status); if (CommSize <=3D SMM_VARIABLE_COMMUNICATE_HEADER_SIZE) { Status =3D EFI_BAD_BUFFER_SIZE; @@ -1561,7 +1564,7 @@ SmmVariableReady ( return; } =20 - Status =3D gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL,= (VOID **) &mSmmCommunication); + Status =3D gBS->LocateProtocol (&gEfiMmCommunication2ProtocolGuid, NULL,= (VOID **) &mMmCommunication2); ASSERT_EFI_ERROR (Status); =20 // diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeD= xe.inf b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.i= nf index 592862773390..01564e4c5068 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf @@ -60,7 +60,7 @@ [LibraryClasses] [Protocols] gEfiVariableWriteArchProtocolGuid ## PRODUCES gEfiVariableArchProtocolGuid ## PRODUCES - gEfiSmmCommunicationProtocolGuid ## CONSUMES + gEfiMmCommunication2ProtocolGuid ## CONSUMES ## CONSUMES ## NOTIFY ## UNDEFINED # Used to do smm communication @@ -100,7 +100,7 @@ [Guids] gEfiImageSecurityDatabaseGuid =20 [Depex] - gEfiSmmCommunicationProtocolGuid + gEfiMmCommunication2ProtocolGuid =20 [UserExtensions.TianoCore."ExtraFiles"] VariableSmmRuntimeDxeExtra.uni --=20 2.17.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 (#51985): https://edk2.groups.io/g/devel/message/51985 Mute This Topic: https://groups.io/mt/67497131/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- From nobody Fri May 3 21:08:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+51986+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51986+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1575647096; cv=none; d=zohomail.com; s=zohoarc; b=GZFaJUl2O13fTXC9jFYhmTgHJd3FsEsUeOOGGi4Xsih/Hg4flC4dKrbiXD+Y2ws7GPfJOoHVNbbIgeUPjnaYOltf3LMaA5XSClLUGHPZb1TkI2l9H7MsalyRuIe/KqN1ZQJj9TSDD4RtXbbDAp1+dV4qftStzF8GdytZDKtGfs8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575647096; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=YxmQjRENbAwjE77Z7skxmWHINbkewfswegXeg8ywpJs=; b=PPT8YcXHfJkEBUYJG/fu+9cw1/nqJ1shFiETTWbrQwFBKqcdl7H5Egy8wPhWWddYTVTZgoOhTtk0ljvmUWwyK6Erb+OOrJoQlcVGpxgSxU/160bAg6NG0nfG38hgjVa1EPsBSFIy+y1uMe0GRK7LKCDwn6VtXMNDgH3+nJQydu0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51986+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1575647096275452.11137867177115; Fri, 6 Dec 2019 07:44:56 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Fri, 06 Dec 2019 07:44:55 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.5120.1575646194464629773 for ; Fri, 06 Dec 2019 07:29:54 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 104D631B; Fri, 6 Dec 2019 07:29:54 -0800 (PST) X-Received: from e123331-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B53093F718; Fri, 6 Dec 2019 07:29:52 -0800 (PST) From: Ard Biesheuvel To: devel@edk2.groups.io Cc: Ard Biesheuvel , Michael D Kinney , Leif Lindholm , Liming Gao , Hao A Wu , Eric Dong , Ray Ni , Achin Gupta , Jiewen Yao Subject: [edk2-devel] [PATCH 7/7] StandaloneMmPkg: switch to MM communicate 2 protocol Date: Fri, 6 Dec 2019 15:29:46 +0000 Message-Id: <20191206152946.624-8-ard.biesheuvel@arm.com> In-Reply-To: <20191206152946.624-1-ard.biesheuvel@arm.com> References: <20191206152946.624-1-ard.biesheuvel@arm.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,ard.biesheuvel@arm.com X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1575647095; bh=z/hHkvBqnBdmGqb8ixkY1nm2R5qsdR7snNrws3Ha1uY=; h=Cc:Date:From:Reply-To:Subject:To; b=Kmrxe5ufUxwMB6foMYwPUBqRFtQM9hoh2T6/QWV4zUs5yshUqeGySuOq0CaDxIPlgL0 tYBI6Sbvn2Av30BJgku9PlKnnfoxUKODSv6dcFE3Z2Dm08+skcRQeeUAX7BsC9a3x4uh+ EdIHKn21MTN6Urbt86tXJcdGMOeMMLZcWNo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Ard Biesheuvel Update the reference to MM communicate to refer to the MM communicate 2 protocol instead. This makes no difference for the MM side of the implementation, but is more accurate nonetheless, since the original MM protocol does not work in combination with standalone MM. Signed-off-by: Ard Biesheuvel --- StandaloneMmPkg/Core/StandaloneMmCore.h | 2 +- StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.h b/StandaloneMmPkg/Core= /StandaloneMmCore.h index 86f6cfa55a35..96c195311add 100644 --- a/StandaloneMmPkg/Core/StandaloneMmCore.h +++ b/StandaloneMmPkg/Core/StandaloneMmCore.h @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include =20 diff --git a/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCp= u.h b/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.h index 71be5cf17272..47a020c27b95 100644 --- a/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.h +++ b/StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.h @@ -10,7 +10,7 @@ #ifndef _ARM_TF_CPU_DRIVER_H_ #define _ARM_TF_CPU_DRIVER_H_ =20 -#include +#include #include #include #include --=20 2.17.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 (#51986): https://edk2.groups.io/g/devel/message/51986 Mute This Topic: https://groups.io/mt/67497133/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-