]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/AcpiPlatformDxe: move "QemuLoader.h" to IndustryStandard
authorLaszlo Ersek <lersek@redhat.com>
Wed, 26 May 2021 20:14:12 +0000 (22:14 +0200)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 4 Jun 2021 16:01:50 +0000 (16:01 +0000)
Turn the "QemuLoader.h" header into a public (IndustryStandard) one. The
QEMU ACPI linker-loader interface is stable between QEMU and multiple
guest firmwares.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20210526201446.12554-10-lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c
OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
OvmfPkg/AcpiPlatformDxe/QemuLoader.h [deleted file]
OvmfPkg/Include/IndustryStandard/QemuLoader.h [new file with mode: 0644]

index 4522d7f6110cb0ab08bf4785818ff8e6f57dbf30..3daeb2ee42d225427b0a57a39051218878150873 100644 (file)
@@ -28,7 +28,6 @@
   PciDecoding.c\r
   Qemu.c\r
   QemuFwCfgAcpi.c\r
-  QemuLoader.h\r
   Xen.c\r
 \r
 [Packages]\r
index c07b84a213856d8209fc68661fea35153adebb59..621e69410da9ba8924da788f89c8fa9ab4ef38e2 100644 (file)
@@ -9,6 +9,7 @@
 **/\r
 \r
 #include <IndustryStandard/Acpi.h>\r
+#include <IndustryStandard/QemuLoader.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/DxeServicesTableLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
@@ -18,7 +19,6 @@
 #include <Library/QemuFwCfgS3Lib.h>\r
 \r
 #include "AcpiPlatform.h"\r
-#include "QemuLoader.h"\r
 \r
 //\r
 // The user structure for the ordered collection that will track the fw_cfg\r
index cc24f35bd83a7b9aa20f8e8d4b317ada821e87c8..48c8269a8b6f02762b5d55ee82fd0423308c1088 100644 (file)
@@ -27,7 +27,6 @@
   PciDecoding.c\r
   QemuFwCfgAcpi.c\r
   QemuFwCfgAcpiPlatform.c\r
-  QemuLoader.h\r
 \r
 [Packages]\r
   MdeModulePkg/MdeModulePkg.dec\r
diff --git a/OvmfPkg/AcpiPlatformDxe/QemuLoader.h b/OvmfPkg/AcpiPlatformDxe/QemuLoader.h
deleted file mode 100644 (file)
index 5782a23..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/** @file\r
-  Command structures for the QEMU FwCfg table loader interface.\r
-\r
-  Copyright (C) 2014, Red Hat, Inc.\r
-\r
-  SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#ifndef QEMU_LOADER_H_\r
-#define QEMU_LOADER_H_\r
-\r
-#include <Base.h>\r
-#include <IndustryStandard/QemuFwCfg.h>\r
-\r
-//\r
-// The types and the documentation reflects the SeaBIOS interface.\r
-//\r
-#define QEMU_LOADER_FNAME_SIZE QEMU_FW_CFG_FNAME_SIZE\r
-\r
-typedef enum {\r
-  QemuLoaderCmdAllocate = 1,\r
-  QemuLoaderCmdAddPointer,\r
-  QemuLoaderCmdAddChecksum,\r
-  QemuLoaderCmdWritePointer,\r
-} QEMU_LOADER_COMMAND_TYPE;\r
-\r
-typedef enum {\r
-  QemuLoaderAllocHigh = 1,\r
-  QemuLoaderAllocFSeg\r
-} QEMU_LOADER_ALLOC_ZONE;\r
-\r
-#pragma pack (1)\r
-//\r
-// QemuLoaderCmdAllocate: download the fw_cfg file named File, to a buffer\r
-// allocated in the zone specified by Zone, aligned at a multiple of Alignment.\r
-//\r
-typedef struct {\r
-  UINT8  File[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r
-  UINT32 Alignment;                    // power of two\r
-  UINT8  Zone;                         // QEMU_LOADER_ALLOC_ZONE values\r
-} QEMU_LOADER_ALLOCATE;\r
-\r
-//\r
-// QemuLoaderCmdAddPointer: the bytes at\r
-// [PointerOffset..PointerOffset+PointerSize) in the file PointerFile contain a\r
-// relative pointer (an offset) into PointeeFile. Increment the relative\r
-// pointer's value by the base address of where PointeeFile's contents have\r
-// been placed (when QemuLoaderCmdAllocate has been executed for PointeeFile).\r
-//\r
-typedef struct {\r
-  UINT8  PointerFile[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r
-  UINT8  PointeeFile[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r
-  UINT32 PointerOffset;\r
-  UINT8  PointerSize;                         // one of 1, 2, 4, 8\r
-} QEMU_LOADER_ADD_POINTER;\r
-\r
-//\r
-// QemuLoaderCmdAddChecksum: calculate the UINT8 checksum (as per\r
-// CalculateChecksum8()) of the range [Start..Start+Length) in File. Store the\r
-// UINT8 result at ResultOffset in the same File.\r
-//\r
-typedef struct {\r
-  UINT8  File[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r
-  UINT32 ResultOffset;\r
-  UINT32 Start;\r
-  UINT32 Length;\r
-} QEMU_LOADER_ADD_CHECKSUM;\r
-\r
-//\r
-// QemuLoaderCmdWritePointer: the bytes at\r
-// [PointerOffset..PointerOffset+PointerSize) in the writeable fw_cfg file\r
-// PointerFile are to receive the absolute address of PointeeFile, as allocated\r
-// and downloaded by the firmware, incremented by the value of PointeeOffset.\r
-// Store the sum of (a) the base address of where PointeeFile's contents have\r
-// been placed (when QemuLoaderCmdAllocate has been executed for PointeeFile)\r
-// and (b) PointeeOffset, to this portion of PointerFile.\r
-//\r
-// This command is similar to QemuLoaderCmdAddPointer; the difference is that\r
-// the "pointer to patch" does not exist in guest-physical address space, only\r
-// in "fw_cfg file space". In addition, the "pointer to patch" is not\r
-// initialized by QEMU in-place with a possibly nonzero offset value: the\r
-// relative offset into PointeeFile comes from the explicit PointeeOffset\r
-// field.\r
-//\r
-typedef struct {\r
-  UINT8  PointerFile[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r
-  UINT8  PointeeFile[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r
-  UINT32 PointerOffset;\r
-  UINT32 PointeeOffset;\r
-  UINT8  PointerSize;                         // one of 1, 2, 4, 8\r
-} QEMU_LOADER_WRITE_POINTER;\r
-\r
-typedef struct {\r
-  UINT32 Type;                             // QEMU_LOADER_COMMAND_TYPE values\r
-  union {\r
-    QEMU_LOADER_ALLOCATE      Allocate;\r
-    QEMU_LOADER_ADD_POINTER   AddPointer;\r
-    QEMU_LOADER_ADD_CHECKSUM  AddChecksum;\r
-    QEMU_LOADER_WRITE_POINTER WritePointer;\r
-    UINT8                     Padding[124];\r
-  } Command;\r
-} QEMU_LOADER_ENTRY;\r
-#pragma pack ()\r
-\r
-#endif\r
diff --git a/OvmfPkg/Include/IndustryStandard/QemuLoader.h b/OvmfPkg/Include/IndustryStandard/QemuLoader.h
new file mode 100644 (file)
index 0000000..5782a23
--- /dev/null
@@ -0,0 +1,106 @@
+/** @file\r
+  Command structures for the QEMU FwCfg table loader interface.\r
+\r
+  Copyright (C) 2014, Red Hat, Inc.\r
+\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef QEMU_LOADER_H_\r
+#define QEMU_LOADER_H_\r
+\r
+#include <Base.h>\r
+#include <IndustryStandard/QemuFwCfg.h>\r
+\r
+//\r
+// The types and the documentation reflects the SeaBIOS interface.\r
+//\r
+#define QEMU_LOADER_FNAME_SIZE QEMU_FW_CFG_FNAME_SIZE\r
+\r
+typedef enum {\r
+  QemuLoaderCmdAllocate = 1,\r
+  QemuLoaderCmdAddPointer,\r
+  QemuLoaderCmdAddChecksum,\r
+  QemuLoaderCmdWritePointer,\r
+} QEMU_LOADER_COMMAND_TYPE;\r
+\r
+typedef enum {\r
+  QemuLoaderAllocHigh = 1,\r
+  QemuLoaderAllocFSeg\r
+} QEMU_LOADER_ALLOC_ZONE;\r
+\r
+#pragma pack (1)\r
+//\r
+// QemuLoaderCmdAllocate: download the fw_cfg file named File, to a buffer\r
+// allocated in the zone specified by Zone, aligned at a multiple of Alignment.\r
+//\r
+typedef struct {\r
+  UINT8  File[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r
+  UINT32 Alignment;                    // power of two\r
+  UINT8  Zone;                         // QEMU_LOADER_ALLOC_ZONE values\r
+} QEMU_LOADER_ALLOCATE;\r
+\r
+//\r
+// QemuLoaderCmdAddPointer: the bytes at\r
+// [PointerOffset..PointerOffset+PointerSize) in the file PointerFile contain a\r
+// relative pointer (an offset) into PointeeFile. Increment the relative\r
+// pointer's value by the base address of where PointeeFile's contents have\r
+// been placed (when QemuLoaderCmdAllocate has been executed for PointeeFile).\r
+//\r
+typedef struct {\r
+  UINT8  PointerFile[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r
+  UINT8  PointeeFile[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r
+  UINT32 PointerOffset;\r
+  UINT8  PointerSize;                         // one of 1, 2, 4, 8\r
+} QEMU_LOADER_ADD_POINTER;\r
+\r
+//\r
+// QemuLoaderCmdAddChecksum: calculate the UINT8 checksum (as per\r
+// CalculateChecksum8()) of the range [Start..Start+Length) in File. Store the\r
+// UINT8 result at ResultOffset in the same File.\r
+//\r
+typedef struct {\r
+  UINT8  File[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r
+  UINT32 ResultOffset;\r
+  UINT32 Start;\r
+  UINT32 Length;\r
+} QEMU_LOADER_ADD_CHECKSUM;\r
+\r
+//\r
+// QemuLoaderCmdWritePointer: the bytes at\r
+// [PointerOffset..PointerOffset+PointerSize) in the writeable fw_cfg file\r
+// PointerFile are to receive the absolute address of PointeeFile, as allocated\r
+// and downloaded by the firmware, incremented by the value of PointeeOffset.\r
+// Store the sum of (a) the base address of where PointeeFile's contents have\r
+// been placed (when QemuLoaderCmdAllocate has been executed for PointeeFile)\r
+// and (b) PointeeOffset, to this portion of PointerFile.\r
+//\r
+// This command is similar to QemuLoaderCmdAddPointer; the difference is that\r
+// the "pointer to patch" does not exist in guest-physical address space, only\r
+// in "fw_cfg file space". In addition, the "pointer to patch" is not\r
+// initialized by QEMU in-place with a possibly nonzero offset value: the\r
+// relative offset into PointeeFile comes from the explicit PointeeOffset\r
+// field.\r
+//\r
+typedef struct {\r
+  UINT8  PointerFile[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r
+  UINT8  PointeeFile[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r
+  UINT32 PointerOffset;\r
+  UINT32 PointeeOffset;\r
+  UINT8  PointerSize;                         // one of 1, 2, 4, 8\r
+} QEMU_LOADER_WRITE_POINTER;\r
+\r
+typedef struct {\r
+  UINT32 Type;                             // QEMU_LOADER_COMMAND_TYPE values\r
+  union {\r
+    QEMU_LOADER_ALLOCATE      Allocate;\r
+    QEMU_LOADER_ADD_POINTER   AddPointer;\r
+    QEMU_LOADER_ADD_CHECKSUM  AddChecksum;\r
+    QEMU_LOADER_WRITE_POINTER WritePointer;\r
+    UINT8                     Padding[124];\r
+  } Command;\r
+} QEMU_LOADER_ENTRY;\r
+#pragma pack ()\r
+\r
+#endif\r