TianoCore EDK2 master
Loading...
Searching...
No Matches
SmmCpuRendezvousLib.c
Go to the documentation of this file.
1
9#include <Base.h>
10#include <Uefi.h>
11#include <Library/BaseLib.h>
12#include <Library/DebugLib.h>
16
18STATIC VOID *mRegistration = NULL;
19
34EFIAPI
36 IN CONST EFI_GUID *Protocol,
37 IN VOID *Interface,
38 IN EFI_HANDLE Handle
39 )
40{
41 EFI_STATUS Status;
42
43 Status = gMmst->MmLocateProtocol (
44 &gEdkiiSmmCpuRendezvousProtocolGuid,
45 NULL,
46 (VOID **)&mSmmCpuRendezvous
47 );
48 ASSERT_EFI_ERROR (Status);
49
50 return EFI_SUCCESS;
51}
52
63EFIAPI
65 IN BOOLEAN BlockingMode
66 )
67{
68 EFI_STATUS Status;
69
70 if ((mRegistration == NULL) && (mSmmCpuRendezvous == NULL)) {
71 //
72 // Locate SMM cpu rendezvous protocol for the first time execute the function.
73 //
74 Status = gMmst->MmLocateProtocol (
75 &gEdkiiSmmCpuRendezvousProtocolGuid,
76 NULL,
77 (VOID **)&mSmmCpuRendezvous
78 );
79 if (EFI_ERROR (Status)) {
80 Status = gMmst->MmRegisterProtocolNotify (
81 &gEdkiiSmmCpuRendezvousProtocolGuid,
83 &mRegistration
84 );
85 if (EFI_ERROR (Status)) {
86 return Status;
87 }
88 }
89 }
90
91 //
92 // The platform have not set up. It doesn't need smm cpu rendezvous.
93 //
94 if (mSmmCpuRendezvous == NULL) {
95 return EFI_SUCCESS;
96 }
97
98 Status = mSmmCpuRendezvous->WaitForAllProcessor (
99 mSmmCpuRendezvous,
100 BlockingMode
101 );
102 return Status;
103}
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define STATIC
Definition: Base.h:264
#define IN
Definition: Base.h:279
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
EFI_STATUS EFIAPI SmmCpuRendezvousProtocolNotify(IN CONST EFI_GUID *Protocol, IN VOID *Interface, IN EFI_HANDLE Handle)
EFI_STATUS EFIAPI SmmWaitForAllProcessor(IN BOOLEAN BlockingMode)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
Definition: Base.h:213