From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: ALg8bN7NuWVpFCSZ9GXjTxxQzOVHbNqtizA6LSgioU4C1m57x4JSWYlBUsWsNv4ENS2zSlCfdMv6qQ== 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 Cc: Ard Biesheuvel , Laszlo Ersek , Leif Lindholm , Michael D Kinney , Liming Gao , Jian J Wang , Hao Wu , Jagadeesh Ujja , Achin Gupta , Thomas Panakamattam Abraham , Sami Mujawar , Star Zeng 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: [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: , X-List-Received-Date: Mon, 14 Jan 2019 13:28:30 -0000 Content-Transfer-Encoding: 8bit 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(+) 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." -- 2.20.1