diff options
author | Simon Glass <sjg@chromium.org> | 2016-09-24 18:19:58 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-10-06 14:53:36 -0400 |
commit | a0a8029058e11b8eda1a3d61fdf497bc687b30f8 (patch) | |
tree | 9b661c0f08cbaea1a70780a2290a09a7ed18037a /include/spl.h | |
parent | ecdfd69a4be55363589e8185ff151b02e6c36cfa (diff) | |
download | u-boot-a0a8029058e11b8eda1a3d61fdf497bc687b30f8.tar.gz |
spl: Add a way to declare an SPL image loader
Add a linker list macro which can be used to declare an SPL image loader.
Update spl_load_image() to search available loaders for the correct one.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'include/spl.h')
-rw-r--r-- | include/spl.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/include/spl.h b/include/spl.h index 4435089b16..884fbe6179 100644 --- a/include/spl.h +++ b/include/spl.h @@ -149,6 +149,38 @@ struct spl_boot_device { const char *boot_device_name; }; +/** + * Holds information about a way of loading an SPL image + * + * @boot_device: Boot device that this loader supports + * @load_image: Function to call to load image + */ +struct spl_image_loader { + uint boot_device; + /** + * load_image() - Load an SPL image + * + * @bootdev: describes the boot device to load from + */ + int (*load_image)(struct spl_boot_device *bootdev); +}; + +/* Declare an SPL image loader */ +#define SPL_LOAD_IMAGE(__name) \ + ll_entry_declare(struct spl_image_loader, __name, spl_image_loader) + +/* + * __priority is the priority of this method, 0 meaning it will be the top + * choice for this device, 9 meaning it is the bottom choice. + * __boot_device is the BOOT_DEVICE_... value + * __method is the load_image function to call + */ +#define SPL_LOAD_IMAGE_METHOD(__priority, __boot_device, __method) \ + SPL_LOAD_IMAGE(__method ## __priority ## __boot_device) = { \ + .boot_device = __boot_device, \ + .load_image = __method, \ + } + /* NAND SPL functions */ int spl_nand_load_image(struct spl_boot_device *bootdev); |