usb_busdma.c (186730) | usb_busdma.c (187173) |
---|---|
1/* $FreeBSD: head/sys/dev/usb2/core/usb2_busdma.c 186730 2009-01-04 00:12:01Z alfred $ */ | 1/* $FreeBSD: head/sys/dev/usb2/core/usb2_busdma.c 187173 2009-01-13 19:03:12Z 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. --- 1211 unchanged lines hidden (view full) --- 1221void 1222usb2_bdma_work_loop(struct usb2_xfer_queue *pq) 1223{ 1224 struct usb2_xfer_root *info; 1225 struct usb2_xfer *xfer; 1226 uint32_t nframes; 1227 1228 xfer = pq->curr; | 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. --- 1211 unchanged lines hidden (view full) --- 1221void 1222usb2_bdma_work_loop(struct usb2_xfer_queue *pq) 1223{ 1224 struct usb2_xfer_root *info; 1225 struct usb2_xfer *xfer; 1226 uint32_t nframes; 1227 1228 xfer = pq->curr; |
1229 info = xfer->usb2_root; | 1229 info = xfer->xroot; |
1230 | 1230 |
1231 mtx_assert(info->priv_mtx, MA_OWNED); | 1231 mtx_assert(info->xfer_mtx, MA_OWNED); |
1232 1233 if (xfer->error) { 1234 /* some error happened */ | 1232 1233 if (xfer->error) { 1234 /* some error happened */ |
1235 USB_BUS_LOCK(xfer->udev->bus); | 1235 USB_BUS_LOCK(info->bus); |
1236 usb2_transfer_done(xfer, 0); | 1236 usb2_transfer_done(xfer, 0); |
1237 USB_BUS_UNLOCK(xfer->udev->bus); | 1237 USB_BUS_UNLOCK(info->bus); |
1238 return; 1239 } 1240 if (!xfer->flags_int.bdma_setup) { 1241 struct usb2_page *pg; 1242 uint32_t frlength_0; 1243 uint8_t isread; 1244 1245 xfer->flags_int.bdma_setup = 1; --- 55 unchanged lines hidden (view full) --- 1301 xfer->frbuffers[nframes].page_start = pg; 1302 1303 pg += (xfer->frlengths[nframes] / USB_PAGE_SIZE); 1304 pg += 2; 1305 } 1306 1307 } 1308 if (info->dma_error) { | 1238 return; 1239 } 1240 if (!xfer->flags_int.bdma_setup) { 1241 struct usb2_page *pg; 1242 uint32_t frlength_0; 1243 uint8_t isread; 1244 1245 xfer->flags_int.bdma_setup = 1; --- 55 unchanged lines hidden (view full) --- 1301 xfer->frbuffers[nframes].page_start = pg; 1302 1303 pg += (xfer->frlengths[nframes] / USB_PAGE_SIZE); 1304 pg += 2; 1305 } 1306 1307 } 1308 if (info->dma_error) { |
1309 USB_BUS_LOCK(xfer->udev->bus); | 1309 USB_BUS_LOCK(info->bus); |
1310 usb2_transfer_done(xfer, USB_ERR_DMA_LOAD_FAILED); | 1310 usb2_transfer_done(xfer, USB_ERR_DMA_LOAD_FAILED); |
1311 USB_BUS_UNLOCK(xfer->udev->bus); | 1311 USB_BUS_UNLOCK(info->bus); |
1312 return; 1313 } 1314 if (info->dma_currframe != info->dma_nframes) { 1315 1316 if (info->dma_currframe == 0) { 1317 /* special case */ 1318 usb2_pc_load_mem(xfer->frbuffers, 1319 info->dma_frlength_0, 0); --- 27 unchanged lines hidden (view full) --- 1347 *------------------------------------------------------------------------*/ 1348void 1349usb2_bdma_done_event(struct usb2_dma_parent_tag *udpt) 1350{ 1351 struct usb2_xfer_root *info; 1352 1353 info = udpt->info; 1354 | 1312 return; 1313 } 1314 if (info->dma_currframe != info->dma_nframes) { 1315 1316 if (info->dma_currframe == 0) { 1317 /* special case */ 1318 usb2_pc_load_mem(xfer->frbuffers, 1319 info->dma_frlength_0, 0); --- 27 unchanged lines hidden (view full) --- 1347 *------------------------------------------------------------------------*/ 1348void 1349usb2_bdma_done_event(struct usb2_dma_parent_tag *udpt) 1350{ 1351 struct usb2_xfer_root *info; 1352 1353 info = udpt->info; 1354 |
1355 mtx_assert(info->priv_mtx, MA_OWNED); | 1355 mtx_assert(info->xfer_mtx, MA_OWNED); |
1356 1357 /* copy error */ 1358 info->dma_error = udpt->dma_error; 1359 1360 /* enter workloop again */ 1361 usb2_command_wrapper(&info->dma_q, 1362 info->dma_q.curr); 1363} --- 63 unchanged lines hidden --- | 1356 1357 /* copy error */ 1358 info->dma_error = udpt->dma_error; 1359 1360 /* enter workloop again */ 1361 usb2_command_wrapper(&info->dma_q, 1362 info->dma_q.curr); 1363} --- 63 unchanged lines hidden --- |