]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdePkg: add MM_STANDALONE implementation of MmServicesTableLib
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 14 Jan 2019 12:06:01 +0000 (13:06 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 16 Jan 2019 19:10:51 +0000 (20:10 +0100)
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 <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c [new file with mode: 0644]
MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf [new file with mode: 0644]
MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.uni [new file with mode: 0644]
MdePkg/MdePkg.dsc

diff --git a/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c b/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c
new file mode 100644 (file)
index 0000000..b870f25
--- /dev/null
@@ -0,0 +1,41 @@
+/** @file\r
+  MM Services Table Library.\r
+\r
+  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2018, Linaro, Ltd. All rights reserved.<BR>\r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php.\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include <PiMm.h>\r
+#include <Library/MmServicesTableLib.h>\r
+#include <Library/DebugLib.h>\r
+\r
+EFI_MM_SYSTEM_TABLE   *gMmst             = NULL;\r
+\r
+/**\r
+  The constructor function caches the pointer of the MM Services Table.\r
+\r
+  @param  ImageHandle   The firmware allocated handle for the EFI image.\r
+  @param  SystemTable   A pointer to the EFI System Table.\r
+\r
+  @retval EFI_SUCCESS   The constructor always returns EFI_SUCCESS.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+StandaloneMmServicesTableLibConstructor (\r
+  IN EFI_HANDLE           ImageHandle,\r
+  IN EFI_MM_SYSTEM_TABLE  *MmSystemTable\r
+  )\r
+{\r
+  gMmst = MmSystemTable;\r
+  ASSERT (gMmst != NULL);\r
+  return EFI_SUCCESS;\r
+}\r
diff --git a/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf b/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf
new file mode 100644 (file)
index 0000000..86f6c5c
--- /dev/null
@@ -0,0 +1,39 @@
+## @file\r
+# Standalone MM Services Table Library.\r
+#\r
+# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2018, Linaro, Ltd. All rights reserved.<BR>\r
+#\r
+#  This program and the accompanying materials\r
+#  are licensed and made available under the terms and conditions of the BSD License\r
+#  which accompanies this distribution. The full text of the license may be found at\r
+#  http://opensource.org/licenses/bsd-license.php.\r
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+#\r
+##\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x0001001B\r
+  BASE_NAME                      = StandaloneMmServicesTableLib\r
+  MODULE_UNI_FILE                = StandaloneMmServicesTableLib.uni\r
+  FILE_GUID                      = eaa4684f-fb4e-41f3-9967-307d5b409182\r
+  MODULE_TYPE                    = MM_STANDALONE\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = MmServicesTableLib|MM_STANDALONE\r
+  PI_SPECIFICATION_VERSION       = 0x00010032\r
+  CONSTRUCTOR                    = StandaloneMmServicesTableLibConstructor\r
+\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 ARM AARCH64\r
+#\r
+\r
+[Sources]\r
+  StandaloneMmServicesTableLib.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+\r
+[LibraryClasses]\r
+  DebugLib\r
diff --git a/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.uni b/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.uni
new file mode 100644 (file)
index 0000000..2cabf1a
--- /dev/null
@@ -0,0 +1,20 @@
+// /** @file\r
+//\r
+// Standalone MM Services Table Library.\r
+//\r
+// Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
+// Copyright (c) 2018, Linaro, Ltd. All rights reserved.<BR>\r
+//\r
+// This program and the accompanying materials\r
+// are licensed and made available under the terms and conditions of the BSD License\r
+// which accompanies this distribution. The full text of the license may be found at\r
+// http://opensource.org/licenses/bsd-license.php.\r
+// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+//\r
+// **/\r
+\r
+\r
+#string STR_MODULE_ABSTRACT             #language en-US "Standalone MM Services Table Library"\r
+\r
+#string STR_MODULE_DESCRIPTION          #language en-US "Standalone MM Services Table Library."\r
index ec561c53cab062419a44fff1a1ddf8246e2fa5df..303e1ab3bd0f46f2f765ab4a9ce8c13f88562196 100644 (file)
   MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf\r
 \r
   MdePkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf\r
+  MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf\r
 \r
 [Components.IA32, Components.X64]\r
   MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf\r