diff options
author | Tobias Waldekranz | 2023-02-16 16:33:50 +0100 |
---|---|---|
committer | Tom Rini | 2023-04-05 10:54:47 -0400 |
commit | 15d9e99a274df5d9b260f75f42f7c394e5fe0e42 (patch) | |
tree | 21b128ef4330fc99ea0dde18b733d432da4b4ed5 /include/blkmap.h | |
parent | c41e209ea67ee9be04519a3c7afda80a32253317 (diff) |
blk: blkmap: Add memory mapping support
Allow a slice of RAM to be mapped to a blkmap. This means that RAM can
now be accessed as if it was a block device, meaning that existing
filesystem drivers can now be used to access ramdisks.
Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/blkmap.h')
-rw-r--r-- | include/blkmap.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/blkmap.h b/include/blkmap.h index 3c7e36efabc..74baeb19f81 100644 --- a/include/blkmap.h +++ b/include/blkmap.h @@ -8,6 +8,35 @@ #define _BLKMAP_H /** + * blkmap_map_mem() - Map region of memory + * + * @dev: Blkmap to create the mapping on + * @blknr: Start block number of the mapping + * @blkcnt: Number of blocks to map + * @addr: The target memory address of the mapping + * Returns: 0 on success, negative error code on failure + */ +int blkmap_map_mem(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, + void *addr); + +/** + * blkmap_map_pmem() - Map region of physical memory + * + * Ensures that a valid physical to virtual memory mapping for the + * requested region is valid for the lifetime of the mapping, on + * architectures that require it (sandbox). + * + * @dev: Blkmap to create the mapping on + * @blknr: Start block number of the mapping + * @blkcnt: Number of blocks to map + * @paddr: The target physical memory address of the mapping + * 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); + + +/** * blkmap_from_label() - Find blkmap from label * * @label: Label of the requested blkmap |