]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg: Tidy Lcd code: Coding standard
authorGirish Pathak <girish.pathak at arm.com>
Tue, 26 Sep 2017 20:15:11 +0000 (21:15 +0100)
committerLeif Lindholm <leif.lindholm@linaro.org>
Mon, 23 Apr 2018 10:42:13 +0000 (11:42 +0100)
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>
ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c
ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h
ArmPlatformPkg/Include/Library/LcdPlatformLib.h
ArmPlatformPkg/Library/HdLcd/HdLcd.c
ArmPlatformPkg/Library/HdLcd/HdLcd.h
ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c

index b721061fc1df5695092e8c71da97ae0b9af46b3f..905eb26ee01b5037dfbaf3c054a62593837c8b5f 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
- Copyright (c) 2011-2014, ARM Ltd. All rights reserved.<BR>\r
+ Copyright (c) 2011-2018, ARM Ltd. All rights reserved.<BR>\r
  This program and the accompanying materials\r
  are licensed and made available under the terms and conditions of the BSD License\r
  which accompanies this distribution.  The full text of the license may be found at\r
@@ -9,7 +9,7 @@
  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
- **/\r
+**/\r
 \r
 #include <PiDxe.h>\r
 #include <Library/BaseMemoryLib.h>\r
 \r
 #include "LcdGraphicsOutputDxe.h"\r
 \r
-/**********************************************************************\r
- *\r
- *  This file implements the Graphics Output protocol on ArmVersatileExpress\r
- *  using the Lcd controller\r
- *\r
- **********************************************************************/\r
+/** This file implements the Graphics Output protocol on ArmVersatileExpress\r
+  using the Lcd controller\r
+\r
+**/\r
 \r
 //\r
 // Global variables\r
@@ -64,7 +62,10 @@ LCD_INSTANCE mLcdTemplate = {
     {\r
       {\r
         HARDWARE_DEVICE_PATH, HW_VENDOR_DP,\r
-        { (UINT8) (sizeof(VENDOR_DEVICE_PATH)), (UINT8) ((sizeof(VENDOR_DEVICE_PATH)) >> 8) },\r
+        {\r
+          (UINT8)(sizeof (VENDOR_DEVICE_PATH)),\r
+          (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)\r
+        },\r
       },\r
       // Hardware Device Path for Lcd\r
       EFI_CALLER_ID_GUID // Use the driver's GUID\r
@@ -73,10 +74,13 @@ LCD_INSTANCE mLcdTemplate = {
     {\r
       END_DEVICE_PATH_TYPE,\r
       END_ENTIRE_DEVICE_PATH_SUBTYPE,\r
-      { sizeof(EFI_DEVICE_PATH_PROTOCOL), 0 }\r
+      {\r
+        sizeof (EFI_DEVICE_PATH_PROTOCOL),\r
+        0\r
+      }\r
     }\r
   },\r
-  (EFI_EVENT) NULL // ExitBootServicesEvent\r
+  (EFI_EVENT)NULL // ExitBootServicesEvent\r
 };\r
 \r
 EFI_STATUS\r
@@ -86,7 +90,7 @@ LcdInstanceContructor (
 {\r
   LCD_INSTANCE* Instance;\r
 \r
-  Instance = AllocateCopyPool (sizeof(LCD_INSTANCE), &mLcdTemplate);\r
+  Instance = AllocateCopyPool (sizeof (LCD_INSTANCE), &mLcdTemplate);\r
   if (Instance == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
@@ -113,23 +117,23 @@ InitializeDisplay (
   UINTN                  VramSize;\r
 \r
   Status = LcdPlatformGetVram (&VramBaseAddress, &VramSize);\r
-  if (EFI_ERROR(Status)) {\r
+  if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
 \r
   // Setup the LCD\r
   Status = LcdInitialize (VramBaseAddress);\r
-  if (EFI_ERROR(Status)) {\r
+  if (EFI_ERROR (Status)) {\r
     goto EXIT_ERROR_LCD_SHUTDOWN;\r
   }\r
 \r
   Status = LcdPlatformInitializeDisplay (Instance->Handle);\r
-  if (EFI_ERROR(Status)) {\r
+  if (EFI_ERROR (Status)) {\r
     goto EXIT_ERROR_LCD_SHUTDOWN;\r
   }\r
 \r
   // Setup all the relevant mode information\r
-  Instance->Gop.Mode->SizeOfInfo      = sizeof(EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);\r
+  Instance->Gop.Mode->SizeOfInfo      = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);\r
   Instance->Gop.Mode->FrameBufferBase = VramBaseAddress;\r
 \r
   // Set the flag before changing the mode, to avoid infinite loops\r
@@ -139,7 +143,8 @@ InitializeDisplay (
   goto EXIT;\r
 \r
 EXIT_ERROR_LCD_SHUTDOWN:\r
-  DEBUG((DEBUG_ERROR, "InitializeDisplay: ERROR - Can not initialise the display. Exit Status=%r\n", Status));\r
+  DEBUG ((DEBUG_ERROR, "InitializeDisplay: ERROR - Can not initialise the display. Exit Status=%r\n", Status));\r
+\r
   LcdShutdown ();\r
 \r
 EXIT:\r
@@ -157,40 +162,44 @@ LcdGraphicsOutputDxeInitialize (
   LCD_INSTANCE* Instance;\r
 \r
   Status = LcdIdentify ();\r
-  if (EFI_ERROR(Status)) {\r
+  if (EFI_ERROR (Status)) {\r
     goto EXIT;\r
   }\r
 \r
   Status = LcdInstanceContructor (&Instance);\r
-  if (EFI_ERROR(Status)) {\r
+  if (EFI_ERROR (Status)) {\r
     goto EXIT;\r
   }\r
 \r
   // Install the Graphics Output Protocol and the Device Path\r
-  Status = gBS->InstallMultipleProtocolInterfaces(\r
-            &Instance->Handle,\r
-            &gEfiGraphicsOutputProtocolGuid, &Instance->Gop,\r
-            &gEfiDevicePathProtocolGuid,     &Instance->DevicePath,\r
-            NULL\r
-            );\r
-\r
-  if (EFI_ERROR(Status)) {\r
-    DEBUG((DEBUG_ERROR, "GraphicsOutputDxeInitialize: Can not install the protocol. Exit Status=%r\n", Status));\r
+  Status = gBS->InstallMultipleProtocolInterfaces (\r
+                  &Instance->Handle,\r
+                  &gEfiGraphicsOutputProtocolGuid,\r
+                  &Instance->Gop,\r
+                  &gEfiDevicePathProtocolGuid,\r
+                  &Instance->DevicePath,\r
+                  NULL\r
+                  );\r
+\r
+  if (EFI_ERROR (Status)) {\r
+    DEBUG ((DEBUG_ERROR, "LcdGraphicsOutputDxeInitialize: Can not install the protocol. Exit Status=%r\n", Status));\r
     goto EXIT;\r
   }\r
 \r
   // Register for an ExitBootServicesEvent\r
-  // When ExitBootServices starts, this function here will make sure that the graphics driver will shut down properly,\r
-  // i.e. it will free up all allocated memory and perform any necessary hardware re-configuration.\r
+  // When ExitBootServices starts, this function will make sure that the\r
+  // graphics driver shuts down properly, i.e. it will free up all\r
+  // allocated memory and perform any necessary hardware re-configuration.\r
   Status = gBS->CreateEvent (\r
-            EVT_SIGNAL_EXIT_BOOT_SERVICES,\r
-            TPL_NOTIFY,\r
-            LcdGraphicsExitBootServicesEvent, NULL,\r
-            &Instance->ExitBootServicesEvent\r
-            );\r
-\r
-  if (EFI_ERROR(Status)) {\r
-    DEBUG((DEBUG_ERROR, "GraphicsOutputDxeInitialize: Can not install the ExitBootServicesEvent handler. Exit Status=%r\n", Status));\r
+                  EVT_SIGNAL_EXIT_BOOT_SERVICES,\r
+                  TPL_NOTIFY,\r
+                  LcdGraphicsExitBootServicesEvent,\r
+                  NULL,\r
+                  &Instance->ExitBootServicesEvent\r
+                  );\r
+\r
+  if (EFI_ERROR (Status)) {\r
+    DEBUG ((DEBUG_ERROR, "LcdGraphicsOutputDxeInitialize: Can not install the ExitBootServicesEvent handler. Exit Status=%r\n", Status));\r
     goto EXIT_ERROR_UNINSTALL_PROTOCOL;\r
   }\r
 \r
@@ -198,48 +207,46 @@ LcdGraphicsOutputDxeInitialize (
   goto EXIT;\r
 \r
 EXIT_ERROR_UNINSTALL_PROTOCOL:\r
-  /* The following function could return an error message,\r
-   * however, to get here something must have gone wrong already,\r
-   * so preserve the original error, i.e. don't change\r
-   * the Status variable, even it fails to uninstall the protocol.\r
-   */\r
+  // The following function could return an error message,\r
+  // however, to get here something must have gone wrong already,\r
+  // so preserve the original error, i.e. don't change\r
+  // the Status variable, even it fails to uninstall the protocol.\r
   gBS->UninstallMultipleProtocolInterfaces (\r
-    Instance->Handle,\r
-    &gEfiGraphicsOutputProtocolGuid, &Instance->Gop, // Uninstall Graphics Output protocol\r
-    &gEfiDevicePathProtocolGuid,     &Instance->DevicePath,     // Uninstall device path\r
-    NULL\r
-    );\r
+         Instance->Handle,\r
+         &gEfiGraphicsOutputProtocolGuid,\r
+         &Instance->Gop, // Uninstall Graphics Output protocol\r
+         &gEfiDevicePathProtocolGuid,\r
+         &Instance->DevicePath,     // Uninstall device path\r
+         NULL\r
+         );\r
 \r
 EXIT:\r
   return Status;\r
-\r
 }\r
 \r
-/***************************************\r
- * This function should be called\r
- * on Event: ExitBootServices\r
- * to free up memory, stop the driver\r
- * and uninstall the protocols\r
- ***************************************/\r
+/** This function should be called\r
+  on Event: ExitBootServices\r
+  to free up memory, stop the driver\r
+  and uninstall the protocols\r
+**/\r
 VOID\r
 LcdGraphicsExitBootServicesEvent (\r
   IN EFI_EVENT  Event,\r
   IN VOID       *Context\r
   )\r
 {\r
-  // By default, this PCD is FALSE. But if a platform starts a predefined OS that\r
-  // does not use a framebuffer then we might want to disable the display controller\r
-  // to avoid to display corrupted information on the screen.\r
+  // By default, this PCD is FALSE. But if a platform starts a predefined OS\r
+  // that does not use a framebuffer then we might want to disable the display\r
+  // controller to avoid to display corrupted information on the screen.\r
   if (FeaturePcdGet (PcdGopDisableOnExitBootServices)) {\r
     // Turn-off the Display controller\r
     LcdShutdown ();\r
   }\r
 }\r
 \r
-/***************************************\r
- * GraphicsOutput Protocol function, mapping to\r
- * EFI_GRAPHICS_OUTPUT_PROTOCOL.QueryMode\r
- ***************************************/\r
+/** GraphicsOutput Protocol function, mapping to\r
+  EFI_GRAPHICS_OUTPUT_PROTOCOL.QueryMode\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 LcdGraphicsQueryMode (\r
@@ -252,19 +259,22 @@ LcdGraphicsQueryMode (
   EFI_STATUS Status = EFI_SUCCESS;\r
   LCD_INSTANCE *Instance;\r
 \r
-  Instance = LCD_INSTANCE_FROM_GOP_THIS(This);\r
+  Instance = LCD_INSTANCE_FROM_GOP_THIS (This);\r
 \r
   // Setup the hardware if not already done\r
-  if( !mDisplayInitialized ) {\r
-    Status = InitializeDisplay(Instance);\r
-    if (EFI_ERROR(Status)) {\r
+  if (!mDisplayInitialized) {\r
+    Status = InitializeDisplay (Instance);\r
+    if (EFI_ERROR (Status)) {\r
       goto EXIT;\r
     }\r
   }\r
 \r
   // Error checking\r
-  if ( (This == NULL) || (Info == NULL) || (SizeOfInfo == NULL) || (ModeNumber >= This->Mode->MaxMode) ) {\r
-    DEBUG((DEBUG_ERROR, "LcdGraphicsQueryMode: ERROR - For mode number %d : Invalid Parameter.\n", ModeNumber ));\r
+  if ((This == NULL) ||\r
+      (Info == NULL) ||\r
+      (SizeOfInfo == NULL) ||\r
+      (ModeNumber >= This->Mode->MaxMode)) {\r
+    DEBUG ((DEBUG_ERROR, "LcdGraphicsQueryMode: ERROR - For mode number %d : Invalid Parameter.\n", ModeNumber));\r
     Status = EFI_INVALID_PARAMETER;\r
     goto EXIT;\r
   }\r
@@ -275,21 +285,20 @@ LcdGraphicsQueryMode (
     goto EXIT;\r
   }\r
 \r
-  *SizeOfInfo = sizeofEFI_GRAPHICS_OUTPUT_MODE_INFORMATION);\r
+  *SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);\r
 \r
-  Status = LcdPlatformQueryMode (ModeNumber,*Info);\r
-  if (EFI_ERROR(Status)) {\r
-    FreePool(*Info);\r
+  Status = LcdPlatformQueryMode (ModeNumber, *Info);\r
+  if (EFI_ERROR (Status)) {\r
+    FreePool (*Info);\r
   }\r
 \r
 EXIT:\r
   return Status;\r
 }\r
 \r
-/***************************************\r
- * GraphicsOutput Protocol function, mapping to\r
- * EFI_GRAPHICS_OUTPUT_PROTOCOL.SetMode\r
- ***************************************/\r
+/** GraphicsOutput Protocol function, mapping to\r
+  EFI_GRAPHICS_OUTPUT_PROTOCOL.SetMode\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 LcdGraphicsSetMode (\r
@@ -305,47 +314,48 @@ LcdGraphicsSetMode (
   Instance = LCD_INSTANCE_FROM_GOP_THIS (This);\r
 \r
   // Setup the hardware if not already done\r
-  if(!mDisplayInitialized) {\r
+  if (!mDisplayInitialized) {\r
     Status = InitializeDisplay (Instance);\r
-    if (EFI_ERROR(Status)) {\r
+    if (EFI_ERROR (Status)) {\r
       goto EXIT;\r
     }\r
   }\r
 \r
   // Check if this mode is supported\r
-  if( ModeNumber >= This->Mode->MaxMode ) {\r
-    DEBUG((DEBUG_ERROR, "LcdGraphicsSetMode: ERROR - Unsupported mode number %d .\n", ModeNumber ));\r
+  if (ModeNumber >= This->Mode->MaxMode) {\r
+    DEBUG ((DEBUG_ERROR, "LcdGraphicsSetMode: ERROR - Unsupported mode number %d .\n", ModeNumber));\r
     Status = EFI_UNSUPPORTED;\r
     goto EXIT;\r
   }\r
 \r
   // Set the oscillator frequency to support the new mode\r
   Status = LcdPlatformSetMode (ModeNumber);\r
-  if (EFI_ERROR(Status)) {\r
+  if (EFI_ERROR (Status)) {\r
     Status = EFI_DEVICE_ERROR;\r
     goto EXIT;\r
   }\r
 \r
   // Update the UEFI mode information\r
   This->Mode->Mode = ModeNumber;\r
-  LcdPlatformQueryMode (ModeNumber,&Instance->ModeInfo);\r
-  Status = LcdPlatformGetBpp(ModeNumber, &Bpp);\r
-  if (EFI_ERROR(Status)) {\r
+  LcdPlatformQueryMode (ModeNumber, &Instance->ModeInfo);\r
+  Status = LcdPlatformGetBpp (ModeNumber, &Bpp);\r
+  if (EFI_ERROR (Status)) {\r
     DEBUG ((DEBUG_ERROR, "LcdGraphicsSetMode: ERROR - Couldn't get bytes per pixel, status: %r\n", Status));\r
     goto EXIT;\r
   }\r
   This->Mode->FrameBufferSize =  Instance->ModeInfo.VerticalResolution\r
-                               * Instance->ModeInfo.PixelsPerScanLine\r
-                               * GetBytesPerPixel(Bpp);\r
+                                 * Instance->ModeInfo.PixelsPerScanLine\r
+                                 * GetBytesPerPixel (Bpp);\r
 \r
   // Set the hardware to the new mode\r
   Status = LcdSetMode (ModeNumber);\r
-  if (EFI_ERROR(Status)) {\r
+  if (EFI_ERROR (Status)) {\r
     Status = EFI_DEVICE_ERROR;\r
     goto EXIT;\r
   }\r
 \r
-  // The UEFI spec requires that we now clear the visible portions of the output display to black.\r
+  // The UEFI spec requires that we now clear the visible portions of the\r
+  // output display to black.\r
 \r
   // Set the fill colour to black\r
   SetMem (&FillColour, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);\r
@@ -361,7 +371,8 @@ LcdGraphicsSetMode (
       0,\r
       This->Mode->Info->HorizontalResolution,\r
       This->Mode->Info->VerticalResolution,\r
-      0);\r
+      0\r
+      );\r
 \r
 EXIT:\r
   return Status;\r
@@ -372,7 +383,7 @@ GetBytesPerPixel (
   IN  LCD_BPP       Bpp\r
   )\r
 {\r
-  switch(Bpp) {\r
+  switch (Bpp) {\r
   case LCD_BITS_PER_PIXEL_24:\r
     return 4;\r
 \r
index b66efd34561f655b74a5ecfad8a97281cdd5929d..16d92f45c47948630d6262a63fd1af4e076706d1 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-  Copyright (c) 2011, ARM Ltd. All rights reserved.<BR>\r
+  Copyright (c) 2011-2018, ARM Ltd. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -11,9 +11,8 @@
 \r
 **/\r
 \r
-#ifndef __ARM_VE_GRAPHICS_DXE_H__\r
-#define __ARM_VE_GRAPHICS_DXE_H__\r
-\r
+#ifndef LCD_GRAPHICS_OUTPUT_DXE_H_\r
+#define LCD_GRAPHICS_OUTPUT_DXE_H_\r
 \r
 #include <Base.h>\r
 \r
@@ -25,7 +24,6 @@
 \r
 #include <Protocol/DevicePath.h>\r
 \r
-\r
 //\r
 // Device structures\r
 //\r
@@ -106,4 +104,4 @@ InitializeDisplay (
   IN LCD_INSTANCE* Instance\r
 );\r
 \r
-#endif /* __ARM_VE_GRAPHICS_DXE_H__ */\r
+#endif /* LCD_GRAPHICS_OUTPUT_DXE_H_ */\r
index b9bdf471e2d65dba7a0fcb0f7ecc352bd576b46b..3d13e417972c67cc51ae4410efd548053511e5d1 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
- Copyright (c) 2011, ARM Ltd. All rights reserved.<BR>\r
+ Copyright (c) 2011-2018, ARM Ltd. All rights reserved.<BR>\r
  This program and the accompanying materials\r
  are licensed and made available under the terms and conditions of the BSD License\r
  which accompanies this distribution.  The full text of the license may be found at\r
@@ -11,8 +11,8 @@
 \r
  **/\r
 \r
-#ifndef __LCDPLATFORMLIB_H\r
-#define __LCDPLATFORMLIB_H\r
+#ifndef LCD_PLATFORM_LIB_H_\r
+#define LCD_PLATFORM_LIB_H_\r
 \r
 #include <Protocol/GraphicsOutput.h>\r
 \r
 #define LCD_12BPP_444_BLUE_MASK         0x0000000F\r
 #define LCD_12BPP_444_RESERVED_MASK     0x0000F000\r
 \r
-\r
-// The enumeration indexes maps the PL111 LcdBpp values used in the LCD Control Register\r
+/** The enumeration indexes maps the PL111 LcdBpp values used in the LCD Control\r
+  Register\r
+**/\r
 typedef enum {\r
   LCD_BITS_PER_PIXEL_1 = 0,\r
   LCD_BITS_PER_PIXEL_2,\r
@@ -171,7 +172,6 @@ typedef enum {
   LCD_BITS_PER_PIXEL_12_444\r
 } LCD_BPP;\r
 \r
-\r
 EFI_STATUS\r
 LcdPlatformInitializeDisplay (\r
   IN EFI_HANDLE   Handle\r
@@ -218,4 +218,4 @@ LcdPlatformGetBpp (
   OUT LCD_BPP*                              Bpp\r
   );\r
 \r
-#endif\r
+#endif /* LCD_PLATFORM_LIB_H_ */\r
index 24efb68f23e3393a96fc760732d978b6346a2807..2cd1be9d255dd5734176d752d60f06f11a047fcb 100644 (file)
@@ -1,6 +1,6 @@
-/** @file  Lcd.c\r
+/** @file\r
 \r
-  Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>\r
+  Copyright (c) 2011-2018, ARM Ltd. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
 \r
 #include "HdLcd.h"\r
 \r
-/**********************************************************************\r
- *\r
- *  This file contains all the bits of the Lcd that are\r
- *  platform independent.\r
- *\r
- **********************************************************************/\r
+/** This file contains all the bits of the Lcd that are\r
+  platform independent.\r
+**/\r
 \r
 STATIC\r
 UINTN\r
@@ -34,7 +31,7 @@ GetBytesPerPixel (
   IN  LCD_BPP       Bpp\r
   )\r
 {\r
-  switch(Bpp) {\r
+  switch (Bpp) {\r
   case LCD_BITS_PER_PIXEL_24:\r
     return 4;\r
 \r
@@ -60,21 +57,27 @@ LcdInitialize (
   )\r
 {\r
   // Disable the controller\r
-  MmioWrite32(HDLCD_REG_COMMAND, HDLCD_DISABLE);\r
+  MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_DISABLE);\r
 \r
   // Disable all interrupts\r
-  MmioWrite32(HDLCD_REG_INT_MASK, 0);\r
+  MmioWrite32 (HDLCD_REG_INT_MASK, 0);\r
 \r
   // Define start of the VRAM. This never changes for any graphics mode\r
-  MmioWrite32(HDLCD_REG_FB_BASE, (UINT32) VramBaseAddress);\r
+  MmioWrite32 (HDLCD_REG_FB_BASE, (UINT32)VramBaseAddress);\r
 \r
   // Setup various registers that never change\r
-  MmioWrite32(HDLCD_REG_BUS_OPTIONS,  (4 << 8) | HDLCD_BURST_8);\r
-  MmioWrite32(HDLCD_REG_POLARITIES,   HDLCD_PXCLK_LOW | HDLCD_DATA_HIGH | HDLCD_DATEN_HIGH | HDLCD_HSYNC_LOW | HDLCD_VSYNC_HIGH);\r
-  MmioWrite32(HDLCD_REG_PIXEL_FORMAT, HDLCD_LITTLE_ENDIAN | HDLCD_4BYTES_PER_PIXEL);\r
-  MmioWrite32(HDLCD_REG_RED_SELECT,   (0 << 16 | 8 << 8 |  0));\r
-  MmioWrite32(HDLCD_REG_GREEN_SELECT, (0 << 16 | 8 << 8 |  8));\r
-  MmioWrite32(HDLCD_REG_BLUE_SELECT,  (0 << 16 | 8 << 8 | 16));\r
+  MmioWrite32 (HDLCD_REG_BUS_OPTIONS,  (4 << 8) | HDLCD_BURST_8);\r
+\r
+  MmioWrite32 (HDLCD_REG_POLARITIES, HDLCD_DEFAULT_POLARITIES);\r
+\r
+  MmioWrite32 (\r
+    HDLCD_REG_PIXEL_FORMAT,\r
+    HDLCD_LITTLE_ENDIAN | HDLCD_4BYTES_PER_PIXEL\r
+    );\r
+\r
+  MmioWrite32 (HDLCD_REG_RED_SELECT,   (0 << 16 | 8 << 8 | 0));\r
+  MmioWrite32 (HDLCD_REG_GREEN_SELECT, (0 << 16 | 8 << 8 | 8));\r
+  MmioWrite32 (HDLCD_REG_BLUE_SELECT,  (0 << 16 | 8 << 8 | 16));\r
 \r
   return EFI_SUCCESS;\r
 }\r
@@ -96,46 +99,53 @@ LcdSetMode (
   UINT32            BytesPerPixel;\r
   LCD_BPP           LcdBpp;\r
 \r
-\r
   // Set the video mode timings and other relevant information\r
-  Status = LcdPlatformGetTimings (ModeNumber,\r
-                                  &HRes,&HSync,&HBackPorch,&HFrontPorch,\r
-                                  &VRes,&VSync,&VBackPorch,&VFrontPorch);\r
+  Status = LcdPlatformGetTimings (\r
+             ModeNumber,\r
+             &HRes,\r
+             &HSync,\r
+             &HBackPorch,\r
+             &HFrontPorch,\r
+             &VRes,\r
+             &VSync,\r
+             &VBackPorch,\r
+             &VFrontPorch\r
+             );\r
   ASSERT_EFI_ERROR (Status);\r
-  if (EFI_ERROR( Status )) {\r
+  if (EFI_ERROR (Status)) {\r
     return EFI_DEVICE_ERROR;\r
   }\r
 \r
-  Status = LcdPlatformGetBpp (ModeNumber,&LcdBpp);\r
+  Status = LcdPlatformGetBpp (ModeNumber, &LcdBpp);\r
   ASSERT_EFI_ERROR (Status);\r
-  if (EFI_ERROR( Status )) {\r
+  if (EFI_ERROR (Status)) {\r
     return EFI_DEVICE_ERROR;\r
   }\r
 \r
-  BytesPerPixel = GetBytesPerPixel(LcdBpp);\r
+  BytesPerPixel = GetBytesPerPixel (LcdBpp);\r
 \r
   // Disable the controller\r
-  MmioWrite32(HDLCD_REG_COMMAND, HDLCD_DISABLE);\r
+  MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_DISABLE);\r
 \r
   // Update the frame buffer information with the new settings\r
-  MmioWrite32(HDLCD_REG_FB_LINE_LENGTH, HRes * BytesPerPixel);\r
-  MmioWrite32(HDLCD_REG_FB_LINE_PITCH,  HRes * BytesPerPixel);\r
-  MmioWrite32(HDLCD_REG_FB_LINE_COUNT,  VRes - 1);\r
+  MmioWrite32 (HDLCD_REG_FB_LINE_LENGTH, HRes * BytesPerPixel);\r
+  MmioWrite32 (HDLCD_REG_FB_LINE_PITCH,  HRes * BytesPerPixel);\r
+  MmioWrite32 (HDLCD_REG_FB_LINE_COUNT,  VRes - 1);\r
 \r
   // Set the vertical timing information\r
-  MmioWrite32(HDLCD_REG_V_SYNC,         VSync);\r
-  MmioWrite32(HDLCD_REG_V_BACK_PORCH,   VBackPorch);\r
-  MmioWrite32(HDLCD_REG_V_DATA,         VRes - 1);\r
-  MmioWrite32(HDLCD_REG_V_FRONT_PORCH,  VFrontPorch);\r
+  MmioWrite32 (HDLCD_REG_V_SYNC,         VSync);\r
+  MmioWrite32 (HDLCD_REG_V_BACK_PORCH,   VBackPorch);\r
+  MmioWrite32 (HDLCD_REG_V_DATA,         VRes - 1);\r
+  MmioWrite32 (HDLCD_REG_V_FRONT_PORCH,  VFrontPorch);\r
 \r
   // Set the horizontal timing information\r
-  MmioWrite32(HDLCD_REG_H_SYNC,         HSync);\r
-  MmioWrite32(HDLCD_REG_H_BACK_PORCH,   HBackPorch);\r
-  MmioWrite32(HDLCD_REG_H_DATA,         HRes - 1);\r
-  MmioWrite32(HDLCD_REG_H_FRONT_PORCH,  HFrontPorch);\r
+  MmioWrite32 (HDLCD_REG_H_SYNC,         HSync);\r
+  MmioWrite32 (HDLCD_REG_H_BACK_PORCH,   HBackPorch);\r
+  MmioWrite32 (HDLCD_REG_H_DATA,         HRes - 1);\r
+  MmioWrite32 (HDLCD_REG_H_FRONT_PORCH,  HFrontPorch);\r
 \r
   // Enable the controller\r
-  MmioWrite32(HDLCD_REG_COMMAND, HDLCD_ENABLE);\r
+  MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_ENABLE);\r
 \r
   return EFI_SUCCESS;\r
 }\r
index 6df97a9dfee60e9fda615cf3bea1b6a164a42333..cd2c0366c7b563d7fb313f82abeef7eb1aa3ef72 100644 (file)
@@ -1,6 +1,6 @@
-/** @file  HDLcd.h\r
+/** @file\r
 \r
- Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>\r
+ Copyright (c) 2011-2018, ARM Ltd. All rights reserved.<BR>\r
 \r
  This program and the accompanying materials\r
  are licensed and made available under the terms and conditions of the BSD License\r
 \r
  **/\r
 \r
-#ifndef _HDLCD_H_\r
-#define _HDLCD_H_\r
+#ifndef HDLCD_H_\r
+#define HDLCD_H_\r
 \r
-//\r
 // HDLCD Controller Register Offsets\r
-//\r
-\r
 #define HDLCD_REG_VERSION                 ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x000)\r
 #define HDLCD_REG_INT_RAWSTAT             ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x010)\r
 #define HDLCD_REG_INT_CLEAR               ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x014)\r
 #define HDLCD_REG_GREEN_SELECT            ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x248)\r
 #define HDLCD_REG_BLUE_SELECT             ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x24C)\r
 \r
-\r
-//\r
 // HDLCD Values of registers\r
-//\r
 \r
 // HDLCD Interrupt mask, clear and status register\r
 #define HDLCD_DMA_END                     BIT0    /* DMA has finished reading a frame */\r
 #define HDLCD_DATA_LOW                    0\r
 #define HDLCD_PXCLK_LOW                   0\r
 \r
+// Default polarities\r
+#define HDLCD_DEFAULT_POLARITIES   (HDLCD_PXCLK_LOW | HDLCD_DATA_HIGH |       \\r
+                                    HDLCD_DATEN_HIGH | HDLCD_HSYNC_LOW |      \\r
+                                    HDLCD_VSYNC_HIGH)\r
+\r
 // Pixel Format\r
 #define HDLCD_LITTLE_ENDIAN              (0 << 31)\r
 #define HDLCD_BIG_ENDIAN                 (1 << 31)\r
@@ -86,4 +85,4 @@
 // Number of bytes per pixel\r
 #define HDLCD_4BYTES_PER_PIXEL           ((4 - 1) << 3)\r
 \r
-#endif /* _HDLCD_H_ */\r
+#endif /* HDLCD_H_ */\r
index 9b4a02045ab7ca170e0d4362ee0e2bcf1d275bdb..3f3f7019f1d252995eab6d8c3d49db8be8e09e40 100644 (file)
@@ -1,6 +1,6 @@
-/** @file  PL111Lcd.c\r
+/** @file\r
 \r
-  Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>\r
+  Copyright (c) 2011-2018, ARM Ltd. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
 \r
 #include "PL111Lcd.h"\r
 \r
-/**********************************************************************\r
- *\r
- *  This file contains all the bits of the PL111 that are\r
- *  platform independent.\r
- *\r
- **********************************************************************/\r
+/** This file contains all the bits of the PL111 that are\r
+  platform independent.\r
 \r
+**/\r
 EFI_STATUS\r
 LcdIdentify (\r
   VOID\r
@@ -54,11 +51,11 @@ LcdInitialize (
   )\r
 {\r
   // Define start of the VRAM. This never changes for any graphics mode\r
-  MmioWrite32(PL111_REG_LCD_UP_BASE, (UINT32) VramBaseAddress);\r
-  MmioWrite32(PL111_REG_LCD_LP_BASE, 0); // We are not using a double buffer\r
+  MmioWrite32 (PL111_REG_LCD_UP_BASE, (UINT32)VramBaseAddress);\r
+  MmioWrite32 (PL111_REG_LCD_LP_BASE, 0); // We are not using a double buffer\r
 \r
   // Disable all interrupts from the PL111\r
-  MmioWrite32(PL111_REG_LCD_IMSC, 0);\r
+  MmioWrite32 (PL111_REG_LCD_IMSC, 0);\r
 \r
   return EFI_SUCCESS;\r
 }\r
@@ -81,37 +78,54 @@ LcdSetMode (
   LCD_BPP           LcdBpp;\r
 \r
   // Set the video mode timings and other relevant information\r
-  Status = LcdPlatformGetTimings (ModeNumber,\r
-                                  &HRes,&HSync,&HBackPorch,&HFrontPorch,\r
-                                  &VRes,&VSync,&VBackPorch,&VFrontPorch);\r
+  Status = LcdPlatformGetTimings (\r
+             ModeNumber,\r
+             &HRes,\r
+             &HSync,\r
+             &HBackPorch,\r
+             &HFrontPorch,\r
+             &VRes,\r
+             &VSync,\r
+             &VBackPorch,\r
+             &VFrontPorch\r
+             );\r
   ASSERT_EFI_ERROR (Status);\r
-  if (EFI_ERROR( Status )) {\r
+  if (EFI_ERROR (Status)) {\r
     return EFI_DEVICE_ERROR;\r
   }\r
 \r
-  Status = LcdPlatformGetBpp (ModeNumber,&LcdBpp);\r
+  Status = LcdPlatformGetBpp (ModeNumber, &LcdBpp);\r
   ASSERT_EFI_ERROR (Status);\r
-  if (EFI_ERROR( Status )) {\r
+  if (EFI_ERROR (Status)) {\r
     return EFI_DEVICE_ERROR;\r
   }\r
 \r
   // Disable the CLCD_LcdEn bit\r
-  LcdControl = MmioRead32PL111_REG_LCD_CONTROL);\r
-  MmioWrite32(PL111_REG_LCD_CONTROL,  LcdControl & ~1);\r
+  LcdControl = MmioRead32 (PL111_REG_LCD_CONTROL);\r
+  MmioWrite32 (PL111_REG_LCD_CONTROL, LcdControl & ~1);\r
 \r
   // Set Timings\r
-  MmioWrite32 (PL111_REG_LCD_TIMING_0, HOR_AXIS_PANEL(HBackPorch, HFrontPorch, HSync, HRes));\r
-  MmioWrite32 (PL111_REG_LCD_TIMING_1, VER_AXIS_PANEL(VBackPorch, VFrontPorch, VSync, VRes));\r
-  MmioWrite32 (PL111_REG_LCD_TIMING_2, CLK_SIG_POLARITY(HRes));\r
+  MmioWrite32 (\r
+    PL111_REG_LCD_TIMING_0,\r
+    HOR_AXIS_PANEL (HBackPorch, HFrontPorch, HSync, HRes)\r
+    );\r
+\r
+  MmioWrite32 (\r
+    PL111_REG_LCD_TIMING_1,\r
+    VER_AXIS_PANEL (VBackPorch, VFrontPorch, VSync, VRes)\r
+    );\r
+\r
+  MmioWrite32 (PL111_REG_LCD_TIMING_2, CLK_SIG_POLARITY (HRes));\r
   MmioWrite32 (PL111_REG_LCD_TIMING_3, 0);\r
 \r
   // PL111_REG_LCD_CONTROL\r
-  LcdControl = PL111_CTRL_LCD_EN | PL111_CTRL_LCD_BPP(LcdBpp) | PL111_CTRL_LCD_TFT | PL111_CTRL_BGR;\r
-  MmioWrite32(PL111_REG_LCD_CONTROL,  LcdControl);\r
+  LcdControl = PL111_CTRL_LCD_EN | PL111_CTRL_LCD_BPP (LcdBpp) |\r
+               PL111_CTRL_LCD_TFT | PL111_CTRL_BGR;\r
+  MmioWrite32 (PL111_REG_LCD_CONTROL, LcdControl);\r
 \r
   // Turn on power to the LCD Panel\r
   LcdControl |= PL111_CTRL_LCD_PWR;\r
-  MmioWrite32(PL111_REG_LCD_CONTROL,  LcdControl);\r
+  MmioWrite32 (PL111_REG_LCD_CONTROL, LcdControl);\r
 \r
   return EFI_SUCCESS;\r
 }\r