Blame SOURCES/0023-OvmfPkg-QemuRamfbDxe-Do-not-report-DXE-failure-on-Aa.patch

1d2c45
From deb3451034326b75fd760aba47a5171493ff055e Mon Sep 17 00:00:00 2001
1dc609
From: Philippe Mathieu-Daude <philmd@redhat.com>
1dc609
Date: Thu, 1 Aug 2019 20:43:48 +0200
1dc609
Subject: OvmfPkg: QemuRamfbDxe: Do not report DXE failure on Aarch64 silent
1dc609
 builds (RH only)
1dc609
1d2c45
Notes about the RHEL-8.2/20190904-37eef91017ad [edk2-stable201908] ->
1d2c45
RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] rebase:
1d2c45
1d2c45
- no change
1d2c45
1dc609
Notes about the RHEL-8.1/20190308-89910a39dcfd [edk2-stable201903] ->
1dc609
RHEL-8.2/20190904-37eef91017ad [edk2-stable201908] rebase:
1dc609
1dc609
- We have to carry this downstream-only patch -- committed originally as
1dc609
  aaaedc1e2cfd -- indefinitely.
1dc609
1dc609
- To avoid confusion, remove the tags from the commit message that had
1dc609
  been added by the downstream maintainer scripts, such as: Message-id,
1dc609
  Patchwork-id, O-Subject, Acked-by. These remain available on the
1dc609
  original downstream commit. The Bugzilla line is preserved, as it
1dc609
  doesn't relate to a specific posting, but to the problem.
1dc609
1dc609
Bugzilla: 1714446
1dc609
1dc609
To suppress an error message on the silent build when ramfb is
1dc609
not configured, change QemuRamfbDxe to return EFI_SUCCESS even
1dc609
when it fails.
1dc609
Some memory is wasted (driver stays resident without
1dc609
any good use), but it is mostly harmless, as the memory
1dc609
is released by the OS after ExitBootServices().
1dc609
1dc609
Suggested-by: Laszlo Ersek <lersek@redhat.com>
1dc609
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
1dc609
(cherry picked from commit aaaedc1e2cfd55ef003fb1b5a37c73a196b26dc7)
1dc609
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
1d2c45
(cherry picked from commit aa2b66b18a62d652bdbefae7b5732297294306ca)
1dc609
---
1dc609
 OvmfPkg/QemuRamfbDxe/QemuRamfb.c      | 14 ++++++++++++++
1dc609
 OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf |  1 +
1dc609
 2 files changed, 15 insertions(+)
1dc609
1dc609
diff --git a/OvmfPkg/QemuRamfbDxe/QemuRamfb.c b/OvmfPkg/QemuRamfbDxe/QemuRamfb.c
1dc609
index 0d49d8bbab..dbf9bcbe16 100644
1dc609
--- a/OvmfPkg/QemuRamfbDxe/QemuRamfb.c
1dc609
+++ b/OvmfPkg/QemuRamfbDxe/QemuRamfb.c
1dc609
@@ -13,6 +13,7 @@
1dc609
 #include <Library/BaseLib.h>
1dc609
 #include <Library/BaseMemoryLib.h>
1dc609
 #include <Library/DebugLib.h>
1dc609
+#include <Library/DebugPrintErrorLevelLib.h>
1dc609
 #include <Library/DevicePathLib.h>
1dc609
 #include <Library/FrameBufferBltLib.h>
1dc609
 #include <Library/MemoryAllocationLib.h>
1dc609
@@ -242,6 +243,19 @@ InitializeQemuRamfb (
1dc609
 
1dc609
   Status = QemuFwCfgFindFile ("etc/ramfb", &mRamfbFwCfgItem, &FwCfgSize);
1dc609
   if (EFI_ERROR (Status)) {
1dc609
+#if defined (MDE_CPU_AARCH64)
1dc609
+    //
1dc609
+    // RHBZ#1714446
1dc609
+    // If no ramfb device was configured, this platform DXE driver should
1dc609
+    // returns EFI_NOT_FOUND, so the DXE Core can unload it. However, even
1dc609
+    // using a silent build, an error message is issued to the guest console.
1dc609
+    // Since this confuse users, return success and stay resident. The wasted
1dc609
+    // guest RAM still gets freed later after ExitBootServices().
1dc609
+    //
1dc609
+    if (GetDebugPrintErrorLevel () == DEBUG_ERROR) {
1dc609
+      return EFI_SUCCESS;
1dc609
+    }
1dc609
+#endif
1dc609
     return EFI_NOT_FOUND;
1dc609
   }
1dc609
   if (FwCfgSize != sizeof (RAMFB_CONFIG)) {
1dc609
diff --git a/OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf b/OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf
1dc609
index e3890b8c20..6ffee5acb2 100644
1dc609
--- a/OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf
1dc609
+++ b/OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf
1dc609
@@ -29,6 +29,7 @@
1dc609
   BaseLib
1dc609
   BaseMemoryLib
1dc609
   DebugLib
1dc609
+  DebugPrintErrorLevelLib
1dc609
   DevicePathLib
1dc609
   FrameBufferBltLib
1dc609
   MemoryAllocationLib
1dc609
-- 
1dc609
2.18.1
1dc609