/* ReportStatusCode() messages will no longer be forwarded to the Callback function. */
EFI_STATUS EFIAPI Unregister(IN EFI_PEI_RSC_HANDLER_CALLBACK Callback)
/* ReportStatusCode() messages will no longer be forwarded to the Callback function. */
EFI_STATUS EFIAPI Unregister(IN EFI_PEI_RSC_HANDLER_CALLBACK Callback)
{
  EFI_PEI_HOB_POINTERS          Hob;
  EFI_PEI_RSC_HANDLER_CALLBACK  *CallbackEntry;
  UINTN                         *NumberOfEntries;
  UINTN                         Index;
  if (Callback == NULL) {
    return EFI_INVALID_PARAMETER;
  }
  Hob.Raw = GetFirstGuidHob (&gStatusCodeCallbackGuid);
  while (Hob.Raw != NULL) {
    NumberOfEntries = GET_GUID_HOB_DATA (Hob);
    CallbackEntry   = (EFI_PEI_RSC_HANDLER_CALLBACK *)(NumberOfEntries + 1);
    for (Index = 0; Index < *NumberOfEntries; Index++) {
      if (CallbackEntry[Index] == Callback) {
        CallbackEntry[Index] = NULL;
        return EFI_SUCCESS;
      }
    }
    Hob.Raw = GET_NEXT_HOB (Hob);
    Hob.Raw = GetNextGuidHob (&gStatusCodeCallbackGuid, Hob.Raw);
  }
  return EFI_NOT_FOUND;
}