]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/AcpiPlatformDxe/QemuLoader.h
OvmfPkg/MemEncryptSevLib: find pages of initial SMRAM save state map
[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
10de33ec 23// The types and the documentation reflects the SeaBIOS interface.\r
a618eaa1
LE
24//\r
25#define QEMU_LOADER_FNAME_SIZE QEMU_FW_CFG_FNAME_SIZE\r
26\r
a618eaa1
LE
27typedef enum {\r
28 QemuLoaderCmdAllocate = 1,\r
29 QemuLoaderCmdAddPointer,\r
75ccd1d8 30 QemuLoaderCmdAddChecksum,\r
774f52f6 31 QemuLoaderCmdWritePointer,\r
a618eaa1
LE
32} QEMU_LOADER_COMMAND_TYPE;\r
33\r
34typedef enum {\r
35 QemuLoaderAllocHigh = 1,\r
36 QemuLoaderAllocFSeg\r
37} QEMU_LOADER_ALLOC_ZONE;\r
38\r
39#pragma pack (1)\r
40//\r
41// QemuLoaderCmdAllocate: download the fw_cfg file named File, to a buffer\r
42// allocated in the zone specified by Zone, aligned at a multiple of Alignment.\r
43//\r
44typedef struct {\r
45 UINT8 File[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r
46 UINT32 Alignment; // power of two\r
47 UINT8 Zone; // QEMU_LOADER_ALLOC_ZONE values\r
48} QEMU_LOADER_ALLOCATE;\r
49\r
50//\r
51// QemuLoaderCmdAddPointer: the bytes at\r
52// [PointerOffset..PointerOffset+PointerSize) in the file PointerFile contain a\r
53// relative pointer (an offset) into PointeeFile. Increment the relative\r
54// pointer's value by the base address of where PointeeFile's contents have\r
55// been placed (when QemuLoaderCmdAllocate has been executed for PointeeFile).\r
56//\r
57typedef struct {\r
58 UINT8 PointerFile[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r
59 UINT8 PointeeFile[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r
60 UINT32 PointerOffset;\r
61 UINT8 PointerSize; // one of 1, 2, 4, 8\r
62} QEMU_LOADER_ADD_POINTER;\r
63\r
64//\r
65// QemuLoaderCmdAddChecksum: calculate the UINT8 checksum (as per\r
66// CalculateChecksum8()) of the range [Start..Start+Length) in File. Store the\r
67// UINT8 result at ResultOffset in the same File.\r
68//\r
69typedef struct {\r
70 UINT8 File[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r
71 UINT32 ResultOffset;\r
72 UINT32 Start;\r
73 UINT32 Length;\r
74} QEMU_LOADER_ADD_CHECKSUM;\r
75\r
774f52f6
LE
76//\r
77// QemuLoaderCmdWritePointer: the bytes at\r
78// [PointerOffset..PointerOffset+PointerSize) in the writeable fw_cfg file\r
79// PointerFile are to receive the absolute address of PointeeFile, as allocated\r
80// and downloaded by the firmware, incremented by the value of PointeeOffset.\r
81// Store the sum of (a) the base address of where PointeeFile's contents have\r
82// been placed (when QemuLoaderCmdAllocate has been executed for PointeeFile)\r
83// and (b) PointeeOffset, to this portion of PointerFile.\r
84//\r
85// This command is similar to QemuLoaderCmdAddPointer; the difference is that\r
86// the "pointer to patch" does not exist in guest-physical address space, only\r
87// in "fw_cfg file space". In addition, the "pointer to patch" is not\r
88// initialized by QEMU in-place with a possibly nonzero offset value: the\r
89// relative offset into PointeeFile comes from the explicit PointeeOffset\r
90// field.\r
91//\r
92typedef struct {\r
93 UINT8 PointerFile[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r
94 UINT8 PointeeFile[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r
95 UINT32 PointerOffset;\r
96 UINT32 PointeeOffset;\r
97 UINT8 PointerSize; // one of 1, 2, 4, 8\r
98} QEMU_LOADER_WRITE_POINTER;\r
99\r
a618eaa1
LE
100typedef struct {\r
101 UINT32 Type; // QEMU_LOADER_COMMAND_TYPE values\r
102 union {\r
75ccd1d8
LE
103 QEMU_LOADER_ALLOCATE Allocate;\r
104 QEMU_LOADER_ADD_POINTER AddPointer;\r
105 QEMU_LOADER_ADD_CHECKSUM AddChecksum;\r
774f52f6 106 QEMU_LOADER_WRITE_POINTER WritePointer;\r
75ccd1d8 107 UINT8 Padding[124];\r
a618eaa1
LE
108 } Command;\r
109} QEMU_LOADER_ENTRY;\r
110#pragma pack ()\r
111\r
112#endif\r