From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=217.140.96.140; helo=cam-smtp0.cambridge.arm.com; envelope-from=evan.lloyd@arm.com; receiver=edk2-devel@lists.01.org Received: from cam-smtp0.cambridge.arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A224F21EC8D16 for ; Tue, 26 Sep 2017 13:12:26 -0700 (PDT) Received: from E111747.Emea.Arm.com (e111747.emea.arm.com [10.1.27.40]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id v8QKFY5a017392; Tue, 26 Sep 2017 21:15:37 +0100 From: evan.lloyd@arm.com To: edk2-devel@lists.01.org Cc: "ard.biesheuvel@linaro.org"@arm.com, "leif.lindholm@linaro.org"@arm.com, "Matteo.Carlini@arm.com"@arm.com, "nd@arm.com"@arm.com Date: Tue, 26 Sep 2017 21:15:21 +0100 Message-Id: <20170926201529.11644-12-evan.lloyd@arm.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170926201529.11644-1-evan.lloyd@arm.com> References: <20170926201529.11644-1-evan.lloyd@arm.com> Subject: [PATCH 11/19] ArmPlatformPkg: Implement LcdIdentify function for HDLCD GOP X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Sep 2017 20:12:27 -0000 From: Girish Pathak LcdIdentify function does not currently check presence of HDLCD controller. Implement this functionality by reading HDLCD_REG_VERSION and checking against the PRODUCT_ID field to detect presence of HDLCD controller. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Girish Pathak Signed-off-by: Evan Lloyd --- ArmPlatformPkg/Include/Drivers/HdLcd.h | 4 +++- ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c | 22 +++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ArmPlatformPkg/Include/Drivers/HdLcd.h b/ArmPlatformPkg/Include/Drivers/HdLcd.h index 6df97a9dfee60e9fda615cf3bea1b6a164a42333..69b47cd720bae86081753affe2f3fafc8aa6c4d0 100644 --- a/ArmPlatformPkg/Include/Drivers/HdLcd.h +++ b/ArmPlatformPkg/Include/Drivers/HdLcd.h @@ -1,6 +1,6 @@ /** @file HDLcd.h - Copyright (c) 2011-2012, ARM Ltd. All rights reserved.
+ Copyright (c) 2011-2017, 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 @@ -86,4 +86,6 @@ // Number of bytes per pixel #define HDLCD_4BYTES_PER_PIXEL ((4 - 1) << 3) +#define HDLCD_PRODUCT_ID 0x1CDC + #endif /* _HDLCD_H_ */ diff --git a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c index a266671a26f01d31e8ddb0cf7cbfe59d2f4dc49c..33c555e75cafaf9affddd0992c4bd9f9289f6703 100644 --- a/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c +++ b/ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/HdLcd.c @@ -159,6 +159,22 @@ LcdShutdown ( MmioWrite32 (HDLCD_REG_COMMAND, HDLCD_DISABLE); } +/** Get the HDLCD Product Id (from the version register). +**/ +STATIC +UINT32 GetHdlcdProductId(VOID) +{ + return ((MmioRead32 (HDLCD_REG_VERSION)) >> 16) ; +} + +/** Check if an HDLCD is present. +**/ +STATIC +BOOLEAN HdlcdPresent(VOID) +{ + return (GetHdlcdProductId() == HDLCD_PRODUCT_ID); +} + /** Check for presence of HDLCD. * * @retval EFI_SUCCESS Platform implements HDLCD. @@ -170,5 +186,9 @@ LcdIdentify ( VOID ) { - return EFI_SUCCESS; + if (HdlcdPresent()) { + return EFI_SUCCESS; + } + + return EFI_NOT_FOUND; } -- Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")