public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Xu, Wei6" <wei6.xu@intel.com>
To: devel@edk2.groups.io
Cc: Wei6 Xu <wei6.xu@intel.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Sami Mujawar <sami.mujawar@arm.com>, Ray Ni <ray.ni@intel.com>
Subject: [edk2-devel] [PATCH 1/2] StandaloneMmPkg: Add Standalone Mm Core platform hook lib.
Date: Fri, 27 Oct 2023 11:28:01 +0800	[thread overview]
Message-ID: <74ca409bcfbd0041c8ead9f504776d76420c4b03.1698375369.git.wei6.xu@intel.com> (raw)
In-Reply-To: <cover.1698375369.git.wei6.xu@intel.com>

Add header file for the definition of StandaloneMmCorePlatformHookLib.
Add NULL instance for StandaloneMmCorePlatformHookLib.

This library class defines a set of platform hooks called by the
Standalone Mm Core. With this library, platform can perform specific
tasks before and after invoking registered MMI handlers.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
---
 .../StandaloneMmCorePlatformHookLibNull.c     | 45 +++++++++++++++++++
 .../Library/StandaloneMmCorePlatformHookLib.h | 44 ++++++++++++++++++
 .../StandaloneMmCorePlatformHookLibNull.inf   | 30 +++++++++++++
 StandaloneMmPkg/StandaloneMmPkg.dec           |  4 ++
 StandaloneMmPkg/StandaloneMmPkg.dsc           |  2 +
 5 files changed, 125 insertions(+)
 create mode 100644 StandaloneMmPkg/Library/StandaloneMmCorePlatformHookLibNull/StandaloneMmCorePlatformHookLibNull.c
 create mode 100644 StandaloneMmPkg/Include/Library/StandaloneMmCorePlatformHookLib.h
 create mode 100644 StandaloneMmPkg/Library/StandaloneMmCorePlatformHookLibNull/StandaloneMmCorePlatformHookLibNull.inf

diff --git a/StandaloneMmPkg/Library/StandaloneMmCorePlatformHookLibNull/StandaloneMmCorePlatformHookLibNull.c b/StandaloneMmPkg/Library/StandaloneMmCorePlatformHookLibNull/StandaloneMmCorePlatformHookLibNull.c
new file mode 100644
index 000000000000..dfd781e8c947
--- /dev/null
+++ b/StandaloneMmPkg/Library/StandaloneMmCorePlatformHookLibNull/StandaloneMmCorePlatformHookLibNull.c
@@ -0,0 +1,45 @@
+/** @file
+  NULL instance of StandaloneMmCorePlatformHookLib.
+
+  Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Library/StandaloneMmCorePlatformHookLib.h>
+
+/**
+  Performs platform specific tasks before invoking registered SMI handlers.
+
+  This function performs platform specific tasks before invoking registered SMI handlers.
+
+  @retval EFI_SUCCESS       The platform hook completes successfully.
+  @retval Other values      The platform hook cannot complete due to some error.
+
+**/
+EFI_STATUS
+EFIAPI
+PlatformHookBeforeMmDispatch (
+  VOID
+  )
+{
+  return EFI_SUCCESS;
+}
+
+/**
+  Performs platform specific tasks after invoking registered SMI handlers.
+
+  This function performs platform specific tasks after invoking registered SMI handlers.
+
+  @retval EFI_SUCCESS       The platform hook completes successfully.
+  @retval Other values      The platform hook cannot complete due to some error.
+
+**/
+EFI_STATUS
+EFIAPI
+PlatformHookAfterMmDispatch (
+  VOID
+  )
+{
+  return EFI_SUCCESS;
+}
diff --git a/StandaloneMmPkg/Include/Library/StandaloneMmCorePlatformHookLib.h b/StandaloneMmPkg/Include/Library/StandaloneMmCorePlatformHookLib.h
new file mode 100644
index 000000000000..37eaa4e8946c
--- /dev/null
+++ b/StandaloneMmPkg/Include/Library/StandaloneMmCorePlatformHookLib.h
@@ -0,0 +1,44 @@
+/** @file
+  Standalone Mm Core Platform Hook Library. This library class defines a set of platform
+  hooks called by the Standalone Mm Core.
+
+  Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef STANDALONE_MM_CORE_PLATFORM_HOOK_LIB_
+#define STANDALONE_MM_CORE_PLATFORM_HOOK_LIB_
+
+/**
+  Performs platform specific tasks before invoking registered MMI handlers.
+
+  This function performs platform specific tasks before invoking registered MMI handlers.
+
+  @retval EFI_SUCCESS       The platform hook completes successfully.
+  @retval Other values      The platform hook cannot complete due to some error.
+
+**/
+EFI_STATUS
+EFIAPI
+PlatformHookBeforeMmDispatch (
+  VOID
+  );
+
+/**
+  Performs platform specific tasks after invoking registered MMI handlers.
+
+  This function performs platform specific tasks after invoking registered MMI handlers.
+
+  @retval EFI_SUCCESS       The platform hook completes successfully.
+  @retval Other values      The platform hook cannot complete due to some error.
+
+**/
+EFI_STATUS
+EFIAPI
+PlatformHookAfterMmDispatch (
+  VOID
+  );
+
+#endif
diff --git a/StandaloneMmPkg/Library/StandaloneMmCorePlatformHookLibNull/StandaloneMmCorePlatformHookLibNull.inf b/StandaloneMmPkg/Library/StandaloneMmCorePlatformHookLibNull/StandaloneMmCorePlatformHookLibNull.inf
new file mode 100644
index 000000000000..917f2983c938
--- /dev/null
+++ b/StandaloneMmPkg/Library/StandaloneMmCorePlatformHookLibNull/StandaloneMmCorePlatformHookLibNull.inf
@@ -0,0 +1,30 @@
+## @file
+#  Standalone MM Core Platform Hook NULL Library instance.
+#
+#  Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = StandaloneMmCorePlatformHookLibNull
+  FILE_GUID                      = A5924660-072B-4188-A850-C45FBED9FCE0
+  MODULE_TYPE                    = MM_CORE_STANDALONE
+  VERSION_STRING                 = 1.0
+  PI_SPECIFICATION_VERSION       = 0x00010032
+  LIBRARY_CLASS                  = StandaloneMmCorePlatformHookLib|MM_CORE_STANDALONE
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+#  VALID_ARCHITECTURES           = IA32 X64
+#
+
+[Sources]
+  StandaloneMmCorePlatformHookLibNull.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  StandaloneMmPkg/StandaloneMmPkg.dec
diff --git a/StandaloneMmPkg/StandaloneMmPkg.dec b/StandaloneMmPkg/StandaloneMmPkg.dec
index 46784d94e421..1e847ebd0635 100644
--- a/StandaloneMmPkg/StandaloneMmPkg.dec
+++ b/StandaloneMmPkg/StandaloneMmPkg.dec
@@ -29,6 +29,10 @@ [LibraryClasses]
   ##                 MM Memory Operation.
   MemLib|Include/Library/StandaloneMmMemLib.h
 
+  ##  @libraryclass  Defines a set of platform hooks called by the Standalone
+  ##                 Mm Core.
+  StandaloneMmCorePlatformHookLib|Include/Library/StandaloneMmCorePlatformHookLib.h
+
 [LibraryClasses.AArch64, LibraryClasses.ARM]
   ##  @libraryclass  Defines a set of interfaces for the MM core entrypoint for
   ##                 AArch64 and ARM.
diff --git a/StandaloneMmPkg/StandaloneMmPkg.dsc b/StandaloneMmPkg/StandaloneMmPkg.dsc
index 8012f93b7dcc..bfa1760f8e6f 100644
--- a/StandaloneMmPkg/StandaloneMmPkg.dsc
+++ b/StandaloneMmPkg/StandaloneMmPkg.dsc
@@ -72,6 +72,7 @@ [LibraryClasses.AARCH64, LibraryClasses.ARM]
 
 [LibraryClasses.common.MM_CORE_STANDALONE]
   HobLib|StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf
+  StandaloneMmCorePlatformHookLib|StandaloneMmPkg/Library/StandaloneMmCorePlatformHookLibNull/StandaloneMmCorePlatformHookLibNull.inf
 
 [LibraryClasses.common.MM_STANDALONE]
   MemoryAllocationLib|StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.inf
@@ -117,6 +118,7 @@ [Components.common]
   StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf
   StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.inf
   StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf
+  StandaloneMmPkg/Library/StandaloneMmCorePlatformHookLibNull/StandaloneMmCorePlatformHookLibNull.inf
 
 [Components.AARCH64, Components.ARM]
   StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.inf
-- 
2.29.2.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#110178): https://edk2.groups.io/g/devel/message/110178
Mute This Topic: https://groups.io/mt/102214567/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2023-10-27  3:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-27  3:28 [edk2-devel] [PATCH 0/2] Add Platform Hook Lib into StandaloneMmCore Xu, Wei6
2023-10-27  3:28 ` Xu, Wei6 [this message]
2023-10-27  3:28 ` [edk2-devel] [PATCH 2/2] StandaloneMmPkg/Core: Consumes Standalone Mm Core Platform Hook Lib Xu, Wei6
2023-10-27 16:08 ` [edk2-devel] [PATCH 0/2] Add Platform Hook Lib into StandaloneMmCore Michael Kubacki
2023-10-28 14:03   ` Laszlo Ersek
2023-10-30  0:52     ` Xu, Wei6
2023-10-30 19:27     ` Michael Kubacki
2023-10-31  1:18       ` Xu, Wei6
2023-10-31  1:40         ` Michael Kubacki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74ca409bcfbd0041c8ead9f504776d76420c4b03.1698375369.git.wei6.xu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox