From patchwork Mon Jan 14 13:27:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 155497 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3659083jaa; Mon, 14 Jan 2019 05:29:00 -0800 (PST) X-Google-Smtp-Source: ALg8bN6fETm3xBB4NS61r5qEqV8aXUsDDGODGCKDXv/gnuFFhuvWbzbK1Vh7+TGwLbaW5s9XakKK X-Received: by 2002:a62:c185:: with SMTP id i127mr25628002pfg.43.1547472540781; Mon, 14 Jan 2019 05:29:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547472540; cv=none; d=google.com; s=arc-20160816; b=gaLofNBZrQ0KmVOQY3fiqv9dxz/g07b/8HztgM1nHpaLbQgexEEeHv6trmempCmize oGr3MnYEkV8BSgjP1E1GehkhznBvHI2Y5Yxvs2Ym0CBSlbJ558b8xe/nnbyUpWl/aCqz 5iVYnY1JnLAyKA2vhPJzJThMGnJVqZXpyoyMAUO3pTEoCOeAYdNx7MxlFIEhRSEIepm0 mYy69mcFtVHLMW9P+0ukO2pyMUR3Rc1mugZslkljgEKNsD2rP/1qNuq1cfqrH9oDxayk sJA7D3ahf5mb0bPjel+k7wZ5ehBQ/d1gMNuQzn2uNRkjhCrS3FbxF51R8JRcw9oSQ4AR uhPw== 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=/aVoftCWgAt14eCt74E8j0lOzDjju0DnsV+FytL55JE=; b=UdTj/WGs8FTLjfxN8f64oQNiJKR+J1hsBlNfZmViimjHFknB7JeFSMBYobgIy9XnuB 0/YY5s0CE9RPWznaPQRnnmNmXroDJWiQVDVfh8Z33BymceIpMhfU+eKV1wToabnv31Yg tGsBxEinYgsAFl+FSqWV+U66z2vWbmiDtXFb5t8JozaUpaJcxSDGYD3UCMU5Iefb1p+d rmbvzsNv1Jk65g0xHG58gAl5NOs7bA2lGzD900OTcSJYrZh8LSTbLxoiuZobSh9XP0YZ RYqMhHFjKI/8qUpgChC9i1V0dnqLw7+XDQXu9PvFfoMAThX3qgclich5vCPmV9Wct2kn n5uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=klBGswXe; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 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. [198.145.21.10]) by mx.google.com with ESMTPS id s8si332565plq.345.2019.01.14.05.29.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Jan 2019 05:29:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=klBGswXe; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 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 28095211B76DB; Mon, 14 Jan 2019 05:28:32 -0800 (PST) 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=2a00:1450:4864:20::32c; helo=mail-wm1-x32c.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (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 1C272211B1FB1 for ; Mon, 14 Jan 2019 05:28:30 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id a62so8901531wmh.4 for ; Mon, 14 Jan 2019 05:28:29 -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=ZLc9edlLrCPE90m1+Nqbw+5Zy1YcH+Jchn359vG8Ny0=; b=klBGswXe4lpV1jrQ305pX7h8zEig6ugLIbZ6LUyH5cCVisNMLOFcPxjSOdeozEs34d wqk+awvafH/JJh8//wC9uaKpisARuVbzwq86Jezy71Ewt8y7cgH1s4NuBGvMYt5CDmbw wrjGk6nLV//eHS2AXma61tWiOzXf1wRroQD3k= 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=ZLc9edlLrCPE90m1+Nqbw+5Zy1YcH+Jchn359vG8Ny0=; b=aKip+x9Ehyho4Rd5CqSFdndEBgiUQkncm55nuqMzkH3KxMtySr0WYJevlVGvsk6FqC ADWPfkDhpv6SGcQzCzQv3h1BbNGMYtqa38fdr+4ahvCT5hJQqXB9ImO/EqXu6PgNdUKK sfB362tS2/3IHwMIyA3VR6KHKMsiLQ8doFAu/QNisDIVAQCbYjWa8X2LkEiukXjJ9UVj OWt/SvxeWw7iKtU3xBGkDR7HWAwt+sPExeASdABcuUVTCMri7MpWWRRJaU/0GwTWgwnT +P4vtWHArrMB1Z74ZRH+O9GK7bQBszkEZjyE2AUU07VEjqE5bXpmmbF6inG3GdMGazZu EL+w== X-Gm-Message-State: AJcUukeeIVY4kibj/F8ZwBcsAsvUWbJ7vAuDLELJwtQMwAitBDK5LMhU gBH6jzUe04qVZ41yCy6vp+760PcwegQ= X-Received: by 2002:a7b:c315:: with SMTP id k21mr11467686wmj.145.1547472508190; Mon, 14 Jan 2019 05:28:28 -0800 (PST) Received: from localhost.localdomain (aputeaux-684-1-19-62.w90-86.abo.wanadoo.fr. [90.86.222.62]) by smtp.gmail.com with ESMTPSA id 202sm33446560wmt.8.2019.01.14.05.28.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Jan 2019 05:28:27 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Mon, 14 Jan 2019 14:27:52 +0100 Message-Id: <20190114132758.24054-12-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190114132758.24054-1-ard.biesheuvel@linaro.org> References: <20190114132758.24054-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [edk2] [PATCH v2 11/17] MdePkg: add MM_STANDALONE implementation of MmServicesTableLib 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 , Michael D Kinney , Laszlo Ersek , Star Zeng Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" The newly introduced generic MmServicesTableLib can be implemented for traditional SMM (as we did already), but MM_STANDALONE drivers require an implementation that is based on standalone MM. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- MdePkg/MdePkg.dsc | 1 + MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf | 39 +++++++++++++++++++ MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c | 41 ++++++++++++++++++++ MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.uni | 20 ++++++++++ 4 files changed, 101 insertions(+) -- 2.20.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc index ec561c53cab0..303e1ab3bd0f 100644 --- a/MdePkg/MdePkg.dsc +++ b/MdePkg/MdePkg.dsc @@ -116,6 +116,7 @@ [Components] MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf + MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf [Components.IA32, Components.X64] MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf diff --git a/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf b/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf new file mode 100644 index 000000000000..86f6c5c78035 --- /dev/null +++ b/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf @@ -0,0 +1,39 @@ +## @file +# Standalone MM Services Table Library. +# +# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2018, Linaro, Ltd. All rights reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php. +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = StandaloneMmServicesTableLib + MODULE_UNI_FILE = StandaloneMmServicesTableLib.uni + FILE_GUID = eaa4684f-fb4e-41f3-9967-307d5b409182 + MODULE_TYPE = MM_STANDALONE + VERSION_STRING = 1.0 + LIBRARY_CLASS = MmServicesTableLib|MM_STANDALONE + PI_SPECIFICATION_VERSION = 0x00010032 + CONSTRUCTOR = StandaloneMmServicesTableLibConstructor + +# +# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 +# + +[Sources] + StandaloneMmServicesTableLib.c + +[Packages] + MdePkg/MdePkg.dec + +[LibraryClasses] + DebugLib diff --git a/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c b/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c new file mode 100644 index 000000000000..b870f25fcfed --- /dev/null +++ b/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c @@ -0,0 +1,41 @@ +/** @file + MM Services Table Library. + + Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2018, Linaro, Ltd. All rights reserved.
+ This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include +#include +#include + +EFI_MM_SYSTEM_TABLE *gMmst = NULL; + +/** + The constructor function caches the pointer of the MM Services Table. + + @param ImageHandle The firmware allocated handle for the EFI image. + @param SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. + +**/ +EFI_STATUS +EFIAPI +StandaloneMmServicesTableLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_MM_SYSTEM_TABLE *MmSystemTable + ) +{ + gMmst = MmSystemTable; + ASSERT (gMmst != NULL); + return EFI_SUCCESS; +} diff --git a/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.uni b/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.uni new file mode 100644 index 000000000000..2cabf1af1483 --- /dev/null +++ b/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.uni @@ -0,0 +1,20 @@ +// /** @file +// +// Standalone MM Services Table Library. +// +// Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+// Copyright (c) 2018, Linaro, Ltd. All rights reserved.
+// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the BSD License +// which accompanies this distribution. The full text of the license may be found at +// http://opensource.org/licenses/bsd-license.php. +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +// +// **/ + + +#string STR_MODULE_ABSTRACT #language en-US "Standalone MM Services Table Library" + +#string STR_MODULE_DESCRIPTION #language en-US "Standalone MM Services Table Library."