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