TianoCore EDK2 master
Loading...
Searching...
No Matches
MmServicesTableLib.c
Go to the documentation of this file.
1
10#include <PiMm.h>
11#include <Protocol/MmBase.h>
13#include <Library/DebugLib.h>
14
16
27EFIAPI
29 IN EFI_HANDLE ImageHandle,
30 IN EFI_SYSTEM_TABLE *SystemTable
31 )
32{
33 EFI_STATUS Status;
34 EFI_MM_BASE_PROTOCOL *InternalMmBase;
35
36 InternalMmBase = NULL;
37 //
38 // Retrieve MM Base Protocol, Do not use gBS from UefiBootServicesTableLib on purpose
39 // to prevent inclusion of gBS, gST, and gImageHandle from SMM Drivers unless the
40 // MM driver explicity declares that dependency.
41 //
42 Status = SystemTable->BootServices->LocateProtocol (
43 &gEfiMmBaseProtocolGuid,
44 NULL,
45 (VOID **)&InternalMmBase
46 );
47 ASSERT_EFI_ERROR (Status);
48 ASSERT (InternalMmBase != NULL);
49
50 //
51 // We are in MM, retrieve the pointer to MM System Table
52 //
53 InternalMmBase->GetMmstLocation (InternalMmBase, &gMmst);
54 ASSERT (gMmst != NULL);
55
56 return EFI_SUCCESS;
57}
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
EFI_STATUS EFIAPI MmServicesTableLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112