20#define MMI_ENTRY_SIGNATURE SIGNATURE_32('m','m','i','e')
30#define MMI_HANDLER_SIGNATURE SIGNATURE_32('m','m','i','h')
43UINTN mMmiManageCallingDepth = 0;
64 ASSERT (MmiHandler->ToRemove);
71 if (MmiEntry !=
NULL) {
106 for (Link = mMmiEntryList.ForwardLink;
107 Link != &mMmiEntryList;
108 Link = Link->ForwardLink)
110 Item =
CR (Link,
MMI_ENTRY, AllEntries, MMI_ENTRY_SIGNATURE);
111 if (
CompareGuid (&Item->HandlerType, HandlerType)) {
124 if ((MmiEntry ==
NULL) && Create) {
126 if (MmiEntry !=
NULL) {
130 MmiEntry->Signature = MMI_ENTRY_SIGNATURE;
131 CopyGuid ((VOID *)&MmiEntry->HandlerType, HandlerType);
162 IN CONST VOID *Context OPTIONAL,
163 IN OUT VOID *CommBuffer OPTIONAL,
176 mMmiManageCallingDepth++;
178 Status = EFI_NOT_FOUND;
179 ReturnStatus = Status;
180 if (HandlerType ==
NULL) {
185 Head = &mRootMmiHandlerList;
191 if (MmiEntry ==
NULL) {
198 Head = &MmiEntry->MmiHandlers;
201 for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {
202 MmiHandler =
CR (Link,
MMI_HANDLER, Link, MMI_HANDLER_SIGNATURE);
204 Status = MmiHandler->Handler (
217 if (HandlerType !=
NULL) {
226 ReturnStatus = Status;
238 if (HandlerType !=
NULL) {
245 case EFI_WARN_INTERRUPT_SOURCE_QUIESCED:
253 case EFI_WARN_INTERRUPT_SOURCE_PENDING:
259 ReturnStatus = Status;
277 ASSERT (mMmiManageCallingDepth > 0);
278 mMmiManageCallingDepth--;
286 if (mMmiManageCallingDepth == 0) {
291 ; !
IsNull (&mRootMmiHandlerList, Link);
297 MmiHandler =
CR (Link,
MMI_HANDLER, Link, MMI_HANDLER_SIGNATURE);
299 if (MmiHandler->ToRemove) {
311 ; !
IsNull (&mMmiEntryList, EntryLink);
317 MmiEntry =
CR (EntryLink,
MMI_ENTRY, AllEntries, MMI_ENTRY_SIGNATURE);
318 EntryLink =
GetNextNode (&mMmiEntryList, EntryLink);
320 ; !
IsNull (&MmiEntry->MmiHandlers, Link);
326 MmiHandler =
CR (Link,
MMI_HANDLER, Link, MMI_HANDLER_SIGNATURE);
328 if (MmiHandler->ToRemove) {
366 if ((Handler ==
NULL) || (DispatchHandle ==
NULL)) {
367 return EFI_INVALID_PARAMETER;
371 if (MmiHandler ==
NULL) {
372 return EFI_OUT_OF_RESOURCES;
375 MmiHandler->Signature = MMI_HANDLER_SIGNATURE;
376 MmiHandler->Handler = Handler;
377 MmiHandler->ToRemove =
FALSE;
379 if (HandlerType ==
NULL) {
384 List = &mRootMmiHandlerList;
390 if (MmiEntry ==
NULL) {
391 return EFI_OUT_OF_RESOURCES;
394 List = &MmiEntry->MmiHandlers;
397 MmiHandler->MmiEntry = MmiEntry;
425 if (MmiHandler ==
NULL) {
426 return EFI_INVALID_PARAMETER;
429 if (MmiHandler->Signature != MMI_HANDLER_SIGNATURE) {
430 return EFI_INVALID_PARAMETER;
433 MmiHandler->ToRemove =
TRUE;
434 if (mMmiManageCallingDepth > 0) {
442 MmiEntry = MmiHandler->MmiEntry;
BOOLEAN EFIAPI IsNull(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
#define INITIALIZE_LIST_HEAD_VARIABLE(ListHead)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define ASSERT_EFI_ERROR(StatusParameter)
#define CR(Record, TYPE, Field, TestSignature)
EFI_STATUS EFIAPI MmiHandlerRegister(IN EFI_MM_HANDLER_ENTRY_POINT Handler, IN CONST EFI_GUID *HandlerType OPTIONAL, OUT EFI_HANDLE *DispatchHandle)
BOOLEAN RemoveMmiHandler(IN MMI_HANDLER *MmiHandler, IN MMI_ENTRY *MmiEntry)
MMI_ENTRY *EFIAPI MmCoreFindMmiEntry(IN EFI_GUID *HandlerType, IN BOOLEAN Create)
EFI_STATUS EFIAPI MmiManage(IN CONST EFI_GUID *HandlerType, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
EFI_STATUS EFIAPI MmiHandlerUnRegister(IN EFI_HANDLE DispatchHandle)
EFI_STATUS(EFIAPI * EFI_MM_HANDLER_ENTRY_POINT)(IN EFI_HANDLE DispatchHandle, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
#define EFI_INTERRUPT_PENDING
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)