summaryrefslogtreecommitdiff
path: root/include/image.h
diff options
context:
space:
mode:
authorAndrew F. Davis <afd@ti.com>2016-11-29 22:33:20 (GMT)
committerTom Rini <trini@konsulko.com>2016-12-03 18:21:19 (GMT)
commitd7be50921ed35e36e000a5e8daba41701a5eebb9 (patch)
tree54562749aee083bb8f3b86eb2fee34c48c7e1291 /include/image.h
parent5ca28f67ace439ee06efd310b53621526bd06468 (diff)
downloadu-boot-d7be50921ed35e36e000a5e8daba41701a5eebb9.tar.xz
image: Add FIT image loadable section custom processing
To help automate the loading of custom image types we add the ability to define custom handlers for the loadable section types. When we find a compatible type while loading a "loadable" image from a FIT image we run its associated handlers to perform any additional steps needed for loading this image. Signed-off-by: Andrew F. Davis <afd@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/image.h')
-rw-r--r--include/image.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/image.h b/include/image.h
index 8131595..b96b8eb 100644
--- a/include/image.h
+++ b/include/image.h
@@ -1271,4 +1271,34 @@ int board_fit_config_name_match(const char *name);
void board_fit_image_post_process(void **p_image, size_t *p_size);
#endif /* CONFIG_SPL_FIT_IMAGE_POST_PROCESS */
+/**
+ * Mapping of image types to function handlers to be invoked on the associated
+ * loaded images
+ *
+ * @type: Type of image, I.E. IH_TYPE_*
+ * @handler: Function to call on loaded image
+ */
+struct fit_loadable_tbl {
+ int type;
+ /**
+ * handler() - Process a loaded image
+ *
+ * @data: Pointer to start of loaded image data
+ * @size: Size of loaded image data
+ */
+ void (*handler)(ulong data, size_t size);
+};
+
+/*
+ * Define a FIT loadable image type handler
+ *
+ * _type is a valid uimage_type ID as defined in the "Image Type" enum above
+ * _handler is the handler function to call after this image type is loaded
+ */
+#define U_BOOT_FIT_LOADABLE_HANDLER(_type, _handler) \
+ ll_entry_declare(struct fit_loadable_tbl, _function, fit_loadable) = { \
+ .type = _type, \
+ .handler = _handler, \
+ }
+
#endif /* __IMAGE_H__ */