mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-24 06:04:52 +02:00
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>
This commit is contained in:
parent
e10c79145e
commit
b1b69d2606
@ -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
|
||||
@ -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,7 +74,10 @@ 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
|
||||
@ -140,6 +144,7 @@ InitializeDisplay (
|
||||
|
||||
EXIT_ERROR_LCD_SHUTDOWN:
|
||||
DEBUG ((DEBUG_ERROR, "InitializeDisplay: ERROR - Can not initialise the display. Exit Status=%r\n", Status));
|
||||
|
||||
LcdShutdown ();
|
||||
|
||||
EXIT:
|
||||
@ -169,28 +174,32 @@ LcdGraphicsOutputDxeInitialize (
|
||||
// Install the Graphics Output Protocol and the Device Path
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&Instance->Handle,
|
||||
&gEfiGraphicsOutputProtocolGuid, &Instance->Gop,
|
||||
&gEfiDevicePathProtocolGuid, &Instance->DevicePath,
|
||||
&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));
|
||||
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,
|
||||
LcdGraphicsExitBootServicesEvent,
|
||||
NULL,
|
||||
&Instance->ExitBootServicesEvent
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG((DEBUG_ERROR, "GraphicsOutputDxeInitialize: Can not install the ExitBootServicesEvent handler. Exit Status=%r\n", 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
|
||||
&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 (
|
||||
@ -263,7 +270,10 @@ LcdGraphicsQueryMode (
|
||||
}
|
||||
|
||||
// Error checking
|
||||
if ( (This == NULL) || (Info == NULL) || (SizeOfInfo == NULL) || (ModeNumber >= This->Mode->MaxMode) ) {
|
||||
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;
|
||||
@ -286,10 +296,9 @@ 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 (
|
||||
@ -345,7 +354,8 @@ LcdGraphicsSetMode (
|
||||
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;
|
||||
|
@ -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_ */
|
||||
|
@ -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,8 +11,8 @@
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __LCDPLATFORMLIB_H
|
||||
#define __LCDPLATFORMLIB_H
|
||||
#ifndef LCD_PLATFORM_LIB_H_
|
||||
#define LCD_PLATFORM_LIB_H_
|
||||
|
||||
#include <Protocol/GraphicsOutput.h>
|
||||
|
||||
@ -158,8 +158,9 @@
|
||||
#define LCD_12BPP_444_BLUE_MASK 0x0000000F
|
||||
#define LCD_12BPP_444_RESERVED_MASK 0x0000F000
|
||||
|
||||
|
||||
// The enumeration indexes maps the PL111 LcdBpp values used in the LCD Control Register
|
||||
/** The enumeration indexes maps the PL111 LcdBpp values used in the LCD Control
|
||||
Register
|
||||
**/
|
||||
typedef enum {
|
||||
LCD_BITS_PER_PIXEL_1 = 0,
|
||||
LCD_BITS_PER_PIXEL_2,
|
||||
@ -171,7 +172,6 @@ typedef enum {
|
||||
LCD_BITS_PER_PIXEL_12_444
|
||||
} LCD_BPP;
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
LcdPlatformInitializeDisplay (
|
||||
IN EFI_HANDLE Handle
|
||||
@ -218,4 +218,4 @@ LcdPlatformGetBpp (
|
||||
OUT LCD_BPP* Bpp
|
||||
);
|
||||
|
||||
#endif
|
||||
#endif /* LCD_PLATFORM_LIB_H_ */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/** @file Lcd.c
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2011-2012, 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
|
||||
@ -21,12 +21,9 @@
|
||||
|
||||
#include "HdLcd.h"
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* This file contains all the bits of the Lcd that are
|
||||
* platform independent.
|
||||
*
|
||||
**********************************************************************/
|
||||
/** This file contains all the bits of the Lcd that are
|
||||
platform independent.
|
||||
**/
|
||||
|
||||
STATIC
|
||||
UINTN
|
||||
@ -70,8 +67,14 @@ LcdInitialize (
|
||||
|
||||
// Setup various registers that never change
|
||||
MmioWrite32 (HDLCD_REG_BUS_OPTIONS, (4 << 8) | HDLCD_BURST_8);
|
||||
MmioWrite32(HDLCD_REG_POLARITIES, HDLCD_PXCLK_LOW | HDLCD_DATA_HIGH | HDLCD_DATEN_HIGH | HDLCD_HSYNC_LOW | HDLCD_VSYNC_HIGH);
|
||||
MmioWrite32(HDLCD_REG_PIXEL_FORMAT, HDLCD_LITTLE_ENDIAN | HDLCD_4BYTES_PER_PIXEL);
|
||||
|
||||
MmioWrite32 (HDLCD_REG_POLARITIES, HDLCD_DEFAULT_POLARITIES);
|
||||
|
||||
MmioWrite32 (
|
||||
HDLCD_REG_PIXEL_FORMAT,
|
||||
HDLCD_LITTLE_ENDIAN | HDLCD_4BYTES_PER_PIXEL
|
||||
);
|
||||
|
||||
MmioWrite32 (HDLCD_REG_RED_SELECT, (0 << 16 | 8 << 8 | 0));
|
||||
MmioWrite32 (HDLCD_REG_GREEN_SELECT, (0 << 16 | 8 << 8 | 8));
|
||||
MmioWrite32 (HDLCD_REG_BLUE_SELECT, (0 << 16 | 8 << 8 | 16));
|
||||
@ -96,11 +99,18 @@ LcdSetMode (
|
||||
UINT32 BytesPerPixel;
|
||||
LCD_BPP LcdBpp;
|
||||
|
||||
|
||||
// Set the video mode timings and other relevant information
|
||||
Status = LcdPlatformGetTimings (ModeNumber,
|
||||
&HRes,&HSync,&HBackPorch,&HFrontPorch,
|
||||
&VRes,&VSync,&VBackPorch,&VFrontPorch);
|
||||
Status = LcdPlatformGetTimings (
|
||||
ModeNumber,
|
||||
&HRes,
|
||||
&HSync,
|
||||
&HBackPorch,
|
||||
&HFrontPorch,
|
||||
&VRes,
|
||||
&VSync,
|
||||
&VBackPorch,
|
||||
&VFrontPorch
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/** @file HDLcd.h
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2011-2012, 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
|
||||
@ -12,13 +12,10 @@
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _HDLCD_H_
|
||||
#define _HDLCD_H_
|
||||
#ifndef HDLCD_H_
|
||||
#define HDLCD_H_
|
||||
|
||||
//
|
||||
// HDLCD Controller Register Offsets
|
||||
//
|
||||
|
||||
#define HDLCD_REG_VERSION ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x000)
|
||||
#define HDLCD_REG_INT_RAWSTAT ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x010)
|
||||
#define HDLCD_REG_INT_CLEAR ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x014)
|
||||
@ -44,10 +41,7 @@
|
||||
#define HDLCD_REG_GREEN_SELECT ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x248)
|
||||
#define HDLCD_REG_BLUE_SELECT ((UINTN)PcdGet32 (PcdArmHdLcdBase) + 0x24C)
|
||||
|
||||
|
||||
//
|
||||
// HDLCD Values of registers
|
||||
//
|
||||
|
||||
// HDLCD Interrupt mask, clear and status register
|
||||
#define HDLCD_DMA_END BIT0 /* DMA has finished reading a frame */
|
||||
@ -79,6 +73,11 @@
|
||||
#define HDLCD_DATA_LOW 0
|
||||
#define HDLCD_PXCLK_LOW 0
|
||||
|
||||
// Default polarities
|
||||
#define HDLCD_DEFAULT_POLARITIES (HDLCD_PXCLK_LOW | HDLCD_DATA_HIGH | \
|
||||
HDLCD_DATEN_HIGH | HDLCD_HSYNC_LOW | \
|
||||
HDLCD_VSYNC_HIGH)
|
||||
|
||||
// Pixel Format
|
||||
#define HDLCD_LITTLE_ENDIAN (0 << 31)
|
||||
#define HDLCD_BIG_ENDIAN (1 << 31)
|
||||
@ -86,4 +85,4 @@
|
||||
// Number of bytes per pixel
|
||||
#define HDLCD_4BYTES_PER_PIXEL ((4 - 1) << 3)
|
||||
|
||||
#endif /* _HDLCD_H_ */
|
||||
#endif /* HDLCD_H_ */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/** @file PL111Lcd.c
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2011-2012, 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
|
||||
@ -19,13 +19,10 @@
|
||||
|
||||
#include "PL111Lcd.h"
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* This file contains all the bits of the PL111 that are
|
||||
* platform independent.
|
||||
*
|
||||
**********************************************************************/
|
||||
/** This file contains all the bits of the PL111 that are
|
||||
platform independent.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
LcdIdentify (
|
||||
VOID
|
||||
@ -81,9 +78,17 @@ LcdSetMode (
|
||||
LCD_BPP LcdBpp;
|
||||
|
||||
// Set the video mode timings and other relevant information
|
||||
Status = LcdPlatformGetTimings (ModeNumber,
|
||||
&HRes,&HSync,&HBackPorch,&HFrontPorch,
|
||||
&VRes,&VSync,&VBackPorch,&VFrontPorch);
|
||||
Status = LcdPlatformGetTimings (
|
||||
ModeNumber,
|
||||
&HRes,
|
||||
&HSync,
|
||||
&HBackPorch,
|
||||
&HFrontPorch,
|
||||
&VRes,
|
||||
&VSync,
|
||||
&VBackPorch,
|
||||
&VFrontPorch
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
@ -100,13 +105,22 @@ LcdSetMode (
|
||||
MmioWrite32 (PL111_REG_LCD_CONTROL, LcdControl & ~1);
|
||||
|
||||
// Set Timings
|
||||
MmioWrite32 (PL111_REG_LCD_TIMING_0, HOR_AXIS_PANEL(HBackPorch, HFrontPorch, HSync, HRes));
|
||||
MmioWrite32 (PL111_REG_LCD_TIMING_1, VER_AXIS_PANEL(VBackPorch, VFrontPorch, VSync, VRes));
|
||||
MmioWrite32 (
|
||||
PL111_REG_LCD_TIMING_0,
|
||||
HOR_AXIS_PANEL (HBackPorch, HFrontPorch, HSync, HRes)
|
||||
);
|
||||
|
||||
MmioWrite32 (
|
||||
PL111_REG_LCD_TIMING_1,
|
||||
VER_AXIS_PANEL (VBackPorch, VFrontPorch, VSync, VRes)
|
||||
);
|
||||
|
||||
MmioWrite32 (PL111_REG_LCD_TIMING_2, CLK_SIG_POLARITY (HRes));
|
||||
MmioWrite32 (PL111_REG_LCD_TIMING_3, 0);
|
||||
|
||||
// PL111_REG_LCD_CONTROL
|
||||
LcdControl = PL111_CTRL_LCD_EN | PL111_CTRL_LCD_BPP(LcdBpp) | PL111_CTRL_LCD_TFT | PL111_CTRL_BGR;
|
||||
LcdControl = PL111_CTRL_LCD_EN | PL111_CTRL_LCD_BPP (LcdBpp) |
|
||||
PL111_CTRL_LCD_TFT | PL111_CTRL_BGR;
|
||||
MmioWrite32 (PL111_REG_LCD_CONTROL, LcdControl);
|
||||
|
||||
// Turn on power to the LCD Panel
|
||||
|
Loading…
x
Reference in New Issue
Block a user