render / rpms / edk2

Forked from rpms/edk2 3 months ago
Clone

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

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