OvmfPkg/MemEncryptSevLib: find pages of initial SMRAM save state map
[mirror_edk2.git] / OvmfPkg / Include / Library / QemuFwCfgLib.h
CommitLineData
f1ec65ba 1/** @file\r
2 QEMU/KVM Firmware Configuration access\r
3\r
29874a8c 4 Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>\r
0dc231c9
LE
5 Copyright (C) 2013, Red Hat, Inc.\r
6\r
f1ec65ba 7 This program and the accompanying materials\r
8 are licensed and made available under the terms and conditions of the BSD License\r
9 which accompanies this distribution. The full text of the license may be found at\r
10 http://opensource.org/licenses/bsd-license.php\r
11\r
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15**/\r
16\r
17#ifndef __FW_CFG_LIB__\r
18#define __FW_CFG_LIB__\r
19\r
5583a8a4 20#include <IndustryStandard/QemuFwCfg.h>\r
f1ec65ba 21\r
22/**\r
23 Returns a boolean indicating if the firmware configuration interface\r
24 is available or not.\r
25\r
0dc231c9
LE
26 This function may change fw_cfg state.\r
27\r
f1ec65ba 28 @retval TRUE The interface is available\r
29 @retval FALSE The interface is not available\r
30\r
31**/\r
32BOOLEAN\r
33EFIAPI\r
34QemuFwCfgIsAvailable (\r
35 VOID\r
36 );\r
37\r
38\r
39/**\r
40 Selects a firmware configuration item for reading.\r
41\r
42 Following this call, any data read from this item will start from\r
43 the beginning of the configuration item's data.\r
44\r
45 @param[in] QemuFwCfgItem - Firmware Configuration item to read\r
46\r
47**/\r
48VOID\r
49EFIAPI\r
50QemuFwCfgSelectItem (\r
51 IN FIRMWARE_CONFIG_ITEM QemuFwCfgItem\r
52 );\r
53\r
54\r
55/**\r
56 Reads firmware configuration bytes into a buffer\r
57\r
58 If called multiple times, then the data read will\r
59 continue at the offset of the firmware configuration\r
60 item where the previous read ended.\r
61\r
62 @param[in] Size - Size in bytes to read\r
63 @param[in] Buffer - Buffer to store data into\r
64\r
65**/\r
66VOID\r
67EFIAPI\r
68QemuFwCfgReadBytes (\r
69 IN UINTN Size,\r
70 IN VOID *Buffer OPTIONAL\r
71 );\r
72\r
73\r
29874a8c 74/**\r
75 Writes firmware configuration bytes from a buffer\r
76\r
77 If called multiple times, then the data written will\r
78 continue at the offset of the firmware configuration\r
79 item where the previous write ended.\r
80\r
81 @param[in] Size - Size in bytes to write\r
82 @param[in] Buffer - Buffer to read data from\r
83\r
84**/\r
85VOID\r
86EFIAPI\r
87QemuFwCfgWriteBytes (\r
88 IN UINTN Size,\r
89 IN VOID *Buffer\r
90 );\r
91\r
92\r
fcca9f67
LE
93/**\r
94 Skip bytes in the firmware configuration item.\r
95\r
96 Increase the offset of the firmware configuration item without transferring\r
97 bytes between the item and a caller-provided buffer. Subsequent read, write\r
98 or skip operations will commence at the increased offset.\r
99\r
100 @param[in] Size Number of bytes to skip.\r
101**/\r
102VOID\r
103EFIAPI\r
104QemuFwCfgSkipBytes (\r
105 IN UINTN Size\r
106 );\r
107\r
108\r
f1ec65ba 109/**\r
110 Reads a UINT8 firmware configuration value\r
111\r
112 @return Value of Firmware Configuration item read\r
113\r
114**/\r
115UINT8\r
116EFIAPI\r
117QemuFwCfgRead8 (\r
118 VOID\r
119 );\r
120\r
121\r
122/**\r
123 Reads a UINT16 firmware configuration value\r
124\r
125 @return Value of Firmware Configuration item read\r
126\r
127**/\r
128UINT16\r
129EFIAPI\r
130QemuFwCfgRead16 (\r
131 VOID\r
132 );\r
133\r
134\r
135/**\r
136 Reads a UINT32 firmware configuration value\r
137\r
138 @return Value of Firmware Configuration item read\r
139\r
140**/\r
141UINT32\r
142EFIAPI\r
143QemuFwCfgRead32 (\r
144 VOID\r
145 );\r
146\r
147\r
148/**\r
149 Reads a UINT64 firmware configuration value\r
150\r
151 @return Value of Firmware Configuration item read\r
152\r
153**/\r
154UINT64\r
155EFIAPI\r
156QemuFwCfgRead64 (\r
157 VOID\r
158 );\r
159\r
160\r
0ac9bc9b 161/**\r
162 Find the configuration item corresponding to the firmware configuration file.\r
163\r
164 @param[in] Name - Name of file to look up.\r
165 @param[out] Item - Configuration item corresponding to the file, to be passed\r
166 to QemuFwCfgSelectItem ().\r
167 @param[out] Size - Number of bytes in the file.\r
168\r
169 @return RETURN_SUCCESS If file is found.\r
170 RETURN_NOT_FOUND If file is not found.\r
171 RETURN_UNSUPPORTED If firmware configuration is unavailable.\r
172\r
173**/\r
174RETURN_STATUS\r
175EFIAPI\r
176QemuFwCfgFindFile (\r
177 IN CONST CHAR8 *Name,\r
178 OUT FIRMWARE_CONFIG_ITEM *Item,\r
179 OUT UINTN *Size\r
180 );\r
0dc231c9 181\r
f1ec65ba 182#endif\r
183\r