QcomModulePkg: Add wait for display completion
Implementation adds support to wait for UEFI display thread completion.
Change-Id: Ia480c05f5e2727a561be07d669d47599d07e2e8e
Signed-off-by: Rahul Sharma <rahsha@codeaurora.org>
diff --git a/QcomModulePkg/Application/LinuxLoader/LinuxLoader.c b/QcomModulePkg/Application/LinuxLoader/LinuxLoader.c
index 317b5b6..a8b594a 100755
--- a/QcomModulePkg/Application/LinuxLoader/LinuxLoader.c
+++ b/QcomModulePkg/Application/LinuxLoader/LinuxLoader.c
@@ -2,7 +2,7 @@
* Copyright (c) 2009, Google Inc.
* All rights reserved.
*
- * Copyright (c) 2009-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2009-2021, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -35,6 +35,8 @@
#include "BootStats.h"
#include "KeyPad.h"
#include "LinuxLoaderLib.h"
+#include <Protocol/DiskIo.h>
+#include <Protocol/EFIDisplayUtils.h>
#include <FastbootLib/FastbootMain.h>
#include <Library/DeviceInfo.h>
#include <Library/DrawUI.h>
@@ -121,6 +123,38 @@
return TRUE;
}
+#if TARGET_BOARD_TYPE_AUTO
+STATIC UINT8
+WaitForDisplayCompletion (VOID)
+{
+ EFI_STATUS Status;
+ EfiQcomDisplayUtilsProtocol *pDisplayUtilsProtocol = NULL;
+ CHAR8 *sLockName = "DispInit";
+
+ Status = gBS->LocateProtocol (&gQcomDisplayUtilsProtocolGuid,
+ NULL,
+ (VOID **)&pDisplayUtilsProtocol);
+ if ((EFI_ERROR (Status)) ||
+ (pDisplayUtilsProtocol == NULL)) {
+ DEBUG ((EFI_D_ERROR, "Failed to locate DisplayUtils protocol, Status=%r\n",
+ Status));
+ return Status;
+ } else {
+ Status = pDisplayUtilsProtocol->DisplayUtilsSetProperty (
+ EFI_DISPLAY_UTILS_WAIT_FOR_EVENT,
+ sLockName, strlen (sLockName));
+ }
+
+ return Status;
+}
+#else
+STATIC UINT8
+WaitForDisplayCompletion (VOID)
+{
+ return EFI_SUCCESS;
+}
+#endif
+
/**
Linux Loader Application EntryPoint
@@ -277,10 +311,21 @@
goto fastboot;
}
+ Status = WaitForDisplayCompletion ();
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "Failed to wait for display completion: %r\n",
+ Status));
+ }
BootLinux (&Info);
}
fastboot:
+ Status = WaitForDisplayCompletion ();
+ if (Status != EFI_SUCCESS) {
+ DEBUG ((EFI_D_ERROR, "Failed to wait for display completion: %r\n",
+ Status));
+ }
+
DEBUG ((EFI_D_INFO, "Launching fastboot\n"));
Status = FastbootInitialize ();
if (EFI_ERROR (Status)) {
diff --git a/QcomModulePkg/Application/LinuxLoader/LinuxLoader.inf b/QcomModulePkg/Application/LinuxLoader/LinuxLoader.inf
index 82bf84f..0fb29b7 100644
--- a/QcomModulePkg/Application/LinuxLoader/LinuxLoader.inf
+++ b/QcomModulePkg/Application/LinuxLoader/LinuxLoader.inf
@@ -1,5 +1,5 @@
#/* @file
-# Copyright (c) 2017-2018,2020 The Linux Foundation. All rights reserved.
+# Copyright (c) 2017-2018,2020-2021 The Linux Foundation. All rights reserved.
# Portions Copyright (c) 2011-2013, ARM Limited. All rights reserved.
#
# This program and the accompanying materials
@@ -109,6 +109,7 @@
gEfiPartitionRecordGuid
gEfiResetReasonProtocolGuid
gQcomRngProtocolGuid
+ gQcomDisplayUtilsProtocolGuid
[FixedPcd]
gQcomTokenSpaceGuid.EnableMdtpSupport
diff --git a/QcomModulePkg/Include/Protocol/EFIDisplayUtils.h b/QcomModulePkg/Include/Protocol/EFIDisplayUtils.h
index 296c5f2..ed4b485 100644
--- a/QcomModulePkg/Include/Protocol/EFIDisplayUtils.h
+++ b/QcomModulePkg/Include/Protocol/EFIDisplayUtils.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2016-2019,2021 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -78,6 +78,23 @@
/**
Display Utils property types
*/
+#if TARGET_BOARD_TYPE_AUTO
+typedef enum
+{
+ EFI_DISPLAY_UTILS_DEVICE_TREE_ADDR = 0x0,
+ /**< Device tree base address: (Type: VOID*) */
+ EFI_DISPLAY_UTILS_PANEL_OVERRIDE,
+ /**< Panel override string (Type: CHAR8*) */
+ EFI_DISPLAY_UTILS_SUPPORTED_PANELS,
+ /**< Newline separated list of supported panels (Type: CHAR16*) */
+ EFI_DISPLAY_UTILS_PANEL_CONFIG,
+ /**< Panel raw configuration */
+ EFI_DISPLAY_UTILS_DYNAMIC_REFRESH,
+ /**< Dynamic refresh settings (Type: UINT32*) */
+ EFI_DISPLAY_UTILS_WAIT_FOR_EVENT,
+ /**< Wait for an event */
+} EFI_DISPLAY_UTILS_PROPERTY_TYPE;
+#else
typedef enum
{
EFI_DISPLAY_UTILS_DEVICE_TREE_ADDR = 0x0,
@@ -89,6 +106,7 @@
EFI_DISPLAY_UTILS_PANEL_CONFIG,
/**< Panel raw configuration */
} EFI_DISPLAY_UTILS_PROPERTY_TYPE;
+#endif
/**
Parameter structure for EFI_DISPLAY_UTILS_PANEL_LIST