14UINTN mSmiManageCallingDepth = 0;
49 for (Link = mSmiEntryList.ForwardLink;
50 Link != &mSmiEntryList;
51 Link = Link->ForwardLink)
53 Item =
CR (Link,
SMI_ENTRY, AllEntries, SMI_ENTRY_SIGNATURE);
54 if (
CompareGuid (&Item->HandlerType, HandlerType)) {
67 if ((SmiEntry ==
NULL) && Create) {
69 if (SmiEntry !=
NULL) {
73 SmiEntry->Signature = SMI_ENTRY_SIGNATURE;
74 CopyGuid ((VOID *)&SmiEntry->HandlerType, HandlerType);
103 ASSERT (SmiHandler->ToRemove);
110 if (SmiEntry !=
NULL) {
139 IN CONST VOID *Context OPTIONAL,
140 IN OUT VOID *CommBuffer OPTIONAL,
154 mSmiManageCallingDepth++;
156 Status = EFI_NOT_FOUND;
157 ReturnStatus = Status;
158 if (HandlerType ==
NULL) {
162 SmiEntry = &mRootSmiEntry;
168 if (SmiEntry ==
NULL) {
177 Head = &SmiEntry->SmiHandlers;
179 for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {
180 SmiHandler =
CR (Link,
SMI_HANDLER, Link, SMI_HANDLER_SIGNATURE);
182 Status = SmiHandler->Handler (
195 if (HandlerType !=
NULL) {
205 ReturnStatus = Status;
217 if (HandlerType !=
NULL) {
225 case EFI_WARN_INTERRUPT_SOURCE_QUIESCED:
233 case EFI_WARN_INTERRUPT_SOURCE_PENDING:
239 ReturnStatus = Status;
257 ASSERT (mSmiManageCallingDepth > 0);
258 mSmiManageCallingDepth--;
266 if (mSmiManageCallingDepth == 0) {
271 ; !
IsNull (&mRootSmiEntry.SmiHandlers, Link);
277 SmiHandler =
CR (Link,
SMI_HANDLER, Link, SMI_HANDLER_SIGNATURE);
278 Link =
GetNextNode (&mRootSmiEntry.SmiHandlers, Link);
279 if (SmiHandler->ToRemove) {
291 ; !
IsNull (&mSmiEntryList, EntryLink);
297 SmiEntry =
CR (EntryLink,
SMI_ENTRY, AllEntries, SMI_ENTRY_SIGNATURE);
298 EntryLink =
GetNextNode (&mSmiEntryList, EntryLink);
300 ; !
IsNull (&SmiEntry->SmiHandlers, Link);
306 SmiHandler =
CR (Link,
SMI_HANDLER, Link, SMI_HANDLER_SIGNATURE);
308 if (SmiHandler->ToRemove) {
335 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,
344 if ((Handler ==
NULL) || (DispatchHandle ==
NULL)) {
345 return EFI_INVALID_PARAMETER;
349 if (SmiHandler ==
NULL) {
350 return EFI_OUT_OF_RESOURCES;
353 SmiHandler->Signature = SMI_HANDLER_SIGNATURE;
354 SmiHandler->Handler = Handler;
356 SmiHandler->ToRemove =
FALSE;
358 if (HandlerType ==
NULL) {
362 SmiEntry = &mRootSmiEntry;
368 if (SmiEntry ==
NULL) {
369 return EFI_OUT_OF_RESOURCES;
373 List = &SmiEntry->SmiHandlers;
375 SmiHandler->SmiEntry = SmiEntry;
403 if (DispatchHandle ==
NULL) {
404 return EFI_INVALID_PARAMETER;
411 for ( HandlerLink =
GetFirstNode (&mRootSmiEntry.SmiHandlers)
412 ; !
IsNull (&mRootSmiEntry.SmiHandlers, HandlerLink) && ((
EFI_HANDLE)SmiHandler != DispatchHandle)
413 ; HandlerLink =
GetNextNode (&mRootSmiEntry.SmiHandlers, HandlerLink)
416 SmiHandler =
CR (HandlerLink,
SMI_HANDLER, Link, SMI_HANDLER_SIGNATURE);
423 ; !
IsNull (&mSmiEntryList, EntryLink) && ((
EFI_HANDLE)SmiHandler != DispatchHandle)
424 ; EntryLink =
GetNextNode (&mSmiEntryList, EntryLink)
427 SmiEntry =
CR (EntryLink,
SMI_ENTRY, AllEntries, SMI_ENTRY_SIGNATURE);
428 for ( HandlerLink =
GetFirstNode (&SmiEntry->SmiHandlers)
429 ; !
IsNull (&SmiEntry->SmiHandlers, HandlerLink) && ((
EFI_HANDLE)SmiHandler != DispatchHandle)
430 ; HandlerLink =
GetNextNode (&SmiEntry->SmiHandlers, HandlerLink)
433 SmiHandler =
CR (HandlerLink,
SMI_HANDLER, Link, SMI_HANDLER_SIGNATURE);
437 if (SmiHandler ==
NULL) {
438 return EFI_INVALID_PARAMETER;
441 ASSERT ((
EFI_HANDLE)SmiHandler == DispatchHandle);
442 SmiHandler->ToRemove =
TRUE;
444 if (mSmiManageCallingDepth > 0) {
453 SmiEntry = SmiHandler->SmiEntry;
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 RETURN_ADDRESS(L)
#define CR(Record, TYPE, Field, TestSignature)
#define EFI_INTERRUPT_PENDING
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
EFI_STATUS EFIAPI SmiManage(IN CONST EFI_GUID *HandlerType, IN CONST VOID *Context OPTIONAL, IN OUT VOID *CommBuffer OPTIONAL, IN OUT UINTN *CommBufferSize OPTIONAL)
SMI_ENTRY *EFIAPI SmmCoreFindSmiEntry(IN EFI_GUID *HandlerType, IN BOOLEAN Create)
EFI_STATUS EFIAPI SmiHandlerUnRegister(IN EFI_HANDLE DispatchHandle)
BOOLEAN RemoveSmiHandler(IN SMI_HANDLER *SmiHandler, IN SMI_ENTRY *SmiEntry)
EFI_STATUS EFIAPI SmiHandlerRegister(IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler, IN CONST EFI_GUID *HandlerType OPTIONAL, OUT EFI_HANDLE *DispatchHandle)