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=girish.pathak@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 85A4520954B8C for ; Tue, 20 Mar 2018 09:05:52 -0700 (PDT) Received: from E107875.Emea.Arm.com (e107875.emea.arm.com [10.10.1.104]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id w2KGCHLw016075; Tue, 20 Mar 2018 16:12:20 GMT From: Girish Pathak To: edk2-devel@lists.01.org Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, Matteo.Carlini@arm.com, Stephanie.Hughes-Fitt@arm.com, nd@arm.com Date: Tue, 20 Mar 2018 16:12:04 +0000 Message-Id: <20180320161212.79120-9-girish.pathak@arm.com> X-Mailer: git-send-email 2.13.3.windows.1 In-Reply-To: <20180320161212.79120-1-girish.pathak@arm.com> References: <20180320161212.79120-1-girish.pathak@arm.com> Subject: [PATCH v3 08/16] 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: Tue, 20 Mar 2018 16:05:54 -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 Reviewed-by: Ard Biesheuvel --- ArmPlatformPkg/Library/HdLcd/HdLcd.c | 8 +++++++- ArmPlatformPkg/Library/HdLcd/HdLcd.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ArmPlatformPkg/Library/HdLcd/HdLcd.c b/ArmPlatformPkg/Library/HdLcd/HdLcd.c index 28306c530e08b5e0fcef4308435045da3c9e093c..039048398c531ec944bc4b43a5551a554a368481 100644 --- a/ArmPlatformPkg/Library/HdLcd/HdLcd.c +++ b/ArmPlatformPkg/Library/HdLcd/HdLcd.c @@ -175,11 +175,17 @@ LcdShutdown ( @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; } diff --git a/ArmPlatformPkg/Library/HdLcd/HdLcd.h b/ArmPlatformPkg/Library/HdLcd/HdLcd.h index cd2c0366c7b563d7fb313f82abeef7eb1aa3ef72..1efa78eedc3013b3ab4615181a59c7d15b851ab5 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_ */ -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'