public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Marcin Juszkiewicz" <marcin.juszkiewicz@linaro.org>
To: devel@edk2.groups.io
Cc: Leif Lindholm <quic_llindhol@quicinc.com>,
	 Ard Biesheuvel <ardb+tianocore@kernel.org>,
	 Graeme Gregory <graeme@xora.org.uk>,
	 Xiong Yining <xiongyining1480@phytium.com.cn>,
	 Chen Baozi <chenbaozi@phytium.com.cn>,
	 Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
Subject: [edk2-devel] [PATCH edk2-platforms v6 5/7] Platform/SbsaQemu: hang if there is no cpu information
Date: Wed, 06 Mar 2024 03:42:02 -0800	[thread overview]
Message-ID: <20240306-no-dt-for-cpu-v6-5-acd8727a1b59@linaro.org> (raw)
In-Reply-To: <20240306-no-dt-for-cpu-v6-0-acd8727a1b59@linaro.org>

In case we do not have cpu information (SMC call fails,
our minimal DT lacks info) we shutdown system.

Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
---
 .../Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.inf        | 2 ++
 .../SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.c | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.inf b/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.inf
index 5358dd339eb3..acf91225b4c7 100644
--- a/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.inf
+++ b/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.inf
@@ -21,6 +21,7 @@ [Packages]
   ArmPkg/ArmPkg.dec
   EmbeddedPkg/EmbeddedPkg.dec
   MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
   Silicon/Qemu/SbsaQemu/SbsaQemu.dec
 
 [LibraryClasses]
@@ -28,6 +29,7 @@ [LibraryClasses]
   BaseMemoryLib
   DebugLib
   FdtLib
+  ResetSystemLib
 
  [Pcd]
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdDeviceTreeBaseAddress
diff --git a/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.c b/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.c
index 6315cce3fb7f..e1f1a9588b19 100644
--- a/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.c
+++ b/Silicon/Qemu/SbsaQemu/Library/SbsaQemuHardwareInfoLib/SbsaQemuHardwareInfoLib.c
@@ -10,6 +10,7 @@
 #include <Library/ArmSmcLib.h>
 #include <Library/DebugLib.h>
 #include <Library/PcdLib.h>
+#include <Library/ResetSystemLib.h>
 #include <Library/SbsaQemuHardwareInfoLib.h>
 #include <libfdt.h>
 #include <IndustryStandard/SbsaQemuSmc.h>
@@ -95,7 +96,7 @@ FdtHelperCountCpus (
   Node = fdt_path_offset (DeviceTreeBase, "/cpus");
   if (Node <= 0) {
     DEBUG ((DEBUG_ERROR, "Unable to locate /cpus in DeviceTree\n"));
-    return 0;
+    ResetShutdown();
   }
 
   CpuCount = 0;

-- 
2.44.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116430): https://edk2.groups.io/g/devel/message/116430
Mute This Topic: https://groups.io/mt/104763767/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  parent reply	other threads:[~2024-03-06 11:42 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-06 11:41 [edk2-devel] [PATCH edk2-platforms v6 0/7] get rid of DeviceTree from SbsaQemu Marcin Juszkiewicz
2024-03-06 11:41 ` [edk2-devel] [PATCH edk2-platforms v6 1/7] Platform/SbsaQemu: add SbsaQemuHardwareInfoLib Marcin Juszkiewicz
2024-03-14 15:09   ` Ard Biesheuvel
2024-03-14 15:14     ` Ard Biesheuvel
2024-03-15 11:34       ` Marcin Juszkiewicz
2024-03-06 11:41 ` [edk2-devel] [PATCH edk2-platforms v6 2/7] Platform/SbsaQemu: read amount of cpus during init Marcin Juszkiewicz
2024-03-14 15:13   ` Ard Biesheuvel
2024-03-15 11:49     ` Marcin Juszkiewicz
2024-03-19 10:25       ` Marcin Juszkiewicz
2024-03-19 11:02         ` Ard Biesheuvel
2024-03-19 11:27           ` Marcin Juszkiewicz
2024-03-06 11:42 ` [edk2-devel] [PATCH edk2-platforms v6 3/7] Platform/SbsaQemu: use PcdCoreCount directly Marcin Juszkiewicz
2024-03-14 15:15   ` Ard Biesheuvel
2024-03-06 11:42 ` [edk2-devel] [PATCH edk2-platforms v6 4/7] Platform/SbsaQemu: move FdtHandlerLib to SbsaQemuHardwareInfoLib Marcin Juszkiewicz
2024-03-14 15:16   ` Ard Biesheuvel
2024-03-06 11:42 ` Marcin Juszkiewicz [this message]
2024-03-06 11:42 ` [edk2-devel] [PATCH edk2-platforms v6 6/7] Platform/SbsaQemu: get the information of memory via SMC calls Marcin Juszkiewicz
2024-03-14 15:18   ` Ard Biesheuvel
2024-03-06 11:42 ` [edk2-devel] [PATCH edk2-platforms v6 7/7] Platform/SbsaQemu: add DeviceTree fallbacks to parse memory information Marcin Juszkiewicz

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=20240306-no-dt-for-cpu-v6-5-acd8727a1b59@linaro.org \
    --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