[PATCH libbsd 09/11] ehci_imx.c: Port to RTEMS

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Apr 2 15:00:52 UTC 2020


On 02/04/2020 16:42, Christian Mauderer wrote:

> diff --git a/freebsd/sys/dev/usb/usb_busdma.c b/freebsd/sys/dev/usb/usb_busdma.c
> index 9a70c687..c8000170 100644
> --- a/freebsd/sys/dev/usb/usb_busdma.c
> +++ b/freebsd/sys/dev/usb/usb_busdma.c
> @@ -78,6 +78,52 @@ static void	usb_pc_common_mem_cb(void *, bus_dma_segment_t *, int, int,
>   		    uint8_t);
>   #endif
>   
> +#ifdef __rtems__
> +#include <bsp.h>
> +#if defined(LIBBSP_ARM_IMX_BSP_H)
> +#define NEED_MISSALIGNED_COPY
> +#endif

Could you please move changes in general file imported from FreeBSD to 
separate commits.

I don't like this change here at all. I had a similar issue with 
misaligned memcpy() to device memory here on the STM32H7 platform. Could 
you first try this patch here:

diff --git a/freebsd/sys/dev/usb/usb_busdma.c 
b/freebsd/sys/dev/usb/usb_busdma.c
index 9a70c687..973a3409 100644
--- a/freebsd/sys/dev/usb/usb_busdma.c
+++ b/freebsd/sys/dev/usb/usb_busdma.c
@@ -584,7 +584,7 @@ usb_pc_alloc_mem(struct usb_page_cache *pc, struct 
usb_page *pg,
         }
         /* allocate memory */
         if (bus_dmamem_alloc(
-           utag->tag, &ptr, (BUS_DMA_WAITOK | BUS_DMA_COHERENT), &map)) {
+           utag->tag, &ptr, BUS_DMA_WAITOK, &map)) {
                 goto error;
         }
         /* setup page cache */



More information about the devel mailing list