[rtems-libbsd commit] usb_busdma: Add USB_NEED_BUSDMA_COHERENT_ALLOC
Christian Mauderer
christianm at rtems.org
Wed Apr 15 15:11:43 UTC 2020
Module: rtems-libbsd
Branch: master
Commit: bd7af5fcee976bc3a287b4622591dc0df40a79f9
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=bd7af5fcee976bc3a287b4622591dc0df40a79f9
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Tue Apr 14 15:55:33 2020 +0200
usb_busdma: Add USB_NEED_BUSDMA_COHERENT_ALLOC
Some BSPs have a cache-coherent memory area, however, it should not be
used for the USB controller.
---
freebsd/sys/dev/usb/usb_busdma.c | 4 ++++
rtemsbsd/include/rtems/bsd/local/opt_usb.h | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/freebsd/sys/dev/usb/usb_busdma.c b/freebsd/sys/dev/usb/usb_busdma.c
index 9a70c68..dc52fe1 100644
--- a/freebsd/sys/dev/usb/usb_busdma.c
+++ b/freebsd/sys/dev/usb/usb_busdma.c
@@ -584,7 +584,11 @@ usb_pc_alloc_mem(struct usb_page_cache *pc, struct usb_page *pg,
}
/* allocate memory */
if (bus_dmamem_alloc(
+#if !defined(__rtems__) || USB_NEED_BUSDMA_COHERENT_ALLOC
utag->tag, &ptr, (BUS_DMA_WAITOK | BUS_DMA_COHERENT), &map)) {
+#else /* __rtems__ */
+ utag->tag, &ptr, BUS_DMA_WAITOK, &map)) {
+#endif /* __rtems__ */
goto error;
}
/* setup page cache */
diff --git a/rtemsbsd/include/rtems/bsd/local/opt_usb.h b/rtemsbsd/include/rtems/bsd/local/opt_usb.h
index 809a969..9f65486 100644
--- a/rtemsbsd/include/rtems/bsd/local/opt_usb.h
+++ b/rtemsbsd/include/rtems/bsd/local/opt_usb.h
@@ -1,4 +1,5 @@
#include <rtems/bsd/modules.h>
+#include <bsp.h>
#define USB_HAVE_CONDVAR 1
@@ -6,6 +7,10 @@
#define USB_HAVE_BUSDMA 1
+#if !defined(LIBBSP_ARM_IMX_BSP_H) && !defined(LIBBSP_ARM_STM32H7_BSP_H)
+#define USB_NEED_BUSDMA_COHERENT_ALLOC 1
+#endif
+
#define USB_HAVE_COMPAT_LINUX 0
#define USB_HAVE_USER_IO 0
More information about the vc
mailing list