[edk2-devel] [PATCH v1 15/16] ArmPlatformPkg: Fix Ecc error 8005

Ard Biesheuvel ard.biesheuvel at arm.com
Wed Dec 9 15:09:04 UTC 2020


On 12/3/20 7:19 PM, Pierre.Gondois at arm.com wrote:
> From: Pierre Gondois <Pierre.Gondois at arm.com>
> 
> This patch fixes the following Ecc reported error:
> Variable name does not follow the rules:
> 1. First character should be upper case
> 2. Must contain lower case characters
> 3. No white space characters
> 4. Global variable name must start with a 'g'
> 
> Indeed, according to the EDK II C Coding Standards
> Specification, s5.6.2.2 "Enumerated Types" and
> s4.3.4 Function and Data Names, elements of an
> enumerated type shoud be a mixed upper- and
> lower-case text.
> 
> A max element is also added, as adviced by
> s5.6.2.2.3 of the same document.
> 
> Reference:
> https://edk2-docs.gitbook.io/edk-ii-c-coding-standards-specification/
> 
> Signed-off-by: Pierre Gondois <Pierre.Gondois at arm.com>

Hello Pierre,

I take it the E... prefix is for Enum? I don't think we need that - most
enum typedef just use CamelCase identifiers here.




> ---
>  The changes can be seen at: https://github.com/PierreARM/edk2-platforms/tree/1537_Ecc_ArmPlatformPkg_v1
> 
>  ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputBlt.c | 88 ++++++++++----------
>  ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c | 20 ++---
>  ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h |  4 +-
>  ArmPlatformPkg/Include/Library/LcdPlatformLib.h                    | 21 ++---
>  ArmPlatformPkg/Library/LcdPlatformNullLib/LcdPlatformNullLib.c     |  4 +-
>  ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c                         |  4 +-
>  6 files changed, 71 insertions(+), 70 deletions(-)
> 
> diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputBlt.c b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputBlt.c
> index 07d2cb0d5dec0f85219fe5cdc438e18ae3a32a38..30b93900d223f550dab50741e7ad8e5442bac245 100644
> --- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputBlt.c
> +++ b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputBlt.c
> @@ -61,7 +61,7 @@ VideoCopyNoHorizontalOverlap (
> 
>    switch (BitsPerPixel) {
> 
> -  case LCD_BITS_PER_PIXEL_24:
> +  case ELcdBitsPerPixel_24:
> 
>      WidthInBytes = Width * 4;
> 
> @@ -79,9 +79,9 @@ VideoCopyNoHorizontalOverlap (
>      }
>      break;
> 
> -  case LCD_BITS_PER_PIXEL_16_555:
> -  case LCD_BITS_PER_PIXEL_16_565:
> -  case LCD_BITS_PER_PIXEL_12_444:
> +  case ELcdBitsPerPixel_16_555:
> +  case ELcdBitsPerPixel_16_565:
> +  case ELcdBitsPerPixel_12_444:
> 
>      WidthInBytes = Width * 2;
> 
> @@ -99,10 +99,10 @@ VideoCopyNoHorizontalOverlap (
>      }
>      break;
> 
> -  case LCD_BITS_PER_PIXEL_8:
> -  case LCD_BITS_PER_PIXEL_4:
> -  case LCD_BITS_PER_PIXEL_2:
> -  case LCD_BITS_PER_PIXEL_1:
> +  case ELcdBitsPerPixel_8:
> +  case ELcdBitsPerPixel_4:
> +  case ELcdBitsPerPixel_2:
> +  case ELcdBitsPerPixel_1:
>    default:
>      // Can't handle this case
>      DEBUG((DEBUG_ERROR, "ArmVeGraphics_Blt: EfiBltVideoToVideo: INVALID Number of Bits Per Pixel: %d\n", BitsPerPixel));
> @@ -149,7 +149,7 @@ VideoCopyHorizontalOverlap (
> 
>    switch (BitsPerPixel) {
> 
> -  case LCD_BITS_PER_PIXEL_24:
> +  case ELcdBitsPerPixel_24:
>      // Allocate a temporary buffer
> 
>      PixelBuffer32bit = (UINT32 *) AllocatePool((Height * Width) * sizeof(UINT32));
> @@ -191,9 +191,9 @@ VideoCopyHorizontalOverlap (
>      break;
> 
> 
> -  case LCD_BITS_PER_PIXEL_16_555:
> -  case LCD_BITS_PER_PIXEL_16_565:
> -  case LCD_BITS_PER_PIXEL_12_444:
> +  case ELcdBitsPerPixel_16_555:
> +  case ELcdBitsPerPixel_16_565:
> +  case ELcdBitsPerPixel_12_444:
>      // Allocate a temporary buffer
>      PixelBuffer16bit = (UINT16 *) AllocatePool((Height * Width) * sizeof(UINT16));
> 
> @@ -236,10 +236,10 @@ VideoCopyHorizontalOverlap (
>      break;
> 
> 
> -  case LCD_BITS_PER_PIXEL_8:
> -  case LCD_BITS_PER_PIXEL_4:
> -  case LCD_BITS_PER_PIXEL_2:
> -  case LCD_BITS_PER_PIXEL_1:
> +  case ELcdBitsPerPixel_8:
> +  case ELcdBitsPerPixel_4:
> +  case ELcdBitsPerPixel_2:
> +  case ELcdBitsPerPixel_1:
>    default:
>      // Can't handle this case
>      DEBUG((DEBUG_ERROR, "ArmVeGraphics_Blt: EfiBltVideoToVideo: INVALID Number of Bits Per Pixel: %d\n", BitsPerPixel));
> @@ -270,7 +270,7 @@ BltVideoFill (
>    EFI_PIXEL_BITMASK*  PixelInformation;
>    EFI_STATUS         Status;
>    UINT32             HorizontalResolution;
> -  LCD_BPP            BitsPerPixel;
> +  ELCD_BPP           BitsPerPixel;
>    VOID            *FrameBufferBase;
>    VOID            *DestinationAddr;
>    UINT16          *DestinationPixel16bit;
> @@ -287,7 +287,7 @@ BltVideoFill (
>    LcdPlatformGetBpp (This->Mode->Mode,&BitsPerPixel);
> 
>    switch (BitsPerPixel) {
> -  case LCD_BITS_PER_PIXEL_24:
> +  case ELcdBitsPerPixel_24:
>      WidthInBytes = Width * 4;
> 
>      // Copy the SourcePixel into every pixel inside the target rectangle
> @@ -303,7 +303,7 @@ BltVideoFill (
>      }
>      break;
> 
> -  case LCD_BITS_PER_PIXEL_16_555:
> +  case ELcdBitsPerPixel_16_555:
>      // Convert the EFI pixel at the start of the BltBuffer(0,0) into a video display pixel
>      Pixel16bit = (UINT16) (
>          ( (EfiSourcePixel->Red      <<  7) & PixelInformation->RedMask      )
> @@ -330,7 +330,7 @@ BltVideoFill (
>      }
>      break;
> 
> -  case LCD_BITS_PER_PIXEL_16_565:
> +  case ELcdBitsPerPixel_16_565:
>      // Convert the EFI pixel at the start of the BltBuffer(0,0) into a video display pixel
>      Pixel16bit = (UINT16) (
>          ( (EfiSourcePixel->Red      <<  8) & PixelInformation->RedMask      )
> @@ -356,7 +356,7 @@ BltVideoFill (
>      }
>      break;
> 
> -  case LCD_BITS_PER_PIXEL_12_444:
> +  case ELcdBitsPerPixel_12_444:
>      // Convert the EFI pixel at the start of the BltBuffer(0,0) into a video display pixel
>      Pixel16bit = (UINT16) (
>          ( (EfiSourcePixel->Red      >> 4) & PixelInformation->RedMask      )
> @@ -382,10 +382,10 @@ BltVideoFill (
>      }
>      break;
> 
> -  case LCD_BITS_PER_PIXEL_8:
> -  case LCD_BITS_PER_PIXEL_4:
> -  case LCD_BITS_PER_PIXEL_2:
> -  case LCD_BITS_PER_PIXEL_1:
> +  case ELcdBitsPerPixel_8:
> +  case ELcdBitsPerPixel_4:
> +  case ELcdBitsPerPixel_2:
> +  case ELcdBitsPerPixel_1:
>    default:
>      // Can't handle this case
>      DEBUG((DEBUG_ERROR, "LcdGraphicsBlt: EfiBltVideoFill: INVALID Number of Bits Per Pixel: %d\n", BitsPerPixel));
> @@ -412,7 +412,7 @@ BltVideoToBltBuffer (
>  {
>    EFI_STATUS         Status;
>    UINT32             HorizontalResolution;
> -  LCD_BPP            BitsPerPixel;
> +  ELCD_BPP           BitsPerPixel;
>    EFI_PIXEL_BITMASK  *PixelInformation;
>    EFI_GRAPHICS_OUTPUT_BLT_PIXEL *EfiDestinationPixel;
>    VOID   *FrameBufferBase;
> @@ -443,7 +443,7 @@ BltVideoToBltBuffer (
>    LcdPlatformGetBpp (This->Mode->Mode,&BitsPerPixel);
> 
>    switch (BitsPerPixel) {
> -  case LCD_BITS_PER_PIXEL_24:
> +  case ELcdBitsPerPixel_24:
>      WidthInBytes = Width * 4;
> 
>      // Access each line inside the Video Memory
> @@ -460,7 +460,7 @@ BltVideoToBltBuffer (
>      }
>      break;
> 
> -  case LCD_BITS_PER_PIXEL_16_555:
> +  case ELcdBitsPerPixel_16_555:
>      // Access each pixel inside the Video Memory
>      for (SourceLine = SourceY, DestinationLine = DestinationY;
>           SourceLine < SourceY + Height;
> @@ -487,7 +487,7 @@ BltVideoToBltBuffer (
>      }
>      break;
> 
> -  case LCD_BITS_PER_PIXEL_16_565:
> +  case ELcdBitsPerPixel_16_565:
>      // Access each pixel inside the Video Memory
>      for (SourceLine = SourceY, DestinationLine = DestinationY;
>           SourceLine < SourceY + Height;
> @@ -515,7 +515,7 @@ BltVideoToBltBuffer (
>      }
>      break;
> 
> -  case LCD_BITS_PER_PIXEL_12_444:
> +  case ELcdBitsPerPixel_12_444:
>      // Access each pixel inside the Video Memory
>      for (SourceLine = SourceY, DestinationLine = DestinationY;
>           SourceLine < SourceY + Height;
> @@ -542,10 +542,10 @@ BltVideoToBltBuffer (
>      }
>      break;
> 
> -  case LCD_BITS_PER_PIXEL_8:
> -  case LCD_BITS_PER_PIXEL_4:
> -  case LCD_BITS_PER_PIXEL_2:
> -  case LCD_BITS_PER_PIXEL_1:
> +  case ELcdBitsPerPixel_8:
> +  case ELcdBitsPerPixel_4:
> +  case ELcdBitsPerPixel_2:
> +  case ELcdBitsPerPixel_1:
>    default:
>      // Can't handle this case
>      DEBUG((DEBUG_ERROR, "LcdGraphicsBlt: EfiBltVideoToBltBuffer: INVALID Number of Bits Per Pixel: %d\n", BitsPerPixel));
> @@ -571,7 +571,7 @@ BltBufferToVideo (
>  {
>    EFI_STATUS         Status;
>    UINT32             HorizontalResolution;
> -  LCD_BPP            BitsPerPixel;
> +  ELCD_BPP           BitsPerPixel;
>    EFI_PIXEL_BITMASK  *PixelInformation;
>    EFI_GRAPHICS_OUTPUT_BLT_PIXEL *EfiSourcePixel;
>    VOID   *FrameBufferBase;
> @@ -601,7 +601,7 @@ BltBufferToVideo (
>    LcdPlatformGetBpp (This->Mode->Mode,&BitsPerPixel);
> 
>    switch (BitsPerPixel) {
> -  case LCD_BITS_PER_PIXEL_24:
> +  case ELcdBitsPerPixel_24:
>      WidthInBytes = Width * 4;
> 
>      // Access each pixel inside the BltBuffer Memory
> @@ -618,7 +618,7 @@ BltBufferToVideo (
>      }
>      break;
> 
> -  case LCD_BITS_PER_PIXEL_16_555:
> +  case ELcdBitsPerPixel_16_555:
>      // Access each pixel inside the BltBuffer Memory
>      for (SourceLine = SourceY, DestinationLine = DestinationY;
>         SourceLine < SourceY + Height;
> @@ -645,7 +645,7 @@ BltBufferToVideo (
>      }
>      break;
> 
> -  case LCD_BITS_PER_PIXEL_16_565:
> +  case ELcdBitsPerPixel_16_565:
>      // Access each pixel inside the BltBuffer Memory
>      for (SourceLine = SourceY, DestinationLine = DestinationY;
>           SourceLine < SourceY + Height;
> @@ -672,7 +672,7 @@ BltBufferToVideo (
>      }
>      break;
> 
> -  case LCD_BITS_PER_PIXEL_12_444:
> +  case ELcdBitsPerPixel_12_444:
>      // Access each pixel inside the BltBuffer Memory
>      for (SourceLine = SourceY, DestinationLine = DestinationY;
>           SourceLine < SourceY + Height;
> @@ -699,10 +699,10 @@ BltBufferToVideo (
>      }
>      break;
> 
> -  case LCD_BITS_PER_PIXEL_8:
> -  case LCD_BITS_PER_PIXEL_4:
> -  case LCD_BITS_PER_PIXEL_2:
> -  case LCD_BITS_PER_PIXEL_1:
> +  case ELcdBitsPerPixel_8:
> +  case ELcdBitsPerPixel_4:
> +  case ELcdBitsPerPixel_2:
> +  case ELcdBitsPerPixel_1:
>    default:
>      // Can't handle this case
>      DEBUG((DEBUG_ERROR, "LcdGraphicsBlt: EfiBltBufferToVideo: INVALID Number of Bits Per Pixel: %d\n", BitsPerPixel));
> @@ -728,7 +728,7 @@ BltVideoToVideo (
>  {
>    EFI_STATUS         Status;
>    UINT32             HorizontalResolution;
> -  LCD_BPP            BitsPerPixel;
> +  ELCD_BPP           BitsPerPixel;
>    VOID   *FrameBufferBase;
> 
>    HorizontalResolution = This->Mode->Info->HorizontalResolution;
> diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c
> index bfd03d8f84258158e76690cc5a0d9333f11d67f0..d85a3830355d6d091c94c1fa33ced4f8a6313947 100644
> --- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c
> +++ b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c
> @@ -299,7 +299,7 @@ LcdGraphicsSetMode (
>    EFI_STATUS                      Status;
>    EFI_GRAPHICS_OUTPUT_BLT_PIXEL   FillColour;
>    LCD_INSTANCE*                   Instance;
> -  LCD_BPP                         Bpp;
> +  ELCD_BPP                        Bpp;
> 
>    Instance = LCD_INSTANCE_FROM_GOP_THIS (This);
> 
> @@ -370,22 +370,22 @@ EXIT:
> 
>  UINTN
>  GetBytesPerPixel (
> -  IN  LCD_BPP       Bpp
> +  IN  ELCD_BPP      Bpp
>    )
>  {
>    switch (Bpp) {
> -  case LCD_BITS_PER_PIXEL_24:
> +  case ELcdBitsPerPixel_24:
>      return 4;
> 
> -  case LCD_BITS_PER_PIXEL_16_565:
> -  case LCD_BITS_PER_PIXEL_16_555:
> -  case LCD_BITS_PER_PIXEL_12_444:
> +  case ELcdBitsPerPixel_16_565:
> +  case ELcdBitsPerPixel_16_555:
> +  case ELcdBitsPerPixel_12_444:
>      return 2;
> 
> -  case LCD_BITS_PER_PIXEL_8:
> -  case LCD_BITS_PER_PIXEL_4:
> -  case LCD_BITS_PER_PIXEL_2:
> -  case LCD_BITS_PER_PIXEL_1:
> +  case ELcdBitsPerPixel_8:
> +  case ELcdBitsPerPixel_4:
> +  case ELcdBitsPerPixel_2:
> +  case ELcdBitsPerPixel_1:
>      return 1;
> 
>    default:
> diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h
> index c49afd3b058f2d2b3c91b1a2d4446a8fcde5202d..6a64fc2bb9dfb10b7d9ca9e4c34cc33a83ff08e6 100644
> --- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h
> +++ b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h
> @@ -1,6 +1,6 @@
>  /** @file
> 
> -  Copyright (c) 2011-2018, ARM Ltd. All rights reserved.<BR>
> +  Copyright (c) 2011 - 2020, Arm Limited. All rights reserved.<BR>
>    SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> @@ -83,7 +83,7 @@ LcdGraphicsBlt (
> 
>  UINTN
>  GetBytesPerPixel (
> -  IN  LCD_BPP       Bpp
> +  IN  ELCD_BPP      Bpp
>    );
> 
>  EFI_STATUS
> diff --git a/ArmPlatformPkg/Include/Library/LcdPlatformLib.h b/ArmPlatformPkg/Include/Library/LcdPlatformLib.h
> index ba24487073bb32296104270d78b0e1928193c9e8..eecf2920537d951feb6c76a51f8d66854806acbc 100644
> --- a/ArmPlatformPkg/Include/Library/LcdPlatformLib.h
> +++ b/ArmPlatformPkg/Include/Library/LcdPlatformLib.h
> @@ -197,15 +197,16 @@
>    Register
>  **/
>  typedef enum {
> -  LCD_BITS_PER_PIXEL_1 = 0,
> -  LCD_BITS_PER_PIXEL_2,
> -  LCD_BITS_PER_PIXEL_4,
> -  LCD_BITS_PER_PIXEL_8,
> -  LCD_BITS_PER_PIXEL_16_555,
> -  LCD_BITS_PER_PIXEL_24,
> -  LCD_BITS_PER_PIXEL_16_565,
> -  LCD_BITS_PER_PIXEL_12_444
> -} LCD_BPP;
> +  ELcdBitsPerPixel_1 = 0,
> +  ELcdBitsPerPixel_2,
> +  ELcdBitsPerPixel_4,
> +  ELcdBitsPerPixel_8,
> +  ELcdBitsPerPixel_16_555,
> +  ELcdBitsPerPixel_24,
> +  ELcdBitsPerPixel_16_565,
> +  ELcdBitsPerPixel_12_444,
> +  ELcdBitsPerPixel_Max
> +} ELCD_BPP;
> 
>  // Display timing settings.
>  typedef struct {
> @@ -320,7 +321,7 @@ LcdPlatformGetTimings (
>  EFI_STATUS
>  LcdPlatformGetBpp (
>    IN  UINT32                                ModeNumber,
> -  OUT LCD_BPP*                              Bpp
> +  OUT ELCD_BPP*                             Bpp
>    );
> 
>  #endif /* LCD_PLATFORM_LIB_H_ */
> diff --git a/ArmPlatformPkg/Library/LcdPlatformNullLib/LcdPlatformNullLib.c b/ArmPlatformPkg/Library/LcdPlatformNullLib/LcdPlatformNullLib.c
> index dca3cf706ee12e2c1e1545e43b862ea87e16395b..ca80eeb83993cfdce6d2428b94b9b8163f0e55ad 100644
> --- a/ArmPlatformPkg/Library/LcdPlatformNullLib/LcdPlatformNullLib.c
> +++ b/ArmPlatformPkg/Library/LcdPlatformNullLib/LcdPlatformNullLib.c
> @@ -1,7 +1,7 @@
>  /** @file
> 
>    Copyright (c) 2017, Linaro, Ltd. All rights reserved.
> -  Copyright (c) 2018, Arm Limited. All rights reserved.
> +  Copyright (c) 2018 - 2020, Arm Limited. All rights reserved.<BR>
> 
>    SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -137,7 +137,7 @@ LcdPlatformGetTimings (
>  EFI_STATUS
>  LcdPlatformGetBpp (
>    IN  UINT32                                ModeNumber,
> -  OUT LCD_BPP*                              Bpp
> +  OUT ELCD_BPP*                             Bpp
>    )
>  {
>    ASSERT (FALSE);
> diff --git a/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c b/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c
> index 05b6f8974f12fafd53cdff2314d33f9c93d79670..ace6c5eb3cbbaa784c5d1f40ee3b372551d83820 100644
> --- a/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c
> +++ b/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c
> @@ -1,7 +1,7 @@
>  /** @file
>    This file contains the platform independent parts of PL111Lcd
> 
> -  Copyright (c) 2011-2018, ARM Ltd. All rights reserved.<BR>
> +  Copyright (c) 2011 - 2020, Arm Limited. All rights reserved.<BR>
> 
>    SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -80,7 +80,7 @@ LcdSetMode (
>    SCAN_TIMINGS      *Horizontal;
>    SCAN_TIMINGS      *Vertical;
>    UINT32            LcdControl;
> -  LCD_BPP           LcdBpp;
> +  ELCD_BPP          LcdBpp;
> 
>    EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  ModeInfo;
> 
> --
> 2.17.1
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#68550): https://edk2.groups.io/g/devel/message/68550
Mute This Topic: https://groups.io/mt/78690966/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list