diff options
author | Girish Pathak <girish.pathak at arm.com> | 2017-09-26 21:15:11 +0100 |
---|---|---|
committer | Leif Lindholm <leif.lindholm@linaro.org> | 2018-04-23 11:42:13 +0100 |
commit | b1b69d2606e8995d08bf25e3ed286c20034bfba3 (patch) | |
tree | 8d9d6f636dc43ca278448b99287f42ebea924dff /ArmPlatformPkg/Drivers | |
parent | e10c79145ec2ab8cc60a4891c8702abda25d7b55 (diff) | |
download | edk2-b1b69d2606e8995d08bf25e3ed286c20034bfba3.tar.gz edk2-b1b69d2606e8995d08bf25e3ed286c20034bfba3.tar.bz2 edk2-b1b69d2606e8995d08bf25e3ed286c20034bfba3.zip |
ArmPlatformPkg: Tidy Lcd code: Coding standard
There is no functional modification in this change
As preparation for further work, the formatting is corrected to meet
the EDKII coding standard.
Of specific note, some invalid include guards were fixed.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Girish Pathak <girish.pathak@arm.com>
Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Diffstat (limited to 'ArmPlatformPkg/Drivers')
-rw-r--r-- | ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c | 191 | ||||
-rw-r--r-- | ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h | 10 |
2 files changed, 105 insertions, 96 deletions
diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c index b721061fc1..905eb26ee0 100644 --- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c +++ b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c @@ -1,6 +1,6 @@ /** @file
- Copyright (c) 2011-2014, ARM Ltd. All rights reserved.<BR>
+ Copyright (c) 2011-2018, ARM Ltd. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -9,7 +9,7 @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
- **/
+**/
#include <PiDxe.h>
#include <Library/BaseMemoryLib.h>
@@ -22,12 +22,10 @@ #include "LcdGraphicsOutputDxe.h"
-/**********************************************************************
- *
- * This file implements the Graphics Output protocol on ArmVersatileExpress
- * using the Lcd controller
- *
- **********************************************************************/
+/** This file implements the Graphics Output protocol on ArmVersatileExpress
+ using the Lcd controller
+
+**/
//
// Global variables
@@ -64,7 +62,10 @@ LCD_INSTANCE mLcdTemplate = { {
{
HARDWARE_DEVICE_PATH, HW_VENDOR_DP,
- { (UINT8) (sizeof(VENDOR_DEVICE_PATH)), (UINT8) ((sizeof(VENDOR_DEVICE_PATH)) >> 8) },
+ {
+ (UINT8)(sizeof (VENDOR_DEVICE_PATH)),
+ (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+ },
},
// Hardware Device Path for Lcd
EFI_CALLER_ID_GUID // Use the driver's GUID
@@ -73,10 +74,13 @@ LCD_INSTANCE mLcdTemplate = { {
END_DEVICE_PATH_TYPE,
END_ENTIRE_DEVICE_PATH_SUBTYPE,
- { sizeof(EFI_DEVICE_PATH_PROTOCOL), 0 }
+ {
+ sizeof (EFI_DEVICE_PATH_PROTOCOL),
+ 0
+ }
}
},
- (EFI_EVENT) NULL // ExitBootServicesEvent
+ (EFI_EVENT)NULL // ExitBootServicesEvent
};
EFI_STATUS
@@ -86,7 +90,7 @@ LcdInstanceContructor ( {
LCD_INSTANCE* Instance;
- Instance = AllocateCopyPool (sizeof(LCD_INSTANCE), &mLcdTemplate);
+ Instance = AllocateCopyPool (sizeof (LCD_INSTANCE), &mLcdTemplate);
if (Instance == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -113,23 +117,23 @@ InitializeDisplay ( UINTN VramSize;
Status = LcdPlatformGetVram (&VramBaseAddress, &VramSize);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
return Status;
}
// Setup the LCD
Status = LcdInitialize (VramBaseAddress);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
goto EXIT_ERROR_LCD_SHUTDOWN;
}
Status = LcdPlatformInitializeDisplay (Instance->Handle);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
goto EXIT_ERROR_LCD_SHUTDOWN;
}
// Setup all the relevant mode information
- Instance->Gop.Mode->SizeOfInfo = sizeof(EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
+ Instance->Gop.Mode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
Instance->Gop.Mode->FrameBufferBase = VramBaseAddress;
// Set the flag before changing the mode, to avoid infinite loops
@@ -139,7 +143,8 @@ InitializeDisplay ( goto EXIT;
EXIT_ERROR_LCD_SHUTDOWN:
- DEBUG((DEBUG_ERROR, "InitializeDisplay: ERROR - Can not initialise the display. Exit Status=%r\n", Status));
+ DEBUG ((DEBUG_ERROR, "InitializeDisplay: ERROR - Can not initialise the display. Exit Status=%r\n", Status));
+
LcdShutdown ();
EXIT:
@@ -157,40 +162,44 @@ LcdGraphicsOutputDxeInitialize ( LCD_INSTANCE* Instance;
Status = LcdIdentify ();
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
goto EXIT;
}
Status = LcdInstanceContructor (&Instance);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
goto EXIT;
}
// Install the Graphics Output Protocol and the Device Path
- Status = gBS->InstallMultipleProtocolInterfaces(
- &Instance->Handle,
- &gEfiGraphicsOutputProtocolGuid, &Instance->Gop,
- &gEfiDevicePathProtocolGuid, &Instance->DevicePath,
- NULL
- );
-
- if (EFI_ERROR(Status)) {
- DEBUG((DEBUG_ERROR, "GraphicsOutputDxeInitialize: Can not install the protocol. Exit Status=%r\n", Status));
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &Instance->Handle,
+ &gEfiGraphicsOutputProtocolGuid,
+ &Instance->Gop,
+ &gEfiDevicePathProtocolGuid,
+ &Instance->DevicePath,
+ NULL
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "LcdGraphicsOutputDxeInitialize: Can not install the protocol. Exit Status=%r\n", Status));
goto EXIT;
}
// Register for an ExitBootServicesEvent
- // When ExitBootServices starts, this function here will make sure that the graphics driver will shut down properly,
- // i.e. it will free up all allocated memory and perform any necessary hardware re-configuration.
+ // When ExitBootServices starts, this function will make sure that the
+ // graphics driver shuts down properly, i.e. it will free up all
+ // allocated memory and perform any necessary hardware re-configuration.
Status = gBS->CreateEvent (
- EVT_SIGNAL_EXIT_BOOT_SERVICES,
- TPL_NOTIFY,
- LcdGraphicsExitBootServicesEvent, NULL,
- &Instance->ExitBootServicesEvent
- );
-
- if (EFI_ERROR(Status)) {
- DEBUG((DEBUG_ERROR, "GraphicsOutputDxeInitialize: Can not install the ExitBootServicesEvent handler. Exit Status=%r\n", Status));
+ EVT_SIGNAL_EXIT_BOOT_SERVICES,
+ TPL_NOTIFY,
+ LcdGraphicsExitBootServicesEvent,
+ NULL,
+ &Instance->ExitBootServicesEvent
+ );
+
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "LcdGraphicsOutputDxeInitialize: Can not install the ExitBootServicesEvent handler. Exit Status=%r\n", Status));
goto EXIT_ERROR_UNINSTALL_PROTOCOL;
}
@@ -198,48 +207,46 @@ LcdGraphicsOutputDxeInitialize ( goto EXIT;
EXIT_ERROR_UNINSTALL_PROTOCOL:
- /* The following function could return an error message,
- * however, to get here something must have gone wrong already,
- * so preserve the original error, i.e. don't change
- * the Status variable, even it fails to uninstall the protocol.
- */
+ // The following function could return an error message,
+ // however, to get here something must have gone wrong already,
+ // so preserve the original error, i.e. don't change
+ // the Status variable, even it fails to uninstall the protocol.
gBS->UninstallMultipleProtocolInterfaces (
- Instance->Handle,
- &gEfiGraphicsOutputProtocolGuid, &Instance->Gop, // Uninstall Graphics Output protocol
- &gEfiDevicePathProtocolGuid, &Instance->DevicePath, // Uninstall device path
- NULL
- );
+ Instance->Handle,
+ &gEfiGraphicsOutputProtocolGuid,
+ &Instance->Gop, // Uninstall Graphics Output protocol
+ &gEfiDevicePathProtocolGuid,
+ &Instance->DevicePath, // Uninstall device path
+ NULL
+ );
EXIT:
return Status;
-
}
-/***************************************
- * This function should be called
- * on Event: ExitBootServices
- * to free up memory, stop the driver
- * and uninstall the protocols
- ***************************************/
+/** This function should be called
+ on Event: ExitBootServices
+ to free up memory, stop the driver
+ and uninstall the protocols
+**/
VOID
LcdGraphicsExitBootServicesEvent (
IN EFI_EVENT Event,
IN VOID *Context
)
{
- // By default, this PCD is FALSE. But if a platform starts a predefined OS that
- // does not use a framebuffer then we might want to disable the display controller
- // to avoid to display corrupted information on the screen.
+ // By default, this PCD is FALSE. But if a platform starts a predefined OS
+ // that does not use a framebuffer then we might want to disable the display
+ // controller to avoid to display corrupted information on the screen.
if (FeaturePcdGet (PcdGopDisableOnExitBootServices)) {
// Turn-off the Display controller
LcdShutdown ();
}
}
-/***************************************
- * GraphicsOutput Protocol function, mapping to
- * EFI_GRAPHICS_OUTPUT_PROTOCOL.QueryMode
- ***************************************/
+/** GraphicsOutput Protocol function, mapping to
+ EFI_GRAPHICS_OUTPUT_PROTOCOL.QueryMode
+**/
EFI_STATUS
EFIAPI
LcdGraphicsQueryMode (
@@ -252,19 +259,22 @@ LcdGraphicsQueryMode ( EFI_STATUS Status = EFI_SUCCESS;
LCD_INSTANCE *Instance;
- Instance = LCD_INSTANCE_FROM_GOP_THIS(This);
+ Instance = LCD_INSTANCE_FROM_GOP_THIS (This);
// Setup the hardware if not already done
- if( !mDisplayInitialized ) {
- Status = InitializeDisplay(Instance);
- if (EFI_ERROR(Status)) {
+ if (!mDisplayInitialized) {
+ Status = InitializeDisplay (Instance);
+ if (EFI_ERROR (Status)) {
goto EXIT;
}
}
// Error checking
- if ( (This == NULL) || (Info == NULL) || (SizeOfInfo == NULL) || (ModeNumber >= This->Mode->MaxMode) ) {
- DEBUG((DEBUG_ERROR, "LcdGraphicsQueryMode: ERROR - For mode number %d : Invalid Parameter.\n", ModeNumber ));
+ if ((This == NULL) ||
+ (Info == NULL) ||
+ (SizeOfInfo == NULL) ||
+ (ModeNumber >= This->Mode->MaxMode)) {
+ DEBUG ((DEBUG_ERROR, "LcdGraphicsQueryMode: ERROR - For mode number %d : Invalid Parameter.\n", ModeNumber));
Status = EFI_INVALID_PARAMETER;
goto EXIT;
}
@@ -275,21 +285,20 @@ LcdGraphicsQueryMode ( goto EXIT;
}
- *SizeOfInfo = sizeof( EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
+ *SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
- Status = LcdPlatformQueryMode (ModeNumber,*Info);
- if (EFI_ERROR(Status)) {
- FreePool(*Info);
+ Status = LcdPlatformQueryMode (ModeNumber, *Info);
+ if (EFI_ERROR (Status)) {
+ FreePool (*Info);
}
EXIT:
return Status;
}
-/***************************************
- * GraphicsOutput Protocol function, mapping to
- * EFI_GRAPHICS_OUTPUT_PROTOCOL.SetMode
- ***************************************/
+/** GraphicsOutput Protocol function, mapping to
+ EFI_GRAPHICS_OUTPUT_PROTOCOL.SetMode
+**/
EFI_STATUS
EFIAPI
LcdGraphicsSetMode (
@@ -305,47 +314,48 @@ LcdGraphicsSetMode ( Instance = LCD_INSTANCE_FROM_GOP_THIS (This);
// Setup the hardware if not already done
- if(!mDisplayInitialized) {
+ if (!mDisplayInitialized) {
Status = InitializeDisplay (Instance);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
goto EXIT;
}
}
// Check if this mode is supported
- if( ModeNumber >= This->Mode->MaxMode ) {
- DEBUG((DEBUG_ERROR, "LcdGraphicsSetMode: ERROR - Unsupported mode number %d .\n", ModeNumber ));
+ if (ModeNumber >= This->Mode->MaxMode) {
+ DEBUG ((DEBUG_ERROR, "LcdGraphicsSetMode: ERROR - Unsupported mode number %d .\n", ModeNumber));
Status = EFI_UNSUPPORTED;
goto EXIT;
}
// Set the oscillator frequency to support the new mode
Status = LcdPlatformSetMode (ModeNumber);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
Status = EFI_DEVICE_ERROR;
goto EXIT;
}
// Update the UEFI mode information
This->Mode->Mode = ModeNumber;
- LcdPlatformQueryMode (ModeNumber,&Instance->ModeInfo);
- Status = LcdPlatformGetBpp(ModeNumber, &Bpp);
- if (EFI_ERROR(Status)) {
+ LcdPlatformQueryMode (ModeNumber, &Instance->ModeInfo);
+ Status = LcdPlatformGetBpp (ModeNumber, &Bpp);
+ if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "LcdGraphicsSetMode: ERROR - Couldn't get bytes per pixel, status: %r\n", Status));
goto EXIT;
}
This->Mode->FrameBufferSize = Instance->ModeInfo.VerticalResolution
- * Instance->ModeInfo.PixelsPerScanLine
- * GetBytesPerPixel(Bpp);
+ * Instance->ModeInfo.PixelsPerScanLine
+ * GetBytesPerPixel (Bpp);
// Set the hardware to the new mode
Status = LcdSetMode (ModeNumber);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
Status = EFI_DEVICE_ERROR;
goto EXIT;
}
- // The UEFI spec requires that we now clear the visible portions of the output display to black.
+ // The UEFI spec requires that we now clear the visible portions of the
+ // output display to black.
// Set the fill colour to black
SetMem (&FillColour, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);
@@ -361,7 +371,8 @@ LcdGraphicsSetMode ( 0,
This->Mode->Info->HorizontalResolution,
This->Mode->Info->VerticalResolution,
- 0);
+ 0
+ );
EXIT:
return Status;
@@ -372,7 +383,7 @@ GetBytesPerPixel ( IN LCD_BPP Bpp
)
{
- switch(Bpp) {
+ switch (Bpp) {
case LCD_BITS_PER_PIXEL_24:
return 4;
diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h index b66efd3456..16d92f45c4 100644 --- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h +++ b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h @@ -1,6 +1,6 @@ /** @file
- Copyright (c) 2011, ARM Ltd. All rights reserved.<BR>
+ Copyright (c) 2011-2018, ARM Ltd. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -11,9 +11,8 @@ **/
-#ifndef __ARM_VE_GRAPHICS_DXE_H__
-#define __ARM_VE_GRAPHICS_DXE_H__
-
+#ifndef LCD_GRAPHICS_OUTPUT_DXE_H_
+#define LCD_GRAPHICS_OUTPUT_DXE_H_
#include <Base.h>
@@ -25,7 +24,6 @@ #include <Protocol/DevicePath.h>
-
//
// Device structures
//
@@ -106,4 +104,4 @@ InitializeDisplay ( IN LCD_INSTANCE* Instance
);
-#endif /* __ARM_VE_GRAPHICS_DXE_H__ */
+#endif /* LCD_GRAPHICS_OUTPUT_DXE_H_ */
|