OvmfPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the OvmfPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Andrew Fish <afish@apple.com>
This commit is contained in:
committed by
mergify[bot]
parent
d1050b9dff
commit
ac0a286f4d
@@ -36,16 +36,14 @@
|
||||
|
||||
#include <Pi/PiStatusCode.h>
|
||||
|
||||
|
||||
//
|
||||
// Convenience variables for the status codes that are relevant for LoadImage()
|
||||
// and StartImage() preparations and return codes.
|
||||
//
|
||||
STATIC EFI_STATUS_CODE_VALUE mLoadPrep;
|
||||
STATIC EFI_STATUS_CODE_VALUE mLoadFail;
|
||||
STATIC EFI_STATUS_CODE_VALUE mStartPrep;
|
||||
STATIC EFI_STATUS_CODE_VALUE mStartFail;
|
||||
|
||||
STATIC EFI_STATUS_CODE_VALUE mLoadPrep;
|
||||
STATIC EFI_STATUS_CODE_VALUE mLoadFail;
|
||||
STATIC EFI_STATUS_CODE_VALUE mStartPrep;
|
||||
STATIC EFI_STATUS_CODE_VALUE mStartFail;
|
||||
|
||||
/**
|
||||
Handle status codes reported through ReportStatusCodeLib /
|
||||
@@ -79,29 +77,31 @@ 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
|
||||
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
|
||||
)
|
||||
{
|
||||
UINTN VariableSize;
|
||||
UINT16 BootCurrent;
|
||||
EFI_STATUS Status;
|
||||
CHAR16 BootOptionName[ARRAY_SIZE (L"Boot####")];
|
||||
EFI_BOOT_MANAGER_LOAD_OPTION BmBootOption;
|
||||
BOOLEAN DevPathStringIsDynamic;
|
||||
CHAR16 *DevPathString;
|
||||
UINTN VariableSize;
|
||||
UINT16 BootCurrent;
|
||||
EFI_STATUS Status;
|
||||
CHAR16 BootOptionName[ARRAY_SIZE (L"Boot####")];
|
||||
EFI_BOOT_MANAGER_LOAD_OPTION BmBootOption;
|
||||
BOOLEAN DevPathStringIsDynamic;
|
||||
CHAR16 *DevPathString;
|
||||
|
||||
//
|
||||
// Ignore all status codes that are irrelevant for LoadImage() and
|
||||
// StartImage() preparations and return codes.
|
||||
//
|
||||
if (Value != mLoadPrep && Value != mLoadFail &&
|
||||
Value != mStartPrep && Value != mStartFail) {
|
||||
if ((Value != mLoadPrep) && (Value != mLoadFail) &&
|
||||
(Value != mStartPrep) && (Value != mStartFail))
|
||||
{
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// Ignore status codes that are not reported by the same containing module.
|
||||
//
|
||||
@@ -112,13 +112,18 @@ HandleStatusCode (
|
||||
//
|
||||
// Sanity-check Data in case of failure reports.
|
||||
//
|
||||
if ((Value == mLoadFail || Value == mStartFail) &&
|
||||
(Data == NULL ||
|
||||
Data->HeaderSize != sizeof *Data ||
|
||||
Data->Size != sizeof (EFI_RETURN_STATUS_EXTENDED_DATA) - sizeof *Data ||
|
||||
!CompareGuid (&Data->Type, &gEfiStatusCodeSpecificDataGuid))) {
|
||||
DEBUG ((DEBUG_ERROR, "%a:%a: malformed Data\n", gEfiCallerBaseName,
|
||||
__FUNCTION__));
|
||||
if (((Value == mLoadFail) || (Value == mStartFail)) &&
|
||||
((Data == NULL) ||
|
||||
(Data->HeaderSize != sizeof *Data) ||
|
||||
(Data->Size != sizeof (EFI_RETURN_STATUS_EXTENDED_DATA) - sizeof *Data) ||
|
||||
!CompareGuid (&Data->Type, &gEfiStatusCodeSpecificDataGuid)))
|
||||
{
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a:%a: malformed Data\n",
|
||||
gEfiCallerBaseName,
|
||||
__FUNCTION__
|
||||
));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -126,33 +131,59 @@ HandleStatusCode (
|
||||
// Get the number of the Boot#### option that the status code applies to.
|
||||
//
|
||||
VariableSize = sizeof BootCurrent;
|
||||
Status = gRT->GetVariable (EFI_BOOT_CURRENT_VARIABLE_NAME,
|
||||
&gEfiGlobalVariableGuid, NULL /* Attributes */,
|
||||
&VariableSize, &BootCurrent);
|
||||
Status = gRT->GetVariable (
|
||||
EFI_BOOT_CURRENT_VARIABLE_NAME,
|
||||
&gEfiGlobalVariableGuid,
|
||||
NULL /* Attributes */,
|
||||
&VariableSize,
|
||||
&BootCurrent
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a:%a: failed to get %g:\"%s\": %r\n",
|
||||
gEfiCallerBaseName, __FUNCTION__, &gEfiGlobalVariableGuid,
|
||||
EFI_BOOT_CURRENT_VARIABLE_NAME, Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a:%a: failed to get %g:\"%s\": %r\n",
|
||||
gEfiCallerBaseName,
|
||||
__FUNCTION__,
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_BOOT_CURRENT_VARIABLE_NAME,
|
||||
Status
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (VariableSize != sizeof BootCurrent) {
|
||||
DEBUG ((DEBUG_ERROR, "%a:%a: got %Lu bytes for %g:\"%s\", expected %Lu\n",
|
||||
gEfiCallerBaseName, __FUNCTION__, (UINT64)VariableSize,
|
||||
&gEfiGlobalVariableGuid, EFI_BOOT_CURRENT_VARIABLE_NAME,
|
||||
(UINT64)sizeof BootCurrent));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a:%a: got %Lu bytes for %g:\"%s\", expected %Lu\n",
|
||||
gEfiCallerBaseName,
|
||||
__FUNCTION__,
|
||||
(UINT64)VariableSize,
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_BOOT_CURRENT_VARIABLE_NAME,
|
||||
(UINT64)sizeof BootCurrent
|
||||
));
|
||||
return EFI_INCOMPATIBLE_VERSION;
|
||||
}
|
||||
|
||||
//
|
||||
// Get the Boot#### option that the status code applies to.
|
||||
//
|
||||
UnicodeSPrint (BootOptionName, sizeof BootOptionName, L"Boot%04x",
|
||||
BootCurrent);
|
||||
UnicodeSPrint (
|
||||
BootOptionName,
|
||||
sizeof BootOptionName,
|
||||
L"Boot%04x",
|
||||
BootCurrent
|
||||
);
|
||||
Status = EfiBootManagerVariableToLoadOption (BootOptionName, &BmBootOption);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR,
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a:%a: EfiBootManagerVariableToLoadOption(\"%s\"): %r\n",
|
||||
gEfiCallerBaseName, __FUNCTION__, BootOptionName, Status));
|
||||
gEfiCallerBaseName,
|
||||
__FUNCTION__,
|
||||
BootOptionName,
|
||||
Status
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -160,20 +191,20 @@ HandleStatusCode (
|
||||
// Format the device path.
|
||||
//
|
||||
DevPathStringIsDynamic = TRUE;
|
||||
DevPathString = ConvertDevicePathToText (
|
||||
BmBootOption.FilePath,
|
||||
FALSE, // DisplayOnly
|
||||
FALSE // AllowShortcuts
|
||||
);
|
||||
DevPathString = ConvertDevicePathToText (
|
||||
BmBootOption.FilePath,
|
||||
FALSE, // DisplayOnly
|
||||
FALSE // AllowShortcuts
|
||||
);
|
||||
if (DevPathString == NULL) {
|
||||
DevPathStringIsDynamic = FALSE;
|
||||
DevPathString = L"<out of memory while formatting device path>";
|
||||
DevPathString = L"<out of memory while formatting device path>";
|
||||
}
|
||||
|
||||
//
|
||||
// Print the message to the console.
|
||||
//
|
||||
if (Value == mLoadPrep || Value == mStartPrep) {
|
||||
if ((Value == mLoadPrep) || (Value == mStartPrep)) {
|
||||
Print (
|
||||
L"%a: %a %s \"%s\" from %s\n",
|
||||
gEfiCallerBaseName,
|
||||
@@ -200,11 +231,11 @@ HandleStatusCode (
|
||||
if (DevPathStringIsDynamic) {
|
||||
FreePool (DevPathString);
|
||||
}
|
||||
|
||||
EfiBootManagerFreeLoadOption (&BmBootOption);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Unregister HandleStatusCode() at ExitBootServices().
|
||||
|
||||
@@ -219,17 +250,16 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
UnregisterAtExitBootServices (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
EFI_RSC_HANDLER_PROTOCOL *StatusCodeRouter;
|
||||
EFI_RSC_HANDLER_PROTOCOL *StatusCodeRouter;
|
||||
|
||||
StatusCodeRouter = Context;
|
||||
StatusCodeRouter->Unregister (HandleStatusCode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Register a status code handler for printing the Boot Manager's LoadImage()
|
||||
and StartImage() preparations, and return codes, to the UEFI console.
|
||||
@@ -246,12 +276,15 @@ PlatformBmPrintScRegisterHandler (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_RSC_HANDLER_PROTOCOL *StatusCodeRouter;
|
||||
EFI_EVENT ExitBootEvent;
|
||||
EFI_STATUS Status;
|
||||
EFI_RSC_HANDLER_PROTOCOL *StatusCodeRouter;
|
||||
EFI_EVENT ExitBootEvent;
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiRscHandlerProtocolGuid,
|
||||
NULL /* Registration */, (VOID **)&StatusCodeRouter);
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiRscHandlerProtocolGuid,
|
||||
NULL /* Registration */,
|
||||
(VOID **)&StatusCodeRouter
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
@@ -260,9 +293,9 @@ PlatformBmPrintScRegisterHandler (
|
||||
//
|
||||
// Set the EFI_STATUS_CODE_VALUE convenience variables.
|
||||
//
|
||||
mLoadPrep = PcdGet32 (PcdProgressCodeOsLoaderLoad);
|
||||
mLoadFail = (EFI_SOFTWARE_DXE_BS_DRIVER |
|
||||
EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR);
|
||||
mLoadPrep = PcdGet32 (PcdProgressCodeOsLoaderLoad);
|
||||
mLoadFail = (EFI_SOFTWARE_DXE_BS_DRIVER |
|
||||
EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR);
|
||||
mStartPrep = PcdGet32 (PcdProgressCodeOsLoaderStart);
|
||||
mStartFail = (EFI_SOFTWARE_DXE_BS_DRIVER |
|
||||
EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED);
|
||||
@@ -272,8 +305,13 @@ PlatformBmPrintScRegisterHandler (
|
||||
//
|
||||
Status = StatusCodeRouter->Register (HandleStatusCode, TPL_CALLBACK);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a:%a: failed to register status code handler: %r\n",
|
||||
gEfiCallerBaseName, __FUNCTION__, Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a:%a: failed to register status code handler: %r\n",
|
||||
gEfiCallerBaseName,
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -294,8 +332,14 @@ PlatformBmPrintScRegisterHandler (
|
||||
//
|
||||
// We have to unregister the callback right now, and fail the function.
|
||||
//
|
||||
DEBUG ((DEBUG_ERROR, "%a:%a: failed to create ExitBootServices() event: "
|
||||
"%r\n", gEfiCallerBaseName, __FUNCTION__, Status));
|
||||
DEBUG ((
|
||||
DEBUG_ERROR,
|
||||
"%a:%a: failed to create ExitBootServices() event: "
|
||||
"%r\n",
|
||||
gEfiCallerBaseName,
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
StatusCodeRouter->Unregister (HandleStatusCode);
|
||||
return Status;
|
||||
}
|
||||
|
Reference in New Issue
Block a user