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 48EDB22225C1B for ; Fri, 22 Dec 2017 10:29:36 -0800 (PST) Received: from E111747.Emea.Arm.com (e111747.emea.arm.com [10.1.25.75]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id vBMIYOYb007680; Fri, 22 Dec 2017 18:34:25 GMT 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: Fri, 22 Dec 2017 18:34:11 +0000 Message-Id: <20171222183418.8616-7-evan.lloyd@arm.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171222183418.8616-1-evan.lloyd@arm.com> References: <20171222183418.8616-1-evan.lloyd@arm.com> Subject: [PATCH v2 06/13] ArmPlatformPkg: Implement LcdIdentify function for HDLCD GOP 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: Fri, 22 Dec 2017 18:29:38 -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/Library/HdLcd/HdLcd.h | 2 ++ ArmPlatformPkg/Library/HdLcd/HdLcd.c | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ArmPlatformPkg/Library/HdLcd/HdLcd.h b/ArmPlatformPkg/Library/HdLcd/HdLcd.h index 861d3c398f7d6b9a171b4d8718c2816419d8e20a..b69fc3436a190b7b20df63fac42e4bef2b522942 100644 --- a/ArmPlatformPkg/Library/HdLcd/HdLcd.h +++ b/ArmPlatformPkg/Library/HdLcd/HdLcd.h @@ -85,4 +85,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/Library/HdLcd/HdLcd.c b/ArmPlatformPkg/Library/HdLcd/HdLcd.c index d71b6020dc0c4b91e74d16e96b06a60601b9628a..b2779af041fae58d712270002cc7d6d277360311 100644 --- a/ArmPlatformPkg/Library/HdLcd/HdLcd.c +++ b/ArmPlatformPkg/Library/HdLcd/HdLcd.c @@ -174,9 +174,15 @@ LcdShutdown (VOID) @retval EFI_SUCCESS Returns success if platform implements a HDLCD controller. + @retval EFI_NOT_FOUND HDLCD display controller not found on the + platform. **/ EFI_STATUS LcdIdentify (VOID) { - return EFI_SUCCESS; + if ((MmioRead32 (HDLCD_REG_VERSION) >> 16) == HDLCD_PRODUCT_ID) { + return EFI_SUCCESS; + } + + return EFI_NOT_FOUND; } -- Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")