diff options
author | iedowse <iedowse@FreeBSD.org> | 2006-05-28 05:27:09 +0000 |
---|---|---|
committer | iedowse <iedowse@FreeBSD.org> | 2006-05-28 05:27:09 +0000 |
commit | 225f58e59f70fbec54ed3ef9c9e4190dee7f16c0 (patch) | |
tree | b49c0a89d3a65700c3feb75bdd142516eff11782 /sys/dev/usb/usbdivar.h | |
parent | 9cd9aeea7a6956872906dbb99a9013fe89b5cbc3 (diff) | |
download | FreeBSD-src-225f58e59f70fbec54ed3ef9c9e4190dee7f16c0.zip FreeBSD-src-225f58e59f70fbec54ed3ef9c9e4190dee7f16c0.tar.gz |
Use the limited scatter-gather capabilities of ehci, ohci and uhci
host controllers to avoid the need to allocate any multi-page
physically contiguous memory blocks. This makes it possible to use
USB devices reliably on low-memory systems or when memory is too
fragmented for contiguous allocations to succeed.
The USB subsystem now uses bus_dmamap_load() directly on the buffers
supplied by USB peripheral drivers, so this also avoids having to
copy data back and forth before and after transfers. The ehci and
ohci controllers support scatter/gather as long as the buffer is
contiguous in the virtual address space. For uhci the hardware
cannot handle a physical address discontinuity within a USB packet,
so it is necessary to copy small memory fragments at times.
Diffstat (limited to 'sys/dev/usb/usbdivar.h')
-rw-r--r-- | sys/dev/usb/usbdivar.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sys/dev/usb/usbdivar.h b/sys/dev/usb/usbdivar.h index 42537da..fe783fc 100644 --- a/sys/dev/usb/usbdivar.h +++ b/sys/dev/usb/usbdivar.h @@ -130,7 +130,8 @@ struct usbd_bus { #endif #endif - bus_dma_tag_t dmatag; /* DMA tag */ + bus_dma_tag_t parent_dmatag; /* Base DMA tag */ + bus_dma_tag_t buffer_dmatag; /* Tag for transfer buffers */ }; struct usbd_device { @@ -187,6 +188,15 @@ struct usbd_pipe { struct usbd_pipe_methods *methods; }; +#define USB_DMA_NSEG (btoc(MAXPHYS) + 1) + +/* DMA-capable memory buffer. */ +struct usb_dma_mapping { + bus_dma_segment_t segs[USB_DMA_NSEG]; /* The physical segments. */ + int nsegs; /* Number of segments. */ + bus_dmamap_t map; /* DMA mapping. */ +}; + struct usbd_xfer { struct usbd_pipe *pipe; void *priv; @@ -214,7 +224,8 @@ struct usbd_xfer { /* For memory allocation */ struct usbd_device *device; - usb_dma_t dmabuf; + struct usb_dma_mapping dmamap; + void *allocbuf; int rqflags; #define URQ_REQUEST 0x01 |