summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/AcpiPlatformDxe/QemuLoader.h
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2014-06-19 06:13:29 +0000
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2014-06-19 06:13:29 +0000
commita618eaa1f45d53073784460ec2c8d9c3d097b789 (patch)
tree773de2c5903544ff093cce15190552bff4da9ec2 /OvmfPkg/AcpiPlatformDxe/QemuLoader.h
parent374df8fc59622f78de0cefaf073c44076cc44f7e (diff)
downloadedk2-a618eaa1f45d53073784460ec2c8d9c3d097b789.tar.gz
edk2-a618eaa1f45d53073784460ec2c8d9c3d097b789.tar.bz2
edk2-a618eaa1f45d53073784460ec2c8d9c3d097b789.zip
OvmfPkg: AcpiPlatformDxe: don't rely on unstable QEMU interface
The fw_cfg file "etc/acpi/tables" is not a stable guest interface -- QEMU could rename it in the future, and/or introduce additional fw_cfg files with ACPI payload. Only the higher-level "etc/table-loader" file is considered stable, which contains a sequence of commands to assist firmware with reading QEMU ACPI tables from the FwCfg interface. Because edk2 provides publishing support for ACPI tables, OVMF only uses the Allocate command to find the names of FwCfg files to read and publish as ACPI tables. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15574 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'OvmfPkg/AcpiPlatformDxe/QemuLoader.h')
-rw-r--r--OvmfPkg/AcpiPlatformDxe/QemuLoader.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/OvmfPkg/AcpiPlatformDxe/QemuLoader.h b/OvmfPkg/AcpiPlatformDxe/QemuLoader.h
new file mode 100644
index 0000000000..b8f6147ceb
--- /dev/null
+++ b/OvmfPkg/AcpiPlatformDxe/QemuLoader.h
@@ -0,0 +1,90 @@
+/** @file
+ Command structures for the QEMU FwCfg table loader interface.
+
+ Copyright (C) 2014, Red Hat, Inc.
+
+ This program and the accompanying materials are licensed and made available
+ under the terms and conditions of the BSD License which accompanies this
+ distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
+ WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __QEMU_LOADER_H__
+#define __QEMU_LOADER_H__
+
+#include <Include/Base.h>
+#include <Library/QemuFwCfgLib.h>
+
+//
+// The types and the documentation reflects the SeaBIOS interface. In OVMF we
+// use a minimal subset of it.
+//
+#define QEMU_LOADER_FNAME_SIZE QEMU_FW_CFG_FNAME_SIZE
+
+//
+// We only look at the Allocate command, and only to get FwCfg filenames.
+//
+typedef enum {
+ QemuLoaderCmdAllocate = 1,
+ QemuLoaderCmdAddPointer,
+ QemuLoaderCmdAddChecksum
+} QEMU_LOADER_COMMAND_TYPE;
+
+typedef enum {
+ QemuLoaderAllocHigh = 1,
+ QemuLoaderAllocFSeg
+} QEMU_LOADER_ALLOC_ZONE;
+
+#pragma pack (1)
+//
+// QemuLoaderCmdAllocate: download the fw_cfg file named File, to a buffer
+// allocated in the zone specified by Zone, aligned at a multiple of Alignment.
+//
+typedef struct {
+ UINT8 File[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated
+ UINT32 Alignment; // power of two
+ UINT8 Zone; // QEMU_LOADER_ALLOC_ZONE values
+} QEMU_LOADER_ALLOCATE;
+
+//
+// QemuLoaderCmdAddPointer: the bytes at
+// [PointerOffset..PointerOffset+PointerSize) in the file PointerFile contain a
+// relative pointer (an offset) into PointeeFile. Increment the relative
+// pointer's value by the base address of where PointeeFile's contents have
+// been placed (when QemuLoaderCmdAllocate has been executed for PointeeFile).
+//
+typedef struct {
+ UINT8 PointerFile[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated
+ UINT8 PointeeFile[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated
+ UINT32 PointerOffset;
+ UINT8 PointerSize; // one of 1, 2, 4, 8
+} QEMU_LOADER_ADD_POINTER;
+
+//
+// QemuLoaderCmdAddChecksum: calculate the UINT8 checksum (as per
+// CalculateChecksum8()) of the range [Start..Start+Length) in File. Store the
+// UINT8 result at ResultOffset in the same File.
+//
+typedef struct {
+ UINT8 File[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated
+ UINT32 ResultOffset;
+ UINT32 Start;
+ UINT32 Length;
+} QEMU_LOADER_ADD_CHECKSUM;
+
+typedef struct {
+ UINT32 Type; // QEMU_LOADER_COMMAND_TYPE values
+ union {
+ QEMU_LOADER_ALLOCATE Allocate;
+ QEMU_LOADER_ADD_POINTER AddPointer;
+ QEMU_LOADER_ADD_CHECKSUM AddChecksum;
+ UINT8 Padding[124];
+ } Command;
+} QEMU_LOADER_ENTRY;
+#pragma pack ()
+
+#endif