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
@@ -13,8 +13,8 @@
|
||||
#include <Protocol/PciIo.h> // EFI_PCI_IO_PROTOCOL
|
||||
|
||||
typedef struct {
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
UINT64 PciAttributes;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
UINT64 PciAttributes;
|
||||
} ORIGINAL_ATTRIBUTES;
|
||||
|
||||
typedef struct S3_CONTEXT S3_CONTEXT;
|
||||
@@ -22,51 +22,50 @@ typedef struct S3_CONTEXT S3_CONTEXT;
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InstallQemuFwCfgTables (
|
||||
IN EFI_ACPI_TABLE_PROTOCOL *AcpiProtocol
|
||||
IN EFI_ACPI_TABLE_PROTOCOL *AcpiProtocol
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InstallAcpiTables (
|
||||
IN EFI_ACPI_TABLE_PROTOCOL *AcpiTable
|
||||
IN EFI_ACPI_TABLE_PROTOCOL *AcpiTable
|
||||
);
|
||||
|
||||
VOID
|
||||
EnablePciDecoding (
|
||||
OUT ORIGINAL_ATTRIBUTES **OriginalAttributes,
|
||||
OUT UINTN *Count
|
||||
OUT ORIGINAL_ATTRIBUTES **OriginalAttributes,
|
||||
OUT UINTN *Count
|
||||
);
|
||||
|
||||
VOID
|
||||
RestorePciDecoding (
|
||||
IN ORIGINAL_ATTRIBUTES *OriginalAttributes,
|
||||
IN UINTN Count
|
||||
IN ORIGINAL_ATTRIBUTES *OriginalAttributes,
|
||||
IN UINTN Count
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
AllocateS3Context (
|
||||
OUT S3_CONTEXT **S3Context,
|
||||
IN UINTN WritePointerCount
|
||||
OUT S3_CONTEXT **S3Context,
|
||||
IN UINTN WritePointerCount
|
||||
);
|
||||
|
||||
VOID
|
||||
ReleaseS3Context (
|
||||
IN S3_CONTEXT *S3Context
|
||||
IN S3_CONTEXT *S3Context
|
||||
);
|
||||
|
||||
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
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
TransferS3ContextToBootScript (
|
||||
IN S3_CONTEXT *S3Context
|
||||
IN S3_CONTEXT *S3Context
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -21,49 +21,50 @@ FindAcpiTableProtocol (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
|
||||
EFI_STATUS Status;
|
||||
EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiAcpiTableProtocolGuid,
|
||||
NULL,
|
||||
(VOID**)&AcpiTable
|
||||
(VOID **)&AcpiTable
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
return AcpiTable;
|
||||
}
|
||||
|
||||
|
||||
STATIC
|
||||
VOID
|
||||
EFIAPI
|
||||
OnRootBridgesConnected (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
DEBUG ((DEBUG_INFO,
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: root bridges have been connected, installing ACPI tables\n",
|
||||
__FUNCTION__));
|
||||
__FUNCTION__
|
||||
));
|
||||
Status = InstallAcpiTables (FindAcpiTableProtocol ());
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: InstallAcpiTables: %r\n", __FUNCTION__, Status));
|
||||
}
|
||||
|
||||
gBS->CloseEvent (Event);
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
AcpiPlatformEntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_EVENT RootBridgesConnected;
|
||||
EFI_STATUS Status;
|
||||
EFI_EVENT RootBridgesConnected;
|
||||
|
||||
//
|
||||
// If the platform doesn't support PCI, or PCI enumeration has been disabled,
|
||||
@@ -71,8 +72,12 @@ AcpiPlatformEntryPoint (
|
||||
// the full functionality.
|
||||
//
|
||||
if (PcdGetBool (PcdPciDisableBusEnumeration)) {
|
||||
DEBUG ((DEBUG_INFO, "%a: PCI or its enumeration disabled, installing "
|
||||
"ACPI tables\n", __FUNCTION__));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: PCI or its enumeration disabled, installing "
|
||||
"ACPI tables\n",
|
||||
__FUNCTION__
|
||||
));
|
||||
return InstallAcpiTables (FindAcpiTableProtocol ());
|
||||
}
|
||||
|
||||
@@ -82,13 +87,20 @@ AcpiPlatformEntryPoint (
|
||||
// setup. (Note that we're a DXE_DRIVER; our entry point function is invoked
|
||||
// strictly before BDS is entered and can connect the root bridges.)
|
||||
//
|
||||
Status = gBS->CreateEventEx (EVT_NOTIFY_SIGNAL, TPL_CALLBACK,
|
||||
OnRootBridgesConnected, NULL /* Context */,
|
||||
&gRootBridgesConnectedEventGroupGuid, &RootBridgesConnected);
|
||||
Status = gBS->CreateEventEx (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
OnRootBridgesConnected,
|
||||
NULL /* Context */,
|
||||
&gRootBridgesConnectedEventGroupGuid,
|
||||
&RootBridgesConnected
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_INFO,
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"%a: waiting for root bridges to be connected, registered callback\n",
|
||||
__FUNCTION__));
|
||||
__FUNCTION__
|
||||
));
|
||||
}
|
||||
|
||||
return Status;
|
||||
|
@@ -13,7 +13,6 @@
|
||||
|
||||
#include "AcpiPlatform.h"
|
||||
|
||||
|
||||
/**
|
||||
Collect all PciIo protocol instances in the system. Save their original
|
||||
attributes, and enable IO and MMIO decoding for each.
|
||||
@@ -40,15 +39,15 @@
|
||||
**/
|
||||
VOID
|
||||
EnablePciDecoding (
|
||||
OUT ORIGINAL_ATTRIBUTES **OriginalAttributes,
|
||||
OUT UINTN *Count
|
||||
OUT ORIGINAL_ATTRIBUTES **OriginalAttributes,
|
||||
OUT UINTN *Count
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN NoHandles;
|
||||
EFI_HANDLE *Handles;
|
||||
ORIGINAL_ATTRIBUTES *OrigAttrs;
|
||||
UINTN Idx;
|
||||
EFI_STATUS Status;
|
||||
UINTN NoHandles;
|
||||
EFI_HANDLE *Handles;
|
||||
ORIGINAL_ATTRIBUTES *OrigAttrs;
|
||||
UINTN Idx;
|
||||
|
||||
*OriginalAttributes = NULL;
|
||||
*Count = 0;
|
||||
@@ -61,8 +60,13 @@ EnablePciDecoding (
|
||||
return;
|
||||
}
|
||||
|
||||
Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiPciIoProtocolGuid,
|
||||
NULL /* SearchKey */, &NoHandles, &Handles);
|
||||
Status = gBS->LocateHandleBuffer (
|
||||
ByProtocol,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
NULL /* SearchKey */,
|
||||
&NoHandles,
|
||||
&Handles
|
||||
);
|
||||
if (Status == EFI_NOT_FOUND) {
|
||||
//
|
||||
// No PCI devices were found on either of the root bridges. We're done.
|
||||
@@ -71,49 +75,75 @@ EnablePciDecoding (
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_WARN, "%a: LocateHandleBuffer(): %r\n", __FUNCTION__,
|
||||
Status));
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"%a: LocateHandleBuffer(): %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
||||
OrigAttrs = AllocatePool (NoHandles * sizeof *OrigAttrs);
|
||||
if (OrigAttrs == NULL) {
|
||||
DEBUG ((DEBUG_WARN, "%a: AllocatePool(): out of resources\n",
|
||||
__FUNCTION__));
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"%a: AllocatePool(): out of resources\n",
|
||||
__FUNCTION__
|
||||
));
|
||||
goto FreeHandles;
|
||||
}
|
||||
|
||||
for (Idx = 0; Idx < NoHandles; ++Idx) {
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
UINT64 Attributes;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
UINT64 Attributes;
|
||||
|
||||
//
|
||||
// Look up PciIo on the handle and stash it
|
||||
//
|
||||
Status = gBS->HandleProtocol (Handles[Idx], &gEfiPciIoProtocolGuid,
|
||||
(VOID**)&PciIo);
|
||||
Status = gBS->HandleProtocol (
|
||||
Handles[Idx],
|
||||
&gEfiPciIoProtocolGuid,
|
||||
(VOID **)&PciIo
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
OrigAttrs[Idx].PciIo = PciIo;
|
||||
|
||||
//
|
||||
// Stash the current attributes
|
||||
//
|
||||
Status = PciIo->Attributes (PciIo, EfiPciIoAttributeOperationGet, 0,
|
||||
&OrigAttrs[Idx].PciAttributes);
|
||||
Status = PciIo->Attributes (
|
||||
PciIo,
|
||||
EfiPciIoAttributeOperationGet,
|
||||
0,
|
||||
&OrigAttrs[Idx].PciAttributes
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_WARN, "%a: EfiPciIoAttributeOperationGet: %r\n",
|
||||
__FUNCTION__, Status));
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"%a: EfiPciIoAttributeOperationGet: %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
goto RestoreAttributes;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve supported attributes
|
||||
//
|
||||
Status = PciIo->Attributes (PciIo, EfiPciIoAttributeOperationSupported, 0,
|
||||
&Attributes);
|
||||
Status = PciIo->Attributes (
|
||||
PciIo,
|
||||
EfiPciIoAttributeOperationSupported,
|
||||
0,
|
||||
&Attributes
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_WARN, "%a: EfiPciIoAttributeOperationSupported: %r\n",
|
||||
__FUNCTION__, Status));
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"%a: EfiPciIoAttributeOperationSupported: %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
goto RestoreAttributes;
|
||||
}
|
||||
|
||||
@@ -121,11 +151,19 @@ EnablePciDecoding (
|
||||
// Enable IO and MMIO decoding
|
||||
//
|
||||
Attributes &= EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_MEMORY;
|
||||
Status = PciIo->Attributes (PciIo, EfiPciIoAttributeOperationEnable,
|
||||
Attributes, NULL);
|
||||
Status = PciIo->Attributes (
|
||||
PciIo,
|
||||
EfiPciIoAttributeOperationEnable,
|
||||
Attributes,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_WARN, "%a: EfiPciIoAttributeOperationEnable: %r\n",
|
||||
__FUNCTION__, Status));
|
||||
DEBUG ((
|
||||
DEBUG_WARN,
|
||||
"%a: EfiPciIoAttributeOperationEnable: %r\n",
|
||||
__FUNCTION__,
|
||||
Status
|
||||
));
|
||||
goto RestoreAttributes;
|
||||
}
|
||||
}
|
||||
@@ -141,19 +179,20 @@ EnablePciDecoding (
|
||||
RestoreAttributes:
|
||||
while (Idx > 0) {
|
||||
--Idx;
|
||||
OrigAttrs[Idx].PciIo->Attributes (OrigAttrs[Idx].PciIo,
|
||||
OrigAttrs[Idx].PciIo->Attributes (
|
||||
OrigAttrs[Idx].PciIo,
|
||||
EfiPciIoAttributeOperationSet,
|
||||
OrigAttrs[Idx].PciAttributes,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
FreePool (OrigAttrs);
|
||||
|
||||
FreeHandles:
|
||||
FreePool (Handles);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Restore the original PCI attributes saved with EnablePciDecoding().
|
||||
|
||||
@@ -171,11 +210,11 @@ FreeHandles:
|
||||
**/
|
||||
VOID
|
||||
RestorePciDecoding (
|
||||
IN ORIGINAL_ATTRIBUTES *OriginalAttributes,
|
||||
IN UINTN Count
|
||||
IN ORIGINAL_ATTRIBUTES *OriginalAttributes,
|
||||
IN UINTN Count
|
||||
)
|
||||
{
|
||||
UINTN Idx;
|
||||
UINTN Idx;
|
||||
|
||||
ASSERT ((OriginalAttributes == NULL) == (Count == 0));
|
||||
if (OriginalAttributes == NULL) {
|
||||
@@ -190,5 +229,6 @@ RestorePciDecoding (
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
FreePool (OriginalAttributes);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -23,10 +23,10 @@
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InstallAcpiTables (
|
||||
IN EFI_ACPI_TABLE_PROTOCOL *AcpiTable
|
||||
IN EFI_ACPI_TABLE_PROTOCOL *AcpiTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = InstallQemuFwCfgTables (AcpiTable);
|
||||
return Status;
|
||||
|
Reference in New Issue
Block a user