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