1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (c) 2023 Addiva Elektronik
4 * Author: Tobias Waldekranz <tobias@waldekranz.com>
11 * blkmap_map_linear() - Map region of other block device
13 * @dev: Blkmap to create the mapping on
14 * @blknr: Start block number of the mapping
15 * @blkcnt: Number of blocks to map
16 * @lblk: The target block device of the mapping
17 * @lblknr: The start block number of the target device
18 * Returns: 0 on success, negative error code on failure
20 int blkmap_map_linear(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt,
21 struct udevice *lblk, lbaint_t lblknr);
24 * blkmap_map_mem() - Map region of memory
26 * @dev: Blkmap to create the mapping on
27 * @blknr: Start block number of the mapping
28 * @blkcnt: Number of blocks to map
29 * @addr: The target memory address of the mapping
30 * Returns: 0 on success, negative error code on failure
32 int blkmap_map_mem(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt,
36 * blkmap_map_pmem() - Map region of physical memory
38 * Ensures that a valid physical to virtual memory mapping for the
39 * requested region is valid for the lifetime of the mapping, on
40 * architectures that require it (sandbox).
42 * @dev: Blkmap to create the mapping on
43 * @blknr: Start block number of the mapping
44 * @blkcnt: Number of blocks to map
45 * @paddr: The target physical memory address of the mapping
46 * Returns: 0 on success, negative error code on failure
48 int blkmap_map_pmem(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt,
53 * blkmap_from_label() - Find blkmap from label
55 * @label: Label of the requested blkmap
56 * Returns: A pointer to the blkmap on success, NULL on failure
58 struct udevice *blkmap_from_label(const char *label);
61 * blkmap_create() - Create new blkmap
63 * @label: Label of the new blkmap
64 * @devp: If not NULL, updated with the address of the resulting device
65 * Returns: 0 on success, negative error code on failure
67 int blkmap_create(const char *label, struct udevice **devp);
70 * blkmap_destroy() - Destroy blkmap
72 * @dev: The blkmap to be destroyed
73 * Returns: 0 on success, negative error code on failure
75 int blkmap_destroy(struct udevice *dev);
77 #endif /* _BLKMAP_H */