summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Müllner <christoph.muellner@theobroma-systems.com>2019-05-04 16:26:43 +0200
committerChristoph Müllner <christoph.muellner@theobroma-systems.com>2019-05-07 17:30:46 +0200
commitd68222d45b4e7f55f500f5e28722cb4304ecde96 (patch)
tree0aae80107e7cf17ba06f2d99cabbde9870c8f10d
parent2d9f20412d8c78493c41d633d336d830aa98c744 (diff)
bouncebuf: Add DMA validation check to addr_aligned().
Currently addr_aligned() performs an alignment and a length check to validate the DMA address. However, some machines have stricter restrictions of DMA-able addresses. This patch adds a call to mach_addr_is_dmaable() to honor this machine specific restrictions. Signed-off-by: Christoph Müllner <christoph.muellner@theobroma-systems.com>
-rw-r--r--common/bouncebuf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/common/bouncebuf.c b/common/bouncebuf.c
index a7098e2caf..1b82243b06 100644
--- a/common/bouncebuf.c
+++ b/common/bouncebuf.c
@@ -26,6 +26,12 @@ static int addr_aligned(struct bounce_buffer *state)
return 0;
}
+ /* Check if valid DMA address. */
+ if (!mach_addr_is_dmaable(state->user_buffer)) {
+ debug("Buffer address is not DMA-able\n");
+ return 0;
+ }
+
/* Aligned */
return 1;
}