From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=aCMLBHBQ; spf=pass (domain: linaro.org, ip: 209.85.128.65, mailfrom: ard.biesheuvel@linaro.org) Received: by mail-wm1-f65.google.com with SMTP id y5so6554674wmi.5 for ; Fri, 22 Nov 2019 00:32:47 -0800 (PST) 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=6MVHUWLgbbdFkEO33pSwJHH7nRIeajYLiJ8aDBj8UX0=; b=aCMLBHBQbLOnZDo5J2M9xju7HPGb/ujHT6MT5+qQSbb2d/Cbfef+xo8MDbqYHGHSJY AposVrQzIiGmhM8Kqt5CpvBurYASo5kRrYTEwuoUtQfuDKp81Uvjb9TA5Ck061kksxJQ ceEB3xnHHAs6PcsPZhaUcHs8GD3/yOgHdKSsarheKaWaP5sTkAeJc+uOOTk4EcAMqXrc 4vad1nvbbooYVQaK3tvewXMxphNrohohiAxvzh6DudyOX8TK5cCFTWmF+WEPIA6uztFY qoLRqJeeEHfji2CDN3wo15FhARXN0yo2QkJk8dHv8NWCtOewyugNHzy9TW7P7QmjDTHh 16KA== 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=6MVHUWLgbbdFkEO33pSwJHH7nRIeajYLiJ8aDBj8UX0=; b=rDo/tVk+B30EEZtR+X7OTmkwChIH3iWSVC4T8VtN6jcpQkxfTcNU5VkEfrg5uDRPkS WAttnbpcUPzOq0FqohC41xUkF6teZ8D4p5V3wG1OanvLnNxqRM/0BMsNAhKbWyXXoUh0 QhnDxkVFliQyufs1FCu+jblWThVWCBS4alABccU7hc29RbzIkfIuAs8fHuvA6k0hx8E3 QF4678JzOcsacxi8nNvBVzMYCj0NwrpSxUje23s8dCjZ0rDAi0AK4MiBv1yyn0vyRhpg HhXSqrktrq1DPP+byg43WA/fDg2pmbWKDQJKlPbTh1HIH+F8bqLwfkaaovAPNtyZqBMt yraA== X-Gm-Message-State: APjAAAVUC1ooTePyg91zp0/4XRaQJwLFN10gsLk8FSqU+DCfHd+rvE4t QaxKXEw69UIGASZ2KNH5nGyxMnx56XvFgvzW 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) Return-Path: 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: [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> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191122083234.12756-1-ard.biesheuvel@linaro.org> References: <20191122083234.12756-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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/FaultTolerantWriteSmmCommon.h b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmCommon.h index 4546a1b445b9..5f0eec0506ed 100644 --- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmCommon.h +++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmCommon.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_HEADER, Data)) +#define SMM_COMMUNICATE_HEADER_SIZE (OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data)) /// /// Size of SMM FTW communicate function header, without including the payload. diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe.c b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe.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" EFI_HANDLE mHandle = NULL; -EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication = NULL; +EFI_MM_COMMUNICATION2_PROTOCOL *mMmCommunication2 = NULL; UINTN mPrivateDataSize = 0; EFI_FAULT_TOLERANT_WRITE_PROTOCOL mFaultTolerantWriteDriver = { @@ -40,7 +40,7 @@ InitCommunicateBuffer ( IN UINTN Function ) { - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; + EFI_MM_COMMUNICATE_HEADER *SmmCommunicateHeader; SMM_FTW_COMMUNICATE_FUNCTION_HEADER *SmmFtwFunctionHeader; // @@ -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; CommSize = DataSize + SMM_COMMUNICATE_HEADER_SIZE + SMM_FTW_COMMUNICATE_HEADER_SIZE; - Status = mSmmCommunication->Communicate (mSmmCommunication, SmmCommunicateHeader, &CommSize); + Status = mMmCommunication2->Communicate (mMmCommunication2, + SmmCommunicateHeader, + SmmCommunicateHeader, + &CommSize); ASSERT_EFI_ERROR (Status); SmmFtwFunctionHeader = (SMM_FTW_COMMUNICATE_FUNCTION_HEADER *) SmmCommunicateHeader->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; // @@ -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; // @@ -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; // @@ -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; // @@ -381,7 +384,7 @@ FtwAbort ( ) { EFI_STATUS Status; - EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader; + EFI_MM_COMMUNICATE_HEADER *SmmCommunicateHeader; // // 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; // @@ -501,7 +504,7 @@ SmmFtwReady ( return; } - Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &mSmmCommunication); + Status = gBS->LocateProtocol (&gEfiMmCommunication2ProtocolGuid, NULL, (VOID **) &mMmCommunication2); ASSERT_EFI_ERROR (Status); // diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe.h b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe.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 #include -#include +#include #include #include diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe.inf b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe.inf index f5dc4bb4fee3..f0dd829653f1 100644 --- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe.inf +++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe.inf @@ -45,7 +45,7 @@ [Protocols] gEfiFaultTolerantWriteProtocolGuid ## PRODUCES - gEfiSmmCommunicationProtocolGuid ## CONSUMES + gEfiMmCommunication2ProtocolGuid ## CONSUMES ## NOTIFY ## UNDEFINED # Used to do smm communication ## CONSUMES @@ -53,7 +53,7 @@ gEfiFirmwareVolumeBlockProtocolGuid ## CONSUMES [Depex] - gEfiSmmCommunicationProtocolGuid + gEfiMmCommunication2ProtocolGuid [UserExtensions.TianoCore."ExtraFiles"] FaultTolerantWriteSmmDxeExtra.uni -- 2.20.1