Blame 0007-ArmVirtPkg-take-PcdResizeXterm-from-the-QEMU-command.patch

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