Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/arm32 No need to allocate bounce buffers if we ...
details: https://anonhg.NetBSD.org/src/rev/6f3bcb14e587
branches: trunk
changeset: 947906:6f3bcb14e587
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sat Dec 19 23:22:18 2020 +0000
description:
No need to allocate bounce buffers if we have a single range that covers
all of physical memory.
diffstat:
sys/arch/arm/arm32/bus_dma.c | 23 +++++++++++++++++++----
1 files changed, 19 insertions(+), 4 deletions(-)
diffs (44 lines):
diff -r 6c002be2864d -r 6f3bcb14e587 sys/arch/arm/arm32/bus_dma.c
--- a/sys/arch/arm/arm32/bus_dma.c Sat Dec 19 22:33:11 2020 +0000
+++ b/sys/arch/arm/arm32/bus_dma.c Sat Dec 19 23:22:18 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.126 2020/12/04 07:12:57 skrll Exp $ */
+/* $NetBSD: bus_dma.c,v 1.127 2020/12/19 23:22:18 jmcneill Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2020 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
#include "opt_cputypes.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.126 2020/12/04 07:12:57 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.127 2020/12/19 23:22:18 jmcneill Exp $");
#include <sys/param.h>
@@ -368,8 +368,23 @@
goto out;
}
- if (t->_ranges != NULL)
- cookieflags |= _BUS_DMA_MIGHT_NEED_BOUNCE;
+ if (t->_ranges != NULL) {
+ /*
+ * If ranges are defined, we may have to bounce. The only
+ * exception is if there is exactly one range that covers
+ * all of physical memory.
+ */
+ switch (t->_nranges) {
+ case 1:
+ if (t->_ranges[0].dr_sysbase == 0 &&
+ t->_ranges[0].dr_len == UINTPTR_MAX) {
+ break;
+ }
+ /* FALLTHROUGH */
+ default:
+ cookieflags |= _BUS_DMA_MIGHT_NEED_BOUNCE;
+ }
+ }
if ((cookieflags & _BUS_DMA_MIGHT_NEED_BOUNCE) == 0) {
STAT_INCR(creates);
Home |
Main Index |
Thread Index |
Old Index