TianoCore EDK2 master
Loading...
Searching...
No Matches
SmmServicesTableLib.c
Go to the documentation of this file.
1
9#include <PiSmm.h>
10#include <Protocol/SmmBase2.h>
12#include <Library/DebugLib.h>
13
15
26EFIAPI
28 IN EFI_HANDLE ImageHandle,
29 IN EFI_SYSTEM_TABLE *SystemTable
30 )
31{
32 EFI_STATUS Status;
33 EFI_SMM_BASE2_PROTOCOL *InternalSmmBase2;
34
35 InternalSmmBase2 = NULL;
36 //
37 // Retrieve SMM Base2 Protocol, Do not use gBS from UefiBootServicesTableLib on purpose
38 // to prevent inclusion of gBS, gST, and gImageHandle from SMM Drivers unless the
39 // SMM driver explicitly declares that dependency.
40 //
41 Status = SystemTable->BootServices->LocateProtocol (
42 &gEfiSmmBase2ProtocolGuid,
43 NULL,
44 (VOID **)&InternalSmmBase2
45 );
46 ASSERT_EFI_ERROR (Status);
47 ASSERT (InternalSmmBase2 != NULL);
48
49 //
50 // We are in SMM, retrieve the pointer to SMM System Table
51 //
52 InternalSmmBase2->GetSmstLocation (InternalSmmBase2, &gSmst);
53 ASSERT (gSmst != NULL);
54
55 return EFI_SUCCESS;
56}
57
69BOOLEAN
70EFIAPI
72 VOID
73 )
74{
75 //
76 // We are already in SMM
77 //
78 return TRUE;
79}
#define NULL
Definition: Base.h:319
#define TRUE
Definition: Base.h:301
#define IN
Definition: Base.h:279
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
BOOLEAN EFIAPI InSmm(VOID)
EFI_SMM_SYSTEM_TABLE2 * gSmst
EFI_STATUS EFIAPI SmmServicesTableLibConstructor(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