From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=axK0LVas; spf=pass (domain: linaro.org, ip: 209.85.128.67, mailfrom: ard.biesheuvel@linaro.org) Received: by mail-wm1-f67.google.com with SMTP id z19so6581609wmk.3 for ; Fri, 22 Nov 2019 00:32:46 -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=Hh4ecZVfuCnp8yIOJT5qKdryrYy5ekn5dLSanK4z41Y=; b=axK0LVasF+El5+vq7Tg8G1B1Wy/20dlN6EFgg7BI42DaD1RXTZOacjl+cDWY4xWWIT zzVJv2I/bSMs93djlAg2X4ZzmdoZQWwgs/lkQ5qab+7xYuIOkAquArwClocauTKTC0z8 jaeTbcI6i+4arLoWZWRK81BtNWTr6gxCRdlrt0OFzGWYtrVmUIZbf9b0rt936r6M0p4c XjplPCVd+sZrNNdSJ0MfCSRL2I288xYkh0hmp1y+pIppooCAjUQuuYzecNKdv5Bxt7tX kORoYziiwUA5kLdy1YNg1+Dr2vsNB+uIJpbo3BHiQCD6L7EbzxDKokrTydKh+LnVLSgD Rfng== 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=Hh4ecZVfuCnp8yIOJT5qKdryrYy5ekn5dLSanK4z41Y=; b=q95V71n9hUCBnicwxfwSFxepQkj3IPx1ve1x8oBPo6czJZR8TGsg8gB7j/2VlWIZ95 aHN4qyTrCnyPdMRrXC7WxwnyYAIun+a1KoigNFx9eoI1o9Zc8WhwjX0j23poZAv7UxcB qug/zgNm6i5fNDF69w2MIkG+kBCuxA6/s/eww2zg/6ZFwZMKB0g8DrjrRP9iFQ8QBcXg S8qP6KOOhZuF50htfH3FMJuO74s5WBy4RIXA2vn94QOcoHK4VOXJ6IEEpL1FdS8/RRWc 2MQN9F+StOhxBZRe/PkJI5JNIaC/KVOeN3HuP95qPWk+PIP8fKoyVb8sEDZOAv2woeCQ 8lRw== X-Gm-Message-State: APjAAAXp5kzghgeJF0lstZ7rPXk6UxQ+Fo2VMXyuDWV+tvqbfP/is5q3 RZiC2jZoeWRIg54cfjDIXCjbky7+d+/8bbPx 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) 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.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: [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> 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/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/MdeModulePkg/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 -EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication = NULL; +EFI_MM_COMMUNICATION2_PROTOCOL *mMmCommunication2 = NULL; /** This function get the variable statistics data from SMM variable driver. @@ -41,7 +41,7 @@ EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication = NULL; 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; CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gEfiSmmVariableProtocolGuid); - SmmCommunicateHeader->MessageLength = *SmmCommunicateSize - OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data); + SmmCommunicateHeader->MessageLength = *SmmCommunicateSize - OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data); SmmVariableFunctionHeader = (SMM_VARIABLE_COMMUNICATE_HEADER *) &SmmCommunicateHeader->Data[0]; SmmVariableFunctionHeader->Function = SMM_VARIABLE_FUNCTION_GET_STATISTICS; - Status = mSmmCommunication->Communicate (mSmmCommunication, SmmCommunicateHeader, SmmCommunicateSize); + Status = mMmCommunication2->Communicate (mMmCommunication2, + SmmCommunicateHeader, + SmmCommunicateHeader, + SmmCommunicateSize); ASSERT_EFI_ERROR (Status); Status = 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; } - Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &mSmmCommunication); + Status = gBS->LocateProtocol (&gEfiMmCommunication2ProtocolGuid, NULL, (VOID **) &mMmCommunication2); if (EFI_ERROR (Status)) { return Status; } @@ -117,7 +120,7 @@ PrintInfoFromSmm ( if (Size > MaxSize) { MaxSize = Size; RealCommSize = MaxSize; - CommBuffer = (EFI_SMM_COMMUNICATE_HEADER *) (UINTN) Entry->PhysicalStart; + CommBuffer = (EFI_MM_COMMUNICATE_HEADER *) (UINTN) Entry->PhysicalStart; } } } diff --git a/MdeModulePkg/Application/VariableInfo/VariableInfo.inf b/MdeModulePkg/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 [Protocols] - gEfiSmmCommunicationProtocolGuid ## SOMETIMES_CONSUMES + gEfiMmCommunication2ProtocolGuid ## SOMETIMES_CONSUMES ## UNDEFINED # Used to do smm communication ## SOMETIMES_CONSUMES -- 2.20.1