]>
Commit | Line | Data |
---|---|---|
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 | |
b26f0cf9 | 7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
f1ec65ba | 8 | \r |
9 | **/\r | |
10 | \r | |
11 | #ifndef __FW_CFG_LIB__\r | |
12 | #define __FW_CFG_LIB__\r | |
13 | \r | |
5583a8a4 | 14 | #include <IndustryStandard/QemuFwCfg.h>\r |
f1ec65ba | 15 | \r |
16 | /**\r | |
17 | Returns a boolean indicating if the firmware configuration interface\r | |
18 | is available or not.\r | |
19 | \r | |
0dc231c9 LE |
20 | This function may change fw_cfg state.\r |
21 | \r | |
f1ec65ba | 22 | @retval TRUE The interface is available\r |
23 | @retval FALSE The interface is not available\r | |
24 | \r | |
25 | **/\r | |
26 | BOOLEAN\r | |
27 | EFIAPI\r | |
28 | QemuFwCfgIsAvailable (\r | |
29 | VOID\r | |
30 | );\r | |
31 | \r | |
32 | \r | |
33 | /**\r | |
34 | Selects a firmware configuration item for reading.\r | |
35 | \r | |
36 | Following this call, any data read from this item will start from\r | |
37 | the beginning of the configuration item's data.\r | |
38 | \r | |
39 | @param[in] QemuFwCfgItem - Firmware Configuration item to read\r | |
40 | \r | |
41 | **/\r | |
42 | VOID\r | |
43 | EFIAPI\r | |
44 | QemuFwCfgSelectItem (\r | |
45 | IN FIRMWARE_CONFIG_ITEM QemuFwCfgItem\r | |
46 | );\r | |
47 | \r | |
48 | \r | |
49 | /**\r | |
50 | Reads firmware configuration bytes into a buffer\r | |
51 | \r | |
52 | If called multiple times, then the data read will\r | |
53 | continue at the offset of the firmware configuration\r | |
54 | item where the previous read ended.\r | |
55 | \r | |
56 | @param[in] Size - Size in bytes to read\r | |
57 | @param[in] Buffer - Buffer to store data into\r | |
58 | \r | |
59 | **/\r | |
60 | VOID\r | |
61 | EFIAPI\r | |
62 | QemuFwCfgReadBytes (\r | |
63 | IN UINTN Size,\r | |
64 | IN VOID *Buffer OPTIONAL\r | |
65 | );\r | |
66 | \r | |
67 | \r | |
29874a8c | 68 | /**\r |
69 | Writes firmware configuration bytes from a buffer\r | |
70 | \r | |
71 | If called multiple times, then the data written will\r | |
72 | continue at the offset of the firmware configuration\r | |
73 | item where the previous write ended.\r | |
74 | \r | |
75 | @param[in] Size - Size in bytes to write\r | |
76 | @param[in] Buffer - Buffer to read data from\r | |
77 | \r | |
78 | **/\r | |
79 | VOID\r | |
80 | EFIAPI\r | |
81 | QemuFwCfgWriteBytes (\r | |
82 | IN UINTN Size,\r | |
83 | IN VOID *Buffer\r | |
84 | );\r | |
85 | \r | |
86 | \r | |
fcca9f67 LE |
87 | /**\r |
88 | Skip bytes in the firmware configuration item.\r | |
89 | \r | |
90 | Increase the offset of the firmware configuration item without transferring\r | |
91 | bytes between the item and a caller-provided buffer. Subsequent read, write\r | |
92 | or skip operations will commence at the increased offset.\r | |
93 | \r | |
94 | @param[in] Size Number of bytes to skip.\r | |
95 | **/\r | |
96 | VOID\r | |
97 | EFIAPI\r | |
98 | QemuFwCfgSkipBytes (\r | |
99 | IN UINTN Size\r | |
100 | );\r | |
101 | \r | |
102 | \r | |
f1ec65ba | 103 | /**\r |
104 | Reads a UINT8 firmware configuration value\r | |
105 | \r | |
106 | @return Value of Firmware Configuration item read\r | |
107 | \r | |
108 | **/\r | |
109 | UINT8\r | |
110 | EFIAPI\r | |
111 | QemuFwCfgRead8 (\r | |
112 | VOID\r | |
113 | );\r | |
114 | \r | |
115 | \r | |
116 | /**\r | |
117 | Reads a UINT16 firmware configuration value\r | |
118 | \r | |
119 | @return Value of Firmware Configuration item read\r | |
120 | \r | |
121 | **/\r | |
122 | UINT16\r | |
123 | EFIAPI\r | |
124 | QemuFwCfgRead16 (\r | |
125 | VOID\r | |
126 | );\r | |
127 | \r | |
128 | \r | |
129 | /**\r | |
130 | Reads a UINT32 firmware configuration value\r | |
131 | \r | |
132 | @return Value of Firmware Configuration item read\r | |
133 | \r | |
134 | **/\r | |
135 | UINT32\r | |
136 | EFIAPI\r | |
137 | QemuFwCfgRead32 (\r | |
138 | VOID\r | |
139 | );\r | |
140 | \r | |
141 | \r | |
142 | /**\r | |
143 | Reads a UINT64 firmware configuration value\r | |
144 | \r | |
145 | @return Value of Firmware Configuration item read\r | |
146 | \r | |
147 | **/\r | |
148 | UINT64\r | |
149 | EFIAPI\r | |
150 | QemuFwCfgRead64 (\r | |
151 | VOID\r | |
152 | );\r | |
153 | \r | |
154 | \r | |
0ac9bc9b | 155 | /**\r |
156 | Find the configuration item corresponding to the firmware configuration file.\r | |
157 | \r | |
158 | @param[in] Name - Name of file to look up.\r | |
159 | @param[out] Item - Configuration item corresponding to the file, to be passed\r | |
160 | to QemuFwCfgSelectItem ().\r | |
161 | @param[out] Size - Number of bytes in the file.\r | |
162 | \r | |
163 | @return RETURN_SUCCESS If file is found.\r | |
164 | RETURN_NOT_FOUND If file is not found.\r | |
165 | RETURN_UNSUPPORTED If firmware configuration is unavailable.\r | |
166 | \r | |
167 | **/\r | |
168 | RETURN_STATUS\r | |
169 | EFIAPI\r | |
170 | QemuFwCfgFindFile (\r | |
171 | IN CONST CHAR8 *Name,\r | |
172 | OUT FIRMWARE_CONFIG_ITEM *Item,\r | |
173 | OUT UINTN *Size\r | |
174 | );\r | |
0dc231c9 | 175 | \r |
f1ec65ba | 176 | #endif\r |
177 | \r |