Blame SOURCES/0015-ArmVirtPkg-take-PcdResizeXterm-from-the-QEMU-command.patch

c4e3b2
From 3f9662c435278564640be672f0c4e17e535f1765 Mon Sep 17 00:00:00 2001
c4e3b2
From: Laszlo Ersek <lersek@redhat.com>
c4e3b2
Date: Sun, 26 Jul 2015 08:02:50 +0000
c4e3b2
Subject: ArmVirtPkg: take PcdResizeXterm from the QEMU command line (RH only)
c4e3b2
c4e3b2
Notes about the RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] ->
c4e3b2
RHEL-8.5/20210520-e1999b264f1f [edk2-stable202105] rebase:
c4e3b2
c4e3b2
- no change
c4e3b2
c4e3b2
Notes about the RHEL-8.2/20190904-37eef91017ad [edk2-stable201908] ->
c4e3b2
RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] rebase:
c4e3b2
c4e3b2
- Resolve leading context divergence in "ArmVirtPkg/ArmVirtQemu.dsc",
c4e3b2
  arising from upstream commits:
c4e3b2
c4e3b2
  - 82662a3b5f56 ("ArmVirtPkg/PlatformPeiLib: discover the TPM base
c4e3b2
                  address from the DT", 2020-03-04)
c4e3b2
c4e3b2
  - ddd34a818315 ("ArmVirtPkg/ArmVirtQemu: enable TPM2 support in the PEI
c4e3b2
                  phase", 2020-03-04)
c4e3b2
c4e3b2
  - cdc3fa54184a ("ArmVirtPkg: control PXEv4 / PXEv6 boot support from the
c4e3b2
                  QEMU command line", 2020-04-28)
c4e3b2
c4e3b2
- Rework the downstream patch quite a bit, paralleling the upstream work
c4e3b2
  done for <https://bugzilla.tianocore.org/show_bug.cgi?id=2681> in commit
c4e3b2
  range 64ab457d1f21..cdc3fa54184a:
c4e3b2
c4e3b2
  - Refresh copyright year in TerminalPcdProducerLib.{inf,c}. Also replace
c4e3b2
    open-coded BSDL with "SPDX-License-Identifier: BSD-2-Clause-Patent".
c4e3b2
c4e3b2
  - Simplify LIBRARY_CLASS: this lib instance is meant to be consumed only
c4e3b2
    via NULL class resolution (basically: as a plugin), so use NULL for
c4e3b2
    LIBRARY_CLASS, not "TerminalPcdProducerLib|DXE_DRIVER".
c4e3b2
c4e3b2
  - Sort the [Packages] section alphabetically in the INF file.
c4e3b2
c4e3b2
  - Replace the open-coded GetNamedFwCfgBoolean() function with a call to
c4e3b2
    QemuFwCfgParseBool(), from QemuFwCfgSimpleParserLib.
c4e3b2
c4e3b2
  - Add the SOMETIMES_PRODUCES usage comment in the [Pcd] section of the
c4e3b2
    INF file.
c4e3b2
c4e3b2
Notes about the RHEL-8.1/20190308-89910a39dcfd [edk2-stable201903] ->
c4e3b2
RHEL-8.2/20190904-37eef91017ad [edk2-stable201908] rebase:
c4e3b2
c4e3b2
- no change
c4e3b2
c4e3b2
Notes about the RHEL-8.0/20180508-ee3198e672e2 ->
c4e3b2
RHEL-8.1/20190308-89910a39dcfd rebase:
c4e3b2
c4e3b2
- no change
c4e3b2
c4e3b2
Notes about the RHEL-7.6/ovmf-20180508-2.gitee3198e672e2.el7 ->
c4e3b2
RHEL-8.0/20180508-ee3198e672e2 rebase:
c4e3b2
c4e3b2
- reorder the rebase changelog in the commit message so that it reads like
c4e3b2
  a blog: place more recent entries near the top
c4e3b2
- no changes to the patch body
c4e3b2
c4e3b2
Notes about the 20171011-92d07e48907f -> 20180508-ee3198e672e2 rebase:
c4e3b2
c4e3b2
- no change
c4e3b2
c4e3b2
Notes about the 20170228-c325e41585e3 -> 20171011-92d07e48907f rebase:
c4e3b2
c4e3b2
- Refresh downstream-only commit d4564d39dfdb against context changes in
c4e3b2
  "ArmVirtPkg/ArmVirtQemu.dsc" from upstream commit 7e5f1b673870
c4e3b2
  ("ArmVirtPkg/PlatformHasAcpiDtDxe: allow guest level ACPI disable
c4e3b2
  override", 2017-03-29).
c4e3b2
c4e3b2
Notes about the 20160608b-988715a -> 20170228-c325e41585e3 rebase:
c4e3b2
c4e3b2
- Adapt commit 6b97969096a3 to the fact that upstream has deprecated such
c4e3b2
  setter functions for dynamic PCDs that don't return a status code (such
c4e3b2
  as PcdSetBool()). Employ PcdSetBoolS(), and assert that it succeeds --
c4e3b2
  there's really no circumstance in this case when it could fail.
c4e3b2
c4e3b2
Contributed-under: TianoCore Contribution Agreement 1.0
c4e3b2
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
c4e3b2
(cherry picked from commit d4564d39dfdbf74e762af43314005a2c026cb262)
c4e3b2
(cherry picked from commit c9081ebe3bcd28e5cce4bf58bd8d4fca12f9af7c)
c4e3b2
(cherry picked from commit 8e92730c8e1cdb642b3b3e680e643ff774a90c65)
c4e3b2
(cherry picked from commit 9448b6b46267d8d807fac0c648e693171bb34806)
c4e3b2
(cherry picked from commit 232fcf06f6b3048b7c2ebd6931f23186b3852f04)
c4e3b2
(cherry picked from commit 8338545260fbb423f796d5196faaaf8ff6e1ed99)
c4e3b2
(cherry picked from commit a5f7a57bf390f1f340ff1d1f1884a73716817ef1)
c4e3b2
---
c4e3b2
 ArmVirtPkg/ArmVirtQemu.dsc                    |  7 +++-
c4e3b2
 .../TerminalPcdProducerLib.c                  | 34 +++++++++++++++++++
c4e3b2
 .../TerminalPcdProducerLib.inf                | 33 ++++++++++++++++++
c4e3b2
 3 files changed, 73 insertions(+), 1 deletion(-)
c4e3b2
 create mode 100644 ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.c
c4e3b2
 create mode 100644 ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.inf
c4e3b2
c4e3b2
diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
c4e3b2
index 54d637163c..41a26c8d18 100644
c4e3b2
--- a/ArmVirtPkg/ArmVirtQemu.dsc
c4e3b2
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
c4e3b2
@@ -280,6 +280,8 @@
c4e3b2
   gEfiSecurityPkgTokenSpaceGuid.PcdTpm2HashMask|0
c4e3b2
 !endif
c4e3b2
 
c4e3b2
+  gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm|FALSE
c4e3b2
+
c4e3b2
 [PcdsDynamicHii]
c4e3b2
   gArmVirtTokenSpaceGuid.PcdForceNoAcpi|L"ForceNoAcpi"|gArmVirtVariableGuid|0x0|FALSE|NV,BS
c4e3b2
 
c4e3b2
@@ -382,7 +384,10 @@
c4e3b2
   MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
c4e3b2
   MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
c4e3b2
   MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
c4e3b2
-  MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
c4e3b2
+  MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf {
c4e3b2
+    <LibraryClasses>
c4e3b2
+      NULL|ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.inf
c4e3b2
+  }
c4e3b2
   MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
c4e3b2
 
c4e3b2
   MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
c4e3b2
diff --git a/ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.c b/ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.c
c4e3b2
new file mode 100644
c4e3b2
index 0000000000..bfd3a6a535
c4e3b2
--- /dev/null
c4e3b2
+++ b/ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.c
c4e3b2
@@ -0,0 +1,34 @@
c4e3b2
+/** @file
c4e3b2
+*  Plugin library for setting up dynamic PCDs for TerminalDxe, from fw_cfg
c4e3b2
+*
c4e3b2
+*  Copyright (C) 2015-2020, Red Hat, Inc.
c4e3b2
+*  Copyright (c) 2014, Linaro Ltd. All rights reserved.
c4e3b2
+*
c4e3b2
+*  SPDX-License-Identifier: BSD-2-Clause-Patent
c4e3b2
+**/
c4e3b2
+
c4e3b2
+#include <Library/DebugLib.h>
c4e3b2
+#include <Library/PcdLib.h>
c4e3b2
+#include <Library/QemuFwCfgSimpleParserLib.h>
c4e3b2
+
c4e3b2
+#define UPDATE_BOOLEAN_PCD_FROM_FW_CFG(TokenName)                             \
c4e3b2
+          do {                                                                \
c4e3b2
+            BOOLEAN       Setting;                                            \
c4e3b2
+            RETURN_STATUS PcdStatus;                                          \
c4e3b2
+                                                                              \
c4e3b2
+            if (!RETURN_ERROR (QemuFwCfgParseBool (                           \
c4e3b2
+                    "opt/org.tianocore.edk2.aavmf/" #TokenName, &Setting))) { \
c4e3b2
+              PcdStatus = PcdSetBoolS (TokenName, Setting);                   \
c4e3b2
+              ASSERT_RETURN_ERROR (PcdStatus);                                \
c4e3b2
+            }                                                                 \
c4e3b2
+          } while (0)
c4e3b2
+
c4e3b2
+RETURN_STATUS
c4e3b2
+EFIAPI
c4e3b2
+TerminalPcdProducerLibConstructor (
c4e3b2
+  VOID
c4e3b2
+  )
c4e3b2
+{
c4e3b2
+  UPDATE_BOOLEAN_PCD_FROM_FW_CFG (PcdResizeXterm);
c4e3b2
+  return RETURN_SUCCESS;
c4e3b2
+}
c4e3b2
diff --git a/ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.inf b/ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.inf
c4e3b2
new file mode 100644
c4e3b2
index 0000000000..a51dbd1670
c4e3b2
--- /dev/null
c4e3b2
+++ b/ArmVirtPkg/Library/TerminalPcdProducerLib/TerminalPcdProducerLib.inf
c4e3b2
@@ -0,0 +1,33 @@
c4e3b2
+## @file
c4e3b2
+#  Plugin library for setting up dynamic PCDs for TerminalDxe, from fw_cfg
c4e3b2
+#
c4e3b2
+#  Copyright (C) 2015-2020, Red Hat, Inc.
c4e3b2
+#  Copyright (c) 2014, Linaro Ltd. All rights reserved.
c4e3b2
+#
c4e3b2
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
c4e3b2
+##
c4e3b2
+
c4e3b2
+[Defines]
c4e3b2
+  INF_VERSION                    = 0x00010005
c4e3b2
+  BASE_NAME                      = TerminalPcdProducerLib
c4e3b2
+  FILE_GUID                      = 4a0c5ed7-8c42-4c01-8f4c-7bf258316a96
c4e3b2
+  MODULE_TYPE                    = BASE
c4e3b2
+  VERSION_STRING                 = 1.0
c4e3b2
+  LIBRARY_CLASS                  = NULL
c4e3b2
+  CONSTRUCTOR                    = TerminalPcdProducerLibConstructor
c4e3b2
+
c4e3b2
+[Sources]
c4e3b2
+  TerminalPcdProducerLib.c
c4e3b2
+
c4e3b2
+[Packages]
c4e3b2
+  MdeModulePkg/MdeModulePkg.dec
c4e3b2
+  MdePkg/MdePkg.dec
c4e3b2
+  OvmfPkg/OvmfPkg.dec
c4e3b2
+
c4e3b2
+[LibraryClasses]
c4e3b2
+  DebugLib
c4e3b2
+  PcdLib
c4e3b2
+  QemuFwCfgSimpleParserLib
c4e3b2
+
c4e3b2
+[Pcd]
c4e3b2
+  gEfiMdeModulePkgTokenSpaceGuid.PcdResizeXterm ## SOMETIMES_PRODUCES
c4e3b2
-- 
c4e3b2
2.27.0
c4e3b2