Skip to content

Commit

Permalink
Implement MmServicesTableLib for MM Core (#730)
Browse files Browse the repository at this point in the history
This change added the long vacant `MmServicesTableLib` for MM core instance.
The implementation will use extern to link the gMmst to the global MM table,
so that the libraries can use gMmst more generically.

cherry-pick from 03d53bb, d4dff6b, 1f75b27
  • Loading branch information
kuqin12 authored and cfernald committed Jul 3, 2024
1 parent 0d3dd14 commit 04893e3
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/HobLib.h>
#include <Library/MmServicesTableLib.h> // MU_CHANGE: Added for gMmst
#include "StandaloneMmCoreMemoryAllocationServices.h"

EFI_MM_SYSTEM_TABLE *gMmst = NULL;
// EFI_MM_SYSTEM_TABLE *gMmst = NULL; // MU_CHANGE: Removed for gMmst

/**
Allocates one or more 4KB pages of a certain memory type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
BaseMemoryLib
DebugLib
HobLib
# MU_CHANGE: Added for gMmst
MmServicesTableLib

[Guids]
gEfiMmPeiMmramMemoryReserveGuid
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/** @file
MM Services Table Library.
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2018, Linaro, Ltd. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#include <PiMm.h>
#include <Library/MmServicesTableLib.h>
#include <Library/DebugLib.h>

EFI_MM_SYSTEM_TABLE *gMmst = NULL;
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## @file
# Standalone MM Services Table Library.
#
# Copyright (c) Microsoft Corporation.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
#
##

[Defines]
INF_VERSION = 0x0001001B
BASE_NAME = StandaloneMmServicesTableLibCore
FILE_GUID = A9E61A64-FDD4-4162-9321-C6769FB96E3B
MODULE_TYPE = MM_CORE_STANDALONE
VERSION_STRING = 1.0
LIBRARY_CLASS = MmServicesTableLib|MM_CORE_STANDALONE
PI_SPECIFICATION_VERSION = 0x00010032

#
# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64
#

[Sources]
StandaloneMmServicesTableLibCore.c

[Packages]
MdePkg/MdePkg.dec
3 changes: 3 additions & 0 deletions StandaloneMmPkg/StandaloneMmPkg.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@

[LibraryClasses.common.MM_CORE_STANDALONE]
HobLib|StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf
# MU_CHANGE: Added core instance of MmServicesTableLib
MmServicesTableLib|StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLibCore.inf

[LibraryClasses.common.MM_STANDALONE]
MemoryAllocationLib|StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.inf
Expand Down Expand Up @@ -138,6 +140,7 @@

# MU_CHANGE [BEGIN]
StandaloneMmPkg/Library/StandaloneMmCoreEntryPointNull/StandaloneMmCoreEntryPointNull.inf
StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLibCore.inf

[Components.X64]
StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/StandaloneMmCoreEntryPoint.inf
Expand Down

0 comments on commit 04893e3

Please sign in to comment.