usb_busdma.c (184610) | usb_busdma.c (184824) |
---|---|
1/* $FreeBSD: head/sys/dev/usb2/core/usb2_busdma.c 184610 2008-11-04 02:31:03Z alfred $ */ | 1/* $FreeBSD: head/sys/dev/usb2/core/usb2_busdma.c 184824 2008-11-10 20:54:31Z thompsa $ */ |
2/*- 3 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. --- 9 unchanged lines hidden (view full) --- 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 | 2/*- 3 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. --- 9 unchanged lines hidden (view full) --- 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 |
27#include <dev/usb2/include/usb2_mfunc.h> 28#include <dev/usb2/include/usb2_error.h> 29#include <dev/usb2/include/usb2_standard.h> 30#include <dev/usb2/include/usb2_defs.h> 31 |
|
27#include <dev/usb2/core/usb2_core.h> 28#include <dev/usb2/core/usb2_busdma.h> 29#include <dev/usb2/core/usb2_process.h> 30#include <dev/usb2/core/usb2_transfer.h> | 32#include <dev/usb2/core/usb2_core.h> 33#include <dev/usb2/core/usb2_busdma.h> 34#include <dev/usb2/core/usb2_process.h> 35#include <dev/usb2/core/usb2_transfer.h> |
36#include <dev/usb2/core/usb2_device.h> |
|
31#include <dev/usb2/core/usb2_util.h> 32 | 37#include <dev/usb2/core/usb2_util.h> 38 |
33#include <dev/usb2/include/usb2_mfunc.h> 34#include <dev/usb2/include/usb2_error.h> 35#include <dev/usb2/include/usb2_standard.h> | 39#include <dev/usb2/controller/usb2_controller.h> 40#include <dev/usb2/controller/usb2_bus.h> |
36 37static void usb2_dma_tag_create(struct usb2_dma_tag *udt, uint32_t size, uint32_t align); 38static void usb2_dma_tag_destroy(struct usb2_dma_tag *udt); 39 40#ifdef __FreeBSD__ 41static void usb2_dma_lock_cb(void *arg, bus_dma_lock_op_t op); 42static int32_t usb2_m_copy_in_cb(void *arg, void *src, uint32_t count); 43static void usb2_pc_alloc_mem_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error); --- 1147 unchanged lines hidden (view full) --- 1191 1192 xfer = pq->curr; 1193 info = xfer->usb2_root; 1194 1195 mtx_assert(info->priv_mtx, MA_OWNED); 1196 1197 if (xfer->error) { 1198 /* some error happened */ | 41 42static void usb2_dma_tag_create(struct usb2_dma_tag *udt, uint32_t size, uint32_t align); 43static void usb2_dma_tag_destroy(struct usb2_dma_tag *udt); 44 45#ifdef __FreeBSD__ 46static void usb2_dma_lock_cb(void *arg, bus_dma_lock_op_t op); 47static int32_t usb2_m_copy_in_cb(void *arg, void *src, uint32_t count); 48static void usb2_pc_alloc_mem_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error); --- 1147 unchanged lines hidden (view full) --- 1196 1197 xfer = pq->curr; 1198 info = xfer->usb2_root; 1199 1200 mtx_assert(info->priv_mtx, MA_OWNED); 1201 1202 if (xfer->error) { 1203 /* some error happened */ |
1199 mtx_lock(xfer->usb2_mtx); | 1204 USB_BUS_LOCK(xfer->udev->bus); |
1200 usb2_transfer_done(xfer, 0); | 1205 usb2_transfer_done(xfer, 0); |
1201 mtx_unlock(xfer->usb2_mtx); | 1206 USB_BUS_UNLOCK(xfer->udev->bus); |
1202 return; 1203 } 1204 if (!xfer->flags_int.bdma_setup) { 1205 struct usb2_page *pg; 1206 uint32_t frlength_0; 1207 uint8_t isread; 1208 1209 xfer->flags_int.bdma_setup = 1; --- 55 unchanged lines hidden (view full) --- 1265 xfer->frbuffers[nframes].page_start = pg; 1266 1267 pg += (xfer->frlengths[nframes] / USB_PAGE_SIZE); 1268 pg += 2; 1269 } 1270 1271 } 1272 if (info->dma_error) { | 1207 return; 1208 } 1209 if (!xfer->flags_int.bdma_setup) { 1210 struct usb2_page *pg; 1211 uint32_t frlength_0; 1212 uint8_t isread; 1213 1214 xfer->flags_int.bdma_setup = 1; --- 55 unchanged lines hidden (view full) --- 1270 xfer->frbuffers[nframes].page_start = pg; 1271 1272 pg += (xfer->frlengths[nframes] / USB_PAGE_SIZE); 1273 pg += 2; 1274 } 1275 1276 } 1277 if (info->dma_error) { |
1273 mtx_lock(xfer->usb2_mtx); | 1278 USB_BUS_LOCK(xfer->udev->bus); |
1274 usb2_transfer_done(xfer, USB_ERR_DMA_LOAD_FAILED); | 1279 usb2_transfer_done(xfer, USB_ERR_DMA_LOAD_FAILED); |
1275 mtx_unlock(xfer->usb2_mtx); | 1280 USB_BUS_UNLOCK(xfer->udev->bus); |
1276 return; 1277 } 1278 if (info->dma_currframe != info->dma_nframes) { 1279 1280 if (info->dma_currframe == 0) { 1281 /* special case */ 1282 usb2_pc_load_mem(xfer->frbuffers, 1283 info->dma_frlength_0, 0); --- 118 unchanged lines hidden --- | 1281 return; 1282 } 1283 if (info->dma_currframe != info->dma_nframes) { 1284 1285 if (info->dma_currframe == 0) { 1286 /* special case */ 1287 usb2_pc_load_mem(xfer->frbuffers, 1288 info->dma_frlength_0, 0); --- 118 unchanged lines hidden --- |