]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Include/Library/QemuFwCfgSimpleParserLib.h
OvmfPkg: Apply uncrustify changes
[mirror_edk2.git] / OvmfPkg / Include / Library / QemuFwCfgSimpleParserLib.h
CommitLineData
611c7f11
LE
1/** @file\r
2 Parse the contents of named fw_cfg files as simple (scalar) data types.\r
3\r
4 Copyright (C) 2020, Red Hat, Inc.\r
5\r
6 SPDX-License-Identifier: BSD-2-Clause-Patent\r
7**/\r
8\r
9#ifndef QEMU_FW_CFG_SIMPLE_PARSER_LIB_H_\r
10#define QEMU_FW_CFG_SIMPLE_PARSER_LIB_H_\r
11\r
12#include <Base.h>\r
13\r
14/**\r
15 Look up FileName with QemuFwCfgFindFile() from QemuFwCfgLib. Read the fw_cfg\r
16 file into a small array with automatic storage duration. Parse the array as\r
17 the textual representation of a BOOLEAN.\r
18\r
19 @param[in] FileName The name of the fw_cfg file to look up and parse.\r
20\r
21 @param[out] Value On success, Value is TRUE if the contents of the fw_cfg\r
22 file case-insensitively match "true", "yes", "y",\r
23 "enable", "enabled", "1".\r
24\r
25 On success, Value is FALSE if the contents of the fw_cfg\r
26 file case-insensitively match "false", "no", "n",\r
27 "disable", "disabled", "0".\r
28\r
29 On failure, Value is not changed.\r
30\r
31 @retval RETURN_SUCCESS Parsing successful. Value has been set.\r
32\r
33 @retval RETURN_UNSUPPORTED Firmware configuration is unavailable.\r
34\r
35 @retval RETURN_PROTOCOL_ERROR Parsing failed. Value has not been changed.\r
36\r
37 @return Error codes propagated from\r
38 QemuFwCfgFindFile(). Value has not been\r
39 changed.\r
40**/\r
41RETURN_STATUS\r
42EFIAPI\r
43QemuFwCfgParseBool (\r
ac0a286f
MK
44 IN CONST CHAR8 *FileName,\r
45 OUT BOOLEAN *Value\r
611c7f11
LE
46 );\r
47\r
48/**\r
49 Look up FileName with QemuFwCfgFindFile() from QemuFwCfgLib. Read the fw_cfg\r
50 file into a small array with automatic storage duration. Parse the array as\r
51 the textual representation of a UINT8.\r
52\r
53 @param[in] FileName The name of the fw_cfg file to look up and parse.\r
54\r
55 @param[in] ParseAsHex If TRUE, call BaseLib's AsciiStrHexToUint64S() for\r
56 parsing the fw_cfg file.\r
57\r
58 If FALSE, call BaseLib's AsciiStrDecimalToUint64S()\r
59 for parsing the fw_cfg file.\r
60\r
61 @param[out] Value On success, Value has been parsed with the BaseLib\r
62 function determined by ParseAsHex, and also\r
63 range-checked for [0, MAX_UINT8].\r
64\r
65 On failure, Value is not changed.\r
66\r
67 @retval RETURN_SUCCESS Parsing successful. Value has been set.\r
68\r
69 @retval RETURN_UNSUPPORTED Firmware configuration is unavailable.\r
70\r
71 @retval RETURN_PROTOCOL_ERROR Parsing failed. Value has not been changed.\r
72\r
73 @retval RETURN_PROTOCOL_ERROR Parsing succeeded, but the result does not fit\r
74 in the [0, MAX_UINT8] range. Value has not\r
75 been changed.\r
76\r
77 @return Error codes propagated from\r
78 QemuFwCfgFindFile() and from the BaseLib\r
79 function selected by ParseAsHex. Value has not\r
80 been changed.\r
81**/\r
82RETURN_STATUS\r
83EFIAPI\r
84QemuFwCfgParseUint8 (\r
ac0a286f
MK
85 IN CONST CHAR8 *FileName,\r
86 IN BOOLEAN ParseAsHex,\r
87 OUT UINT8 *Value\r
611c7f11
LE
88 );\r
89\r
90//\r
91// The following functions behave identically to QemuFwCfgParseUint8(),\r
92// only their range checks use MAX_UINT16, MAX_UINT32, MAX_UINT64, MAX_UINTN,\r
93// respectively.\r
94//\r
95\r
96RETURN_STATUS\r
97EFIAPI\r
98QemuFwCfgParseUint16 (\r
ac0a286f
MK
99 IN CONST CHAR8 *FileName,\r
100 IN BOOLEAN ParseAsHex,\r
101 OUT UINT16 *Value\r
611c7f11
LE
102 );\r
103\r
104RETURN_STATUS\r
105EFIAPI\r
106QemuFwCfgParseUint32 (\r
ac0a286f
MK
107 IN CONST CHAR8 *FileName,\r
108 IN BOOLEAN ParseAsHex,\r
109 OUT UINT32 *Value\r
611c7f11
LE
110 );\r
111\r
112RETURN_STATUS\r
113EFIAPI\r
114QemuFwCfgParseUint64 (\r
ac0a286f
MK
115 IN CONST CHAR8 *FileName,\r
116 IN BOOLEAN ParseAsHex,\r
117 OUT UINT64 *Value\r
611c7f11
LE
118 );\r
119\r
120RETURN_STATUS\r
121EFIAPI\r
122QemuFwCfgParseUintn (\r
ac0a286f
MK
123 IN CONST CHAR8 *FileName,\r
124 IN BOOLEAN ParseAsHex,\r
125 OUT UINTN *Value\r
611c7f11
LE
126 );\r
127\r
128#endif // QEMU_FW_CFG_SIMPLE_PARSER_LIB_H_\r