diff options
Diffstat (limited to 'include/blkmap.h')
-rw-r--r-- | include/blkmap.h | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/include/blkmap.h b/include/blkmap.h index d53095437fa..57555fda4fb 100644 --- a/include/blkmap.h +++ b/include/blkmap.h @@ -7,6 +7,7 @@ #ifndef _BLKMAP_H #define _BLKMAP_H +#include <blk.h> #include <dm/lists.h> /** @@ -60,10 +61,12 @@ int blkmap_map_mem(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, * @blknr: Start block number of the mapping * @blkcnt: Number of blocks to map * @paddr: The target physical memory address of the mapping + * @preserve: Mapping intended to be preserved for subsequent stages, + * like the OS (e.g. ISO installer) * Returns: 0 on success, negative error code on failure */ int blkmap_map_pmem(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, - phys_addr_t paddr); + phys_addr_t paddr, bool preserve); /** * blkmap_from_label() - Find blkmap from label @@ -102,4 +105,32 @@ int blkmap_destroy(struct udevice *dev); int blkmap_create_ramdisk(const char *label, ulong image_addr, ulong image_size, struct udevice **devp); +/** + * blkmap_get_preserved_pmem_slices() - Look for memory mapped preserved slices + * @cb: Callback function to call for the blkmap slice + * @ctx: Argument to be passed to the callback function + * + * The function is used to iterate through all the blkmap slices, looking + * specifically for memory mapped blkmap mapping which has been + * created with the preserve attribute. The function looks for such slices + * with the relevant attributes and then calls the callback function which + * then does additional configuration as needed. The callback function is + * invoked for all the discovered slices, unless there is an error returned + * by the callback, in which case the function returns that error. + * + * The callback function has the following arguments + * @ctx: Argument to be passed to the callback function + * @addr: Start address of the memory mapped slice + * @size: Size of the memory mapped slice + * + * Typically, the callback will perform some configuration needed for the + * information passed on to it. An example of this would be setting up the + * pmem node in a device-tree(passed through the ctx argument) with the + * parameters passed on to the callback. + * + * Return: 0 on success, negative error on failure + */ +int blkmap_get_preserved_pmem_slices(int (*cb)(void *ctx, u64 addr, + u64 size), void *ctx); + #endif /* _BLKMAP_H */ |