]>
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 | |
f1ec65ba | 32 | /**\r |
33 | Selects a firmware configuration item for reading.\r | |
34 | \r | |
35 | Following this call, any data read from this item will start from\r | |
36 | the beginning of the configuration item's data.\r | |
37 | \r | |
38 | @param[in] QemuFwCfgItem - Firmware Configuration item to read\r | |
39 | \r | |
40 | **/\r | |
41 | VOID\r | |
42 | EFIAPI\r | |
43 | QemuFwCfgSelectItem (\r | |
ac0a286f | 44 | IN FIRMWARE_CONFIG_ITEM QemuFwCfgItem\r |
f1ec65ba | 45 | );\r |
46 | \r | |
f1ec65ba | 47 | /**\r |
48 | Reads firmware configuration bytes into a buffer\r | |
49 | \r | |
50 | If called multiple times, then the data read will\r | |
51 | continue at the offset of the firmware configuration\r | |
52 | item where the previous read ended.\r | |
53 | \r | |
54 | @param[in] Size - Size in bytes to read\r | |
55 | @param[in] Buffer - Buffer to store data into\r | |
56 | \r | |
57 | **/\r | |
58 | VOID\r | |
59 | EFIAPI\r | |
60 | QemuFwCfgReadBytes (\r | |
ac0a286f MK |
61 | IN UINTN Size,\r |
62 | IN VOID *Buffer OPTIONAL\r | |
f1ec65ba | 63 | );\r |
64 | \r | |
29874a8c | 65 | /**\r |
66 | Writes firmware configuration bytes from a buffer\r | |
67 | \r | |
68 | If called multiple times, then the data written will\r | |
69 | continue at the offset of the firmware configuration\r | |
70 | item where the previous write ended.\r | |
71 | \r | |
72 | @param[in] Size - Size in bytes to write\r | |
73 | @param[in] Buffer - Buffer to read data from\r | |
74 | \r | |
75 | **/\r | |
76 | VOID\r | |
77 | EFIAPI\r | |
78 | QemuFwCfgWriteBytes (\r | |
ac0a286f MK |
79 | IN UINTN Size,\r |
80 | IN VOID *Buffer\r | |
29874a8c | 81 | );\r |
82 | \r | |
fcca9f67 LE |
83 | /**\r |
84 | Skip bytes in the firmware configuration item.\r | |
85 | \r | |
86 | Increase the offset of the firmware configuration item without transferring\r | |
87 | bytes between the item and a caller-provided buffer. Subsequent read, write\r | |
88 | or skip operations will commence at the increased offset.\r | |
89 | \r | |
90 | @param[in] Size Number of bytes to skip.\r | |
91 | **/\r | |
92 | VOID\r | |
93 | EFIAPI\r | |
94 | QemuFwCfgSkipBytes (\r | |
ac0a286f | 95 | IN UINTN Size\r |
fcca9f67 LE |
96 | );\r |
97 | \r | |
f1ec65ba | 98 | /**\r |
99 | Reads a UINT8 firmware configuration value\r | |
100 | \r | |
101 | @return Value of Firmware Configuration item read\r | |
102 | \r | |
103 | **/\r | |
104 | UINT8\r | |
105 | EFIAPI\r | |
106 | QemuFwCfgRead8 (\r | |
107 | VOID\r | |
108 | );\r | |
109 | \r | |
f1ec65ba | 110 | /**\r |
111 | Reads a UINT16 firmware configuration value\r | |
112 | \r | |
113 | @return Value of Firmware Configuration item read\r | |
114 | \r | |
115 | **/\r | |
116 | UINT16\r | |
117 | EFIAPI\r | |
118 | QemuFwCfgRead16 (\r | |
119 | VOID\r | |
120 | );\r | |
121 | \r | |
f1ec65ba | 122 | /**\r |
123 | Reads a UINT32 firmware configuration value\r | |
124 | \r | |
125 | @return Value of Firmware Configuration item read\r | |
126 | \r | |
127 | **/\r | |
128 | UINT32\r | |
129 | EFIAPI\r | |
130 | QemuFwCfgRead32 (\r | |
131 | VOID\r | |
132 | );\r | |
133 | \r | |
f1ec65ba | 134 | /**\r |
135 | Reads a UINT64 firmware configuration value\r | |
136 | \r | |
137 | @return Value of Firmware Configuration item read\r | |
138 | \r | |
139 | **/\r | |
140 | UINT64\r | |
141 | EFIAPI\r | |
142 | QemuFwCfgRead64 (\r | |
143 | VOID\r | |
144 | );\r | |
145 | \r | |
0ac9bc9b | 146 | /**\r |
147 | Find the configuration item corresponding to the firmware configuration file.\r | |
148 | \r | |
149 | @param[in] Name - Name of file to look up.\r | |
150 | @param[out] Item - Configuration item corresponding to the file, to be passed\r | |
151 | to QemuFwCfgSelectItem ().\r | |
152 | @param[out] Size - Number of bytes in the file.\r | |
153 | \r | |
154 | @return RETURN_SUCCESS If file is found.\r | |
155 | RETURN_NOT_FOUND If file is not found.\r | |
156 | RETURN_UNSUPPORTED If firmware configuration is unavailable.\r | |
157 | \r | |
158 | **/\r | |
159 | RETURN_STATUS\r | |
160 | EFIAPI\r | |
161 | QemuFwCfgFindFile (\r | |
162 | IN CONST CHAR8 *Name,\r | |
163 | OUT FIRMWARE_CONFIG_ITEM *Item,\r | |
164 | OUT UINTN *Size\r | |
165 | );\r | |
0dc231c9 | 166 | \r |
f1ec65ba | 167 | #endif\r |