From nobody Mon Apr 29 10:34:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+51170+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51170+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1574411563; cv=none; d=zoho.com; s=zohoarc; b=Ia/2wwRFEhYEbq5/H3c9G2oYYuThidY7Vp2nHup3ZM2npsNw/QoIsXN7uKJowCAULbgouKnhYJiQW9MKDmNXmx9MEext2XXqyKnipuxXbF/SbV2xAJBYVHFTkz//Jx670fORWMXw985xiSOQQR2AQe2lgGpIO5Ede6b5qu9jWKM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574411563; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=B1JE8ksbgAWMRUjxlO4QdI+4qBWsvQZNEZ1ndBkzX8M=; b=Cm/dIKqSVf1pvQH8SHnlU+XKZXUnXsi4XX00vCRQtdIM662sIyzXgpAYwsdE28qK6FEeeXJvuPVAHYbceI5SGiOK+dqFCU5Bw1avcfdRGah5B8UcwZseqGwrapMpOlj40p6M18lQtGvB8Jas/BfvAmaBA4QF6uyEpNBvfM000aY= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51170+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1574411563903687.6458468468566; Fri, 22 Nov 2019 00:32:43 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Fri, 22 Nov 2019 00:32:43 -0800 X-Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by mx.groups.io with SMTP id smtpd.web11.3950.1574411562698738059 for ; Fri, 22 Nov 2019 00:32:43 -0800 X-Received: by mail-wr1-f48.google.com with SMTP id z3so7559107wru.3 for ; Fri, 22 Nov 2019 00:32:42 -0800 (PST) X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= X-Google-Smtp-Source: APXvYqxWZ9tpcyiWZOlrJbCi/GyerCM2R3+NnZRUobyn2ELdFMKVdKzV2doXcjnKF2TTsovyC0q8hg== X-Received: by 2002:a5d:51c9:: with SMTP id n9mr17189715wrv.6.1574411561007; Fri, 22 Nov 2019 00:32:41 -0800 (PST) X-Received: from sudo.home ([2a01:cb1d:112:6f00:ac04:254:3863:fdeb]) by smtp.gmail.com with ESMTPSA id c15sm7225845wrx.78.2019.11.22.00.32.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Nov 2019 00:32:40 -0800 (PST) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: leif.lindholm@linaro.org, Ard Biesheuvel , piwg@uefi.org, kimon.berlin@hp.com, eugene@hp.com Subject: [edk2-devel] [PATCH 1/6] MdePkg: introduce MM communicate 2 protocol Date: Fri, 22 Nov 2019 09:32:29 +0100 Message-Id: <20191122083234.12756-2-ard.biesheuvel@linaro.org> In-Reply-To: <20191122083234.12756-1-ard.biesheuvel@linaro.org> References: <20191122083234.12756-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 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@linaro.org Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1574411563; bh=2tURYB7MUoiK+sbcS7nVeVRvEL0q33RA9nggQyBgMoE=; h=Cc:Date:From:Reply-To:Subject:To; b=vWCrY01HrRM6Dh1usGErjzFQMGr9hNsyxJwwFJGaGXTqkvelPD7YKA3iQHu0TSYxw/z TjvVvjCw9KoAHC6rBV0CsEn21JPenLbCPMEiQ6sYxUBMatWDH0CqN2LELUoHsnZzqKBpY ToaOByR3PYld/uOtcmF4WzfRyuZ6NHL2+nQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add the protocol definition of the MM communicate 2 protocol, which has been introduced by 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 @@ ## 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.20.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 (#51170): https://edk2.groups.io/g/devel/message/51170 Mute This Topic: https://groups.io/mt/61584092/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 Mon Apr 29 10:34:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+51171+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51171+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1574411565; cv=none; d=zoho.com; s=zohoarc; b=avnugqZZq78EMeZUcFK9MBdUQbRmUwDGUfUnDBcp3a3sY2E/hc5vmU/Ks/Lqx/AH8kEvVdLJeO5n6E4z4jtLFlE9vYQCSvjoal3KUq62ZAem9pMJBasd3eEVqg5R1seSNmdzono+huHjSRY74kH4mF2M2HKHRsKcliYbABHBS2o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574411565; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=2/7xAI4o2/JJqOUv3utKH8UAEkrVA8HGLPvVmO3JMe4=; b=F2edx2OquzQwkqbHSsZQDLSaRS6zu2U7kCnzsOxxLEsWlJmYA1Fh6PAJa/3E5hVZYt0cGxx1R+jOFMdJUcG/hYIR2luXOSUnNQ7mUzdg3P3QfSGffJ9SCKCo4NCJdr41NdmDBuMy93SQfgqCYE/ACGbhAJdWZFi3KAsDi1G30Vk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51171+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1574411565204577.5348350839729; Fri, 22 Nov 2019 00:32:45 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Fri, 22 Nov 2019 00:32:44 -0800 X-Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by mx.groups.io with SMTP id smtpd.web10.3912.1574411564004392695 for ; Fri, 22 Nov 2019 00:32:44 -0800 X-Received: by mail-wm1-f67.google.com with SMTP id 8so6603763wmo.0 for ; Fri, 22 Nov 2019 00:32:43 -0800 (PST) X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= X-Google-Smtp-Source: APXvYqwbNURdncTHr/o729ssvVlQz8pN596pRzlhUzA+y1YBzFUJHQ2EhqyGCL17RWBo+kET6QI4ZQ== X-Received: by 2002:a7b:ce11:: with SMTP id m17mr14043260wmc.123.1574411562221; Fri, 22 Nov 2019 00:32:42 -0800 (PST) X-Received: from sudo.home ([2a01:cb1d:112:6f00:ac04:254:3863:fdeb]) by smtp.gmail.com with ESMTPSA id c15sm7225845wrx.78.2019.11.22.00.32.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Nov 2019 00:32:41 -0800 (PST) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: leif.lindholm@linaro.org, Ard Biesheuvel , piwg@uefi.org, kimon.berlin@hp.com, eugene@hp.com Subject: [edk2-devel] [PATCH 2/6] MdeModulePkg/SmmIpl: expose MM communicate 2 protocol Date: Fri, 22 Nov 2019 09:32:30 +0100 Message-Id: <20191122083234.12756-3-ard.biesheuvel@linaro.org> In-Reply-To: <20191122083234.12756-1-ard.biesheuvel@linaro.org> References: <20191122083234.12756-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 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@linaro.org Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1574411564; bh=H5Wn45rrMSOaL1K3dIUDYX0+FtJN/fuibEz/Utnu+MQ=; h=Cc:Date:From:Reply-To:Subject:To; b=hgBgAEkSDyunZ0LDLafqjqOd2jG1yL3fzD6TualSjFuaD77xq4dKTeDNDIqisCkRMMP wLbT5QW+1SZ99bgh31pNmu0Wr0y8zT7RxlJiVF9iczp0DtHtnlahySjxgdRWG+M7YmWMW UN+DGTkZi0HgVxftyWXTuYeGz2330LXJLPk= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" 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 @@ [Protocols] gEfiSmmBase2ProtocolGuid ## PRODUCES gEfiSmmCommunicationProtocolGuid ## PRODUCES + gEfiMmCommunication2ProtocolGuid ## PRODUCES gEfiSmmAccess2ProtocolGuid ## CONSUMES ## NOTIFY ## CONSUMES --=20 2.20.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 (#51171): https://edk2.groups.io/g/devel/message/51171 Mute This Topic: https://groups.io/mt/61584095/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 Mon Apr 29 10:34:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+51172+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51172+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1574411567; cv=none; d=zoho.com; s=zohoarc; b=dsHffkBlgB0TNHc+/Y7BpzpnFStUTjV56vl1KLyRxhjdOJNPSs0wbERxyY5qA1PeVgw9fJVJ3y/zLzKk6ZD0VmOZKQR07MQvO3+yDlLSZpUm7SvBFPOwTXGLrWBEj66JLmt+UVvZCW84T/N5PtVc77aoaI/u65GUmjHCf5DP6jI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574411567; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=dgCkfa5Qc26AfU7d+A0wx8Bz0G+K/UzF8CDjP6heb7I=; b=AfM2U+2dAIZr8K7YhcmtMByCL9B6DWVYM1maPFF6qEcLAGLXc2ZHa9cT8ad6JFHxhTCx7lk1AJb85CLwYoskUP3bhy+sDVPfQD+YjcSXU66ZfiJwA9B9z12IDVuc1XB91sA6UAL94zylgiWdlrlBEoLA1FzI2n1xblyOr5aKHug= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51172+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1574411567168749.438312958277; Fri, 22 Nov 2019 00:32:47 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Fri, 22 Nov 2019 00:32:46 -0800 X-Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by mx.groups.io with SMTP id smtpd.web12.3984.1574411565281433977 for ; Fri, 22 Nov 2019 00:32:45 -0800 X-Received: by mail-wm1-f50.google.com with SMTP id f129so5225093wmf.2 for ; Fri, 22 Nov 2019 00:32:45 -0800 (PST) X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= X-Google-Smtp-Source: APXvYqyQUV8CxUUOZpkAW4d6LAUGjI/DkCShWJdGn08ezzt0ZBZXfznpNqmKT486rGvbXRhDKzmD/g== X-Received: by 2002:a1c:2d4b:: with SMTP id t72mr15754224wmt.112.1574411563419; Fri, 22 Nov 2019 00:32:43 -0800 (PST) X-Received: from sudo.home ([2a01:cb1d:112:6f00:ac04:254:3863:fdeb]) by smtp.gmail.com with ESMTPSA id c15sm7225845wrx.78.2019.11.22.00.32.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Nov 2019 00:32:42 -0800 (PST) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: leif.lindholm@linaro.org, Ard Biesheuvel , piwg@uefi.org, kimon.berlin@hp.com, eugene@hp.com Subject: [edk2-devel] [PATCH 3/6] ArmPkg/MmCommunicationDxe: expose MM Communicate 2 protocol Date: Fri, 22 Nov 2019 09:32:31 +0100 Message-Id: <20191122083234.12756-4-ard.biesheuvel@linaro.org> In-Reply-To: <20191122083234.12756-1-ard.biesheuvel@linaro.org> References: <20191122083234.12756-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 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@linaro.org Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1574411566; bh=FQMrb8D2j5POvoleHvwRwvHRk86+JSNx+jrOxr37AUE=; h=Cc:Date:From:Reply-To:Subject:To; b=kig8F0ZAtddh8RDYL2KmhgagBb3Z5Tmfxf6APyT2lMfZom6v3v7/1hY9WJJpT4ocSaU tC+uMEq0NXnV5bBWYHz2Ok61h1wnTKPZ3OQIHcJ2flLmk5OWCXctU8Rp1F9QK+IgAgqGu 1eGqaOUMp1TcleWZD3eOp+EFEyPLVDyHAr4= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" 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 | 83 +++++++++------= ----- ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf | 6 +- 2 files changed, 42 insertions(+), 47 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(). - - @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. - - @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 + 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. + **/ -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 @@ 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 @@ UefiDriverEntryPoint =20 [Protocols] - gEfiMmCommunicationProtocolGuid ## PRODUCES + gEfiMmCommunication2ProtocolGuid ## PRODUCES =20 [Pcd.common] gArmTokenSpaceGuid.PcdMmBufferBase --=20 2.20.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 (#51172): https://edk2.groups.io/g/devel/message/51172 Mute This Topic: https://groups.io/mt/61584099/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 Mon Apr 29 10:34:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+51173+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51173+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1574411567; cv=none; d=zoho.com; s=zohoarc; b=Wnx5d+/ERQnr6qjogkTGCar7O/ooVWOXUW6Sv2Ivy5f+/tq7RrWPTICmkHMdKJZZkSaesuHFOW34yozdks0NXh1sg0aIfVmuBtfVyaFmL4uimuwimehKKQZ93dX4C9m0KB2LGhxbbqF81cJzNV7/O3u1D2ZL/BCyRXeZswOeYrA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574411567; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=piNoE8jhkYT41YIMLljsQ/PwowMX61KSPxrsZc2HvJ0=; b=DOB7cSWBBFMBpapynW8oZmK3b700kj7KCNMGCW6O5bVMZMWOaUkXc5iFb/9tWStoP8EFMcgwgttUeO5774CO+v/e+ZTCMOAueF56kb1CiHGNNn39kVTJDfubsQjfSTWsG4mU5HowR5chr44hTVckhmgy/3PkyPP7/w5OD+8d4gU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51173+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1574411567502766.0908887923757; Fri, 22 Nov 2019 00:32:47 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Fri, 22 Nov 2019 00:32:47 -0800 X-Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by mx.groups.io with SMTP id smtpd.web11.3951.1574411566358372251 for ; Fri, 22 Nov 2019 00:32:46 -0800 X-Received: by mail-wm1-f67.google.com with SMTP id z19so6581609wmk.3 for ; Fri, 22 Nov 2019 00:32:46 -0800 (PST) X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= X-Google-Smtp-Source: APXvYqy06FH44EmkX9e336PEvz9kHJUqOTCd5S2/XSUio97qRCOlPvPvmCMuthLngW7rVYcaguINPA== X-Received: by 2002:a7b:c357:: with SMTP id l23mr1000833wmj.152.1574411564680; Fri, 22 Nov 2019 00:32:44 -0800 (PST) X-Received: from sudo.home ([2a01:cb1d:112:6f00:ac04:254:3863:fdeb]) by smtp.gmail.com with ESMTPSA id c15sm7225845wrx.78.2019.11.22.00.32.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Nov 2019 00:32:43 -0800 (PST) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: leif.lindholm@linaro.org, Ard Biesheuvel , piwg@uefi.org, kimon.berlin@hp.com, eugene@hp.com Subject: [edk2-devel] [PATCH 4/6] MdeModulePkg/VariableInfo: switch to MM communicate 2 protocol Date: Fri, 22 Nov 2019 09:32:32 +0100 Message-Id: <20191122083234.12756-5-ard.biesheuvel@linaro.org> In-Reply-To: <20191122083234.12756-1-ard.biesheuvel@linaro.org> References: <20191122083234.12756-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 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@linaro.org Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1574411567; bh=BLK3UhrLWeyMDMSP+oLHv28rpvjFA3iLxbDebXCTDYI=; h=Cc:Date:From:Reply-To:Subject:To; b=NtN/CnqhyHnJU3lLp31YXZWc0MEO+CvkN6EGhhzubz4snHa9uxJ6s72WESEmtPMzB4o uI3P9xLqrdBDhFyD9vA1X2GcBn9vKjRuFBa+5KSBlARf/s6fRbTe1xtXW9wj9+dg6dvUO mAusNv50fXXpLn9cCz3CXWRCtKHuRwLMVbE= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" 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 @@ MemoryAllocationLib =20 [Protocols] - gEfiSmmCommunicationProtocolGuid ## SOMETIMES_CONSUMES + gEfiMmCommunication2ProtocolGuid ## SOMETIMES_CONSUMES =20 ## UNDEFINED # Used to do smm communication ## SOMETIMES_CONSUMES --=20 2.20.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 (#51173): https://edk2.groups.io/g/devel/message/51173 Mute This Topic: https://groups.io/mt/61584104/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 Mon Apr 29 10:34:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+51174+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51174+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1574411569; cv=none; d=zoho.com; s=zohoarc; b=i4FOBYgBE+3J9EkTLnF+91IEvSMG43BEogxdRqK7RDiwe/XGly7O++5PCHDyxvfOW53VVWuBkQYe91lsAbZeRlI/FxNyRP1tkfhH/1LCizqpjh8WSnmcN6PyxLFbLAk+r9FcC77ocJxGvyX2hp6xobqg4k0fnQGva5LrfPfHe2s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574411569; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=q+LA47p81BqVUwzJEsrcVlv9T0UVryIBnDMFu00u91I=; b=P5QiGfU+kbdsocewle10sltogpeHuxLO4BcWKrfU3vwrUDC8sznVafMxv/P4Mapw+d4pI14HWkeMBaGhixKDS3M+wfKjwNBl3fd3+kxfFVdq2tmZPdl4i1lZ13b+BVm80g0bqIxuKQeNofFe4iVipZ7DjHkQsnaIbOgcUqpHtc0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51174+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 157441156900434.80873964116972; Fri, 22 Nov 2019 00:32:49 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Fri, 22 Nov 2019 00:32:48 -0800 X-Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by mx.groups.io with SMTP id smtpd.web12.3985.1574411567661725160 for ; Fri, 22 Nov 2019 00:32:48 -0800 X-Received: by mail-wm1-f65.google.com with SMTP id y5so6554674wmi.5 for ; Fri, 22 Nov 2019 00:32:47 -0800 (PST) X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= X-Google-Smtp-Source: APXvYqwdnwhNJx1SN1y0iT+f+23i4i/VNeqRzEKQi21aY26AZlB6hj7mY8smXTDhkb9FLR6B+nzcLA== X-Received: by 2002:a05:600c:cb:: with SMTP id u11mr14859814wmm.5.1574411565973; Fri, 22 Nov 2019 00:32:45 -0800 (PST) X-Received: from sudo.home ([2a01:cb1d:112:6f00:ac04:254:3863:fdeb]) by smtp.gmail.com with ESMTPSA id c15sm7225845wrx.78.2019.11.22.00.32.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Nov 2019 00:32:44 -0800 (PST) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: leif.lindholm@linaro.org, Ard Biesheuvel , piwg@uefi.org, kimon.berlin@hp.com, eugene@hp.com Subject: [edk2-devel] [PATCH 5/6] MdeModulePkg/FaultTolerantWriteSmmDxe: switch to MM communicate 2 protocol Date: Fri, 22 Nov 2019 09:32:33 +0100 Message-Id: <20191122083234.12756-6-ard.biesheuvel@linaro.org> In-Reply-To: <20191122083234.12756-1-ard.biesheuvel@linaro.org> References: <20191122083234.12756-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 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@linaro.org Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1574411568; bh=Em/zlurKQ87pY0ORHjZcoyQjMDniJJ6XUDxTJFcQbFo=; h=Cc:Date:From:Reply-To:Subject:To; b=PCH5MldhZS6N4/SPC723Pp5Si7U47fVian6O5ucvtKA78GQ3pHXyGmHiJtSuMTWdHzc oMIMkqWcdrZB3Aez0dfqndlzdBVfMVh+kgOch/F1dafzuYBxwQV3HtYsv1QFtrSpWizPK 3erszpJPGcS0mDe+x7I+a9f4qiiihSWOtJk= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" 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 @@ =20 [Protocols] gEfiFaultTolerantWriteProtocolGuid ## PRODUCES - gEfiSmmCommunicationProtocolGuid ## CONSUMES + gEfiMmCommunication2ProtocolGuid ## CONSUMES ## NOTIFY ## UNDEFINED # Used to do smm communication ## CONSUMES @@ -53,7 +53,7 @@ gEfiFirmwareVolumeBlockProtocolGuid ## CONSUMES =20 [Depex] - gEfiSmmCommunicationProtocolGuid + gEfiMmCommunication2ProtocolGuid =20 [UserExtensions.TianoCore."ExtraFiles"] FaultTolerantWriteSmmDxeExtra.uni --=20 2.20.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 (#51174): https://edk2.groups.io/g/devel/message/51174 Mute This Topic: https://groups.io/mt/61584109/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 Mon Apr 29 10:34:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+51175+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51175+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1574411570; cv=none; d=zoho.com; s=zohoarc; b=cpkQ/MBWAsymGQUCNxICpXTBqyWcAp8qO0k0NWLQoxH9c5qylBU2nDfQ/OVb7K1qCXt8+9k653VCP4oPZNi7qHG0WCSttQTTkRKlxn/yEaBxBLypggnYOe4SK7kJPLqhqigfwUJbVF9FkvDc36G/HA1Rv8bDaNh69gmJOpxVdqI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1574411570; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=xEtIx8FfTsqVQOMXwbwQGrabklp+zwahoXt2+pj3mIE=; b=iFeKk9QLPAydXihth33+s58OTPeZvqBuNeDuOmo8d2trlXvtdui6jfclvysG4yHHfW8iyuEA2yOmhX63RVyuydc8C+sntZEr81xQcGUhrXi9f1JrhtJUhYs5vhazIzpPRwgVu0poWeJSBSJVOe4D6K391Rk/n87fsik/II5Rhcc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51175+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1574411570281449.2948042773762; Fri, 22 Nov 2019 00:32:50 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id aaaaYY1788612xaaaaaaaaaa; Fri, 22 Nov 2019 00:32:49 -0800 X-Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by mx.groups.io with SMTP id smtpd.web10.3915.1574411568958832544 for ; Fri, 22 Nov 2019 00:32:49 -0800 X-Received: by mail-wm1-f66.google.com with SMTP id t26so6563464wmi.4 for ; Fri, 22 Nov 2019 00:32:48 -0800 (PST) X-Gm-Message-State: aaaaaaaaaaaaaaaaaaaaaaaax1787277AA= X-Google-Smtp-Source: APXvYqydeT2BMVzA3no9A8WGb0i6j5tRl7hYMHnSBMjTFWQzkCyaLTpo/Q9IIY2OGjgMvnk51Dj0Ow== X-Received: by 2002:a1c:96c9:: with SMTP id y192mr15639378wmd.8.1574411567199; Fri, 22 Nov 2019 00:32:47 -0800 (PST) X-Received: from sudo.home ([2a01:cb1d:112:6f00:ac04:254:3863:fdeb]) by smtp.gmail.com with ESMTPSA id c15sm7225845wrx.78.2019.11.22.00.32.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Nov 2019 00:32:46 -0800 (PST) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: leif.lindholm@linaro.org, Ard Biesheuvel , piwg@uefi.org, kimon.berlin@hp.com, eugene@hp.com Subject: [edk2-devel] [PATCH 6/6] MdeModulePkg/VariableSmmRuntimeDxe: switch to MM communicate 2 protocol Date: Fri, 22 Nov 2019 09:32:34 +0100 Message-Id: <20191122083234.12756-7-ard.biesheuvel@linaro.org> In-Reply-To: <20191122083234.12756-1-ard.biesheuvel@linaro.org> References: <20191122083234.12756-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 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@linaro.org Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1574411569; bh=s4ZkExfEy6x3byATIwbRJv35zF9H/l6jsLVnxFXD4XY=; h=Cc:Date:From:Reply-To:Subject:To; b=lmhhiU3mYVvX/bHQp7Me/xl+befT9kF9O6SpG5BEP6RAdyQNybSBjW1O2KJIQBePbQc EGZr6NqNMDzlG156UFBGW5a8v23WNtsOUSqViM+uXSE6ZLW9tSqtUVjSGuN2DArAO/7sn 18iWOjJ8qFp0Q6RlOTv/GoHxUTyutncpRHk= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" 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 d525998ae301..f49e4a9664ae 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; } @@ -1305,7 +1308,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); @@ -1328,7 +1331,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; @@ -1353,7 +1356,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 @@ -1364,7 +1367,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; @@ -1409,7 +1412,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; @@ -1430,7 +1433,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 @@ -1441,7 +1444,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; @@ -1482,7 +1485,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; @@ -1503,7 +1506,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 @@ -1521,7 +1524,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; @@ -1559,7 +1562,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 a250533a534f..0f3ec6a9a43d 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf @@ -59,7 +59,7 @@ [Protocols] gEfiVariableWriteArchProtocolGuid ## PRODUCES gEfiVariableArchProtocolGuid ## PRODUCES - gEfiSmmCommunicationProtocolGuid ## CONSUMES + gEfiMmCommunication2ProtocolGuid ## CONSUMES ## CONSUMES ## NOTIFY ## UNDEFINED # Used to do smm communication @@ -99,7 +99,7 @@ gEfiImageSecurityDatabaseGuid =20 [Depex] - gEfiSmmCommunicationProtocolGuid + gEfiMmCommunication2ProtocolGuid =20 [UserExtensions.TianoCore."ExtraFiles"] VariableSmmRuntimeDxeExtra.uni --=20 2.20.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 (#51175): https://edk2.groups.io/g/devel/message/51175 Mute This Topic: https://groups.io/mt/61584116/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-