bios_table: Add decode functions for attr table
Add some necessary decode functions to decode entry of
attribute table
Signed-off-by: John Wang <wangzqbj@inspur.com>
Change-Id: I3549ea58d7837fdec91e99b09b37a0fd6c873aa0
diff --git a/libpldm/bios_table.h b/libpldm/bios_table.h
index 298ba7e..d0e06a4 100644
--- a/libpldm/bios_table.h
+++ b/libpldm/bios_table.h
@@ -171,6 +171,13 @@
uint16_t pldm_bios_table_attr_entry_decode_attribute_handle(
const struct pldm_bios_attr_table_entry *entry);
+/** @brief Get the attribute type of the attribute table entry
+ * @param[in] entry - Pointer to bios attribute table entry
+ * @return Type of the attribute table entry
+ */
+uint8_t pldm_bios_table_attr_entry_decode_attribute_type(
+ const struct pldm_bios_attr_table_entry *entry);
+
/** @brief Get the attribute name handle from the attribute table entry
* @param[in] entry - Pointer to bios attribute table entry
* @return handle to identify the name of the attribute, this handle points
@@ -290,6 +297,18 @@
const struct pldm_bios_attr_table_entry *entry, uint16_t *pv_hdls,
uint8_t pv_num);
+/** @brief Get Indices of default values
+ * @param[in] entry - Pointer to bios attribute table entry
+ * @param[out] def_indices - Pointer to a buffer to store
+ * default value indices
+ * @param[in] def_num - Number of DefaultValues the buffer can
+ * store
+ * @return Number of default values decoded
+ */
+uint8_t pldm_bios_table_attr_entry_enum_decode_def_indices(
+ const struct pldm_bios_attr_table_entry *entry, uint8_t *def_indices,
+ uint8_t def_num);
+
/** @struct pldm_bios_table_attr_entry_string_info
*
* An auxiliary structure for passing parameters to @ref
@@ -368,6 +387,30 @@
uint8_t pldm_bios_table_attr_entry_string_decode_string_type(
const struct pldm_bios_attr_table_entry *entry);
+/** @brief Get maximum length of the string from a bios attribute table entry in
+ * bytes
+ * @param[in] entry - Pointer to a bios attribute table entry
+ * @return Maximum length of the string
+ */
+uint16_t pldm_bios_table_attr_entry_string_decode_max_length(
+ const struct pldm_bios_attr_table_entry *entry);
+
+/** @brief Get minimum length of the string from a bios attribute table entry in
+ * bytes
+ * @param[in] entry - Pointer to a bios attribute table entry
+ * @return Minimum length of the string
+ */
+uint16_t pldm_bios_table_attr_entry_string_decode_min_length(
+ const struct pldm_bios_attr_table_entry *entry);
+
+/** @brief Get the default string from a bios attribute table entry
+ * @param[out] buffer - Pointer to a buffer to store the string
+ * @param[in] size - Size of the buffer to store the string
+ * @return Length of the string decoded
+ */
+uint16_t pldm_bios_table_attr_entry_string_decode_def_string(
+ const struct pldm_bios_attr_table_entry *entry, char *buffer, size_t size);
+
/** @struct pldm_bios_table_attr_entry_integer_info
*
* An auxiliary structure for passing parameters to @ref
@@ -421,6 +464,18 @@
void *entry, size_t entry_length,
const struct pldm_bios_table_attr_entry_integer_info *info);
+/** @brief Decode the specific fields(integer) of attribute table entry
+ * @param[in] entry - Pointer to an entry of attribute table
+ * @param[out] lower - The lower bound on the integer value
+ * @param[out] upper - The upper bound on the integer value
+ * @param[out] scalar - The scalar value that is used for the increments to
+ * this integer
+ * @param[out] def - The default value of the integer
+ */
+void pldm_bios_table_attr_entry_integer_decode(
+ const struct pldm_bios_attr_table_entry *entry, uint64_t *lower,
+ uint64_t *upper, uint32_t *scalar, uint64_t *def);
+
/** @brief Get the attribute handle from the attribute value table entry
* @param[in] entry - Pointer to bios attribute value table entry
* @return handle to identify the attribute in the attribute value table