From ac0a286f4d747a4c6c603a7b225917293cbe1e9f Mon Sep 17 00:00:00 2001 From: Michael Kubacki Date: Sun, 5 Dec 2021 14:54:09 -0800 Subject: 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 Cc: Leif Lindholm Cc: Michael D Kinney Signed-off-by: Michael Kubacki Reviewed-by: Andrew Fish --- OvmfPkg/QemuRamfbDxe/QemuRamfb.c | 191 ++++++++++++++++++++++++--------------- 1 file changed, 119 insertions(+), 72 deletions(-) (limited to 'OvmfPkg/QemuRamfbDxe') diff --git a/OvmfPkg/QemuRamfbDxe/QemuRamfb.c b/OvmfPkg/QemuRamfbDxe/QemuRamfb.c index 881315f42d..f5113fbc78 100644 --- a/OvmfPkg/QemuRamfbDxe/QemuRamfb.c +++ b/OvmfPkg/QemuRamfbDxe/QemuRamfb.c @@ -26,22 +26,22 @@ #pragma pack (1) typedef struct RAMFB_CONFIG { - UINT64 Address; - UINT32 FourCC; - UINT32 Flags; - UINT32 Width; - UINT32 Height; - UINT32 Stride; + UINT64 Address; + UINT32 FourCC; + UINT32 Flags; + UINT32 Width; + UINT32 Height; + UINT32 Stride; } RAMFB_CONFIG; #pragma pack () -STATIC EFI_HANDLE mRamfbHandle; -STATIC EFI_HANDLE mGopHandle; -STATIC FRAME_BUFFER_CONFIGURE *mQemuRamfbFrameBufferBltConfigure; -STATIC UINTN mQemuRamfbFrameBufferBltConfigureSize; -STATIC FIRMWARE_CONFIG_ITEM mRamfbFwCfgItem; +STATIC EFI_HANDLE mRamfbHandle; +STATIC EFI_HANDLE mGopHandle; +STATIC FRAME_BUFFER_CONFIGURE *mQemuRamfbFrameBufferBltConfigure; +STATIC UINTN mQemuRamfbFrameBufferBltConfigureSize; +STATIC FIRMWARE_CONFIG_ITEM mRamfbFwCfgItem; -STATIC EFI_GRAPHICS_OUTPUT_MODE_INFORMATION mQemuRamfbModeInfo[] = { +STATIC EFI_GRAPHICS_OUTPUT_MODE_INFORMATION mQemuRamfbModeInfo[] = { { 0, // Version 640, // HorizontalResolution @@ -57,7 +57,7 @@ STATIC EFI_GRAPHICS_OUTPUT_MODE_INFORMATION mQemuRamfbModeInfo[] = { } }; -STATIC EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE mQemuRamfbMode = { +STATIC EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE mQemuRamfbMode = { ARRAY_SIZE (mQemuRamfbModeInfo), // MaxMode 0, // Mode mQemuRamfbModeInfo, // Info @@ -76,17 +76,22 @@ QemuRamfbGraphicsOutputQueryMode ( { EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *ModeInfo; - if (Info == NULL || SizeOfInfo == NULL || - ModeNumber >= mQemuRamfbMode.MaxMode) { + if ((Info == NULL) || (SizeOfInfo == NULL) || + (ModeNumber >= mQemuRamfbMode.MaxMode)) + { return EFI_INVALID_PARAMETER; } + ModeInfo = &mQemuRamfbModeInfo[ModeNumber]; - *Info = AllocateCopyPool (sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION), - ModeInfo); + *Info = AllocateCopyPool ( + sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION), + ModeInfo + ); if (*Info == NULL) { return EFI_OUT_OF_RESOURCES; } + *SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION); return EFI_SUCCESS; @@ -96,8 +101,8 @@ STATIC EFI_STATUS EFIAPI QemuRamfbGraphicsOutputSetMode ( - IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This, - IN UINT32 ModeNumber + IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This, + IN UINT32 ModeNumber ) { EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *ModeInfo; @@ -108,10 +113,16 @@ QemuRamfbGraphicsOutputSetMode ( if (ModeNumber >= mQemuRamfbMode.MaxMode) { return EFI_UNSUPPORTED; } + ModeInfo = &mQemuRamfbModeInfo[ModeNumber]; - DEBUG ((DEBUG_INFO, "Ramfb: SetMode %u (%ux%u)\n", ModeNumber, - ModeInfo->HorizontalResolution, ModeInfo->VerticalResolution)); + DEBUG (( + DEBUG_INFO, + "Ramfb: SetMode %u (%ux%u)\n", + ModeNumber, + ModeInfo->HorizontalResolution, + ModeInfo->VerticalResolution + )); Config.Address = SwapBytes64 (mQemuRamfbMode.FrameBufferBase); Config.FourCC = SwapBytes32 (RAMFB_FORMAT); @@ -121,7 +132,7 @@ QemuRamfbGraphicsOutputSetMode ( Config.Stride = SwapBytes32 (ModeInfo->HorizontalResolution * RAMFB_BPP); Status = FrameBufferBltConfigure ( - (VOID*)(UINTN)mQemuRamfbMode.FrameBufferBase, + (VOID *)(UINTN)mQemuRamfbMode.FrameBufferBase, ModeInfo, mQemuRamfbFrameBufferBltConfigure, &mQemuRamfbFrameBufferBltConfigureSize @@ -131,6 +142,7 @@ QemuRamfbGraphicsOutputSetMode ( if (mQemuRamfbFrameBufferBltConfigure != NULL) { FreePool (mQemuRamfbFrameBufferBltConfigure); } + mQemuRamfbFrameBufferBltConfigure = AllocatePool (mQemuRamfbFrameBufferBltConfigureSize); if (mQemuRamfbFrameBufferBltConfigure == NULL) { @@ -139,12 +151,13 @@ QemuRamfbGraphicsOutputSetMode ( } Status = FrameBufferBltConfigure ( - (VOID*)(UINTN)mQemuRamfbMode.FrameBufferBase, + (VOID *)(UINTN)mQemuRamfbMode.FrameBufferBase, ModeInfo, mQemuRamfbFrameBufferBltConfigure, &mQemuRamfbFrameBufferBltConfigureSize ); } + if (RETURN_ERROR (Status)) { ASSERT (Status == RETURN_UNSUPPORTED); return Status; @@ -173,8 +186,12 @@ QemuRamfbGraphicsOutputSetMode ( 0 // Delta -- ignored ); if (RETURN_ERROR (Status)) { - DEBUG ((DEBUG_WARN, "%a: clearing the screen failed: %r\n", - __FUNCTION__, Status)); + DEBUG (( + DEBUG_WARN, + "%a: clearing the screen failed: %r\n", + __FUNCTION__, + Status + )); } return EFI_SUCCESS; @@ -184,16 +201,16 @@ STATIC EFI_STATUS EFIAPI QemuRamfbGraphicsOutputBlt ( - IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This, - IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL, - IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation, - IN UINTN SourceX, - IN UINTN SourceY, - IN UINTN DestinationX, - IN UINTN DestinationY, - IN UINTN Width, - IN UINTN Height, - IN UINTN Delta + IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This, + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL, + IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation, + IN UINTN SourceX, + IN UINTN SourceY, + IN UINTN DestinationX, + IN UINTN DestinationY, + IN UINTN Width, + IN UINTN Height, + IN UINTN Delta ) { return FrameBufferBlt ( @@ -210,7 +227,7 @@ QemuRamfbGraphicsOutputBlt ( ); } -STATIC EFI_GRAPHICS_OUTPUT_PROTOCOL mQemuRamfbGraphicsOutput = { +STATIC EFI_GRAPHICS_OUTPUT_PROTOCOL mQemuRamfbGraphicsOutput = { QemuRamfbGraphicsOutputQueryMode, QemuRamfbGraphicsOutputSetMode, QemuRamfbGraphicsOutputBlt, @@ -220,8 +237,8 @@ STATIC EFI_GRAPHICS_OUTPUT_PROTOCOL mQemuRamfbGraphicsOutput = { EFI_STATUS EFIAPI InitializeQemuRamfb ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_DEVICE_PATH_PROTOCOL *RamfbDevicePath; @@ -244,9 +261,14 @@ InitializeQemuRamfb ( if (EFI_ERROR (Status)) { return EFI_NOT_FOUND; } + if (FwCfgSize != sizeof (RAMFB_CONFIG)) { - DEBUG ((DEBUG_ERROR, "Ramfb: FwCfg size mismatch (expected %lu, got %lu)\n", - (UINT64)sizeof (RAMFB_CONFIG), (UINT64)FwCfgSize)); + DEBUG (( + DEBUG_ERROR, + "Ramfb: FwCfg size mismatch (expected %lu, got %lu)\n", + (UINT64)sizeof (RAMFB_CONFIG), + (UINT64)FwCfgSize + )); return EFI_PROTOCOL_ERROR; } @@ -257,26 +279,37 @@ InitializeQemuRamfb ( mQemuRamfbModeInfo[Index].PixelFormat = PixelBlueGreenRedReserved8BitPerColor; FbSize = RAMFB_BPP * - mQemuRamfbModeInfo[Index].HorizontalResolution * - mQemuRamfbModeInfo[Index].VerticalResolution; + mQemuRamfbModeInfo[Index].HorizontalResolution * + mQemuRamfbModeInfo[Index].VerticalResolution; if (MaxFbSize < FbSize) { MaxFbSize = FbSize; } - DEBUG ((DEBUG_INFO, "Ramfb: Mode %lu: %ux%u, %lu kB\n", (UINT64)Index, + + DEBUG (( + DEBUG_INFO, + "Ramfb: Mode %lu: %ux%u, %lu kB\n", + (UINT64)Index, mQemuRamfbModeInfo[Index].HorizontalResolution, mQemuRamfbModeInfo[Index].VerticalResolution, - (UINT64)(FbSize / 1024))); + (UINT64)(FbSize / 1024) + )); } - Pages = EFI_SIZE_TO_PAGES (MaxFbSize); + Pages = EFI_SIZE_TO_PAGES (MaxFbSize); MaxFbSize = EFI_PAGES_TO_SIZE (Pages); - FbBase = (EFI_PHYSICAL_ADDRESS)(UINTN)AllocateReservedPages (Pages); + FbBase = (EFI_PHYSICAL_ADDRESS)(UINTN)AllocateReservedPages (Pages); if (FbBase == 0) { DEBUG ((DEBUG_ERROR, "Ramfb: memory allocation failed\n")); return EFI_OUT_OF_RESOURCES; } - DEBUG ((DEBUG_INFO, "Ramfb: Framebuffer at 0x%lx, %lu kB, %lu pages\n", - (UINT64)FbBase, (UINT64)(MaxFbSize / 1024), (UINT64)Pages)); + + DEBUG (( + DEBUG_INFO, + "Ramfb: Framebuffer at 0x%lx, %lu kB, %lu pages\n", + (UINT64)FbBase, + (UINT64)(MaxFbSize / 1024), + (UINT64)Pages + )); mQemuRamfbMode.FrameBufferSize = MaxFbSize; mQemuRamfbMode.FrameBufferBase = FbBase; @@ -288,14 +321,18 @@ InitializeQemuRamfb ( // // ramfb vendor devpath // - VendorDeviceNode.Header.Type = HARDWARE_DEVICE_PATH; + VendorDeviceNode.Header.Type = HARDWARE_DEVICE_PATH; VendorDeviceNode.Header.SubType = HW_VENDOR_DP; CopyGuid (&VendorDeviceNode.Guid, &gQemuRamfbGuid); - SetDevicePathNodeLength (&VendorDeviceNode.Header, - sizeof (VENDOR_DEVICE_PATH)); + SetDevicePathNodeLength ( + &VendorDeviceNode.Header, + sizeof (VENDOR_DEVICE_PATH) + ); - RamfbDevicePath = AppendDevicePathNode (NULL, - (EFI_DEVICE_PATH_PROTOCOL *) &VendorDeviceNode); + RamfbDevicePath = AppendDevicePathNode ( + NULL, + (EFI_DEVICE_PATH_PROTOCOL *)&VendorDeviceNode + ); if (RamfbDevicePath == NULL) { Status = EFI_OUT_OF_RESOURCES; goto FreeFramebuffer; @@ -308,31 +345,38 @@ InitializeQemuRamfb ( NULL ); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "Ramfb: install Ramfb Vendor DevicePath failed: %r\n", - Status)); + DEBUG (( + DEBUG_ERROR, + "Ramfb: install Ramfb Vendor DevicePath failed: %r\n", + Status + )); goto FreeRamfbDevicePath; } // // gop devpath + protocol // - AcpiDeviceNode.Header.Type = ACPI_DEVICE_PATH; + AcpiDeviceNode.Header.Type = ACPI_DEVICE_PATH; AcpiDeviceNode.Header.SubType = ACPI_ADR_DP; - AcpiDeviceNode.ADR = ACPI_DISPLAY_ADR ( - 1, // DeviceIdScheme - 0, // HeadId - 0, // NonVgaOutput - 1, // BiosCanDetect - 0, // VendorInfo - ACPI_ADR_DISPLAY_TYPE_EXTERNAL_DIGITAL, // Type - 0, // Port - 0 // Index + AcpiDeviceNode.ADR = ACPI_DISPLAY_ADR ( + 1, // DeviceIdScheme + 0, // HeadId + 0, // NonVgaOutput + 1, // BiosCanDetect + 0, // VendorInfo + ACPI_ADR_DISPLAY_TYPE_EXTERNAL_DIGITAL, // Type + 0, // Port + 0 // Index + ); + SetDevicePathNodeLength ( + &AcpiDeviceNode.Header, + sizeof (ACPI_ADR_DEVICE_PATH) ); - SetDevicePathNodeLength (&AcpiDeviceNode.Header, - sizeof (ACPI_ADR_DEVICE_PATH)); - GopDevicePath = AppendDevicePathNode (RamfbDevicePath, - (EFI_DEVICE_PATH_PROTOCOL *) &AcpiDeviceNode); + GopDevicePath = AppendDevicePathNode ( + RamfbDevicePath, + (EFI_DEVICE_PATH_PROTOCOL *)&AcpiDeviceNode + ); if (GopDevicePath == NULL) { Status = EFI_OUT_OF_RESOURCES; goto FreeRamfbHandle; @@ -347,8 +391,11 @@ InitializeQemuRamfb ( NULL ); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "Ramfb: install GOP DevicePath failed: %r\n", - Status)); + DEBUG (( + DEBUG_ERROR, + "Ramfb: install GOP DevicePath failed: %r\n", + Status + )); goto FreeGopDevicePath; } @@ -388,6 +435,6 @@ FreeRamfbHandle: FreeRamfbDevicePath: FreePool (RamfbDevicePath); FreeFramebuffer: - FreePages ((VOID*)(UINTN)mQemuRamfbMode.FrameBufferBase, Pages); + FreePages ((VOID *)(UINTN)mQemuRamfbMode.FrameBufferBase, Pages); return Status; } -- cgit v1.2.3