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