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

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