public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/2] dp command without ACPI
@ 2023-06-29 21:09 Jeff Brasen
  2023-06-29 21:09 ` [PATCH 1/2] MdeModulePkg/DxeCorePerformanceLib: Install BPDT in config table Jeff Brasen
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jeff Brasen @ 2023-06-29 21:09 UTC (permalink / raw)
  To: devel; +Cc: jian.j.wang, gaoliming, dandan.bi, zhichao.gao, Jeff Brasen

Systems that do not boot with ACPI (system that use device tree for example)
can not use the shell dp command. This patch adds this to the configuration
table so that dp command can get this without the FPDT table.

I am open to other ways for this to be passed if desired (Installed protocol, 
handler of the status code, etc) but wanted to post this to at least get thoughts
on this.

-Jeff

Jeff Brasen (2):
  MdeModulePkg/DxeCorePerformanceLib: Install BPDT in config table
  ShellPkg/Dp: Allow dp command to work without ACPI

 .../DxeCorePerformanceLib/DxeCorePerformanceLib.c     |  2 ++
 ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c         | 11 ++++++++---
 ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf    |  1 +
 .../DpDynamicCommand/DpDynamicCommand.inf             |  1 +
 4 files changed, 12 insertions(+), 3 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] MdeModulePkg/DxeCorePerformanceLib: Install BPDT in config table
  2023-06-29 21:09 [PATCH 0/2] dp command without ACPI Jeff Brasen
@ 2023-06-29 21:09 ` Jeff Brasen
  2023-06-29 21:09 ` [PATCH 2/2] ShellPkg/Dp: Allow dp command to work without ACPI Jeff Brasen
  2023-06-30  1:35 ` 回复: [PATCH 0/2] dp command " gaoliming
  2 siblings, 0 replies; 4+ messages in thread
From: Jeff Brasen @ 2023-06-29 21:09 UTC (permalink / raw)
  To: devel; +Cc: jian.j.wang, gaoliming, dandan.bi, zhichao.gao, Jeff Brasen

Install the performance table into the UEFI configuration table.
This will allow the shell application to get this if the system
is not using ACPI.

Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
---
 .../Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c       | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
index ef14bc0738..e72b04794a 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
@@ -1403,6 +1403,8 @@ ReportFpdtRecordBuffer (
         &BPDTAddr,
         sizeof (UINT64)
         );
+      Status = gBS->InstallConfigurationTable (&gEdkiiFpdtExtendedFirmwarePerformanceGuid, (VOID *)BPDTAddr);
+      ASSERT_EFI_ERROR (Status);
     }
 
     //
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] ShellPkg/Dp: Allow dp command to work without ACPI
  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
  2023-06-30  1:35 ` 回复: [PATCH 0/2] dp command " gaoliming
  2 siblings, 0 replies; 4+ messages in thread
From: Jeff Brasen @ 2023-06-29 21:09 UTC (permalink / raw)
  To: devel; +Cc: jian.j.wang, gaoliming, dandan.bi, zhichao.gao, Jeff Brasen

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* 回复: [PATCH 0/2] dp command without ACPI
  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 ` [PATCH 2/2] ShellPkg/Dp: Allow dp command to work without ACPI Jeff Brasen
@ 2023-06-30  1:35 ` gaoliming
  2 siblings, 0 replies; 4+ messages in thread
From: gaoliming @ 2023-06-30  1:35 UTC (permalink / raw)
  To: 'Jeff Brasen', devel; +Cc: jian.j.wang, dandan.bi, zhichao.gao

Jeff:
  Performance has been stored as FPDT table. It can be directly mapped to
the configuration table. So, this solution is good to me. Reviewed-by:
Liming Gao <gaoliming@byosoft.com.cn>

Thanks
Liming
> -----邮件原件-----
> 发件人: Jeff Brasen <jbrasen@nvidia.com>
> 发送时间: 2023年6月30日 5:09
> 收件人: devel@edk2.groups.io
> 抄送: jian.j.wang@intel.com; gaoliming@byosoft.com.cn;
> dandan.bi@intel.com; zhichao.gao@intel.com; Jeff Brasen
> <jbrasen@nvidia.com>
> 主题: [PATCH 0/2] dp command without ACPI
> 
> Systems that do not boot with ACPI (system that use device tree for
example)
> can not use the shell dp command. This patch adds this to the
configuration
> table so that dp command can get this without the FPDT table.
> 
> I am open to other ways for this to be passed if desired (Installed
protocol,
> handler of the status code, etc) but wanted to post this to at least get
> thoughts
> on this.
> 
> -Jeff
> 
> Jeff Brasen (2):
>   MdeModulePkg/DxeCorePerformanceLib: Install BPDT in config table
>   ShellPkg/Dp: Allow dp command to work without ACPI
> 
>  .../DxeCorePerformanceLib/DxeCorePerformanceLib.c     |  2 ++
>  ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c         | 11
> ++++++++---
>  ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf    |  1 +
>  .../DpDynamicCommand/DpDynamicCommand.inf             |  1 +
>  4 files changed, 12 insertions(+), 3 deletions(-)
> 
> --
> 2.25.1




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-06-30  1:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 2/2] ShellPkg/Dp: Allow dp command to work without ACPI Jeff Brasen
2023-06-30  1:35 ` 回复: [PATCH 0/2] dp command " gaoliming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox