public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Oliver Steffen" <osteffen@redhat.com>
To: devel@edk2.groups.io
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Chasel Chiu <chasel.chiu@intel.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Leif Lindholm <quic_llindhol@quicinc.com>,
	Nate DeSimone <nathaniel.l.desimone@intel.com>,
	Sami Mujawar <sami.mujawar@arm.com>,
	Star Zeng <star.zeng@intel.com>, Andrew Fish <afish@apple.com>,
	Laszlo Ersek <lersek@redhat.com>,
	Oliver Steffen <osteffen@redhat.com>
Subject: [PATCH 2/3] ArmPlatformPkg: PrePeiCore: write early hello message to the serial port
Date: Tue, 26 Jul 2022 09:28:47 +0200	[thread overview]
Message-ID: <20220726072848.640026-3-osteffen@redhat.com> (raw)
In-Reply-To: <20220726072848.640026-1-osteffen@redhat.com>

From: Laszlo Ersek <lersek@redhat.com>

Print the early hello message to the serial port.

The FixedPcdGetSize() macro expands to an integer constant, therefore an
optimizing compiler can eliminate the new code, if the platform DSC
doesn't override the empty string (size=1) default of
PcdEarlyHelloMessage.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Oliver Steffen <osteffen@redhat.com>
---
 ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf  | 2 ++
 ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf | 2 ++
 ArmPlatformPkg/PrePeiCore/PrePeiCore.h          | 1 +
 ArmPlatformPkg/PrePeiCore/MainMPCore.c          | 7 +++++++
 ArmPlatformPkg/PrePeiCore/MainUniCore.c         | 7 +++++++
 5 files changed, 19 insertions(+)

diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf b/ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf
index a5b4722459d1..ea7b220bc831 100644
--- a/ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf
+++ b/ArmPlatformPkg/PrePeiCore/PrePeiCoreMPCore.inf
@@ -66,6 +66,8 @@ [FixedPcd]
   gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize
   gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize
 
+  gArmPlatformTokenSpaceGuid.PcdEarlyHelloMessage
+
   gArmTokenSpaceGuid.PcdGicDistributorBase
   gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase
   gArmTokenSpaceGuid.PcdGicSgiIntId
diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf b/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
index 466a2b01c384..29fb8737cb2f 100644
--- a/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
+++ b/ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
@@ -64,4 +64,6 @@ [FixedPcd]
   gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize
   gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize
 
+  gArmPlatformTokenSpaceGuid.PcdEarlyHelloMessage
+
   gEfiMdeModulePkgTokenSpaceGuid.PcdInitValueInTempStack
diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCore.h b/ArmPlatformPkg/PrePeiCore/PrePeiCore.h
index 0345dd7bdd2a..ae8302becda2 100644
--- a/ArmPlatformPkg/PrePeiCore/PrePeiCore.h
+++ b/ArmPlatformPkg/PrePeiCore/PrePeiCore.h
@@ -16,6 +16,7 @@
 #include <Library/DebugLib.h>
 #include <Library/IoLib.h>
 #include <Library/PcdLib.h>
+#include <Library/SerialPortLib.h>
 
 #include <PiPei.h>
 #include <Ppi/TemporaryRamSupport.h>
diff --git a/ArmPlatformPkg/PrePeiCore/MainMPCore.c b/ArmPlatformPkg/PrePeiCore/MainMPCore.c
index b5d0d3a6442f..21c9d5f6da8f 100644
--- a/ArmPlatformPkg/PrePeiCore/MainMPCore.c
+++ b/ArmPlatformPkg/PrePeiCore/MainMPCore.c
@@ -116,6 +116,13 @@ PrimaryMain (
   UINTN                   TemporaryRamBase;
   UINTN                   TemporaryRamSize;
 
+  if (FixedPcdGetSize (PcdEarlyHelloMessage) > 1) {
+    SerialPortWrite (
+      FixedPcdGetPtr (PcdEarlyHelloMessage),
+      FixedPcdGetSize (PcdEarlyHelloMessage) - 1
+      );
+  }
+
   CreatePpiList (&PpiListSize, &PpiList);
 
   // Enable the GIC Distributor
diff --git a/ArmPlatformPkg/PrePeiCore/MainUniCore.c b/ArmPlatformPkg/PrePeiCore/MainUniCore.c
index 1c2580eb923b..37560540e14f 100644
--- a/ArmPlatformPkg/PrePeiCore/MainUniCore.c
+++ b/ArmPlatformPkg/PrePeiCore/MainUniCore.c
@@ -29,6 +29,13 @@ PrimaryMain (
   UINTN                   TemporaryRamBase;
   UINTN                   TemporaryRamSize;
 
+  if (FixedPcdGetSize (PcdEarlyHelloMessage) > 1) {
+    SerialPortWrite (
+      FixedPcdGetPtr (PcdEarlyHelloMessage),
+      FixedPcdGetSize (PcdEarlyHelloMessage) - 1
+      );
+  }
+
   CreatePpiList (&PpiListSize, &PpiList);
 
   // Adjust the Temporary Ram as the new Ppi List (Common + Platform Ppi Lists) is created at
-- 
2.37.1


  parent reply	other threads:[~2022-07-26  7:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-26  7:28 [PATCH 0/3] ArmPlatformPkg, ArmVirtPkg: Add early hello message Oliver Steffen
2022-07-26  7:28 ` [PATCH 1/3] ArmPlatformPkg: introduce fixed PCD for " Oliver Steffen
2022-07-26  7:28 ` Oliver Steffen [this message]
2022-07-26 10:42   ` [PATCH 2/3] ArmPlatformPkg: PrePeiCore: write early hello message to the serial port Sami Mujawar
2022-07-26 15:50     ` Oliver Steffen
2022-07-26 16:22       ` Sami Mujawar
2022-07-28  9:53         ` Oliver Steffen
2022-08-04 13:20           ` [edk2-devel] " Ard Biesheuvel
2022-07-26  7:28 ` [PATCH 3/3] ArmVirtPkg: set early hello message Oliver Steffen

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=20220726072848.640026-3-osteffen@redhat.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