From d8c4bb9afa0bd87e4d790f5e8974939bcaea1353 Mon Sep 17 00:00:00 2001 From: Olivier Martin Date: Mon, 23 Sep 2013 09:40:27 +0000 Subject: [PATCH] ArmPlatformPkg/LcdGraphicsOutputDxe: Call LcdShutdown() on ExitBootServices() if PcdGopDisableOnExitBootServices Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14702 6f19259b-4bc3-4df7-8a09-765794883524 --- ArmPlatformPkg/ArmPlatformPkg.dec | 6 +++++- ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c | 4 ++-- .../LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf | 3 +++ .../Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c | 8 +++++++- ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c | 6 ++---- .../LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf | 3 +++ 6 files changed, 22 insertions(+), 8 deletions(-) diff --git a/ArmPlatformPkg/ArmPlatformPkg.dec b/ArmPlatformPkg/ArmPlatformPkg.dec index 3358225aee..b459db21b2 100644 --- a/ArmPlatformPkg/ArmPlatformPkg.dec +++ b/ArmPlatformPkg/ArmPlatformPkg.dec @@ -53,7 +53,11 @@ gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores|FALSE|BOOLEAN|0x00000004 gArmPlatformTokenSpaceGuid.PcdNorFlashCheckBlockLocked|FALSE|BOOLEAN|0x0000003C - + + # Disable the GOP controller on ExitBootServices(). By default the value is FALSE, + # we assume the OS will handle the FrameBuffer from the UEFI GOP information. + gArmPlatformTokenSpaceGuid.PcdGopDisableOnExitBootServices|FALSE|BOOLEAN|0x0000003D + [PcdsFixedAtBuild.common] gArmPlatformTokenSpaceGuid.PcdCoreCount|1|UINT32|0x00000039 gArmPlatformTokenSpaceGuid.PcdClusterCount|1|UINT32|0x00000038 diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c index c9baa98224..9186912dfc 100644 --- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c +++ b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c @@ -120,6 +120,6 @@ LcdShutdown ( VOID ) { - // Nothing to do in terms of hardware. - // We could switch off the monitor display if required + // Disable the controller + MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_DISABLE); } diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf index ac61bf75eb..8de4752b72 100644 --- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf +++ b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcdGraphicsOutputDxe.inf @@ -56,5 +56,8 @@ [FixedPcd] gArmPlatformTokenSpaceGuid.PcdArmHdLcdBase +[FeaturePcd] + gArmPlatformTokenSpaceGuid.PcdGopDisableOnExitBootServices + [Depex] gEfiCpuArchProtocolGuid diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c index 34a56b3d8d..f4165d0003 100644 --- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c +++ b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.c @@ -225,7 +225,13 @@ LcdGraphicsExitBootServicesEvent ( IN VOID *Context ) { - //TODO: Implement me + // 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 (); + } } /*************************************** diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c index a955acb4dc..ad841cd8dc 100644 --- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c +++ b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111Lcd.c @@ -99,8 +99,6 @@ LcdShutdown ( VOID ) { - // Nothing to do in terms of hardware. - // We could switch off the monitor display if required - - //TODO: ImplementMe + // Disable the controller + MmioAnd32 (PL111_REG_LCD_CONTROL, ~PL111_CTRL_LCD_EN); } diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf index 5387e53c4a..27f00617e4 100644 --- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf +++ b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/PL111LcdGraphicsOutputDxe.inf @@ -52,5 +52,8 @@ [FixedPcd] gArmPlatformTokenSpaceGuid.PcdPL111LcdBase +[FeaturePcd] + gArmPlatformTokenSpaceGuid.PcdGopDisableOnExitBootServices + [Depex] gEfiCpuArchProtocolGuid