summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-02-22 22:55:50 -0700
committerTom Rini <trini@konsulko.com>2016-03-14 19:18:28 -0400
commitcef2e51489567260857984c3e95d98eb03c97fe9 (patch)
tree7fe3c1d3f1d436477a0bb5cf1c5781fb7ca87c12 /common
parent3837ce65bd57991ebd7f8235db4040596d3125a4 (diff)
downloadtalos-obmc-uboot-cef2e51489567260857984c3e95d98eb03c97fe9.tar.gz
talos-obmc-uboot-cef2e51489567260857984c3e95d98eb03c97fe9.zip
image: Add functions to obtain short names
Sometimes it is useful to obtain the short name for an Operating System, architecture or compression mechanism. Provide functions for this. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/image.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/common/image.c b/common/image.c
index 7d3a54397c..26d6c9a592 100644
--- a/common/image.c
+++ b/common/image.c
@@ -608,11 +608,9 @@ const char *genimg_get_type_name(uint8_t type)
return (get_table_entry_name(uimage_type, "Unknown Image", type));
}
-const char *genimg_get_type_short_name(uint8_t type)
+static const char *genimg_get_short_name(const table_entry_t *table, int val)
{
- const table_entry_t *table;
-
- table = get_table_entry(uimage_type, type);
+ table = get_table_entry(table, val);
if (!table)
return "unknown";
#if defined(USE_HOSTCC) || !defined(CONFIG_NEEDS_MANUAL_RELOC)
@@ -622,12 +620,32 @@ const char *genimg_get_type_short_name(uint8_t type)
#endif
}
+const char *genimg_get_type_short_name(uint8_t type)
+{
+ return genimg_get_short_name(uimage_type, type);
+}
+
const char *genimg_get_comp_name(uint8_t comp)
{
return (get_table_entry_name(uimage_comp, "Unknown Compression",
comp));
}
+const char *genimg_get_comp_short_name(uint8_t comp)
+{
+ return genimg_get_short_name(uimage_comp, comp);
+}
+
+const char *genimg_get_os_short_name(uint8_t os)
+{
+ return genimg_get_short_name(uimage_os, os);
+}
+
+const char *genimg_get_arch_short_name(uint8_t arch)
+{
+ return genimg_get_short_name(uimage_arch, arch);
+}
+
/**
* get_table_entry_id - translate short entry name to id
* @table: pointer to a translation table for entries of a specific type
OpenPOWER on IntegriCloud