2 Command structures for the QEMU FwCfg table loader interface.
4 Copyright (C) 2014, Red Hat, Inc.
6 This program and the accompanying materials are licensed and made available
7 under the terms and conditions of the BSD License which accompanies this
8 distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
12 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #ifndef __QEMU_LOADER_H__
17 #define __QEMU_LOADER_H__
19 #include <Include/Base.h>
20 #include <Library/QemuFwCfgLib.h>
23 // The types and the documentation reflects the SeaBIOS interface.
25 #define QEMU_LOADER_FNAME_SIZE QEMU_FW_CFG_FNAME_SIZE
28 QemuLoaderCmdAllocate
= 1,
29 QemuLoaderCmdAddPointer
,
30 QemuLoaderCmdAddChecksum
31 } QEMU_LOADER_COMMAND_TYPE
;
34 QemuLoaderAllocHigh
= 1,
36 } QEMU_LOADER_ALLOC_ZONE
;
40 // QemuLoaderCmdAllocate: download the fw_cfg file named File, to a buffer
41 // allocated in the zone specified by Zone, aligned at a multiple of Alignment.
44 UINT8 File
[QEMU_LOADER_FNAME_SIZE
]; // NUL-terminated
45 UINT32 Alignment
; // power of two
46 UINT8 Zone
; // QEMU_LOADER_ALLOC_ZONE values
47 } QEMU_LOADER_ALLOCATE
;
50 // QemuLoaderCmdAddPointer: the bytes at
51 // [PointerOffset..PointerOffset+PointerSize) in the file PointerFile contain a
52 // relative pointer (an offset) into PointeeFile. Increment the relative
53 // pointer's value by the base address of where PointeeFile's contents have
54 // been placed (when QemuLoaderCmdAllocate has been executed for PointeeFile).
57 UINT8 PointerFile
[QEMU_LOADER_FNAME_SIZE
]; // NUL-terminated
58 UINT8 PointeeFile
[QEMU_LOADER_FNAME_SIZE
]; // NUL-terminated
60 UINT8 PointerSize
; // one of 1, 2, 4, 8
61 } QEMU_LOADER_ADD_POINTER
;
64 // QemuLoaderCmdAddChecksum: calculate the UINT8 checksum (as per
65 // CalculateChecksum8()) of the range [Start..Start+Length) in File. Store the
66 // UINT8 result at ResultOffset in the same File.
69 UINT8 File
[QEMU_LOADER_FNAME_SIZE
]; // NUL-terminated
73 } QEMU_LOADER_ADD_CHECKSUM
;
76 UINT32 Type
; // QEMU_LOADER_COMMAND_TYPE values
78 QEMU_LOADER_ALLOCATE Allocate
;
79 QEMU_LOADER_ADD_POINTER AddPointer
;
80 QEMU_LOADER_ADD_CHECKSUM AddChecksum
;