Merge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell
[platform/kernel/u-boot.git] / include / smbios.h
index 3cbc687..1846607 100644 (file)
@@ -1,14 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
  *
  * Adapted from coreboot src/include/smbios.h
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #ifndef _SMBIOS_H_
 #define _SMBIOS_H_
 
+#include <dm/ofnode.h>
+
 /* SMBIOS spec version implemented */
 #define SMBIOS_MAJOR_VER       3
 #define SMBIOS_MINOR_VER       0
@@ -55,6 +56,7 @@ struct __packed smbios_entry {
 #define BIOS_CHARACTERISTICS_SELECTABLE_BOOT   (1 << 16)
 
 #define BIOS_CHARACTERISTICS_EXT1_ACPI         (1 << 0)
+#define BIOS_CHARACTERISTICS_EXT1_UEFI         (1 << 3)
 #define BIOS_CHARACTERISTICS_EXT2_TARGET       (1 << 2)
 
 struct __packed smbios_type0 {
@@ -222,18 +224,47 @@ static inline void fill_smbios_header(void *table, int type,
  *
  * @addr:      start address to write the structure
  * @handle:    the structure's handle, a unique 16-bit number
+ * @node:      node containing the information to write (ofnode_null() if none)
  * @return:    size of the structure
  */
-typedef int (*smbios_write_type)(uintptr_t *addr, int handle);
+typedef int (*smbios_write_type)(ulong *addr, int handle, ofnode node);
 
 /**
  * write_smbios_table() - Write SMBIOS table
  *
  * This writes SMBIOS table at a given address.
  *
- * @addr:      start address to write SMBIOS table
- * @return:    end address of SMBIOS table
+ * @addr:      start address to write SMBIOS table. If this is not
+ *     16-byte-aligned then it will be aligned before the table is written
+ * @return:    end address of SMBIOS table (and start address for next entry)
+ */
+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
  */
-uintptr_t write_smbios_table(uintptr_t addr);
+const char *smbios_string(const struct smbios_header *header, int index);
 
 #endif /* _SMBIOS_H_ */