* [PATCH 2/4] MdePkg: Import MmServicesTableLib library.
[not found] <5f41891c14511148a07d6b05c3f9ff7547aa8200.1532212228.git.Marvin.Haeuser@outlook.com>
@ 2018-07-21 22:32 ` Marvin Häuser
2018-07-21 22:32 ` [PATCH 3/4] MdeModulePkg: Import PiSmmCoreMmServicesTableLib library Marvin Häuser
2018-07-21 22:32 ` [PATCH 4/4] StandaloneMmPkg: Import StandaloneMmServicesTableLib library Marvin Häuser
2 siblings, 0 replies; 4+ messages in thread
From: Marvin Häuser @ 2018-07-21 22:32 UTC (permalink / raw)
To: edk2-devel@lists.01.org
Cc: michael.d.kinney@intel.com, liming.gao@intel.com,
star.zeng@intel.com, eric.dong@intel.com, ruiyu.ni@intel.com,
achin.gupta@arm.com, jiewen.yao@intel.com,
supreeth.venkatesh@arm.com
Implements the MmServicesTableLib library class.
The code was derieved from SmmServicesTableLib.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
---
MdePkg/Library/MmServicesTableLib/MmServicesTableLib.c | 85 ++++++++++++++++++++
MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf | 41 ++++++++++
MdePkg/Library/MmServicesTableLib/MmServicesTableLib.uni | 21 +++++
MdePkg/MdePkg.dsc | 1 +
4 files changed, 148 insertions(+)
diff --git a/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.c b/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.c
new file mode 100644
index 000000000000..1ecbb044162d
--- /dev/null
+++ b/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.c
@@ -0,0 +1,85 @@
+/** @file
+ MM Services Table Library.
+
+ Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
+ 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 <PiMm.h>
+#include <Protocol/MmBase.h>
+#include <Library/MmServicesTableLib.h>
+#include <Library/DebugLib.h>
+
+EFI_MM_SYSTEM_TABLE *gMmst = NULL;
+
+/**
+ The constructor function caches the pointer of 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
+MmServicesTableLibConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_MM_BASE_PROTOCOL *InternalMmBase;
+
+ InternalMmBase = NULL;
+ //
+ // Retrieve MM Base Protocol, Do not use gBS from UefiBootServicesTableLib on purpose
+ // to prevent inclusion of gBS, gST, and gImageHandle from MM Drivers unless the
+ // MM driver explicity declares that dependency.
+ //
+ Status = SystemTable->BootServices->LocateProtocol (
+ &gEfiMmBaseProtocolGuid,
+ NULL,
+ (VOID **)&InternalMmBase
+ );
+ ASSERT_EFI_ERROR (Status);
+ ASSERT (InternalMmBase != NULL);
+
+ //
+ // We are in MM, retrieve the pointer to MM System Table
+ //
+ InternalMmBase->GetMmstLocation (InternalMmBase, &gMmst);
+ ASSERT (gMmst != NULL);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function allows the caller to determine if the driver is executing in
+ Management Mode(MM).
+
+ This function returns TRUE if the driver is executing in MM and FALSE if the
+ driver is not executing in MM.
+
+ @retval TRUE The driver is executing in Management Mode (MM).
+ @retval FALSE The driver is not executing in Management Mode (MM).
+
+**/
+BOOLEAN
+EFIAPI
+InMm (
+ VOID
+ )
+{
+ //
+ // We are already in MM
+ //
+ return TRUE;
+}
diff --git a/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf b/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf
new file mode 100644
index 000000000000..fd6b2cbe1f94
--- /dev/null
+++ b/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf
@@ -0,0 +1,41 @@
+## @file
+# MM Services Table Library.
+#
+# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+#
+# 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 = 0x00010005
+ BASE_NAME = MmServicesTableLib
+ MODULE_UNI_FILE = MmServicesTableLib.uni
+ FILE_GUID = 319D85EE-D290-4B26-BBDA-9D43CF35DF60
+ MODULE_TYPE = DXE_SMM_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = MmServicesTableLib|DXE_SMM_DRIVER
+ PI_SPECIFICATION_VERSION = 0x0001000A
+ CONSTRUCTOR = MmServicesTableLibConstructor
+
+[Sources]
+ MmServicesTableLib.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ DebugLib
+
+[Protocols]
+ gEfiMmBaseProtocolGuid ## CONSUMES
+
+[Depex]
+ gEfiMmBaseProtocolGuid
+
diff --git a/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.uni b/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.uni
new file mode 100644
index 000000000000..5194cd829051
--- /dev/null
+++ b/MdePkg/Library/MmServicesTableLib/MmServicesTableLib.uni
@@ -0,0 +1,21 @@
+// /** @file
+// MM Services Table Library.
+//
+// MM Services Table Library.
+//
+// Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+//
+// 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 "MM Services Table Library"
+
+#string STR_MODULE_DESCRIPTION #language en-US "MM Services Table Library."
+
diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc
index c7b93d4c8c44..7903638f8dad 100644
--- a/MdePkg/MdePkg.dsc
+++ b/MdePkg/MdePkg.dsc
@@ -151,6 +151,7 @@ [Components.IA32, Components.X64]
MdePkg/Library/SmmIoLibSmmCpuIo2/SmmIoLibSmmCpuIo2.inf
MdePkg/Library/SmmPciLibPciRootBridgeIo/SmmPciLibPciRootBridgeIo.inf
MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.inf
+ MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf
MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.inf
MdePkg/Library/SmmPeriodicSmiLib/SmmPeriodicSmiLib.inf
MdePkg/Library/BaseS3BootScriptLibNull/BaseS3BootScriptLibNull.inf
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/4] MdeModulePkg: Import PiSmmCoreMmServicesTableLib library.
[not found] <5f41891c14511148a07d6b05c3f9ff7547aa8200.1532212228.git.Marvin.Haeuser@outlook.com>
2018-07-21 22:32 ` [PATCH 2/4] MdePkg: Import MmServicesTableLib library Marvin Häuser
@ 2018-07-21 22:32 ` Marvin Häuser
2018-07-21 22:32 ` [PATCH 4/4] StandaloneMmPkg: Import StandaloneMmServicesTableLib library Marvin Häuser
2 siblings, 0 replies; 4+ messages in thread
From: Marvin Häuser @ 2018-07-21 22:32 UTC (permalink / raw)
To: edk2-devel@lists.01.org
Cc: michael.d.kinney@intel.com, liming.gao@intel.com,
star.zeng@intel.com, eric.dong@intel.com, ruiyu.ni@intel.com,
achin.gupta@arm.com, jiewen.yao@intel.com,
supreeth.venkatesh@arm.com
Implements the MmServicesTableLib library class for PiSmmCore.
The code was derieved from PiSmmCoreSmmServicesTableLib.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
---
MdeModulePkg/Library/PiSmmCoreMmServicesTableLib/PiSmmCoreMmServicesTableLib.c | 61 ++++++++++++++++++++
MdeModulePkg/Library/PiSmmCoreMmServicesTableLib/PiSmmCoreMmServicesTableLib.inf | 32 ++++++++++
MdeModulePkg/Library/PiSmmCoreMmServicesTableLib/PiSmmCoreMmServicesTableLib.uni | 21 +++++++
3 files changed, 114 insertions(+)
diff --git a/MdeModulePkg/Library/PiSmmCoreMmServicesTableLib/PiSmmCoreMmServicesTableLib.c b/MdeModulePkg/Library/PiSmmCoreMmServicesTableLib/PiSmmCoreMmServicesTableLib.c
new file mode 100644
index 000000000000..9184e9e2e6c9
--- /dev/null
+++ b/MdeModulePkg/Library/PiSmmCoreMmServicesTableLib/PiSmmCoreMmServicesTableLib.c
@@ -0,0 +1,61 @@
+/** @file
+ SMM Core MM Services Table Library.
+
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+ 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 <PiMm.h>
+#include <PiSmm.h>
+#include <Library/MmServicesTableLib.h>
+#include <Library/DebugLib.h>
+
+EFI_MM_SYSTEM_TABLE *gMmst = NULL;
+extern EFI_SMM_SYSTEM_TABLE2 gSmmCoreSmst;
+
+/**
+ The constructor function caches the pointer of 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
+SmmCoreMmServicesTableLibConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ gMmst = (EFI_MM_SYSTEM_TABLE *)&gSmmCoreSmst;
+ return EFI_SUCCESS;
+}
+
+/**
+ This function allows the caller to determine if the driver is executing in
+ Management Mode(MM).
+
+ This function returns TRUE if the driver is executing in MM and FALSE if the
+ driver is not executing in MM.
+
+ @retval TRUE The driver is executing in Management Mode (MM).
+ @retval FALSE The driver is not executing in Management Mode (MM).
+
+**/
+BOOLEAN
+EFIAPI
+InMm (
+ VOID
+ )
+{
+ return TRUE;
+}
diff --git a/MdeModulePkg/Library/PiSmmCoreMmServicesTableLib/PiSmmCoreMmServicesTableLib.inf b/MdeModulePkg/Library/PiSmmCoreMmServicesTableLib/PiSmmCoreMmServicesTableLib.inf
new file mode 100644
index 000000000000..06bb455b1777
--- /dev/null
+++ b/MdeModulePkg/Library/PiSmmCoreMmServicesTableLib/PiSmmCoreMmServicesTableLib.inf
@@ -0,0 +1,32 @@
+## @file
+# SMM Core MM Services Table Library.
+#
+# Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
+#
+# 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 = 0x00010005
+ BASE_NAME = PiSmmCoreMmServicesTableLib
+ MODULE_UNI_FILE = PiSmmCoreMmServicesTableLib.uni
+ FILE_GUID = 9E32CD7E-DB34-42B5-B5FA-77DD98633F47
+ MODULE_TYPE = SMM_CORE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = MmServicesTableLib|SMM_CORE
+ PI_SPECIFICATION_VERSION = 0x0001000A
+ CONSTRUCTOR = SmmCoreMmServicesTableLibConstructor
+
+[Sources]
+ PiSmmCoreMmServicesTableLib.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+
diff --git a/MdeModulePkg/Library/PiSmmCoreMmServicesTableLib/PiSmmCoreMmServicesTableLib.uni b/MdeModulePkg/Library/PiSmmCoreMmServicesTableLib/PiSmmCoreMmServicesTableLib.uni
new file mode 100644
index 000000000000..dbf7ce93731e
--- /dev/null
+++ b/MdeModulePkg/Library/PiSmmCoreMmServicesTableLib/PiSmmCoreMmServicesTableLib.uni
@@ -0,0 +1,21 @@
+// /** @file
+// SMM Core MM Services Table Library.
+//
+// SMM Core MM Services Table Library.
+//
+// Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
+//
+// 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 "SMM Core MM Services Table Library"
+
+#string STR_MODULE_DESCRIPTION #language en-US "SMM Core MM Services Table Library."
+
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 4/4] StandaloneMmPkg: Import StandaloneMmServicesTableLib library.
[not found] <5f41891c14511148a07d6b05c3f9ff7547aa8200.1532212228.git.Marvin.Haeuser@outlook.com>
2018-07-21 22:32 ` [PATCH 2/4] MdePkg: Import MmServicesTableLib library Marvin Häuser
2018-07-21 22:32 ` [PATCH 3/4] MdeModulePkg: Import PiSmmCoreMmServicesTableLib library Marvin Häuser
@ 2018-07-21 22:32 ` Marvin Häuser
2018-07-23 12:48 ` Marvin Häuser
2 siblings, 1 reply; 4+ messages in thread
From: Marvin Häuser @ 2018-07-21 22:32 UTC (permalink / raw)
To: edk2-devel@lists.01.org
Cc: michael.d.kinney@intel.com, liming.gao@intel.com,
star.zeng@intel.com, eric.dong@intel.com, ruiyu.ni@intel.com,
achin.gupta@arm.com, jiewen.yao@intel.com,
supreeth.venkatesh@arm.com
Implements the MmServicesTableLib library class for MM Stanalone
modules. The code was derieved from SmmServicesTableLib.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
---
StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c | 64 ++++++++++++++++++++
StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf | 35 +++++++++++
StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.uni | 21 +++++++
3 files changed, 120 insertions(+)
diff --git a/StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c b/StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c
new file mode 100644
index 000000000000..d33ff953b555
--- /dev/null
+++ b/StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c
@@ -0,0 +1,64 @@
+/** @file
+ Standalone MM Services Table Library.
+
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+ 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 <PiMm.h>
+#include <Library/MmServicesTableLib.h>
+#include <Library/DebugLib.h>
+
+EFI_MM_SYSTEM_TABLE *gMmst = NULL;
+
+/**
+ The constructor function caches the pointer of MM Services Table.
+
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param MmSystemTable A pointer to the MM 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;
+}
+
+/**
+ This function allows the caller to determine if the driver is executing in
+ Management Mode(MM).
+
+ This function returns TRUE if the driver is executing in MM and FALSE if the
+ driver is not executing in MM.
+
+ @retval TRUE The driver is executing in Management Mode (MM).
+ @retval FALSE The driver is not executing in Management Mode (MM).
+
+**/
+BOOLEAN
+EFIAPI
+InMm (
+ VOID
+ )
+{
+ //
+ // We are already in MM
+ //
+ return TRUE;
+}
diff --git a/StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf b/StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf
new file mode 100644
index 000000000000..bfe5678a5bc0
--- /dev/null
+++ b/StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf
@@ -0,0 +1,35 @@
+## @file
+# Standalone MM Services Table Library.
+#
+# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+#
+# 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 = 0x00010005
+ BASE_NAME = StandaloneMmServicesTableLib
+ MODULE_UNI_FILE = StandaloneMmServicesTableLib.uni
+ FILE_GUID = 821F6D8E-CE99-4CD5-B1FD-C33AC8BA5704
+ MODULE_TYPE = MM_STANDALONE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = MmServicesTableLib|MM_STANDALONE
+ PI_SPECIFICATION_VERSION = 0x0001000A
+ CONSTRUCTOR = StandaloneMmServicesTableLibConstructor
+
+[Sources]
+ StandaloneMmServicesTableLib.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ StandaloneMmPkg/StandaloneMmPkg.dec
+
+[LibraryClasses]
+ DebugLib
diff --git a/StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.uni b/StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.uni
new file mode 100644
index 000000000000..c0581e2820ce
--- /dev/null
+++ b/StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.uni
@@ -0,0 +1,21 @@
+// /** @file
+// Standalone MM Services Table Library.
+//
+// Standalone MM Services Table Library.
+//
+// Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+//
+// 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.18.0.windows.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 4/4] StandaloneMmPkg: Import StandaloneMmServicesTableLib library.
2018-07-21 22:32 ` [PATCH 4/4] StandaloneMmPkg: Import StandaloneMmServicesTableLib library Marvin Häuser
@ 2018-07-23 12:48 ` Marvin Häuser
0 siblings, 0 replies; 4+ messages in thread
From: Marvin Häuser @ 2018-07-23 12:48 UTC (permalink / raw)
To: edk2-devel@lists.01.org
Cc: jiewen.yao@intel.com, supreeth.venkatesh@arm.com,
achin.gupta@arm.com
Comment inline.
Thanks,
Marvin
> -----Original Message-----
> From: edk2-devel <edk2-devel-bounces@lists.01.org> On Behalf Of Marvin
> Häuser
> Sent: Sunday, July 22, 2018 12:32 AM
> To: edk2-devel@lists.01.org
> Cc: ruiyu.ni@intel.com; eric.dong@intel.com; liming.gao@intel.com;
> jiewen.yao@intel.com; michael.d.kinney@intel.com; star.zeng@intel.com
> Subject: [edk2] [PATCH 4/4] StandaloneMmPkg: Import
> StandaloneMmServicesTableLib library.
>
> Implements the MmServicesTableLib library class for MM Stanalone
> modules. The code was derieved from SmmServicesTableLib.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
> ---
>
> StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneMmS
> ervicesTableLib.c | 64 ++++++++++++++++++++
>
> StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneMmS
> ervicesTableLib.inf | 35 +++++++++++
> StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneMmS
> ervicesTableLib.uni | 21 +++++++
> 3 files changed, 120 insertions(+)
>
> diff --git
> a/StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneM
> mServicesTableLib.c
> b/StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneM
> mServicesTableLib.c
> new file mode 100644
> index 000000000000..d33ff953b555
> --- /dev/null
> +++
> b/StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneM
> mS
> +++ ervicesTableLib.c
> @@ -0,0 +1,64 @@
> +/** @file
> + Standalone MM Services Table Library.
> +
> + Copyright (c) 2010 - 2018, Intel Corporation. All rights
> + reserved.<BR> 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 <PiMm.h>
> +#include <Library/MmServicesTableLib.h> #include <Library/DebugLib.h>
> +
> +EFI_MM_SYSTEM_TABLE *gMmst = NULL;
> +
> +/**
> + The constructor function caches the pointer of MM Services Table.
> +
> + @param ImageHandle The firmware allocated handle for the EFI image.
> + @param MmSystemTable A pointer to the MM 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;
> +}
> +
> +/**
> + This function allows the caller to determine if the driver is
> +executing in
> + Management Mode(MM).
> +
> + This function returns TRUE if the driver is executing in MM and FALSE
> + if the driver is not executing in MM.
> +
> + @retval TRUE The driver is executing in Management Mode (MM).
> + @retval FALSE The driver is not executing in Management Mode (MM).
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +InMm (
> + VOID
> + )
> +{
> + //
> + // We are already in MM
> + //
> + return TRUE;
> +}
> diff --git
> a/StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneM
> mServicesTableLib.inf
> b/StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneM
> mServicesTableLib.inf
> new file mode 100644
> index 000000000000..bfe5678a5bc0
> --- /dev/null
> +++
> b/StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneM
> mS
> +++ ervicesTableLib.inf
> @@ -0,0 +1,35 @@
> +## @file
> +# Standalone MM Services Table Library.
> +#
> +# Copyright (c) 2009 - 2014, Intel Corporation. All rights
> +reserved.<BR> # # 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 = 0x00010005
> + BASE_NAME = StandaloneMmServicesTableLib
> + MODULE_UNI_FILE = StandaloneMmServicesTableLib.uni
> + FILE_GUID = 821F6D8E-CE99-4CD5-B1FD-C33AC8BA5704
> + MODULE_TYPE = MM_STANDALONE
> + VERSION_STRING = 1.0
> + LIBRARY_CLASS = MmServicesTableLib|MM_STANDALONE
> + PI_SPECIFICATION_VERSION = 0x0001000A
I just noticed I forgot to stage the update of this value to 0x00010032 when committing.
I can send a V2 once the other patches have been commented on / reviewed.
> + CONSTRUCTOR = StandaloneMmServicesTableLibConstructor
> +
> +[Sources]
> + StandaloneMmServicesTableLib.c
> +
> +[Packages]
> + MdePkg/MdePkg.dec
> + StandaloneMmPkg/StandaloneMmPkg.dec
> +
> +[LibraryClasses]
> + DebugLib
> diff --git
> a/StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneM
> mServicesTableLib.uni
> b/StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneM
> mServicesTableLib.uni
> new file mode 100644
> index 000000000000..c0581e2820ce
> --- /dev/null
> +++
> b/StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneM
> mS
> +++ ervicesTableLib.uni
> @@ -0,0 +1,21 @@
> +// /** @file
> +// Standalone MM Services Table Library.
> +//
> +// Standalone MM Services Table Library.
> +//
> +// Copyright (c) 2009 - 2014, Intel Corporation. All rights
> +reserved.<BR> // // 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.18.0.windows.1
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 4+ messages in thread