[v2,02/14] core/flash: extern function to get the name of a PNOR partition

Message ID 1504164285-15095-3-git-send-email-cclaudio@linux.vnet.ibm.com
State Under Review
Headers show
Series
  • libstb: simplify the initialization of cvc drivers
Related show

Commit Message

Claudio Carvalho Aug. 31, 2017, 7:24 a.m.
This adds the flash_map_resource_name() to allow other skiboot
subsystems to lookup the name of a PNOR partition. With this 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 53e6eba..90402ef 100644
--- a/core/flash.c
+++ b/core/flash.c
@@ -424,6 +424,16 @@  static struct {
 	{ RESOURCE_ID_IMA_CATALOG,  RESOURCE_SUBID_SUPPORTED,	"IMA_CATALOG" },
 };
 
+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 4b7d519..06d681e 100644
--- a/include/skiboot.h
+++ b/include/skiboot.h
@@ -243,6 +243,7 @@  extern int flash_subpart_info(void *part_header, uint32_t header_len,
 			      uint32_t part_size, uint32_t *part_actual,
 			      uint32_t subid, uint32_t *offset,
 			      uint32_t *size);
+extern char *flash_map_resource_name(enum resource_id id);
 /* NVRAM support */
 extern void nvram_init(void);
 extern void nvram_read_complete(bool success);