public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: devel@edk2.groups.io
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>,
	Zhiguang Liu <zhiguang@liu@intel.com>,
	Michael D Kinney <michael.d.kinney@intel.com>
Subject: [PATCH 3/6] SimicsOpenBoardPkg: Enable serial terminal
Date: Wed, 24 May 2023 20:28:49 +0800	[thread overview]
Message-ID: <20230524122852.2047-4-ray.ni@intel.com> (raw)
In-Reply-To: <20230524122852.2047-1-ray.ni@intel.com>

Signed-off-by: Ray Ni <ray.ni@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Zhiguang Liu <zhiguang@liu@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
---
 .../BoardX58Ich10/OpenBoardPkg.fdf            |  1 -
 .../BoardX58Ich10/OpenBoardPkgPcd.dsc         |  1 +
 .../Library/BoardBdsHookLib/BoardBdsHookLib.c | 56 ++++++++-----------
 3 files changed, 24 insertions(+), 34 deletions(-)

diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf
index 6ecff76362..aa44c01784 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf
@@ -198,7 +198,6 @@ INF  UefiCpuPkg/CpuDxe/CpuDxe.inf
 INF  MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
 INF  MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
 INF  UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf
-INF  MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
 INF  MdeModulePkg/Universal/PrintDxe/PrintDxe.inf
 INF  MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
 INF  MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc
index 732d95e44f..b6672d1a78 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkgPcd.dsc
@@ -69,6 +69,7 @@
   ######################################
   gNetworkFeaturePkgTokenSpaceGuid.PcdNetworkFeatureEnable|TRUE
   gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable|TRUE
+  gMinPlatformPkgTokenSpaceGuid.PcdSerialTerminalEnable|TRUE
 
 [PcdsFeatureFlag.X64]
   ######################################
diff --git a/Platform/Intel/SimicsOpenBoardPkg/Library/BoardBdsHookLib/BoardBdsHookLib.c b/Platform/Intel/SimicsOpenBoardPkg/Library/BoardBdsHookLib/BoardBdsHookLib.c
index 3c6385c12f..238513f666 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/Library/BoardBdsHookLib/BoardBdsHookLib.c
+++ b/Platform/Intel/SimicsOpenBoardPkg/Library/BoardBdsHookLib/BoardBdsHookLib.c
@@ -837,45 +837,35 @@ PlatformInitializeConsole (
   )
 {
   UINTN                              Index;
-  EFI_DEVICE_PATH_PROTOCOL           *VarConout;
-  EFI_DEVICE_PATH_PROTOCOL           *VarConin;
 
   //
-  // Connect RootBridge
+  // Do platform specific PCI Device check and add them to ConOut, ConIn, ErrOut
+  // Note: Why perform the ConIn/ConOut/ErrOut variables update without checking
+  //          whether "ConIn", "ConOut" or "ErrOut" is present in the variable store?
+  //       Because SerialPortTerminalLib.constructor() adds the serial terminal device
+  //          to "ConIn", "ConOut" and "ErrOut" variables always, checking presence of
+  //          the three variables will lead to the following update logic never runs.
   //
-  GetEfiGlobalVariable2 (EFI_CON_OUT_VARIABLE_NAME, (VOID **) &VarConout, NULL);
-  GetEfiGlobalVariable2 (EFI_CON_IN_VARIABLE_NAME, (VOID **) &VarConin, NULL);
-
-  if (VarConout == NULL || VarConin == NULL) {
-    //
-    // Do platform specific PCI Device check and add them to ConOut, ConIn, ErrOut
-    //
-    DetectAndPreparePlatformPciDevicePaths (FALSE);
-    DetectAndPreparePlatformPciDevicePaths(TRUE);
+  DetectAndPreparePlatformPciDevicePaths (FALSE);
+  DetectAndPreparePlatformPciDevicePaths(TRUE);
+  //
+  // Have chance to connect the platform default console,
+  // the platform default console is the minimue device group
+  // the platform should support
+  //
+  for (Index = 0; PlatformConsole[Index].DevicePath != NULL; ++Index) {
     //
-    // Have chance to connect the platform default console,
-    // the platform default console is the minimue device group
-    // the platform should support
+    // Update the console variable with the connect type
     //
-    for (Index = 0; PlatformConsole[Index].DevicePath != NULL; ++Index) {
-      //
-      // Update the console variable with the connect type
-      //
-      if ((PlatformConsole[Index].ConnectType & CONSOLE_IN) == CONSOLE_IN) {
-        EfiBootManagerUpdateConsoleVariable (ConIn, PlatformConsole[Index].DevicePath, NULL);
-      }
-      if ((PlatformConsole[Index].ConnectType & CONSOLE_OUT) == CONSOLE_OUT) {
-        EfiBootManagerUpdateConsoleVariable (ConOut, PlatformConsole[Index].DevicePath, NULL);
-      }
-      if ((PlatformConsole[Index].ConnectType & STD_ERROR) == STD_ERROR) {
-        EfiBootManagerUpdateConsoleVariable (ErrOut, PlatformConsole[Index].DevicePath, NULL);
-      }
+    if ((PlatformConsole[Index].ConnectType & CONSOLE_IN) == CONSOLE_IN) {
+      EfiBootManagerUpdateConsoleVariable (ConIn, PlatformConsole[Index].DevicePath, NULL);
+    }
+    if ((PlatformConsole[Index].ConnectType & CONSOLE_OUT) == CONSOLE_OUT) {
+      EfiBootManagerUpdateConsoleVariable (ConOut, PlatformConsole[Index].DevicePath, NULL);
+    }
+    if ((PlatformConsole[Index].ConnectType & STD_ERROR) == STD_ERROR) {
+      EfiBootManagerUpdateConsoleVariable (ErrOut, PlatformConsole[Index].DevicePath, NULL);
     }
-  } else {
-    //
-    // Only detect VGA device and add them to ConOut
-    //
-    DetectAndPreparePlatformPciDevicePaths (TRUE);
   }
 }
 
-- 
2.39.1.windows.1


  parent reply	other threads:[~2023-05-24 12:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-24 12:28 [PATCH 0/6] Fine tune SimicsOpenBoardPkg Ni, Ray
2023-05-24 12:28 ` [PATCH 1/6] SimicsOpenBoardPkg: Remove un-used PlatformBootManagerLib Ni, Ray
2023-05-24 12:28 ` [PATCH 2/6] SimicsOpenBoardPkg: Remove logic that loads variable from disk file Ni, Ray
2023-05-24 12:28 ` Ni, Ray [this message]
2023-05-24 12:28 ` [PATCH 4/6] MinPlatform/build_bios.py: Support performance enabled build Ni, Ray
2023-05-24 23:07   ` Chiu, Chasel
2023-05-25  0:44     ` Ni, Ray
2023-05-24 12:28 ` [PATCH 5/6] SimicsOpenBoardPkg: Add "dp" command in performance build Ni, Ray
2023-05-24 12:28 ` [PATCH 6/6] SimicsOpenBoardPkg: Disable DriverBindingSupport perf logging Ni, Ray
     [not found] ` <17621420EF808DC9.12947@groups.io>
2023-05-25  2:10   ` [edk2-devel] [PATCH 1/6] SimicsOpenBoardPkg: Remove un-used PlatformBootManagerLib Ni, Ray
     [not found] ` <17621421B6E6FB43.8048@groups.io>
2023-05-25  2:10   ` [edk2-devel] [PATCH 2/6] SimicsOpenBoardPkg: Remove logic that loads variable from disk file Ni, Ray
     [not found] ` <17621422F0AEB994.8048@groups.io>
2023-05-25  2:11   ` [edk2-devel] [PATCH 6/6] SimicsOpenBoardPkg: Disable DriverBindingSupport perf logging Ni, Ray
     [not found] ` <176214229D12BE31.8048@groups.io>
2023-05-25  2:11   ` [edk2-devel] [PATCH 5/6] SimicsOpenBoardPkg: Add "dp" command in performance build Ni, Ray
     [not found] ` <17621421D3F4CA3E.12947@groups.io>
2023-05-25  2:11   ` [edk2-devel] [PATCH 3/6] SimicsOpenBoardPkg: Enable serial terminal Ni, Ray
2023-05-26  6:36 ` [edk2-devel] [PATCH 0/6] Fine tune SimicsOpenBoardPkg Zhiguang Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230524122852.2047-4-ray.ni@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox