aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMasahisa Kojima2023-11-10 13:25:36 +0900
committerIlias Apalodimas2023-11-18 10:08:08 +0200
commitd822255d653421bdcda9d6f443929a5b67ca4454 (patch)
treebc42b17bc84c18cb92af30806633e8aa8658e2f2 /include
parent8cf18da1a971dbfe121c1fc1836bb4af942d06dc (diff)
blk: blkmap: add ramdisk creation utility function
User needs to call several functions to create the ramdisk with blkmap. This adds the utility function to create blkmap device and mount the ramdisk. Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/blkmap.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/blkmap.h b/include/blkmap.h
index af54583c7dd..30dc84a7da8 100644
--- a/include/blkmap.h
+++ b/include/blkmap.h
@@ -7,6 +7,23 @@
#ifndef _BLKMAP_H
#define _BLKMAP_H
+#include <dm/lists.h>
+
+/**
+ * struct blkmap - Block map
+ *
+ * Data associated with a blkmap.
+ *
+ * @label: Human readable name of this blkmap
+ * @blk: Underlying block device
+ * @slices: List of slices associated with this blkmap
+ */
+struct blkmap {
+ char *label;
+ struct udevice *blk;
+ struct list_head slices;
+};
+
/**
* blkmap_map_linear() - Map region of other block device
*
@@ -74,4 +91,16 @@ int blkmap_create(const char *label, struct udevice **devp);
*/
int blkmap_destroy(struct udevice *dev);
+/**
+ * blkmap_create_ramdisk() - Create new ramdisk with blkmap
+ *
+ * @label: Label of the new blkmap
+ * @image_addr: Target memory start address of this mapping
+ * @image_size: Target memory size of this mapping
+ * @devp: Updated with the address of the created blkmap device
+ * Returns: 0 on success, negative error code on failure
+ */
+int blkmap_create_ramdisk(const char *label, ulong image_addr, ulong image_size,
+ struct udevice **devp);
+
#endif /* _BLKMAP_H */