]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: Add AcpiViewCommandLib
authorTomas Pilar <Tomas.Pilar@arm.com>
Fri, 19 Jun 2020 11:59:54 +0000 (12:59 +0100)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 30 Jun 2020 01:39:50 +0000 (01:39 +0000)
The UefiShellAcpiViewCommandLib is converted from NULL library to a
named library so that it may be used in modules other than shell.
The library interface exposes the main method for to AcpiView
functionality as well as a helper method to dump a buffer to a file.

The Shell module is still built by pulling UefiShellAcpiViewCommandLib
as a NULL library to preserve the modularity of shell builds.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Tomas Pilar <tomas.pilar@arm.com>
ShellPkg/Include/Library/AcpiViewCommandLib.h [new file with mode: 0644]
ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c
ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h [deleted file]
ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf
ShellPkg/ShellPkg.dec
ShellPkg/ShellPkg.dsc

diff --git a/ShellPkg/Include/Library/AcpiViewCommandLib.h b/ShellPkg/Include/Library/AcpiViewCommandLib.h
new file mode 100644 (file)
index 0000000..11cf96c
--- /dev/null
@@ -0,0 +1,46 @@
+/** @file\r
+  Library providing 'acpiview' functionality to display and\r
+  validate installed ACPI tables.\r
+\r
+  Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+**/\r
+\r
+#ifndef ACPI_VIEW_COMMAND_LIB_H_\r
+#define ACPI_VIEW_COMMAND_LIB_H_\r
+\r
+/**\r
+  Dump a buffer to a file. Print error message if a file cannot be created.\r
+\r
+  @param[in] FileName   The filename that shall be created to contain the buffer.\r
+  @param[in] Buffer     Pointer to buffer that shall be dumped.\r
+  @param[in] BufferSize The size of buffer to be dumped in bytes.\r
+\r
+  @return The number of bytes that were written\r
+**/\r
+UINTN\r
+EFIAPI\r
+ShellDumpBufferToFile (\r
+  IN CONST CHAR16* FileNameBuffer,\r
+  IN CONST VOID*   Buffer,\r
+  IN CONST UINTN   BufferSize\r
+  );\r
+\r
+/**\r
+  Display and validate ACPI tables.\r
+\r
+  @param[in] ImageHandle  Handle to the Image (NULL if internal).\r
+  @param[in] SystemTable  Pointer to the System Table (NULL if internal).\r
+\r
+  @retval SHELL_INVALID_PARAMETER The command line invocation could not be parsed.\r
+  @retval SHELL_NOT_FOUND         The command failed.\r
+  @retval SHELL_SUCCESS           The command was successful.\r
+**/\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunAcpiView (\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
+  );\r
+\r
+#endif // UEFI_SHELL_ACPIVIEW_COMMAND_LIB_H_\r
index d2240b2e89d5668f90060e57f5fd67d3c55c008f..9a5b013fb234e2a09a12a690607b5b871dffde72 100644 (file)
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
+#include <Library/AcpiViewCommandLib.h>\r
 #include "AcpiParser.h"\r
 #include "AcpiTableParser.h"\r
 #include "AcpiView.h"\r
 #include "AcpiViewConfig.h"\r
-#include "UefiShellAcpiViewCommandLib.h"\r
 \r
 #if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)\r
 #include "Arm/SbbrValidator.h"\r
index e6a65d5bc5f7e19b81ad460183495a495144993c..d2f26ff89f12e596702281c38ab0de3729aa68e4 100644 (file)
 #include <Library/ShellLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/UefiLib.h>\r
+#include <Library/AcpiViewCommandLib.h>\r
 #include <Uefi.h>\r
 \r
 #include "AcpiParser.h"\r
 #include "AcpiTableParser.h"\r
 #include "AcpiView.h"\r
 #include "AcpiViewConfig.h"\r
-#include "UefiShellAcpiViewCommandLib.h"\r
 \r
 CONST CHAR16 gShellAcpiViewFileName[] = L"ShellCommand";\r
 EFI_HII_HANDLE gShellAcpiViewHiiHandle = NULL;\r
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h
deleted file mode 100644 (file)
index b1b1ffe..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/** @file\r
-  Header file for 'acpiview' Shell command functions.\r
-\r
-  Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.<BR>\r
-  SPDX-License-Identifier: BSD-2-Clause-Patent\r
-**/\r
-\r
-#ifndef UEFI_SHELL_ACPIVIEW_COMMAND_LIB_H_\r
-#define UEFI_SHELL_ACPIVIEW_COMMAND_LIB_H_\r
-\r
-/**\r
-  Dump a buffer to a file. Print error message if a file cannot be created.\r
-\r
-  @param[in] FileName   The filename that shall be created to contain the buffer.\r
-  @param[in] Buffer     Pointer to buffer that shall be dumped.\r
-  @param[in] BufferSize The size of buffer to be dumped in bytes.\r
-\r
-  @return The number of bytes that were written\r
-**/\r
-UINTN\r
-EFIAPI\r
-ShellDumpBufferToFile (\r
-  IN CONST CHAR16* FileNameBuffer,\r
-  IN CONST VOID*   Buffer,\r
-  IN CONST UINTN   BufferSize\r
-  );\r
-\r
-/**\r
-  Function for 'acpiview' command.\r
-\r
-  @param[in] ImageHandle  Handle to the Image (NULL if internal).\r
-  @param[in] SystemTable  Pointer to the System Table (NULL if internal).\r
-\r
-  @retval SHELL_INVALID_PARAMETER The command line invocation could not be parsed\r
-  @retval SHELL_NOT_FOUND         The command failed\r
-  @retval SHELL_SUCCESS           The command was successful\r
-**/\r
-SHELL_STATUS\r
-EFIAPI\r
-ShellCommandRunAcpiView (\r
-  IN EFI_HANDLE        ImageHandle,\r
-  IN EFI_SYSTEM_TABLE  *SystemTable\r
-  );\r
-\r
-#endif // UEFI_SHELL_ACPIVIEW_COMMAND_LIB_H_\r
index 92de2391b09f3d8b8522b132cbacb9980ef6c95c..91459f9ec632635ee453c5ef46f67445cd9eee0c 100644 (file)
@@ -14,7 +14,7 @@
   FILE_GUID                      = FB5B305E-84F5-461F-940D-82D345757AFA\r
   MODULE_TYPE                    = UEFI_APPLICATION\r
   VERSION_STRING                 = 1.0\r
-  LIBRARY_CLASS                  = NULL|UEFI_APPLICATION UEFI_DRIVER\r
+  LIBRARY_CLASS                  = AcpiViewCommandLib|UEFI_APPLICATION UEFI_DRIVER\r
   CONSTRUCTOR                    = UefiShellAcpiViewCommandLibConstructor\r
   DESTRUCTOR                     = UefiShellAcpiViewCommandLibDestructor\r
 \r
@@ -46,7 +46,6 @@
   Parsers/Ssdt/SsdtParser.c\r
   Parsers/Xsdt/XsdtParser.c\r
   UefiShellAcpiViewCommandLib.c\r
-  UefiShellAcpiViewCommandLib.h\r
   UefiShellAcpiViewCommandLib.uni\r
 \r
 [Sources.ARM, Sources.AARCH64]\r
index c17e358d15ed079cbece59d857ed87800c601261..d0843d3381268f81c20f5b9f72b1ec148443d554 100644 (file)
@@ -34,6 +34,9 @@
   ## @libraryclass   provides BCFG command\r
   BcfgCommandLib|Include/Library/BcfgCommandLib.h\r
 \r
+  ## @libraryclass   provides the AcpiView command\r
+  AcpiViewCommandLib|Include/Library/AcpiViewCommandLib.h\r
+\r
 [Guids]\r
   gEfiShellEnvironment2ExtGuid    = {0xd2c18636, 0x40e5, 0x4eb5, {0xa3, 0x1b, 0x36, 0x69, 0x5f, 0xd4, 0x2c, 0x87}}\r
   gEfiShellPkgTokenSpaceGuid      = {0x171e9188, 0x31d3, 0x40f5, {0xb1, 0x0c, 0x53, 0x9b, 0x2d, 0xb9, 0x40, 0xcd}}\r
index b7ee856b3a16780fc15256e6b1a0ac9124cc5c63..5d2d96ab071cde68ae5c369019dba4328e6b701c 100644 (file)
@@ -2,7 +2,7 @@
 # Shell Package\r
 #\r
 # Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>\r
-# Copyright (c) 2018, Arm Limited. All rights reserved.<BR>\r
+# Copyright (c) 2018 - 2020, Arm Limited. All rights reserved.<BR>\r
 # Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>\r
 #\r
 #    SPDX-License-Identifier: BSD-2-Clause-Patent\r
@@ -50,6 +50,7 @@
 \r
   PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf\r
   BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf\r
+  AcpiViewCommandLib|ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf\r
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf\r
 \r
   UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf\r