]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/AcpiPlatformDxe/QemuLoader.h
OvmfPkg: resolve OrderedCollectionLib with base red-black tree instance
[mirror_edk2.git] / OvmfPkg / AcpiPlatformDxe / QemuLoader.h
CommitLineData
a618eaa1
LE
1/** @file\r
2 Command structures for the QEMU FwCfg table loader interface.\r
3\r
4 Copyright (C) 2014, Red Hat, Inc.\r
5\r
6 This program and the accompanying materials are licensed and made available\r
7 under the terms and conditions of the BSD License which accompanies this\r
8 distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r
12 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef __QEMU_LOADER_H__\r
17#define __QEMU_LOADER_H__\r
18\r
19#include <Include/Base.h>\r
20#include <Library/QemuFwCfgLib.h>\r
21\r
22//\r
23// The types and the documentation reflects the SeaBIOS interface. In OVMF we\r
24// use a minimal subset of it.\r
25//\r
26#define QEMU_LOADER_FNAME_SIZE QEMU_FW_CFG_FNAME_SIZE\r
27\r
28//\r
29// We only look at the Allocate command, and only to get FwCfg filenames.\r
30//\r
31typedef enum {\r
32 QemuLoaderCmdAllocate = 1,\r
33 QemuLoaderCmdAddPointer,\r
34 QemuLoaderCmdAddChecksum\r
35} QEMU_LOADER_COMMAND_TYPE;\r
36\r
37typedef enum {\r
38 QemuLoaderAllocHigh = 1,\r
39 QemuLoaderAllocFSeg\r
40} QEMU_LOADER_ALLOC_ZONE;\r
41\r
42#pragma pack (1)\r
43//\r
44// QemuLoaderCmdAllocate: download the fw_cfg file named File, to a buffer\r
45// allocated in the zone specified by Zone, aligned at a multiple of Alignment.\r
46//\r
47typedef struct {\r
48 UINT8 File[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r
49 UINT32 Alignment; // power of two\r
50 UINT8 Zone; // QEMU_LOADER_ALLOC_ZONE values\r
51} QEMU_LOADER_ALLOCATE;\r
52\r
53//\r
54// QemuLoaderCmdAddPointer: the bytes at\r
55// [PointerOffset..PointerOffset+PointerSize) in the file PointerFile contain a\r
56// relative pointer (an offset) into PointeeFile. Increment the relative\r
57// pointer's value by the base address of where PointeeFile's contents have\r
58// been placed (when QemuLoaderCmdAllocate has been executed for PointeeFile).\r
59//\r
60typedef struct {\r
61 UINT8 PointerFile[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r
62 UINT8 PointeeFile[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r
63 UINT32 PointerOffset;\r
64 UINT8 PointerSize; // one of 1, 2, 4, 8\r
65} QEMU_LOADER_ADD_POINTER;\r
66\r
67//\r
68// QemuLoaderCmdAddChecksum: calculate the UINT8 checksum (as per\r
69// CalculateChecksum8()) of the range [Start..Start+Length) in File. Store the\r
70// UINT8 result at ResultOffset in the same File.\r
71//\r
72typedef struct {\r
73 UINT8 File[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r
74 UINT32 ResultOffset;\r
75 UINT32 Start;\r
76 UINT32 Length;\r
77} QEMU_LOADER_ADD_CHECKSUM;\r
78\r
79typedef struct {\r
80 UINT32 Type; // QEMU_LOADER_COMMAND_TYPE values\r
81 union {\r
82 QEMU_LOADER_ALLOCATE Allocate;\r
83 QEMU_LOADER_ADD_POINTER AddPointer;\r
84 QEMU_LOADER_ADD_CHECKSUM AddChecksum;\r
85 UINT8 Padding[124];\r
86 } Command;\r
87} QEMU_LOADER_ENTRY;\r
88#pragma pack ()\r
89\r
90#endif\r