On 22 December 2017 at 18:34, <evan.lloyd@arm.com> wrote:
> From: Girish Pathak <girish.pathak at arm.com>
>
> 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 <girish.pathak@arm.com>
> Signed-off-by: Evan Lloyd <evan.lloyd@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
> 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")
>
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel