[09/19] core/flash.c: extern function to get the name of a PNOR partition

Message ID 1510421322-27237-10-git-send-email-cclaudio@linux.vnet.ibm.com
State New
Headers show
Series
  • libstb: add support for secure and trusted boot in P9
Related show

Commit Message

Claudio Carvalho Nov. 11, 2017, 5:28 p.m.
This adds the flash_map_resource_name() to allow skiboot subsystems to
lookup the name of a PNOR partition. Thus, we don't need to duplicate
the same information in other places (e.g. libstb).

Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com>
---
 core/flash.c      | 10 ++++++++++
 include/skiboot.h |  1 +
 2 files changed, 11 insertions(+)

Patch

diff --git a/core/flash.c b/core/flash.c
index 2744496..66568e7 100644
--- a/core/flash.c
+++ b/core/flash.c
@@ -537,6 +537,16 @@  static struct {
 	{ RESOURCE_ID_VERSION,	RESOURCE_SUBID_NONE,		"VERSION" },
 };
 
+const char *flash_map_resource_name(enum resource_id id)
+{
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(part_name_map); i++) {
+		if (part_name_map[i].id == id)
+			return part_name_map[i].name;
+	}
+	return NULL;
+}
 
 static size_t sizeof_elf_from_hdr(void *buf)
 {
diff --git a/include/skiboot.h b/include/skiboot.h
index db91325..1b961fe 100644
--- a/include/skiboot.h
+++ b/include/skiboot.h
@@ -256,6 +256,7 @@  extern int flash_subpart_info(void *part_header, uint32_t header_len,
 			      uint32_t *size);
 extern void flash_fw_version_preload(void);
 extern void flash_dt_add_fw_version(void);
+extern const char *flash_map_resource_name(enum resource_id id);
 
 /* NVRAM support */
 extern void nvram_init(void);