smbios: add parsing API
Add a very simple API to be able to access SMBIOS strings
like vendor, model and bios version.
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
diff --git a/include/smbios.h b/include/smbios.h
index 97b9ddc..44f49e9 100644
--- a/include/smbios.h
+++ b/include/smbios.h
@@ -237,4 +237,31 @@
*/
ulong write_smbios_table(ulong addr);
+/**
+ * smbios_entry() - Get a valid struct smbios_entry pointer
+ *
+ * @address: address where smbios tables is located
+ * @size: size of smbios table
+ * @return: NULL or a valid pointer to a struct smbios_entry
+ */
+const struct smbios_entry *smbios_entry(u64 address, u32 size);
+
+/**
+ * smbios_header() - Search for SMBIOS header type
+ *
+ * @entry: pointer to a struct smbios_entry
+ * @type: SMBIOS type
+ * @return: NULL or a valid pointer to a struct smbios_header
+ */
+const struct smbios_header *smbios_header(const struct smbios_entry *entry, int type);
+
+/**
+ * smbios_string() - Return string from SMBIOS
+ *
+ * @header: pointer to struct smbios_header
+ * @index: string index
+ * @return: NULL or a valid const char pointer
+ */
+const char *smbios_string(const struct smbios_header *header, int index);
+
#endif /* _SMBIOS_H_ */