]>
Commit | Line | Data |
---|---|---|
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 |
27 | typedef enum {\r |
28 | QemuLoaderCmdAllocate = 1,\r | |
29 | QemuLoaderCmdAddPointer,\r | |
30 | QemuLoaderCmdAddChecksum\r | |
31 | } QEMU_LOADER_COMMAND_TYPE;\r | |
32 | \r | |
33 | typedef enum {\r | |
34 | QemuLoaderAllocHigh = 1,\r | |
35 | QemuLoaderAllocFSeg\r | |
36 | } QEMU_LOADER_ALLOC_ZONE;\r | |
37 | \r | |
38 | #pragma pack (1)\r | |
39 | //\r | |
40 | // QemuLoaderCmdAllocate: download the fw_cfg file named File, to a buffer\r | |
41 | // allocated in the zone specified by Zone, aligned at a multiple of Alignment.\r | |
42 | //\r | |
43 | typedef struct {\r | |
44 | UINT8 File[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r | |
45 | UINT32 Alignment; // power of two\r | |
46 | UINT8 Zone; // QEMU_LOADER_ALLOC_ZONE values\r | |
47 | } QEMU_LOADER_ALLOCATE;\r | |
48 | \r | |
49 | //\r | |
50 | // QemuLoaderCmdAddPointer: the bytes at\r | |
51 | // [PointerOffset..PointerOffset+PointerSize) in the file PointerFile contain a\r | |
52 | // relative pointer (an offset) into PointeeFile. Increment the relative\r | |
53 | // pointer's value by the base address of where PointeeFile's contents have\r | |
54 | // been placed (when QemuLoaderCmdAllocate has been executed for PointeeFile).\r | |
55 | //\r | |
56 | typedef struct {\r | |
57 | UINT8 PointerFile[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r | |
58 | UINT8 PointeeFile[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r | |
59 | UINT32 PointerOffset;\r | |
60 | UINT8 PointerSize; // one of 1, 2, 4, 8\r | |
61 | } QEMU_LOADER_ADD_POINTER;\r | |
62 | \r | |
63 | //\r | |
64 | // QemuLoaderCmdAddChecksum: calculate the UINT8 checksum (as per\r | |
65 | // CalculateChecksum8()) of the range [Start..Start+Length) in File. Store the\r | |
66 | // UINT8 result at ResultOffset in the same File.\r | |
67 | //\r | |
68 | typedef struct {\r | |
69 | UINT8 File[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated\r | |
70 | UINT32 ResultOffset;\r | |
71 | UINT32 Start;\r | |
72 | UINT32 Length;\r | |
73 | } QEMU_LOADER_ADD_CHECKSUM;\r | |
74 | \r | |
75 | typedef struct {\r | |
76 | UINT32 Type; // QEMU_LOADER_COMMAND_TYPE values\r | |
77 | union {\r | |
78 | QEMU_LOADER_ALLOCATE Allocate;\r | |
79 | QEMU_LOADER_ADD_POINTER AddPointer;\r | |
80 | QEMU_LOADER_ADD_CHECKSUM AddChecksum;\r | |
81 | UINT8 Padding[124];\r | |
82 | } Command;\r | |
83 | } QEMU_LOADER_ENTRY;\r | |
84 | #pragma pack ()\r | |
85 | \r | |
86 | #endif\r |