]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Include/IndustryStandard/QemuLoader.h
OvmfPkg/AcpiPlatformDxe: move "QemuLoader.h" to IndustryStandard
[mirror_edk2.git] / OvmfPkg / Include / IndustryStandard / QemuLoader.h
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