From patchwork Mon Mar 11 15:36:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 160046 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp12062286jad; Mon, 11 Mar 2019 08:39:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwop0eiIFaqAWIEMTrVb63NB3YpsHUxgqNVNIcqz/iHK7KbTowV7TJ/NRfXPu9sR1tepYbx X-Received: by 2002:a63:eb0f:: with SMTP id t15mr31034739pgh.252.1552318742982; Mon, 11 Mar 2019 08:39:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552318742; cv=none; d=google.com; s=arc-20160816; b=M2fLRWOF5qUAbw85qDdwhHhPuDiJmPNSo4huNeuWTszp4xKOUkctALdtGrI6IEBei5 N61eslrg5QTdDriFBBgtgGuQAQMDt968RaHHVr6eYgJTdX3UkjQf7tbaeSlxv62HWhwv aC68tCkinz+bHRvbP0iUaQGPeRm4fbuOD3iQkqSf5ardnyYM4NavQnN6vjSqezAq7vuq sWA9rR/F+OSxhR0Xa7rBL+CbBJB9lv55v3oWTYvIETffOgA0JNBWBB4YVRZmD12KpIOp IFAvzgg+4QgP/rzfMJxprEVxA4rTGKgLS6rbn2PBLymTpoZufthSy9H4l/BBXut/Y6eq QVdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=C71py2t7+a0PuC3gOMb4NnSUhvBVudhF6Mx0G37Ts1U=; b=qVpGC3cWrAAv/PmvMwprwB9oRTqTU7k6IlPBN/t4/AoDYv9lERvmN4FEgGoww10/3r 8pGMxjY/83rWsooPyqqqJA3IuU4Sfr+u2Dhr0b3wwOqfs1sRPnggQU1MLJ5LbHq1tPcR 2J7D9LolA6acEvaiSgaTONhtod26oYE0kdexhwhmu+OAx4TLMzQZjr8YAVcmi86EdAfD PiAryroDEzC6HzG45MZumo6YTpnFwvwSdNRmpGYyPFRjUi5G5qwuOqHbER+1Bo1URbxP rx9/HZy295fX7qjMdfjVgDDxhyocUbcglrRp6w2PXNujMtw1oCFWrMi94YhT5rg6SC1h 5CVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=SwycuW9X; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id o24si5447286pfa.34.2019.03.11.08.39.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Mar 2019 08:39:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=SwycuW9X; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id C75F1211DB416; Mon, 11 Mar 2019 08:37:22 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.85.128.51; helo=mail-wm1-f51.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8A48B211D56B2 for ; Mon, 11 Mar 2019 08:37:21 -0700 (PDT) Received: by mail-wm1-f51.google.com with SMTP id x7so5017297wmj.0 for ; Mon, 11 Mar 2019 08:37:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hTTtggkQdTqeHpniDTz+4U37bmlhYJ6rY9dd/4ox9TM=; b=SwycuW9XP12QlnGrHb/GaSN0RHGVoATmkQx7et+kijRo0BbmJrdqiUVEB/kGCC5KnO 6jWjYkkCuHmKotjLmak6FzE0HGGelRH2kUL67tJq/7XJm8ZTpMa++8SummdCN76LNVeM QQfV7NND+OHfwU+IEtVIpK4Mf/ySAKE1K6fbJ/ToKTfP+b8TETwfRR7sw7SD+4c92bQN udExjO0aH7j2pmbw6yE66P+l6fkJG36IcXga2wgrd+jk9Qt+4EVxY76eIUHh4SFwuOFx nsKC6iG0tjt9wuhKhPk+5XRdI+fLjz+5nY2ZDlC1n5PtMadn1y3j5LL9waYbXz/nMCmY 1gMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hTTtggkQdTqeHpniDTz+4U37bmlhYJ6rY9dd/4ox9TM=; b=N8hq0+VgHU5SFO0unPirsXMZoHZwAgkGwQO92k2xCBxm29RcNVfT/K9V7eeAx5ZsyD 4R4tOxkkIhiEoSjW1gqnGycL6+VUZpW6Rp+rCV1vh9JyK7/u5XQYTCORGgrK25qJ5vz3 iPpiCbyk79QbL/3V1rrjWxJsiO1QbcQ4bb1tRVnkwggPeSZwsq+W0e4lLn6sim4yGUKN QHuYgYEIgx8NvrlS5qqsM6v/KqVnVEg+dxUvtEg1c74aKfvOheMhHZ51ypZA00b7Xaud tFCXF0ul/0NiID0Ll3M3+dNllPuD8PViURK0O6gahP7YwbPPLdqgIuK71YPfUp2Y+TxF jQvw== X-Gm-Message-State: APjAAAU+we1dxpUHsY7PrB3/t6UumqJlIFSLOjWseUjwGQ3fMrF/o/yY yuxwNNmH5lfrwnpYJyET2sPoUHg716Y= X-Received: by 2002:a1c:4e19:: with SMTP id g25mr222288wmh.106.1552318579649; Mon, 11 Mar 2019 08:36:19 -0700 (PDT) Received: from localhost.localdomain (laubervilliers-657-1-83-120.w92-154.abo.wanadoo.fr. [92.154.90.120]) by smtp.gmail.com with ESMTPSA id u13sm34938965wmf.3.2019.03.11.08.36.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Mar 2019 08:36:18 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Mon, 11 Mar 2019 16:36:08 +0100 Message-Id: <20190311153608.3251-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190311153608.3251-1-ard.biesheuvel@linaro.org> References: <20190311153608.3251-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [edk2] [PATCH 4/4] MdeModulePkg/VariableSmmRuntimeDxe: switch to MmCommunicateLib library X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hao Wu , Liming Gao , Jiewen Yao , Michael D Kinney , Star Zeng Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Replace direct calls to the EFI_SMM_COMMUNICATE protocol with calls to the MmCommunicateLib library, which abstracts differences between traditional MM and standalone MM. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- MdeModulePkg/MdeModulePkg.dsc | 1 + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf | 4 ++-- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c | 10 +++------- 3 files changed, 6 insertions(+), 9 deletions(-) -- 2.20.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc index 84c2629d5adc..e8bafaf5007b 100644 --- a/MdeModulePkg/MdeModulePkg.dsc +++ b/MdeModulePkg/MdeModulePkg.dsc @@ -140,6 +140,7 @@ [LibraryClasses.common.DXE_RUNTIME_DRIVER] DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxDxeLib.inf CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf + MmCommunicateLib|MdeModulePkg/Library/RuntimeDxeMmCommunicateLib/RuntimeDxeMmCommunicateLib.inf [LibraryClasses.common.SMM_CORE] HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf index bd73f7ac29f2..53ab1baa7974 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf @@ -56,13 +56,13 @@ [LibraryClasses] DebugLib UefiRuntimeLib DxeServicesTableLib + MmCommunicateLib UefiDriverEntryPoint TpmMeasurementLib [Protocols] gEfiVariableWriteArchProtocolGuid ## PRODUCES gEfiVariableArchProtocolGuid ## PRODUCES - gEfiSmmCommunicationProtocolGuid ## CONSUMES ## CONSUMES ## NOTIFY ## UNDEFINED # Used to do smm communication @@ -88,7 +88,7 @@ [Guids] gEfiImageSecurityDatabaseGuid [Depex] - gEfiSmmCommunicationProtocolGuid + TRUE [UserExtensions.TianoCore."ExtraFiles"] VariableSmmRuntimeDxeExtra.uni diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c index 85d655dc19ff..e52913a1eb6f 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c @@ -34,6 +34,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include +#include #include #include #include @@ -49,7 +50,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. EFI_HANDLE mHandle = NULL; EFI_SMM_VARIABLE_PROTOCOL *mSmmVariable = NULL; EFI_EVENT mVirtualAddressChangeEvent = NULL; -EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication = NULL; UINT8 *mVariableBuffer = NULL; UINT8 *mVariableBufferPhysical = NULL; UINTN mVariableBufferSize; @@ -179,7 +179,7 @@ SendCommunicateBuffer ( SMM_VARIABLE_COMMUNICATE_HEADER *SmmVariableFunctionHeader; CommSize = DataSize + SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE; - Status = mSmmCommunication->Communicate (mSmmCommunication, mVariableBufferPhysical, &CommSize); + Status = MmCommunicate (mVariableBufferPhysical, mVariableBuffer, &CommSize); ASSERT_EFI_ERROR (Status); SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) mVariableBuffer; @@ -898,7 +898,6 @@ VariableAddressChangeEvent ( ) { EfiConvertPointer (0x0, (VOID **) &mVariableBuffer); - EfiConvertPointer (0x0, (VOID **) &mSmmCommunication); } /** @@ -954,7 +953,7 @@ GetVariablePayloadSize ( // // Send data to SMM. // - Status = mSmmCommunication->Communicate (mSmmCommunication, CommBuffer, &CommSize); + Status = MmCommunicate (CommBuffer, CommBuffer, &CommSize); ASSERT_EFI_ERROR (Status); Status = SmmVariableFunctionHeader->ReturnStatus; @@ -996,9 +995,6 @@ SmmVariableReady ( return; } - Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &mSmmCommunication); - ASSERT_EFI_ERROR (Status); - // // Allocate memory for variable communicate buffer. //