From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=40.107.3.60; helo=eur03-am5-obe.outbound.protection.outlook.com; envelope-from=evan.lloyd@arm.com; receiver=edk2-devel@lists.01.org Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30060.outbound.protection.outlook.com [40.107.3.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7E9F6224BBC30 for ; Wed, 21 Mar 2018 05:47:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=4u14r2XCH7gDzxLmPaHD14N/tShAo5mwatNxBy8G4pQ=; b=edgwPjpJeN8Ew7wjk3c9IbCKLBN53A7j9dw0yknQuLmCVfSelchf+P8uJP1xOd7Juptf0gQS4lweCKcZrL9iKqaMcOFdwu6GmegPjZ+gowXeBwEp2A7BKoknR4kA7HfBCwrYrk4QL3ar4epgZNut9zqfNO3F0YCSoNBROpi7IqU= Received: from HE1PR0801MB1771.eurprd08.prod.outlook.com (10.168.150.14) by HE1PR0801MB1932.eurprd08.prod.outlook.com (10.168.94.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.588.14; Wed, 21 Mar 2018 12:53:58 +0000 Received: from HE1PR0801MB1771.eurprd08.prod.outlook.com ([fe80::69cc:3ecf:9c8c:f5a3]) by HE1PR0801MB1771.eurprd08.prod.outlook.com ([fe80::69cc:3ecf:9c8c:f5a3%17]) with mapi id 15.20.0588.017; Wed, 21 Mar 2018 12:53:58 +0000 From: Evan Lloyd To: Girish Pathak , "edk2-devel@lists.01.org" CC: nd , Stephanie Hughes-Fitt , "leif.lindholm@linaro.org" , "ard.biesheuvel@linaro.org" Thread-Topic: [edk2] [PATCH v3 03/16] ArmPlatformPkg: Tidy Lcd code: Coding standard Thread-Index: AQHTwGZTxvapBnJk5Eq2cAeNy+7jN6PaporQ Date: Wed, 21 Mar 2018 12:53:58 +0000 Message-ID: References: <20180320161212.79120-1-girish.pathak@arm.com> <20180320161212.79120-4-girish.pathak@arm.com> In-Reply-To: <20180320161212.79120-4-girish.pathak@arm.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Evan.Lloyd@arm.com; x-originating-ip: [217.140.96.140] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1PR0801MB1932; 7:a/bKfGSjvPRRZ7VUH3zBX/lo7IahV9Vv4iZOVgxLhH+qiUT8vy7LhuBCs0CCMgDsX1XoIeKQY4ppUF7masehgewVUrntvr0O+MmNU+HKKsj0E+aHoVziJCzvRQ2z0D3//xTNUTm76SeV7/3DX40ef7aiva8ve0pCC92tHu7poTMoNDzqhhriE1gAKVJw1fYlfQW/0uukJfMXlsyzAzI4sapct+fqg2hu/FmMPeOZl4Vtp/Q8JvJeXg4Rw88MCVaF x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 78311d5b-4eca-4773-ba45-08d58f2ad05b x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(2017052603328)(7153060)(7193020); SRVR:HE1PR0801MB1932; x-ms-traffictypediagnostic: HE1PR0801MB1932: nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917)(162533806227266); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231221)(944501323)(52105095)(93006095)(93001095)(3002001)(6055026)(6041310)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011); SRVR:HE1PR0801MB1932; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0801MB1932; x-forefront-prvs: 0618E4E7E1 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(396003)(366004)(39380400002)(39860400002)(346002)(189003)(199004)(13464003)(305945005)(7736002)(86362001)(25786009)(59450400001)(2900100001)(74316002)(76176011)(7696005)(575784001)(9686003)(14454004)(68736007)(966005)(99286004)(6116002)(72206003)(54906003)(3846002)(2501003)(5250100002)(81156014)(8676002)(229853002)(81166006)(110136005)(4326008)(53936002)(6246003)(2950100002)(66066001)(6436002)(16200700003)(2906002)(6306002)(316002)(53946003)(55016002)(478600001)(5660300001)(33656002)(105586002)(106356001)(97736004)(8936002)(3660700001)(102836004)(6506007)(3280700002)(53546011)(26005)(569006); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0801MB1932; H:HE1PR0801MB1771.eurprd08.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: DhVqs8hqzleqoipPrCMLFYnQjixTF282nclQDQGQ7gib0JUP8vrGevNT3fYbAC9Rk7oIgB4zBNUTok2N7EFclrcHIzHMyvrdmnsJm5wS2jwuX5EC8UuOczg6Jmuyi22EgPQnipLyeDijtOaQGA4uf07mqQThnxyFAuOmdZraBMF+14AVoCJTwolokEFfeuuLlsORrqrFldG13T03dy8P1iA46A/B/X8ZG+gS5lEHtDvUPHGQREy1Uhw8a0mwkCQ/9zPnwWWncMWZtllxYtZpdi2ZEfUsgsDGj9BWOhRz74QSge7OtSwsNWTdMV8O2CTD4Iym0V6MsG+TPe7smr/cAQ== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 78311d5b-4eca-4773-ba45-08d58f2ad05b X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Mar 2018 12:53:58.8145 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1932 Subject: Re: [PATCH v3 03/16] ArmPlatformPkg: Tidy Lcd code: Coding standard X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 12:47:32 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Evan Lloyd > -----Original Message----- > From: edk2-devel On Behalf Of Girish > Pathak > Sent: 20 March 2018 16:12 > To: edk2-devel@lists.01.org > Cc: nd ; Stephanie Hughes-Fitt Fitt@arm.com>; leif.lindholm@linaro.org; ard.biesheuvel@linaro.org > Subject: [edk2] [PATCH v3 03/16] ArmPlatformPkg: Tidy Lcd code: Coding > standard >=20 > From: Girish Pathak >=20 > There is no functional modification in this change As preparation for fur= ther > work, the formatting is corrected to meet the EDKII coding standard. > Of specific note, some invalid include guards were fixed. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Girish Pathak > Signed-off-by: Evan Lloyd > --- >=20 > Notes: > v3: > - Minor coding style changes [Ard] >=20 > Done [Girish] >=20 > - Changing one style to the other is just pointless churn [Ard] >=20 > Fixing the include guards: is a small improvement. > (Ideally patchcheck should reject these.) > Reducing lines to 80 columns: makes Leif (at least) > happy, and aligns with formatter behaviour. Correcting > Doxygen format comments: prevents Doxygen generating > gibberish. Spaces before '(': Maintains consistency, > and aligns with desired formatter behaviour. [Evan] >=20 > ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c > | 187 +++++++++++--------- > ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h | > 10 +- > ArmPlatformPkg/Include/Library/LcdPlatformLib.h | 14= +- > ArmPlatformPkg/Library/HdLcd/HdLcd.c | 88= +++++---- > ArmPlatformPkg/Library/HdLcd/HdLcd.h | 21= ++- > ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c | 64= ++++--- > 6 files changed, 208 insertions(+), 176 deletions(-) >=20 > diff --git > a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe. > c > b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe. > c > index > b721061fc1df5695092e8c71da97ae0b9af46b3f..905eb26ee01b5037dfbaf3 > c054a62593837c8b5f 100644 > --- > a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe. > c > +++ > b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe. > c > @@ -1,6 +1,6 @@ > /** @file >=20 > - Copyright (c) 2011-2014, ARM Ltd. All rights reserved.
> + Copyright (c) 2011-2018, ARM Ltd. All rights reserved.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the B= SD > 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. >=20 > - **/ > +**/ >=20 > #include > #include > @@ -22,12 +22,10 @@ >=20 > #include "LcdGraphicsOutputDxe.h" >=20 > - > /********************************************************** > ************ > - * > - * 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 > + > +**/ >=20 > // > // Global variables > @@ -64,7 +62,10 @@ LCD_INSTANCE mLcdTemplate =3D { > { > { > 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 =3D { > { > 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 > }; >=20 > EFI_STATUS > @@ -86,7 +90,7 @@ LcdInstanceContructor ( { > LCD_INSTANCE* Instance; >=20 > - Instance =3D AllocateCopyPool (sizeof(LCD_INSTANCE), &mLcdTemplate); > + Instance =3D AllocateCopyPool (sizeof (LCD_INSTANCE), &mLcdTemplate); > if (Instance =3D=3D NULL) { > return EFI_OUT_OF_RESOURCES; > } > @@ -113,23 +117,23 @@ InitializeDisplay ( > UINTN VramSize; >=20 > Status =3D LcdPlatformGetVram (&VramBaseAddress, &VramSize); > - if (EFI_ERROR(Status)) { > + if (EFI_ERROR (Status)) { > return Status; > } >=20 > // Setup the LCD > Status =3D LcdInitialize (VramBaseAddress); > - if (EFI_ERROR(Status)) { > + if (EFI_ERROR (Status)) { > goto EXIT_ERROR_LCD_SHUTDOWN; > } >=20 > Status =3D LcdPlatformInitializeDisplay (Instance->Handle); > - if (EFI_ERROR(Status)) { > + if (EFI_ERROR (Status)) { > goto EXIT_ERROR_LCD_SHUTDOWN; > } >=20 > // Setup all the relevant mode information > - Instance->Gop.Mode->SizeOfInfo =3D > sizeof(EFI_GRAPHICS_OUTPUT_MODE_INFORMATION); > + Instance->Gop.Mode->SizeOfInfo =3D sizeof > (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION); > Instance->Gop.Mode->FrameBufferBase =3D VramBaseAddress; >=20 > // Set the flag before changing the mode, to avoid infinite loops @@ - > 139,7 +143,8 @@ InitializeDisplay ( > goto EXIT; >=20 > EXIT_ERROR_LCD_SHUTDOWN: > - DEBUG((DEBUG_ERROR, "InitializeDisplay: ERROR - Can not initialise the > display. Exit Status=3D%r\n", Status)); > + DEBUG ((DEBUG_ERROR, "InitializeDisplay: ERROR - Can not initialise > + the display. Exit Status=3D%r\n", Status)); > + > LcdShutdown (); >=20 > EXIT: > @@ -157,40 +162,44 @@ LcdGraphicsOutputDxeInitialize ( > LCD_INSTANCE* Instance; >=20 > Status =3D LcdIdentify (); > - if (EFI_ERROR(Status)) { > + if (EFI_ERROR (Status)) { > goto EXIT; > } >=20 > Status =3D LcdInstanceContructor (&Instance); > - if (EFI_ERROR(Status)) { > + if (EFI_ERROR (Status)) { > goto EXIT; > } >=20 > // Install the Graphics Output Protocol and the Device Path > - Status =3D gBS->InstallMultipleProtocolInterfaces( > - &Instance->Handle, > - &gEfiGraphicsOutputProtocolGuid, &Instance->Gop, > - &gEfiDevicePathProtocolGuid, &Instance->DevicePath, > - NULL > - ); > + Status =3D gBS->InstallMultipleProtocolInterfaces ( > + &Instance->Handle, > + &gEfiGraphicsOutputProtocolGuid, > + &Instance->Gop, > + &gEfiDevicePathProtocolGuid, > + &Instance->DevicePath, > + NULL > + ); >=20 > - if (EFI_ERROR(Status)) { > - DEBUG((DEBUG_ERROR, "GraphicsOutputDxeInitialize: Can not install th= e > protocol. Exit Status=3D%r\n", Status)); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "LcdGraphicsOutputDxeInitialize: Can not > + install the protocol. Exit Status=3D%r\n", Status)); > goto EXIT; > } >=20 > // Register for an ExitBootServicesEvent > - // When ExitBootServices starts, this function here will make sure tha= t 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 =3D gBS->CreateEvent ( > - EVT_SIGNAL_EXIT_BOOT_SERVICES, > - TPL_NOTIFY, > - LcdGraphicsExitBootServicesEvent, NULL, > - &Instance->ExitBootServicesEvent > - ); > + EVT_SIGNAL_EXIT_BOOT_SERVICES, > + TPL_NOTIFY, > + LcdGraphicsExitBootServicesEvent, > + NULL, > + &Instance->ExitBootServicesEvent > + ); >=20 > - if (EFI_ERROR(Status)) { > - DEBUG((DEBUG_ERROR, "GraphicsOutputDxeInitialize: Can not install th= e > ExitBootServicesEvent handler. Exit Status=3D%r\n", Status)); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "LcdGraphicsOutputDxeInitialize: Can not > + install the ExitBootServicesEvent handler. Exit Status=3D%r\n", > + Status)); > goto EXIT_ERROR_UNINSTALL_PROTOCOL; > } >=20 > @@ -198,48 +207,46 @@ LcdGraphicsOutputDxeInitialize ( > goto EXIT; >=20 > 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, // Unins= tall > device path > - NULL > - ); > + Instance->Handle, > + &gEfiGraphicsOutputProtocolGuid, > + &Instance->Gop, // Uninstall Graphics Output protocol > + &gEfiDevicePathProtocolGuid, > + &Instance->DevicePath, // Uninstall device path > + NULL > + ); >=20 > EXIT: > return Status; > - > } >=20 > -/*************************************** > - * 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 predefine= d OS > that > - // does not use a framebuffer then we might want to disable the displa= y > 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 (); > } > } >=20 > -/*************************************** > - * 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 =3D EFI_SUCCESS; > LCD_INSTANCE *Instance; >=20 > - Instance =3D LCD_INSTANCE_FROM_GOP_THIS(This); > + Instance =3D LCD_INSTANCE_FROM_GOP_THIS (This); >=20 > // Setup the hardware if not already done > - if( !mDisplayInitialized ) { > - Status =3D InitializeDisplay(Instance); > - if (EFI_ERROR(Status)) { > + if (!mDisplayInitialized) { > + Status =3D InitializeDisplay (Instance); > + if (EFI_ERROR (Status)) { > goto EXIT; > } > } >=20 > // Error checking > - if ( (This =3D=3D NULL) || (Info =3D=3D NULL) || (SizeOfInfo =3D=3D NU= LL) || > (ModeNumber >=3D This->Mode->MaxMode) ) { > - DEBUG((DEBUG_ERROR, "LcdGraphicsQueryMode: ERROR - For mode > number %d : Invalid Parameter.\n", ModeNumber )); > + if ((This =3D=3D NULL) || > + (Info =3D=3D NULL) || > + (SizeOfInfo =3D=3D NULL) || > + (ModeNumber >=3D This->Mode->MaxMode)) { > + DEBUG ((DEBUG_ERROR, "LcdGraphicsQueryMode: ERROR - For mode > number > + %d : Invalid Parameter.\n", ModeNumber)); > Status =3D EFI_INVALID_PARAMETER; > goto EXIT; > } > @@ -275,21 +285,20 @@ LcdGraphicsQueryMode ( > goto EXIT; > } >=20 > - *SizeOfInfo =3D sizeof( EFI_GRAPHICS_OUTPUT_MODE_INFORMATION); > + *SizeOfInfo =3D sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION); >=20 > - Status =3D LcdPlatformQueryMode (ModeNumber,*Info); > - if (EFI_ERROR(Status)) { > - FreePool(*Info); > + Status =3D LcdPlatformQueryMode (ModeNumber, *Info); if (EFI_ERROR > + (Status)) { > + FreePool (*Info); > } >=20 > EXIT: > return Status; > } >=20 > -/*************************************** > - * 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 =3D LCD_INSTANCE_FROM_GOP_THIS (This); >=20 > // Setup the hardware if not already done > - if(!mDisplayInitialized) { > + if (!mDisplayInitialized) { > Status =3D InitializeDisplay (Instance); > - if (EFI_ERROR(Status)) { > + if (EFI_ERROR (Status)) { > goto EXIT; > } > } >=20 > // Check if this mode is supported > - if( ModeNumber >=3D This->Mode->MaxMode ) { > - DEBUG((DEBUG_ERROR, "LcdGraphicsSetMode: ERROR - Unsupported > mode number %d .\n", ModeNumber )); > + if (ModeNumber >=3D This->Mode->MaxMode) { > + DEBUG ((DEBUG_ERROR, "LcdGraphicsSetMode: ERROR - Unsupported > mode > + number %d .\n", ModeNumber)); > Status =3D EFI_UNSUPPORTED; > goto EXIT; > } >=20 > // Set the oscillator frequency to support the new mode > Status =3D LcdPlatformSetMode (ModeNumber); > - if (EFI_ERROR(Status)) { > + if (EFI_ERROR (Status)) { > Status =3D EFI_DEVICE_ERROR; > goto EXIT; > } >=20 > // Update the UEFI mode information > This->Mode->Mode =3D ModeNumber; > - LcdPlatformQueryMode (ModeNumber,&Instance->ModeInfo); > - Status =3D LcdPlatformGetBpp(ModeNumber, &Bpp); > - if (EFI_ERROR(Status)) { > + LcdPlatformQueryMode (ModeNumber, &Instance->ModeInfo); Status =3D > + 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 =3D Instance->ModeInfo.VerticalResolution > - * Instance->ModeInfo.PixelsPerScanLine > - * GetBytesPerPixel(Bpp); > + * Instance->ModeInfo.PixelsPerScanLine > + * GetBytesPerPixel (Bpp); >=20 > // Set the hardware to the new mode > Status =3D LcdSetMode (ModeNumber); > - if (EFI_ERROR(Status)) { > + if (EFI_ERROR (Status)) { > Status =3D EFI_DEVICE_ERROR; > goto EXIT; > } >=20 > - // The UEFI spec requires that we now clear the visible portions of th= e > output display to black. > + // The UEFI spec requires that we now clear the visible portions of > + the // output display to black. >=20 > // 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 > + ); >=20 > EXIT: > return Status; > @@ -372,7 +383,7 @@ GetBytesPerPixel ( > IN LCD_BPP Bpp > ) > { > - switch(Bpp) { > + switch (Bpp) { > case LCD_BITS_PER_PIXEL_24: > return 4; >=20 > diff --git > a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe. > h > b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe. > h > index > b66efd34561f655b74a5ecfad8a97281cdd5929d..16d92f45c47948630d62 > 62a63fd1af4e076706d1 100644 > --- > a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe. > h > +++ > b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe. > h > @@ -1,6 +1,6 @@ > /** @file >=20 > - Copyright (c) 2011, ARM Ltd. All rights reserved.
> + Copyright (c) 2011-2018, ARM Ltd. All rights reserved.
> 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 @@ >=20 > **/ >=20 > -#ifndef __ARM_VE_GRAPHICS_DXE_H__ > -#define __ARM_VE_GRAPHICS_DXE_H__ > - > +#ifndef LCD_GRAPHICS_OUTPUT_DXE_H_ > +#define LCD_GRAPHICS_OUTPUT_DXE_H_ >=20 > #include >=20 > @@ -25,7 +24,6 @@ >=20 > #include >=20 > - > // > // Device structures > // > @@ -106,4 +104,4 @@ InitializeDisplay ( > IN LCD_INSTANCE* Instance > ); >=20 > -#endif /* __ARM_VE_GRAPHICS_DXE_H__ */ > +#endif /* LCD_GRAPHICS_OUTPUT_DXE_H_ */ > diff --git a/ArmPlatformPkg/Include/Library/LcdPlatformLib.h > b/ArmPlatformPkg/Include/Library/LcdPlatformLib.h > index > b9bdf471e2d65dba7a0fcb0f7ecc352bd576b46b..3d13e417972c67cc51ae4 > 410efd548053511e5d1 100644 > --- a/ArmPlatformPkg/Include/Library/LcdPlatformLib.h > +++ b/ArmPlatformPkg/Include/Library/LcdPlatformLib.h > @@ -1,6 +1,6 @@ > /** @file >=20 > - Copyright (c) 2011, ARM Ltd. All rights reserved.
> + Copyright (c) 2011-2018, ARM Ltd. All rights reserved.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the B= SD > License > which accompanies this distribution. The full text of the license may = be > found at @@ -11,8 +11,8 @@ >=20 > **/ >=20 > -#ifndef __LCDPLATFORMLIB_H > -#define __LCDPLATFORMLIB_H > +#ifndef LCD_PLATFORM_LIB_H_ > +#define LCD_PLATFORM_LIB_H_ >=20 > #include >=20 > @@ -158,8 +158,9 @@ > #define LCD_12BPP_444_BLUE_MASK 0x0000000F > #define LCD_12BPP_444_RESERVED_MASK 0x0000F000 >=20 > - > -// 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 =3D 0, > LCD_BITS_PER_PIXEL_2, > @@ -171,7 +172,6 @@ typedef enum { > LCD_BITS_PER_PIXEL_12_444 > } LCD_BPP; >=20 > - > EFI_STATUS > LcdPlatformInitializeDisplay ( > IN EFI_HANDLE Handle > @@ -218,4 +218,4 @@ LcdPlatformGetBpp ( > OUT LCD_BPP* Bpp > ); >=20 > -#endif > +#endif /* LCD_PLATFORM_LIB_H_ */ > diff --git a/ArmPlatformPkg/Library/HdLcd/HdLcd.c > b/ArmPlatformPkg/Library/HdLcd/HdLcd.c > index > 24efb68f23e3393a96fc760732d978b6346a2807..2cd1be9d255dd5734176 > d752d60f06f11a047fcb 100644 > --- a/ArmPlatformPkg/Library/HdLcd/HdLcd.c > +++ b/ArmPlatformPkg/Library/HdLcd/HdLcd.c > @@ -1,6 +1,6 @@ > -/** @file Lcd.c > +/** @file >=20 > - Copyright (c) 2011-2012, ARM Ltd. All rights reserved.
> + Copyright (c) 2011-2018, ARM Ltd. All rights reserved.
>=20 > This program and the accompanying materials > are licensed and made available under the terms and conditions of the > BSD License @@ -21,12 +21,9 @@ >=20 > #include "HdLcd.h" >=20 > - > /********************************************************** > ************ > - * > - * 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. > +**/ >=20 > STATIC > UINTN > @@ -34,7 +31,7 @@ GetBytesPerPixel ( > IN LCD_BPP Bpp > ) > { > - switch(Bpp) { > + switch (Bpp) { > case LCD_BITS_PER_PIXEL_24: > return 4; >=20 > @@ -60,21 +57,27 @@ LcdInitialize ( > ) > { > // Disable the controller > - MmioWrite32(HDLCD_REG_COMMAND, HDLCD_DISABLE); > + MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_DISABLE); >=20 > // Disable all interrupts > - MmioWrite32(HDLCD_REG_INT_MASK, 0); > + MmioWrite32 (HDLCD_REG_INT_MASK, 0); >=20 > // Define start of the VRAM. This never changes for any graphics mode > - MmioWrite32(HDLCD_REG_FB_BASE, (UINT32) VramBaseAddress); > + MmioWrite32 (HDLCD_REG_FB_BASE, (UINT32)VramBaseAddress); >=20 > // 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_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)); > + MmioWrite32 (HDLCD_REG_BUS_OPTIONS, (4 << 8) | HDLCD_BURST_8); > + > + 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)); >=20 > return EFI_SUCCESS; > } > @@ -96,46 +99,53 @@ LcdSetMode ( > UINT32 BytesPerPixel; > LCD_BPP LcdBpp; >=20 > - > // Set the video mode timings and other relevant information > - Status =3D LcdPlatformGetTimings (ModeNumber, > - &HRes,&HSync,&HBackPorch,&HFrontPorch, > - &VRes,&VSync,&VBackPorch,&VFrontPorch)= ; > + Status =3D LcdPlatformGetTimings ( > + ModeNumber, > + &HRes, > + &HSync, > + &HBackPorch, > + &HFrontPorch, > + &VRes, > + &VSync, > + &VBackPorch, > + &VFrontPorch > + ); > ASSERT_EFI_ERROR (Status); > - if (EFI_ERROR( Status )) { > + if (EFI_ERROR (Status)) { > return EFI_DEVICE_ERROR; > } >=20 > - Status =3D LcdPlatformGetBpp (ModeNumber,&LcdBpp); > + Status =3D LcdPlatformGetBpp (ModeNumber, &LcdBpp); > ASSERT_EFI_ERROR (Status); > - if (EFI_ERROR( Status )) { > + if (EFI_ERROR (Status)) { > return EFI_DEVICE_ERROR; > } >=20 > - BytesPerPixel =3D GetBytesPerPixel(LcdBpp); > + BytesPerPixel =3D GetBytesPerPixel (LcdBpp); >=20 > // Disable the controller > - MmioWrite32(HDLCD_REG_COMMAND, HDLCD_DISABLE); > + MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_DISABLE); >=20 > // Update the frame buffer information with the new settings > - MmioWrite32(HDLCD_REG_FB_LINE_LENGTH, HRes * BytesPerPixel); > - MmioWrite32(HDLCD_REG_FB_LINE_PITCH, HRes * BytesPerPixel); > - MmioWrite32(HDLCD_REG_FB_LINE_COUNT, VRes - 1); > + MmioWrite32 (HDLCD_REG_FB_LINE_LENGTH, HRes * BytesPerPixel); > + MmioWrite32 (HDLCD_REG_FB_LINE_PITCH, HRes * BytesPerPixel); > + MmioWrite32 (HDLCD_REG_FB_LINE_COUNT, VRes - 1); >=20 > // Set the vertical timing information > - MmioWrite32(HDLCD_REG_V_SYNC, VSync); > - MmioWrite32(HDLCD_REG_V_BACK_PORCH, VBackPorch); > - MmioWrite32(HDLCD_REG_V_DATA, VRes - 1); > - MmioWrite32(HDLCD_REG_V_FRONT_PORCH, VFrontPorch); > + MmioWrite32 (HDLCD_REG_V_SYNC, VSync); > + MmioWrite32 (HDLCD_REG_V_BACK_PORCH, VBackPorch); > + MmioWrite32 (HDLCD_REG_V_DATA, VRes - 1); > + MmioWrite32 (HDLCD_REG_V_FRONT_PORCH, VFrontPorch); >=20 > // Set the horizontal timing information > - MmioWrite32(HDLCD_REG_H_SYNC, HSync); > - MmioWrite32(HDLCD_REG_H_BACK_PORCH, HBackPorch); > - MmioWrite32(HDLCD_REG_H_DATA, HRes - 1); > - MmioWrite32(HDLCD_REG_H_FRONT_PORCH, HFrontPorch); > + MmioWrite32 (HDLCD_REG_H_SYNC, HSync); > + MmioWrite32 (HDLCD_REG_H_BACK_PORCH, HBackPorch); > + MmioWrite32 (HDLCD_REG_H_DATA, HRes - 1); > + MmioWrite32 (HDLCD_REG_H_FRONT_PORCH, HFrontPorch); >=20 > // Enable the controller > - MmioWrite32(HDLCD_REG_COMMAND, HDLCD_ENABLE); > + MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_ENABLE); >=20 > return EFI_SUCCESS; > } > diff --git a/ArmPlatformPkg/Library/HdLcd/HdLcd.h > b/ArmPlatformPkg/Library/HdLcd/HdLcd.h > index > 6df97a9dfee60e9fda615cf3bea1b6a164a42333..cd2c0366c7b563d7fb313f > 82abeef7eb1aa3ef72 100644 > --- a/ArmPlatformPkg/Library/HdLcd/HdLcd.h > +++ b/ArmPlatformPkg/Library/HdLcd/HdLcd.h > @@ -1,6 +1,6 @@ > -/** @file HDLcd.h > +/** @file >=20 > - Copyright (c) 2011-2012, ARM Ltd. All rights reserved.
> + Copyright (c) 2011-2018, ARM Ltd. All rights reserved.
>=20 > This program and the accompanying materials > are licensed and made available under the terms and conditions of the B= SD > License @@ -12,13 +12,10 @@ >=20 > **/ >=20 > -#ifndef _HDLCD_H_ > -#define _HDLCD_H_ > +#ifndef HDLCD_H_ > +#define HDLCD_H_ >=20 > -// > // 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) >=20 > - > -// > // HDLCD Values of registers > -// >=20 > // HDLCD Interrupt mask, clear and status register > #define HDLCD_DMA_END BIT0 /* DMA has finished re= ading a > frame */ > @@ -79,6 +73,11 @@ > #define HDLCD_DATA_LOW 0 > #define HDLCD_PXCLK_LOW 0 >=20 > +// 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) >=20 > -#endif /* _HDLCD_H_ */ > +#endif /* HDLCD_H_ */ > diff --git a/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c > b/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c > index > 9b4a02045ab7ca170e0d4362ee0e2bcf1d275bdb..3f3f7019f1d252995eab6 > d8c3d49db8be8e09e40 100644 > --- a/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c > +++ b/ArmPlatformPkg/Library/PL111Lcd/PL111Lcd.c > @@ -1,6 +1,6 @@ > -/** @file PL111Lcd.c > +/** @file >=20 > - Copyright (c) 2011-2012, ARM Ltd. All rights reserved.
> + Copyright (c) 2011-2018, ARM Ltd. All rights reserved.
>=20 > This program and the accompanying materials > are licensed and made available under the terms and conditions of the > BSD License @@ -19,13 +19,10 @@ >=20 > #include "PL111Lcd.h" >=20 > - > /********************************************************** > ************ > - * > - * 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. >=20 > +**/ > EFI_STATUS > LcdIdentify ( > VOID > @@ -54,11 +51,11 @@ LcdInitialize ( > ) > { > // Define start of the VRAM. This never changes for any graphics mode > - MmioWrite32(PL111_REG_LCD_UP_BASE, (UINT32) VramBaseAddress); > - MmioWrite32(PL111_REG_LCD_LP_BASE, 0); // We are not using a > double buffer > + MmioWrite32 (PL111_REG_LCD_UP_BASE, (UINT32)VramBaseAddress); > + MmioWrite32 (PL111_REG_LCD_LP_BASE, 0); // We are not using a > double > + buffer >=20 > // Disable all interrupts from the PL111 > - MmioWrite32(PL111_REG_LCD_IMSC, 0); > + MmioWrite32 (PL111_REG_LCD_IMSC, 0); >=20 > return EFI_SUCCESS; > } > @@ -81,37 +78,54 @@ LcdSetMode ( > LCD_BPP LcdBpp; >=20 > // Set the video mode timings and other relevant information > - Status =3D LcdPlatformGetTimings (ModeNumber, > - &HRes,&HSync,&HBackPorch,&HFrontPorch, > - &VRes,&VSync,&VBackPorch,&VFrontPorch)= ; > + Status =3D LcdPlatformGetTimings ( > + ModeNumber, > + &HRes, > + &HSync, > + &HBackPorch, > + &HFrontPorch, > + &VRes, > + &VSync, > + &VBackPorch, > + &VFrontPorch > + ); > ASSERT_EFI_ERROR (Status); > - if (EFI_ERROR( Status )) { > + if (EFI_ERROR (Status)) { > return EFI_DEVICE_ERROR; > } >=20 > - Status =3D LcdPlatformGetBpp (ModeNumber,&LcdBpp); > + Status =3D LcdPlatformGetBpp (ModeNumber, &LcdBpp); > ASSERT_EFI_ERROR (Status); > - if (EFI_ERROR( Status )) { > + if (EFI_ERROR (Status)) { > return EFI_DEVICE_ERROR; > } >=20 > // Disable the CLCD_LcdEn bit > - LcdControl =3D MmioRead32( PL111_REG_LCD_CONTROL); > - MmioWrite32(PL111_REG_LCD_CONTROL, LcdControl & ~1); > + LcdControl =3D MmioRead32 (PL111_REG_LCD_CONTROL); > + MmioWrite32 (PL111_REG_LCD_CONTROL, LcdControl & ~1); >=20 > // 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_2, CLK_SIG_POLARITY(HRes)); > + 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); >=20 > // PL111_REG_LCD_CONTROL > - LcdControl =3D PL111_CTRL_LCD_EN | PL111_CTRL_LCD_BPP(LcdBpp) | > PL111_CTRL_LCD_TFT | PL111_CTRL_BGR; > - MmioWrite32(PL111_REG_LCD_CONTROL, LcdControl); > + LcdControl =3D PL111_CTRL_LCD_EN | PL111_CTRL_LCD_BPP (LcdBpp) | > + PL111_CTRL_LCD_TFT | PL111_CTRL_BGR; > + MmioWrite32 (PL111_REG_LCD_CONTROL, LcdControl); >=20 > // Turn on power to the LCD Panel > LcdControl |=3D PL111_CTRL_LCD_PWR; > - MmioWrite32(PL111_REG_LCD_CONTROL, LcdControl); > + MmioWrite32 (PL111_REG_LCD_CONTROL, LcdControl); >=20 > return EFI_SUCCESS; > } > -- > 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' >=20 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel