[edk2-devel] [PATCH 15/43] OvmfPkg/XenAcpiPlatformDxe: remove the InstallAcpiTable() helper function

Laszlo Ersek lersek at redhat.com
Wed May 26 20:14:18 UTC 2021


The InstallAcpiTable() helper function buys us nothing. Reduce code
complexity by removing the function.

This patch is best viewed with "git show -b".

Cc: Anthony Perard <anthony.perard at citrix.com>
Cc: Ard Biesheuvel <ardb+tianocore at kernel.org>
Cc: Jordan Justen <jordan.l.justen at intel.com>
Cc: Julien Grall <julien at xen.org>
Cc: Philippe Mathieu-Daudé <philmd at redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek at redhat.com>
---
 OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h |  9 ---
 OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c | 30 ++--------
 OvmfPkg/XenAcpiPlatformDxe/Xen.c          | 60 ++++++++++----------
 3 files changed, 36 insertions(+), 63 deletions(-)

diff --git a/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h b/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h
index 2959ff0be6cf..47d9769ed12b 100644
--- a/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h
+++ b/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h
@@ -9,21 +9,12 @@
 
 #ifndef ACPI_PLATFORM_H_
 #define ACPI_PLATFORM_H_
 
 #include <Protocol/AcpiTable.h> // EFI_ACPI_TABLE_PROTOCOL
 
-EFI_STATUS
-EFIAPI
-InstallAcpiTable (
-  IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol,
-  IN   VOID                          *AcpiTableBuffer,
-  IN   UINTN                         AcpiTableBufferSize,
-  OUT  UINTN                         *TableKey
-  );
-
 EFI_STATUS
 EFIAPI
 InstallXenTables (
   IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol
   );
 
diff --git a/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c b/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c
index 66dcf885859e..daf2bf3f458a 100644
--- a/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c
+++ b/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c
@@ -11,30 +11,12 @@
 #include <Library/UefiBootServicesTableLib.h> // gBS
 #include <Library/XenPlatformLib.h>           // XenDetected()
 #include <Protocol/FirmwareVolume2.h>         // gEfiFirmwareVolume2Protocol...
 
 #include "AcpiPlatform.h"
 
-EFI_STATUS
-EFIAPI
-InstallAcpiTable (
-  IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol,
-  IN   VOID                          *AcpiTableBuffer,
-  IN   UINTN                         AcpiTableBufferSize,
-  OUT  UINTN                         *TableKey
-  )
-{
-  return AcpiProtocol->InstallAcpiTable (
-                         AcpiProtocol,
-                         AcpiTableBuffer,
-                         AcpiTableBufferSize,
-                         TableKey
-                         );
-}
-
-
 /**
   Locate the first instance of a protocol.  If the protocol requested is an
   FV protocol, then it will return the first FV that contains the ACPI table
   storage file.
 
   @param  Instance      Return pointer to the first instance of the protocol
@@ -197,18 +179,18 @@ InstallOvmfFvTables (
       TableSize = ((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->Length;
       ASSERT (Size >= TableSize);
 
       //
       // Install ACPI table
       //
-      Status = InstallAcpiTable (
-                 AcpiTable,
-                 CurrentTable,
-                 TableSize,
-                 &TableHandle
-                 );
+      Status = AcpiTable->InstallAcpiTable (
+                            AcpiTable,
+                            CurrentTable,
+                            TableSize,
+                            &TableHandle
+                            );
 
       //
       // Free memory allocated by ReadSection
       //
       gBS->FreePool (CurrentTable);
 
diff --git a/OvmfPkg/XenAcpiPlatformDxe/Xen.c b/OvmfPkg/XenAcpiPlatformDxe/Xen.c
index e8395db548d9..151376176f7d 100644
--- a/OvmfPkg/XenAcpiPlatformDxe/Xen.c
+++ b/OvmfPkg/XenAcpiPlatformDxe/Xen.c
@@ -182,18 +182,18 @@ InstallXenTables (
       CurrentTablePointer = (UINTN) *(UINT64 *)CurrentTableEntry;
       CurrentTable = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTablePointer;
 
       //
       // Install the XSDT tables
       //
-      Status = InstallAcpiTable (
-                 AcpiProtocol,
-                 CurrentTable,
-                 CurrentTable->Length,
-                 &TableHandle
-                 );
+      Status = AcpiProtocol->InstallAcpiTable (
+                               AcpiProtocol,
+                               CurrentTable,
+                               CurrentTable->Length,
+                               &TableHandle
+                               );
 
       if (EFI_ERROR (Status)) {
         return Status;
       }
 
       //
@@ -232,18 +232,18 @@ InstallXenTables (
       CurrentTablePointer = *(UINT32 *)CurrentTableEntry;
       CurrentTable = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTablePointer;
 
       //
       // Install the RSDT tables
       //
-      Status = InstallAcpiTable (
-                 AcpiProtocol,
-                 CurrentTable,
-                 CurrentTable->Length,
-                 &TableHandle
-                 );
+      Status = AcpiProtocol->InstallAcpiTable (
+                               AcpiProtocol,
+                               CurrentTable,
+                               CurrentTable->Length,
+                               &TableHandle
+                               );
 
       if (EFI_ERROR (Status)) {
         return Status;
       }
 
       //
@@ -263,32 +263,32 @@ InstallXenTables (
   // Install the FACS table.
   //
   if (Fadt2Table) {
     //
     // FACS 2.0
     //
-    Status = InstallAcpiTable (
-               AcpiProtocol,
-               Facs2Table,
-               Facs2Table->Length,
-               &TableHandle
-               );
+    Status = AcpiProtocol->InstallAcpiTable (
+                             AcpiProtocol,
+                             Facs2Table,
+                             Facs2Table->Length,
+                             &TableHandle
+                             );
     if (EFI_ERROR (Status)) {
       return Status;
     }
   }
   else if (Fadt1Table) {
     //
     // FACS 1.0
     //
-    Status = InstallAcpiTable (
-               AcpiProtocol,
-               Facs1Table,
-               Facs1Table->Length,
-               &TableHandle
-               );
+    Status = AcpiProtocol->InstallAcpiTable (
+                             AcpiProtocol,
+                             Facs1Table,
+                             Facs1Table->Length,
+                             &TableHandle
+                             );
     if (EFI_ERROR (Status)) {
       return Status;
     }
   }
 
   //
@@ -298,18 +298,18 @@ InstallXenTables (
   if (DsdtTable == NULL) {
     DEBUG ((DEBUG_ERROR, "%a: no DSDT found\n", __FUNCTION__));
     ASSERT (FALSE);
     CpuDeadLoop ();
   }
 
-  Status = InstallAcpiTable (
-             AcpiProtocol,
-             DsdtTable,
-             DsdtTable->Length,
-             &TableHandle
-             );
+  Status = AcpiProtocol->InstallAcpiTable (
+                           AcpiProtocol,
+                           DsdtTable,
+                           DsdtTable->Length,
+                           &TableHandle
+                           );
   if (EFI_ERROR (Status)) {
     return Status;
   }
 
   return EFI_SUCCESS;
 }
-- 
2.19.1.3.g30247aa5d201




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#75684): https://edk2.groups.io/g/devel/message/75684
Mute This Topic: https://groups.io/mt/83110592/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list