/* When this function is called the function pointer is added to an internal list and any future calls to ReportStatusCode() will be forwarded to the Callback function. */
EFI_STATUS EFIAPI Register(IN EFI_MM_RSC_HANDLER_CALLBACK Callback)
/* When this function is called the function pointer is added to an internal list and any future calls to ReportStatusCode() will be forwarded to the Callback function. */
EFI_STATUS EFIAPI Register(IN EFI_MM_RSC_HANDLER_CALLBACK Callback)
{
  LIST_ENTRY                     *Link;
  MM_RSC_HANDLER_CALLBACK_ENTRY  *CallbackEntry;
  if (Callback == NULL) {
    return EFI_INVALID_PARAMETER;
  }
  for (Link = GetFirstNode (&mCallbackListHead); !IsNull (&mCallbackListHead, Link); Link = GetNextNode (&mCallbackListHead, Link)) {
    CallbackEntry = CR (Link, MM_RSC_HANDLER_CALLBACK_ENTRY, Node, MM_RSC_HANDLER_CALLBACK_ENTRY_SIGNATURE);
    if (CallbackEntry->RscHandlerCallback == Callback) {
      return EFI_ALREADY_STARTED;
    }
  }
  CallbackEntry = (MM_RSC_HANDLER_CALLBACK_ENTRY *)AllocatePool (sizeof (MM_RSC_HANDLER_CALLBACK_ENTRY));
  ASSERT (CallbackEntry != NULL);
  CallbackEntry->Signature          = MM_RSC_HANDLER_CALLBACK_ENTRY_SIGNATURE;
  CallbackEntry->RscHandlerCallback = Callback;
  InsertTailList (&mCallbackListHead, &CallbackEntry->Node);
  return EFI_SUCCESS;
}