[edk2-devel] [PATCH 3/5] OvmfPkg: move BootScript into AcpiPlatformLib

Corvin Köhne corvink at FreeBSD.org
Wed Jun 14 07:55:45 UTC 2023


This is required to move InstallQemuFwCfgTables into AcpiPlatformLib.

Signed-off-by: Corvin Köhne <corvink at FreeBSD.org>
Cc: Ard Biesheuvel <ardb+tianocore at kernel.org>
Cc: Gerd Hoffmann <kraxel at redhat.com>
Cc: Jiewen Yao <jiewen.yao at intel.com>
Cc: Jordan Justen <jordan.l.justen at intel.com>
Cc: Leif Lindholm <quic_llindhol at quicinc.com>
Cc: Peter Grehan <grehan at freebsd.org>
Cc: Rebecca Cran <rebecca at bsdio.com>
Cc: Sami Mujawar <sami.mujawar at arm.com>
---
 OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf   |  2 --
 .../AcpiPlatformLib/DxeAcpiPlatformLib.inf    |  2 ++
 OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h        | 27 -------------------
 OvmfPkg/Include/Library/AcpiPlatformLib.h     | 27 +++++++++++++++++++
 .../AcpiPlatformLib}/BootScript.c             |  3 +--
 5 files changed, 30 insertions(+), 31 deletions(-)
 rename OvmfPkg/{AcpiPlatformDxe => Library/AcpiPlatformLib}/BootScript.c (96%)

diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
index b22aad95e081..6001b9626970 100644
--- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
+++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -23,7 +23,6 @@ [Defines]
 [Sources]
   AcpiPlatform.c
   AcpiPlatform.h
-  BootScript.c
   CloudHvAcpi.c
   EntryPoint.c
   QemuFwCfgAcpi.c
@@ -40,7 +39,6 @@ [LibraryClasses]
   MemoryAllocationLib
   OrderedCollectionLib
   QemuFwCfgLib
-  QemuFwCfgS3Lib
   UefiDriverEntryPoint
   HobLib
   TpmMeasurementLib
diff --git a/OvmfPkg/Library/AcpiPlatformLib/DxeAcpiPlatformLib.inf b/OvmfPkg/Library/AcpiPlatformLib/DxeAcpiPlatformLib.inf
index 4be501bb2c58..b6e55b618cbb 100644
--- a/OvmfPkg/Library/AcpiPlatformLib/DxeAcpiPlatformLib.inf
+++ b/OvmfPkg/Library/AcpiPlatformLib/DxeAcpiPlatformLib.inf
@@ -15,6 +15,7 @@ [Defines]
   LIBRARY_CLASS  = AcpiPlatformLib
 
 [Sources]
+  BootScript.c
   DxeAcpiPlatformLib.c
   PciDecoding.c
 
@@ -27,6 +28,7 @@ [LibraryClasses]
   BaseLib
   DebugLib
   PcdLib
+  QemuFwCfgS3Lib
   UefiBootServicesTableLib
 
 [Pcd]
diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
index 1328f6d1cba6..c9f2755014a1 100644
--- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
+++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
@@ -11,8 +11,6 @@
 
 #include <Protocol/AcpiTable.h> // EFI_ACPI_TABLE_PROTOCOL
 
-typedef struct S3_CONTEXT S3_CONTEXT;
-
 EFI_STATUS
 EFIAPI
 InstallCloudHvTablesTdx (
@@ -37,29 +35,4 @@ InstallAcpiTables (
   IN   EFI_ACPI_TABLE_PROTOCOL  *AcpiTable
   );
 
-EFI_STATUS
-AllocateS3Context (
-  OUT S3_CONTEXT  **S3Context,
-  IN  UINTN       WritePointerCount
-  );
-
-VOID
-ReleaseS3Context (
-  IN S3_CONTEXT  *S3Context
-  );
-
-EFI_STATUS
-SaveCondensedWritePointerToS3Context (
-  IN OUT S3_CONTEXT  *S3Context,
-  IN     UINT16      PointerItem,
-  IN     UINT8       PointerSize,
-  IN     UINT32      PointerOffset,
-  IN     UINT64      PointerValue
-  );
-
-EFI_STATUS
-TransferS3ContextToBootScript (
-  IN S3_CONTEXT  *S3Context
-  );
-
 #endif
diff --git a/OvmfPkg/Include/Library/AcpiPlatformLib.h b/OvmfPkg/Include/Library/AcpiPlatformLib.h
index 167d6c49d6e2..70c974dce05e 100644
--- a/OvmfPkg/Include/Library/AcpiPlatformLib.h
+++ b/OvmfPkg/Include/Library/AcpiPlatformLib.h
@@ -15,6 +15,8 @@ typedef struct {
   UINT64                 PciAttributes;
 } ORIGINAL_ATTRIBUTES;
 
+typedef struct S3_CONTEXT S3_CONTEXT;
+
 /**
   Searches and returns the address of the ACPI Root System Description Pointer (RSDP) in system memory.
 
@@ -69,4 +71,29 @@ RestorePciDecoding (
   IN UINTN                Count
   );
 
+EFI_STATUS
+AllocateS3Context (
+  OUT S3_CONTEXT  **S3Context,
+  IN  UINTN       WritePointerCount
+  );
+
+VOID
+ReleaseS3Context (
+  IN S3_CONTEXT  *S3Context
+  );
+
+EFI_STATUS
+SaveCondensedWritePointerToS3Context (
+  IN OUT S3_CONTEXT  *S3Context,
+  IN     UINT16      PointerItem,
+  IN     UINT8       PointerSize,
+  IN     UINT32      PointerOffset,
+  IN     UINT64      PointerValue
+  );
+
+EFI_STATUS
+TransferS3ContextToBootScript (
+  IN S3_CONTEXT  *S3Context
+  );
+
 #endif
diff --git a/OvmfPkg/AcpiPlatformDxe/BootScript.c b/OvmfPkg/Library/AcpiPlatformLib/BootScript.c
similarity index 96%
rename from OvmfPkg/AcpiPlatformDxe/BootScript.c
rename to OvmfPkg/Library/AcpiPlatformLib/BootScript.c
index ff1491de0d2d..1b1658d703b0 100644
--- a/OvmfPkg/AcpiPlatformDxe/BootScript.c
+++ b/OvmfPkg/Library/AcpiPlatformLib/BootScript.c
@@ -7,13 +7,12 @@
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
+#include <Library/AcpiPlatformLib.h>
 #include <Library/BaseLib.h>             // CpuDeadLoop()
 #include <Library/DebugLib.h>            // DEBUG()
 #include <Library/MemoryAllocationLib.h> // AllocatePool()
 #include <Library/QemuFwCfgS3Lib.h>      // QemuFwCfgS3ScriptSkipBytes()
 
-#include "AcpiPlatform.h"
-
 //
 // Condensed structure for capturing the fw_cfg operations -- select, skip,
 // write -- inherent in executing a QEMU_LOADER_WRITE_POINTER command.
-- 
2.41.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106077): https://edk2.groups.io/g/devel/message/106077
Mute This Topic: https://groups.io/mt/99523355/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