21UINT32 mStatusCodeNestStatus = 0;
57 Address = CallbackEntry->StatusCodeDataBuffer;
58 while (Address < CallbackEntry->EndPointer) {
60 CallbackEntry->RscHandlerCallback (
72 CallbackEntry->EndPointer = CallbackEntry->StatusCodeDataBuffer;
106 IN EFI_RSC_HANDLER_CALLBACK Callback,
114 if (Callback ==
NULL) {
115 return EFI_INVALID_PARAMETER;
120 if (CallbackEntry->RscHandlerCallback == Callback) {
124 return EFI_ALREADY_STARTED;
129 ASSERT (CallbackEntry !=
NULL);
131 CallbackEntry->Signature = RSC_HANDLER_CALLBACK_ENTRY_SIGNATURE;
132 CallbackEntry->RscHandlerCallback = Callback;
133 CallbackEntry->Tpl = Tpl;
143 if (Tpl != TPL_HIGH_LEVEL) {
145 CallbackEntry->BufferSize = EFI_PAGE_SIZE;
146 CallbackEntry->EndPointer = CallbackEntry->StatusCodeDataBuffer;
147 Status =
gBS->CreateEvent (
152 &CallbackEntry->Event
179 IN EFI_RSC_HANDLER_CALLBACK Callback
185 if (Callback ==
NULL) {
186 return EFI_INVALID_PARAMETER;
191 if (CallbackEntry->RscHandlerCallback == Callback) {
195 if (CallbackEntry->Tpl != TPL_HIGH_LEVEL) {
196 FreePool ((VOID *)(
UINTN)CallbackEntry->StatusCodeDataBuffer);
197 gBS->CloseEvent (CallbackEntry->Event);
206 return EFI_NOT_FOUND;
249 return EFI_DEVICE_ERROR;
258 if ((CallbackEntry->Tpl == TPL_HIGH_LEVEL) ||
EfiAtRuntime ()) {
259 CallbackEntry->RscHandlerCallback (
273 FailSafeEndPointer = CallbackEntry->EndPointer;
274 CallbackEntry->EndPointer =
ALIGN_VARIABLE (CallbackEntry->EndPointer);
284 if (CallbackEntry->EndPointer > (CallbackEntry->StatusCodeDataBuffer + (CallbackEntry->BufferSize / 8) * 7)) {
287 CallbackEntry->BufferSize,
288 CallbackEntry->BufferSize * 2,
289 (VOID *)(
UINTN)CallbackEntry->StatusCodeDataBuffer
291 if (NewBuffer !=
NULL) {
292 FailSafeEndPointer = (
EFI_PHYSICAL_ADDRESS)(
UINTN)NewBuffer + (FailSafeEndPointer - CallbackEntry->StatusCodeDataBuffer);
293 CallbackEntry->EndPointer = (
EFI_PHYSICAL_ADDRESS)(
UINTN)NewBuffer + (CallbackEntry->EndPointer - CallbackEntry->StatusCodeDataBuffer);
296 CallbackEntry->BufferSize *= 2;
304 if (CallbackEntry->EndPointer > (CallbackEntry->StatusCodeDataBuffer + CallbackEntry->BufferSize)) {
305 CallbackEntry->EndPointer = FailSafeEndPointer;
309 RscData->Type = Type;
310 RscData->Value = Value;
311 RscData->Instance = Instance;
312 if (CallerId !=
NULL) {
313 CopyGuid (&RscData->CallerId, CallerId);
319 ZeroMem (&RscData->Data, sizeof (RscData->Data));
320 RscData->Data.
HeaderSize =
sizeof (RscData->Data);
323 Status =
gBS->SignalEvent (CallbackEntry->Event);
390 Status =
gBS->InstallMultipleProtocolInterfaces (
392 &gEfiRscHandlerProtocolGuid,
393 &mRscHandlerProtocol,
394 &gEfiStatusCodeRuntimeProtocolGuid,
395 &mStatusCodeProtocol,
400 Status =
gBS->CreateEventEx (
405 &gEfiEventVirtualAddressChangeGuid,
406 &mVirtualAddressChangeEvent
BOOLEAN EFIAPI IsNull(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
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)
#define INITIALIZE_LIST_HEAD_VARIABLE(ListHead)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
VOID *EFIAPI ReallocatePool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateRuntimeZeroPool(IN UINTN AllocationSize)
#define ALIGN_VARIABLE(Value)
#define OFFSET_OF(TYPE, Field)
#define ASSERT_EFI_ERROR(StatusParameter)
#define CR(Record, TYPE, Field, TestSignature)
UINT32 EFI_STATUS_CODE_VALUE
UINT32 EFI_STATUS_CODE_TYPE
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
EFI_STATUS EFIAPI ReportDispatcher(IN EFI_STATUS_CODE_TYPE Type, IN EFI_STATUS_CODE_VALUE Value, IN UINT32 Instance, IN EFI_GUID *CallerId OPTIONAL, IN EFI_STATUS_CODE_DATA *Data OPTIONAL)
EFI_STATUS EFIAPI Register(IN EFI_RSC_HANDLER_CALLBACK Callback, IN EFI_TPL Tpl)
EFI_STATUS EFIAPI GenericStatusCodeRuntimeDxeEntry(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
VOID EFIAPI VirtualAddressChangeCallBack(IN EFI_EVENT Event, IN VOID *Context)
VOID EFIAPI RscHandlerNotification(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS EFIAPI Unregister(IN EFI_RSC_HANDLER_CALLBACK Callback)
UINT32 EFIAPI InterlockedCompareExchange32(IN OUT volatile UINT32 *Value, IN UINT32 CompareValue, IN UINT32 ExchangeValue)
UINT64 EFI_PHYSICAL_ADDRESS
EFI_TPL EFIAPI EfiGetCurrentTpl(VOID)
BOOLEAN EFIAPI EfiAtRuntime(VOID)
EFI_STATUS EFIAPI EfiConvertList(IN UINTN DebugDisposition, IN OUT LIST_ENTRY *ListHead)
EFI_STATUS EFIAPI EfiConvertFunctionPointer(IN UINTN DebugDisposition, IN OUT VOID **Address)