aboutsummaryrefslogtreecommitdiff
path: root/include/blk.h
diff options
context:
space:
mode:
authorMarek Vasut2023-08-14 01:49:59 +0200
committerTom Rini2023-08-22 15:17:53 -0400
commit75191f75bce45f3b9aff607c88f17778d3805c61 (patch)
treef717b428fb9e9addb9bb2ed28295c8d176104738 /include/blk.h
parente2b5cc608b23418d5bcd5e2fe0b5d93593d02e97 (diff)
blk: Add bounce buffer support to read/write operations
Some devices have limited DMA capabilities and require that the buffers passed to them fit specific properties. Add new optional callback which can be used at driver level to indicate whether a buffer alignment is suitable for the device DMA or not, and trigger use of generic bounce buffer implementation to help use of unsuitable buffers at the expense of performance degradation. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Diffstat (limited to 'include/blk.h')
-rw-r--r--include/blk.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/blk.h b/include/blk.h
index 8986e953e5a..b819f97c2f1 100644
--- a/include/blk.h
+++ b/include/blk.h
@@ -7,6 +7,7 @@
#ifndef BLK_H
#define BLK_H
+#include <bouncebuf.h>
#include <dm/uclass-id.h>
#include <efi.h>
@@ -260,6 +261,24 @@ struct blk_ops {
* @return 0 if OK, -ve on error
*/
int (*select_hwpart)(struct udevice *dev, int hwpart);
+
+#if IS_ENABLED(CONFIG_BOUNCE_BUFFER)
+ /**
+ * buffer_aligned() - test memory alignment of block operation buffer
+ *
+ * Some devices have limited DMA capabilities and require that the
+ * buffers passed to them fit specific properties. This optional
+ * callback can be used to indicate whether a buffer alignment is
+ * suitable for the device DMA or not, and trigger use of generic
+ * bounce buffer implementation to help use of unsuitable buffers
+ * at the expense of performance degradation.
+ *
+ * @dev: Block device associated with the request
+ * @state: Bounce buffer state
+ * @return 1 if OK, 0 if unaligned
+ */
+ int (*buffer_aligned)(struct udevice *dev, struct bounce_buffer *state);
+#endif /* CONFIG_BOUNCE_BUFFER */
};
/*