public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Jeff Brasen" <jbrasen@nvidia.com>
To: <devel@edk2.groups.io>
Cc: <jian.j.wang@intel.com>, <gaoliming@byosoft.com.cn>,
	<dandan.bi@intel.com>, <zhichao.gao@intel.com>,
	Jeff Brasen <jbrasen@nvidia.com>
Subject: [PATCH 2/2] ShellPkg/Dp: Allow dp command to work without ACPI
Date: Thu, 29 Jun 2023 21:09:03 +0000	[thread overview]
Message-ID: <3e7139508ece2a4ba8ceb88c6b1348f77bfa7d53.1688072687.git.jbrasen@nvidia.com> (raw)
In-Reply-To: <cover.1688072687.git.jbrasen@nvidia.com>

If the system does not have ACPI setup use the configuration table
to get the performance info.

Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
---
 ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c         | 11 ++++++++---
 ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf    |  1 +
 .../DpDynamicCommand/DpDynamicCommand.inf             |  1 +
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c
index 512a146da6..98c84d2ef9 100644
--- a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c
+++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c
@@ -129,17 +129,22 @@ EFI_STATUS
 GetBootPerformanceTable (
   )
 {
+  EFI_STATUS                  Status;
   FIRMWARE_PERFORMANCE_TABLE  *FirmwarePerformanceTable;
 
   FirmwarePerformanceTable = (FIRMWARE_PERFORMANCE_TABLE *)EfiLocateFirstAcpiTable (
                                                              EFI_ACPI_5_0_FIRMWARE_PERFORMANCE_DATA_TABLE_SIGNATURE
                                                              );
   if (FirmwarePerformanceTable == NULL) {
-    ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GET_ACPI_FPDT_FAIL), mDpHiiHandle);
-    return EFI_NOT_FOUND;
+    Status = EfiGetSystemConfigurationTable (&gEdkiiFpdtExtendedFirmwarePerformanceGuid, (VOID **)&mBootPerformanceTable);
+    if (EFI_ERROR (Status)) {
+      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_GET_ACPI_FPDT_FAIL), mDpHiiHandle);
+      return EFI_NOT_FOUND;
+    }
+  } else {
+    mBootPerformanceTable = (UINT8 *)(UINTN)FirmwarePerformanceTable->BootPointerRecord.BootPerformanceTablePointer;
   }
 
-  mBootPerformanceTable     = (UINT8 *)(UINTN)FirmwarePerformanceTable->BootPointerRecord.BootPerformanceTablePointer;
   mBootPerformanceTableSize = ((BOOT_PERFORMANCE_TABLE *)mBootPerformanceTable)->Header.Length;
 
   return EFI_SUCCESS;
diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf b/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf
index 4a58286b8c..d9e1c23a1e 100644
--- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf
+++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf
@@ -54,6 +54,7 @@
 
 [Guids]
   gPerformanceProtocolGuid                                ## CONSUMES ## SystemTable
+  gEdkiiFpdtExtendedFirmwarePerformanceGuid               ## CONSUMES ## SystemTable
 
 [Protocols]
   gEfiLoadedImageProtocolGuid                             ## CONSUMES
diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf
index 013bdbd4a0..2723fee706 100644
--- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf
+++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.inf
@@ -55,6 +55,7 @@
 
 [Guids]
   gPerformanceProtocolGuid                                ## CONSUMES ## SystemTable
+  gEdkiiFpdtExtendedFirmwarePerformanceGuid               ## CONSUMES ## SystemTable
 
 [Protocols]
   gEfiLoadedImageProtocolGuid                             ## CONSUMES
-- 
2.25.1


  parent reply	other threads:[~2023-06-29 21:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-29 21:09 [PATCH 0/2] dp command without ACPI Jeff Brasen
2023-06-29 21:09 ` [PATCH 1/2] MdeModulePkg/DxeCorePerformanceLib: Install BPDT in config table Jeff Brasen
2023-06-29 21:09 ` Jeff Brasen [this message]
2023-06-30  1:35 ` 回复: [PATCH 0/2] dp command without ACPI gaoliming

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=3e7139508ece2a4ba8ceb88c6b1348f77bfa7d53.1688072687.git.jbrasen@nvidia.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