/* Provides an interface that a software module can call to report a status code. */
EFI_STATUS EFIAPI ReportDispatcher(IN CONST EFI_MM_STATUS_CODE_PROTOCOL *This, IN EFI_STATUS_CODE_TYPE CodeType, IN EFI_STATUS_CODE_VALUE Value, IN UINT32 Instance, IN CONST EFI_GUID *CallerId, IN EFI_STATUS_CODE_DATA *Data OPTIONAL)
/* Provides an interface that a software module can call to report a status code. */
EFI_STATUS EFIAPI ReportDispatcher(IN CONST EFI_MM_STATUS_CODE_PROTOCOL *This, IN EFI_STATUS_CODE_TYPE CodeType, IN EFI_STATUS_CODE_VALUE Value, IN UINT32 Instance, IN CONST EFI_GUID *CallerId, IN EFI_STATUS_CODE_DATA *Data OPTIONAL)
{
  LIST_ENTRY                     *Link;
  MM_RSC_HANDLER_CALLBACK_ENTRY  *CallbackEntry;
  if (InterlockedCompareExchange32 (&mStatusCodeNestStatus, 0, 1) == 1) {
    return EFI_DEVICE_ERROR;
  }
  for (Link = GetFirstNode (&mCallbackListHead); !IsNull (&mCallbackListHead, Link);) {
    CallbackEntry = CR (Link, MM_RSC_HANDLER_CALLBACK_ENTRY, Node, MM_RSC_HANDLER_CALLBACK_ENTRY_SIGNATURE);
    Link = GetNextNode (&mCallbackListHead, Link);
    CallbackEntry->RscHandlerCallback (
                     CodeType,
                     Value,
                     Instance,
                     (EFI_GUID *)CallerId,
                     Data
                     );
  }
  InterlockedCompareExchange32 (&mStatusCodeNestStatus, 1, 0);
  return EFI_SUCCESS;
}