bios: Add a configuration parser for integer attribute
Add a configuration parser for integer attribute
and check the fields for string attribute
Signed-off-by: John Wang <wangzqbj@inspur.com>
Change-Id: I3be56f4a64373fb442ef58ad9d6693ffb8994917
diff --git a/libpldmresponder/bios_parser.hpp b/libpldmresponder/bios_parser.hpp
index 6620ddb..1757fc7 100644
--- a/libpldmresponder/bios_parser.hpp
+++ b/libpldmresponder/bios_parser.hpp
@@ -33,6 +33,7 @@
using Strings = std::vector<std::string>;
inline constexpr auto bIOSEnumJson = "enum_attrs.json";
inline constexpr auto bIOSStrJson = "string_attrs.json";
+inline constexpr auto bIOSIntegerJson = "integer_attrs.json";
/** @brief Get all the preconfigured strings
* @return all the preconfigurated strings
@@ -106,4 +107,42 @@
} // namespace bios_string
+namespace bios_integer
+{
+
+using AttrName = std::string;
+using IsReadOnly = bool;
+using LowerBound = uint64_t;
+using UpperBound = uint64_t;
+using ScalarIncrement = uint32_t;
+using DefaultValue = uint64_t;
+using AttrValues = std::tuple<IsReadOnly, LowerBound, UpperBound,
+ ScalarIncrement, DefaultValue>;
+
+constexpr auto AttrIsReadOnly = 0;
+constexpr auto AttrLowerBound = 1;
+constexpr auto AttrUpperBound = 2;
+constexpr auto AttrScalarIncrement = 3;
+constexpr auto AttrDefaultValue = 4;
+
+using AttrValuesMap = std::map<AttrName, AttrValues>;
+
+/** @brief Get the values of all fields for the
+ * BIOSInteger and BIOSIntegerReadOnly types
+ *
+ * @return information needed to build the BIOS attribute table specific to
+ * BIOSInteger and BIOSIntegerReadOnly types
+ */
+const AttrValuesMap& getValues();
+
+/** @brief Get the current values for the BIOS Attribute
+ *
+ * @param[in] attrName - BIOS attribute name
+ *
+ * @return BIOS attribute value
+ */
+uint64_t getAttrValue(const AttrName& attrName);
+
+} // namespace bios_integer
+
} // namespace bios_parser