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
@@ -14,20 +14,18 @@
|
||||
|
||||
#include "AcpiPlatform.h"
|
||||
|
||||
|
||||
//
|
||||
// Condensed structure for capturing the fw_cfg operations -- select, skip,
|
||||
// write -- inherent in executing a QEMU_LOADER_WRITE_POINTER command.
|
||||
//
|
||||
typedef struct {
|
||||
UINT16 PointerItem; // resolved from QEMU_LOADER_WRITE_POINTER.PointerFile
|
||||
UINT8 PointerSize; // copied as-is from QEMU_LOADER_WRITE_POINTER
|
||||
UINT32 PointerOffset; // copied as-is from QEMU_LOADER_WRITE_POINTER
|
||||
UINT64 PointerValue; // resolved from QEMU_LOADER_WRITE_POINTER.PointeeFile
|
||||
// and QEMU_LOADER_WRITE_POINTER.PointeeOffset
|
||||
UINT16 PointerItem; // resolved from QEMU_LOADER_WRITE_POINTER.PointerFile
|
||||
UINT8 PointerSize; // copied as-is from QEMU_LOADER_WRITE_POINTER
|
||||
UINT32 PointerOffset; // copied as-is from QEMU_LOADER_WRITE_POINTER
|
||||
UINT64 PointerValue; // resolved from QEMU_LOADER_WRITE_POINTER.PointeeFile
|
||||
// and QEMU_LOADER_WRITE_POINTER.PointeeOffset
|
||||
} CONDENSED_WRITE_POINTER;
|
||||
|
||||
|
||||
//
|
||||
// Context structure to accumulate CONDENSED_WRITE_POINTER objects from
|
||||
// QEMU_LOADER_WRITE_POINTER commands.
|
||||
@@ -36,27 +34,25 @@ typedef struct {
|
||||
// context structure is released, all pointed-to objects must be released too.
|
||||
//
|
||||
struct S3_CONTEXT {
|
||||
CONDENSED_WRITE_POINTER *WritePointers; // one array element per processed
|
||||
// QEMU_LOADER_WRITE_POINTER
|
||||
// command
|
||||
UINTN Allocated; // number of elements allocated for
|
||||
// WritePointers
|
||||
UINTN Used; // number of elements populated in
|
||||
// WritePointers
|
||||
CONDENSED_WRITE_POINTER *WritePointers; // one array element per processed
|
||||
// QEMU_LOADER_WRITE_POINTER
|
||||
// command
|
||||
UINTN Allocated; // number of elements allocated for
|
||||
// WritePointers
|
||||
UINTN Used; // number of elements populated in
|
||||
// WritePointers
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Scratch buffer, allocated in EfiReservedMemoryType type memory, for the ACPI
|
||||
// S3 Boot Script opcodes to work on.
|
||||
//
|
||||
#pragma pack (1)
|
||||
typedef union {
|
||||
UINT64 PointerValue; // filled in from CONDENSED_WRITE_POINTER.PointerValue
|
||||
UINT64 PointerValue; // filled in from CONDENSED_WRITE_POINTER.PointerValue
|
||||
} SCRATCH_BUFFER;
|
||||
#pragma pack ()
|
||||
|
||||
|
||||
/**
|
||||
Allocate an S3_CONTEXT object.
|
||||
|
||||
@@ -75,12 +71,12 @@ typedef union {
|
||||
**/
|
||||
EFI_STATUS
|
||||
AllocateS3Context (
|
||||
OUT S3_CONTEXT **S3Context,
|
||||
IN UINTN WritePointerCount
|
||||
OUT S3_CONTEXT **S3Context,
|
||||
IN UINTN WritePointerCount
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
S3_CONTEXT *Context;
|
||||
EFI_STATUS Status;
|
||||
S3_CONTEXT *Context;
|
||||
|
||||
if (WritePointerCount == 0) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@@ -91,15 +87,17 @@ AllocateS3Context (
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Context->WritePointers = AllocatePool (WritePointerCount *
|
||||
sizeof *Context->WritePointers);
|
||||
Context->WritePointers = AllocatePool (
|
||||
WritePointerCount *
|
||||
sizeof *Context->WritePointers
|
||||
);
|
||||
if (Context->WritePointers == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto FreeContext;
|
||||
}
|
||||
|
||||
Context->Allocated = WritePointerCount;
|
||||
*S3Context = Context;
|
||||
*S3Context = Context;
|
||||
return EFI_SUCCESS;
|
||||
|
||||
FreeContext:
|
||||
@@ -108,7 +106,6 @@ FreeContext:
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Release an S3_CONTEXT object.
|
||||
|
||||
@@ -116,14 +113,13 @@ FreeContext:
|
||||
**/
|
||||
VOID
|
||||
ReleaseS3Context (
|
||||
IN S3_CONTEXT *S3Context
|
||||
IN S3_CONTEXT *S3Context
|
||||
)
|
||||
{
|
||||
FreePool (S3Context->WritePointers);
|
||||
FreePool (S3Context);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Save the information necessary to replicate a QEMU_LOADER_WRITE_POINTER
|
||||
command during S3 resume, in condensed format.
|
||||
@@ -158,31 +154,38 @@ ReleaseS3Context (
|
||||
**/
|
||||
EFI_STATUS
|
||||
SaveCondensedWritePointerToS3Context (
|
||||
IN OUT S3_CONTEXT *S3Context,
|
||||
IN UINT16 PointerItem,
|
||||
IN UINT8 PointerSize,
|
||||
IN UINT32 PointerOffset,
|
||||
IN UINT64 PointerValue
|
||||
IN OUT S3_CONTEXT *S3Context,
|
||||
IN UINT16 PointerItem,
|
||||
IN UINT8 PointerSize,
|
||||
IN UINT32 PointerOffset,
|
||||
IN UINT64 PointerValue
|
||||
)
|
||||
{
|
||||
CONDENSED_WRITE_POINTER *Condensed;
|
||||
CONDENSED_WRITE_POINTER *Condensed;
|
||||
|
||||
if (S3Context->Used == S3Context->Allocated) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
Condensed = S3Context->WritePointers + S3Context->Used;
|
||||
|
||||
Condensed = S3Context->WritePointers + S3Context->Used;
|
||||
Condensed->PointerItem = PointerItem;
|
||||
Condensed->PointerSize = PointerSize;
|
||||
Condensed->PointerOffset = PointerOffset;
|
||||
Condensed->PointerValue = PointerValue;
|
||||
DEBUG ((DEBUG_VERBOSE, "%a: 0x%04x/[0x%08x+%d] := 0x%Lx (%Lu)\n",
|
||||
__FUNCTION__, PointerItem, PointerOffset, PointerSize, PointerValue,
|
||||
(UINT64)S3Context->Used));
|
||||
DEBUG ((
|
||||
DEBUG_VERBOSE,
|
||||
"%a: 0x%04x/[0x%08x+%d] := 0x%Lx (%Lu)\n",
|
||||
__FUNCTION__,
|
||||
PointerItem,
|
||||
PointerOffset,
|
||||
PointerSize,
|
||||
PointerValue,
|
||||
(UINT64)S3Context->Used
|
||||
));
|
||||
++S3Context->Used;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION provided to QemuFwCfgS3Lib.
|
||||
**/
|
||||
@@ -190,31 +193,33 @@ STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
AppendFwCfgBootScript (
|
||||
IN OUT VOID *Context OPTIONAL,
|
||||
IN OUT VOID *ExternalScratchBuffer
|
||||
IN OUT VOID *Context OPTIONAL,
|
||||
IN OUT VOID *ExternalScratchBuffer
|
||||
)
|
||||
{
|
||||
S3_CONTEXT *S3Context;
|
||||
SCRATCH_BUFFER *ScratchBuffer;
|
||||
UINTN Index;
|
||||
S3_CONTEXT *S3Context;
|
||||
SCRATCH_BUFFER *ScratchBuffer;
|
||||
UINTN Index;
|
||||
|
||||
S3Context = Context;
|
||||
S3Context = Context;
|
||||
ScratchBuffer = ExternalScratchBuffer;
|
||||
|
||||
for (Index = 0; Index < S3Context->Used; ++Index) {
|
||||
CONST CONDENSED_WRITE_POINTER *Condensed;
|
||||
RETURN_STATUS Status;
|
||||
CONST CONDENSED_WRITE_POINTER *Condensed;
|
||||
RETURN_STATUS Status;
|
||||
|
||||
Condensed = &S3Context->WritePointers[Index];
|
||||
|
||||
Status = QemuFwCfgS3ScriptSkipBytes (Condensed->PointerItem,
|
||||
Condensed->PointerOffset);
|
||||
Status = QemuFwCfgS3ScriptSkipBytes (
|
||||
Condensed->PointerItem,
|
||||
Condensed->PointerOffset
|
||||
);
|
||||
if (RETURN_ERROR (Status)) {
|
||||
goto FatalError;
|
||||
}
|
||||
|
||||
ScratchBuffer->PointerValue = Condensed->PointerValue;
|
||||
Status = QemuFwCfgS3ScriptWriteBytes (-1, Condensed->PointerSize);
|
||||
Status = QemuFwCfgS3ScriptWriteBytes (-1, Condensed->PointerSize);
|
||||
if (RETURN_ERROR (Status)) {
|
||||
goto FatalError;
|
||||
}
|
||||
@@ -230,7 +235,6 @@ FatalError:
|
||||
CpuDeadLoop ();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Translate and append the information from an S3_CONTEXT object to the ACPI S3
|
||||
Boot Script.
|
||||
@@ -253,17 +257,20 @@ FatalError:
|
||||
**/
|
||||
EFI_STATUS
|
||||
TransferS3ContextToBootScript (
|
||||
IN S3_CONTEXT *S3Context
|
||||
IN S3_CONTEXT *S3Context
|
||||
)
|
||||
{
|
||||
RETURN_STATUS Status;
|
||||
RETURN_STATUS Status;
|
||||
|
||||
if (S3Context->Used == 0) {
|
||||
ReleaseS3Context (S3Context);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Status = QemuFwCfgS3CallWhenBootScriptReady (AppendFwCfgBootScript,
|
||||
S3Context, sizeof (SCRATCH_BUFFER));
|
||||
Status = QemuFwCfgS3CallWhenBootScriptReady (
|
||||
AppendFwCfgBootScript,
|
||||
S3Context,
|
||||
sizeof (SCRATCH_BUFFER)
|
||||
);
|
||||
return (EFI_STATUS)Status;
|
||||
}
|
||||
|
Reference in New Issue
Block a user