aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/message.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2007-03-31 21:15:43 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-04-27 16:28:39 -0400
commit35d07fd58f47284adecf219d3b73e4ea197cf29f (patch)
treeccad5ae6102b257676806575d156895bb10ddcdf /drivers/usb/core/message.c
parentebc3ac149bf3a20c235625f1c07e0f997b3e08ba (diff)
USB: Allow transfer_buffer with transfer_dma
Some host controller drivers may need a PIO fallback when a DMA channel is temporarily unavailable. This patch provides an address that such drivers can use for PIO in those cases, and nulls that field out when no such address is available (highmem) which should help usbmon. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/message.c')
-rw-r--r--drivers/usb/core/message.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index da4ee07e0094..b7434787db5f 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -412,10 +412,24 @@ int usb_sg_init (
412 io->urbs [i]->status = -EINPROGRESS; 412 io->urbs [i]->status = -EINPROGRESS;
413 io->urbs [i]->actual_length = 0; 413 io->urbs [i]->actual_length = 0;
414 414
415 /*
416 * Some systems need to revert to PIO when DMA is temporarily
417 * unavailable. For their sakes, both transfer_buffer and
418 * transfer_dma are set when possible. However this can only
419 * work on systems without HIGHMEM, since DMA buffers located
420 * in high memory are not directly addressable by the CPU for
421 * PIO ... so when HIGHMEM is in use, transfer_buffer is NULL
422 * to prevent stale pointers and to help spot bugs.
423 */
415 if (dma) { 424 if (dma) {
416 /* hc may use _only_ transfer_dma */
417 io->urbs [i]->transfer_dma = sg_dma_address (sg + i); 425 io->urbs [i]->transfer_dma = sg_dma_address (sg + i);
418 len = sg_dma_len (sg + i); 426 len = sg_dma_len (sg + i);
427#ifdef CONFIG_HIGHMEM
428 io->urbs[i]->transfer_buffer = NULL;
429#else
430 io->urbs[i]->transfer_buffer =
431 page_address(sg[i].page) + sg[i].offset;
432#endif
419 } else { 433 } else {
420 /* hc may use _only_ transfer_buffer */ 434 /* hc may use _only_ transfer_buffer */
421 io->urbs [i]->transfer_buffer = 435 io->urbs [i]->transfer_buffer =