Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _ASM_SCATTERLIST_H |
| 2 | #define _ASM_SCATTERLIST_H |
| 3 | |
Jean Delvare | a9dfd28 | 2007-03-06 02:45:12 -0800 | [diff] [blame] | 4 | #include <asm/types.h> |
| 5 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | /* |
Jens Axboe | d09d276 | 2007-10-23 12:39:41 +0200 | [diff] [blame] | 7 | * Drivers must set either ->address or (preferred) page and ->offset |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * to indicate where data must be transferred to/from. |
| 9 | * |
Jens Axboe | d09d276 | 2007-10-23 12:39:41 +0200 | [diff] [blame] | 10 | * Using page is recommended since it handles highmem data as well as |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | * low mem. ->address is restricted to data which has a virtual mapping, and |
Jens Axboe | d09d276 | 2007-10-23 12:39:41 +0200 | [diff] [blame] | 12 | * it will go away in the future. Updating to page can be automated very |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | * easily -- something like |
| 14 | * |
| 15 | * sg->address = some_ptr; |
| 16 | * |
| 17 | * can be rewritten as |
| 18 | * |
Jens Axboe | d09d276 | 2007-10-23 12:39:41 +0200 | [diff] [blame] | 19 | * sg_set_page(virt_to_page(some_ptr)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | * sg->offset = (unsigned long) some_ptr & ~PAGE_MASK; |
| 21 | * |
| 22 | * and that's it. There's no excuse for not highmem enabling YOUR driver. /jens |
| 23 | */ |
| 24 | struct scatterlist { |
Jens Axboe | d6ec084 | 2007-10-22 20:01:06 +0200 | [diff] [blame] | 25 | #ifdef CONFIG_DEBUG_SG |
| 26 | unsigned long sg_magic; |
| 27 | #endif |
Jens Axboe | 18dabf4 | 2007-10-22 19:57:20 +0200 | [diff] [blame] | 28 | unsigned long page_link; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | unsigned int offset; /* for highmem, page offset */ |
| 30 | |
| 31 | dma_addr_t dma_address; |
| 32 | unsigned int length; |
| 33 | }; |
| 34 | |
| 35 | #define ISA_DMA_THRESHOLD (0xffffffffUL) |
| 36 | |
| 37 | #endif /* !_ASM_SCATTERLIST_H */ |