TianoCore EDK2 master
Loading...
Searching...
No Matches
StatusCodeHandler.c File Reference

Go to the source code of this file.

Functions

STATIC EFI_STATUS EFIAPI HandleStatusCode (IN EFI_STATUS_CODE_TYPE CodeType, IN EFI_STATUS_CODE_VALUE Value, IN UINT32 Instance, IN EFI_GUID *CallerId, IN EFI_STATUS_CODE_DATA *Data)
 
STATIC VOID EFIAPI UnregisterAtExitBootServices (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS EFIAPI PlatformBmPrintScRegisterHandler (VOID)
 

Variables

STATIC EFI_STATUS_CODE_VALUE mLoadPrep
 
STATIC EFI_STATUS_CODE_VALUE mLoadFail
 
STATIC EFI_STATUS_CODE_VALUE mStartPrep
 
STATIC EFI_STATUS_CODE_VALUE mStartFail
 

Detailed Description

Register a status code handler for printing the Boot Manager's LoadImage() and StartImage() preparations, and return codes, to the UEFI console.

This feature enables users that are not accustomed to analyzing the firmware log to glean some information about UEFI boot option processing (loading and starting).

This library instance filters out (ignores) status codes that are not reported by the containing firmware module. The intent is to link this library instance into BdsDxe via PlatformBootManagerLib (which BdsDxe depends upon), then catch only those status codes that BdsDxe reports (which happens via UefiBootManagerLib). Status codes reported by other modules (such as UiApp), via UefiBootManagerLib or otherwise, are meant to be ignored.

Copyright (C) 2019, Red Hat, Inc.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file StatusCodeHandler.c.

Function Documentation

◆ HandleStatusCode()

STATIC EFI_STATUS EFIAPI HandleStatusCode ( IN EFI_STATUS_CODE_TYPE  CodeType,
IN EFI_STATUS_CODE_VALUE  Value,
IN UINT32  Instance,
IN EFI_GUID CallerId,
IN EFI_STATUS_CODE_DATA Data 
)

Handle status codes reported through ReportStatusCodeLib / EFI_STATUS_CODE_PROTOCOL.ReportStatusCode(). Format matching status codes to the system console.

The highest TPL at which this handler can be registered with EFI_RSC_HANDLER_PROTOCOL.Register() is TPL_CALLBACK. That's because HandleStatusCode() uses the UEFI variable services.

The parameter list of this function precisely matches that of EFI_STATUS_CODE_PROTOCOL.ReportStatusCode().

The return status of this function is ignored by the caller, but the function still returns sensible codes:

Return values
EFI_SUCCESSThe status code has been processed; either as a no-op, due to filtering, or by formatting it to the system console.
EFI_INVALID_PARAMETERUnknown or malformed contents have been detected in Data.
EFI_INCOMPATIBLE_VERSIONUnexpected UEFI variable behavior has been encountered.
Returns
Error codes propagated from underlying services.

Definition at line 79 of file StatusCodeHandler.c.

◆ PlatformBmPrintScRegisterHandler()

EFI_STATUS EFIAPI PlatformBmPrintScRegisterHandler ( VOID  )

Register a status code handler for printing the Boot Manager's LoadImage() and StartImage() preparations, and return codes, to the UEFI console.

Return values
EFI_SUCCESSThe status code handler has been successfully registered.
Returns
Error codes propagated from boot services and from EFI_RSC_HANDLER_PROTOCOL.

Definition at line 275 of file StatusCodeHandler.c.

◆ UnregisterAtExitBootServices()

STATIC VOID EFIAPI UnregisterAtExitBootServices ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Unregister HandleStatusCode() at ExitBootServices().

(See EFI_RSC_HANDLER_PROTOCOL in Volume 3 of the Platform Init spec.)

Parameters
[in]EventEvent whose notification function is being invoked.
[in]ContextPointer to EFI_RSC_HANDLER_PROTOCOL, originally looked up when HandleStatusCode() was registered.

Definition at line 252 of file StatusCodeHandler.c.

Variable Documentation

◆ mLoadFail

Definition at line 44 of file StatusCodeHandler.c.

◆ mLoadPrep

Definition at line 43 of file StatusCodeHandler.c.

◆ mStartFail

Definition at line 46 of file StatusCodeHandler.c.

◆ mStartPrep

Definition at line 45 of file StatusCodeHandler.c.