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

Claudio Carvalho cclaudio at linux.vnet.ibm.com
Thu Aug 31 17:24:33 AEST 2017


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 at linux.vnet.ibm.com>
---
 core/flash.c      | 10 ++++++++++
 include/skiboot.h |  1 +
 2 files changed, 11 insertions(+)

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);
-- 
2.7.4



More information about the Skiboot mailing list