diff options
Diffstat (limited to 'include')
25 files changed, 79 insertions, 49 deletions
diff --git a/include/asm-alpha/scatterlist.h b/include/asm-alpha/scatterlist.h index 917365405e83..b7647063bd55 100644 --- a/include/asm-alpha/scatterlist.h +++ b/include/asm-alpha/scatterlist.h | |||
@@ -5,7 +5,7 @@ | |||
5 | #include <asm/types.h> | 5 | #include <asm/types.h> |
6 | 6 | ||
7 | struct scatterlist { | 7 | struct scatterlist { |
8 | struct page *page; | 8 | unsigned long page_link; |
9 | unsigned int offset; | 9 | unsigned int offset; |
10 | 10 | ||
11 | unsigned int length; | 11 | unsigned int length; |
diff --git a/include/asm-arm/scatterlist.h b/include/asm-arm/scatterlist.h index de2f65eb42ed..ab1d85dd0232 100644 --- a/include/asm-arm/scatterlist.h +++ b/include/asm-arm/scatterlist.h | |||
@@ -5,7 +5,7 @@ | |||
5 | #include <asm/types.h> | 5 | #include <asm/types.h> |
6 | 6 | ||
7 | struct scatterlist { | 7 | struct scatterlist { |
8 | struct page *page; /* buffer page */ | 8 | unsigned long page_link; |
9 | unsigned int offset; /* buffer offset */ | 9 | unsigned int offset; /* buffer offset */ |
10 | dma_addr_t dma_address; /* dma address */ | 10 | dma_addr_t dma_address; /* dma address */ |
11 | unsigned int length; /* length */ | 11 | unsigned int length; /* length */ |
diff --git a/include/asm-avr32/scatterlist.h b/include/asm-avr32/scatterlist.h index c6d5ce3b3a25..1356f29d89f5 100644 --- a/include/asm-avr32/scatterlist.h +++ b/include/asm-avr32/scatterlist.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <asm/types.h> | 4 | #include <asm/types.h> |
5 | 5 | ||
6 | struct scatterlist { | 6 | struct scatterlist { |
7 | struct page *page; | 7 | unsigned long page_link; |
8 | unsigned int offset; | 8 | unsigned int offset; |
9 | dma_addr_t dma_address; | 9 | dma_addr_t dma_address; |
10 | unsigned int length; | 10 | unsigned int length; |
diff --git a/include/asm-blackfin/scatterlist.h b/include/asm-blackfin/scatterlist.h index 60e07b92044c..384af549e5b8 100644 --- a/include/asm-blackfin/scatterlist.h +++ b/include/asm-blackfin/scatterlist.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <linux/mm.h> | 4 | #include <linux/mm.h> |
5 | 5 | ||
6 | struct scatterlist { | 6 | struct scatterlist { |
7 | struct page *page; | 7 | unsigned long page_link; |
8 | unsigned int offset; | 8 | unsigned int offset; |
9 | dma_addr_t dma_address; | 9 | dma_addr_t dma_address; |
10 | unsigned int length; | 10 | unsigned int length; |
diff --git a/include/asm-cris/scatterlist.h b/include/asm-cris/scatterlist.h index 4bdc44c4ac3d..5a8a83440d3b 100644 --- a/include/asm-cris/scatterlist.h +++ b/include/asm-cris/scatterlist.h | |||
@@ -6,7 +6,7 @@ struct scatterlist { | |||
6 | unsigned int length; | 6 | unsigned int length; |
7 | 7 | ||
8 | /* The following is i386 highmem junk - not used by us */ | 8 | /* The following is i386 highmem junk - not used by us */ |
9 | struct page * page; /* Location for highmem page, if any */ | 9 | unsigned long page_link; |
10 | unsigned int offset;/* for highmem, page offset */ | 10 | unsigned int offset;/* for highmem, page offset */ |
11 | 11 | ||
12 | }; | 12 | }; |
diff --git a/include/asm-frv/scatterlist.h b/include/asm-frv/scatterlist.h index 8e827fa853f1..53dade7b2e16 100644 --- a/include/asm-frv/scatterlist.h +++ b/include/asm-frv/scatterlist.h | |||
@@ -22,7 +22,7 @@ | |||
22 | * and that's it. There's no excuse for not highmem enabling YOUR driver. /jens | 22 | * and that's it. There's no excuse for not highmem enabling YOUR driver. /jens |
23 | */ | 23 | */ |
24 | struct scatterlist { | 24 | struct scatterlist { |
25 | struct page *page; /* Location for highmem page, if any */ | 25 | unsigned long page_link; |
26 | unsigned int offset; /* for highmem, page offset */ | 26 | unsigned int offset; /* for highmem, page offset */ |
27 | 27 | ||
28 | dma_addr_t dma_address; | 28 | dma_addr_t dma_address; |
diff --git a/include/asm-h8300/scatterlist.h b/include/asm-h8300/scatterlist.h index 985fdf54eaca..7e41983d6b26 100644 --- a/include/asm-h8300/scatterlist.h +++ b/include/asm-h8300/scatterlist.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <asm/types.h> | 4 | #include <asm/types.h> |
5 | 5 | ||
6 | struct scatterlist { | 6 | struct scatterlist { |
7 | struct page *page; | 7 | unsigned long page_link; |
8 | unsigned int offset; | 8 | unsigned int offset; |
9 | dma_addr_t dma_address; | 9 | dma_addr_t dma_address; |
10 | unsigned int length; | 10 | unsigned int length; |
diff --git a/include/asm-ia64/scatterlist.h b/include/asm-ia64/scatterlist.h index 7d5234d50312..2f76ce304964 100644 --- a/include/asm-ia64/scatterlist.h +++ b/include/asm-ia64/scatterlist.h | |||
@@ -9,7 +9,7 @@ | |||
9 | #include <asm/types.h> | 9 | #include <asm/types.h> |
10 | 10 | ||
11 | struct scatterlist { | 11 | struct scatterlist { |
12 | struct page *page; | 12 | unsigned long page_link; |
13 | unsigned int offset; | 13 | unsigned int offset; |
14 | unsigned int length; /* buffer length */ | 14 | unsigned int length; /* buffer length */ |
15 | 15 | ||
diff --git a/include/asm-m32r/scatterlist.h b/include/asm-m32r/scatterlist.h index 352415ff5eb9..33b4b4d2c89e 100644 --- a/include/asm-m32r/scatterlist.h +++ b/include/asm-m32r/scatterlist.h | |||
@@ -6,7 +6,7 @@ | |||
6 | struct scatterlist { | 6 | struct scatterlist { |
7 | char * address; /* Location data is to be transferred to, NULL for | 7 | char * address; /* Location data is to be transferred to, NULL for |
8 | * highmem page */ | 8 | * highmem page */ |
9 | struct page * page; /* Location for highmem page, if any */ | 9 | unsigned long page_link; |
10 | unsigned int offset;/* for highmem, page offset */ | 10 | unsigned int offset;/* for highmem, page offset */ |
11 | 11 | ||
12 | dma_addr_t dma_address; | 12 | dma_addr_t dma_address; |
diff --git a/include/asm-m68k/scatterlist.h b/include/asm-m68k/scatterlist.h index 24887a2d9c7b..e06bb891048e 100644 --- a/include/asm-m68k/scatterlist.h +++ b/include/asm-m68k/scatterlist.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | 5 | ||
6 | struct scatterlist { | 6 | struct scatterlist { |
7 | struct page *page; | 7 | unsigned long page_link; |
8 | unsigned int offset; | 8 | unsigned int offset; |
9 | unsigned int length; | 9 | unsigned int length; |
10 | 10 | ||
diff --git a/include/asm-m68knommu/scatterlist.h b/include/asm-m68knommu/scatterlist.h index 4da79d3d3f34..28bed41dc80b 100644 --- a/include/asm-m68knommu/scatterlist.h +++ b/include/asm-m68knommu/scatterlist.h | |||
@@ -5,7 +5,7 @@ | |||
5 | #include <asm/types.h> | 5 | #include <asm/types.h> |
6 | 6 | ||
7 | struct scatterlist { | 7 | struct scatterlist { |
8 | struct page *page; | 8 | unsigned long page_link; |
9 | unsigned int offset; | 9 | unsigned int offset; |
10 | dma_addr_t dma_address; | 10 | dma_addr_t dma_address; |
11 | unsigned int length; | 11 | unsigned int length; |
diff --git a/include/asm-mips/scatterlist.h b/include/asm-mips/scatterlist.h index 7af104c95b20..787797cdb0a9 100644 --- a/include/asm-mips/scatterlist.h +++ b/include/asm-mips/scatterlist.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <asm/types.h> | 4 | #include <asm/types.h> |
5 | 5 | ||
6 | struct scatterlist { | 6 | struct scatterlist { |
7 | struct page * page; | 7 | unsigned long page_link; |
8 | unsigned int offset; | 8 | unsigned int offset; |
9 | dma_addr_t dma_address; | 9 | dma_addr_t dma_address; |
10 | unsigned int length; | 10 | unsigned int length; |
diff --git a/include/asm-parisc/scatterlist.h b/include/asm-parisc/scatterlist.h index e7211c748446..26da9146fffb 100644 --- a/include/asm-parisc/scatterlist.h +++ b/include/asm-parisc/scatterlist.h | |||
@@ -5,7 +5,7 @@ | |||
5 | #include <asm/types.h> | 5 | #include <asm/types.h> |
6 | 6 | ||
7 | struct scatterlist { | 7 | struct scatterlist { |
8 | struct page *page; | 8 | unsigned long page_link; |
9 | unsigned int offset; | 9 | unsigned int offset; |
10 | 10 | ||
11 | unsigned int length; | 11 | unsigned int length; |
diff --git a/include/asm-powerpc/scatterlist.h b/include/asm-powerpc/scatterlist.h index b075f619c3b7..b9f1dbc24843 100644 --- a/include/asm-powerpc/scatterlist.h +++ b/include/asm-powerpc/scatterlist.h | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <asm/dma.h> | 14 | #include <asm/dma.h> |
15 | 15 | ||
16 | struct scatterlist { | 16 | struct scatterlist { |
17 | struct page *page; | 17 | unsigned long page_link; |
18 | unsigned int offset; | 18 | unsigned int offset; |
19 | unsigned int length; | 19 | unsigned int length; |
20 | 20 | ||
diff --git a/include/asm-s390/scatterlist.h b/include/asm-s390/scatterlist.h index a43b3afc5e2d..eb3948690d6e 100644 --- a/include/asm-s390/scatterlist.h +++ b/include/asm-s390/scatterlist.h | |||
@@ -2,7 +2,7 @@ | |||
2 | #define _ASMS390_SCATTERLIST_H | 2 | #define _ASMS390_SCATTERLIST_H |
3 | 3 | ||
4 | struct scatterlist { | 4 | struct scatterlist { |
5 | struct page *page; | 5 | unsigned long page_link; |
6 | unsigned int offset; | 6 | unsigned int offset; |
7 | unsigned int length; | 7 | unsigned int length; |
8 | }; | 8 | }; |
diff --git a/include/asm-sh/scatterlist.h b/include/asm-sh/scatterlist.h index b9ae53c38365..bc7c809e16fb 100644 --- a/include/asm-sh/scatterlist.h +++ b/include/asm-sh/scatterlist.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <asm/types.h> | 4 | #include <asm/types.h> |
5 | 5 | ||
6 | struct scatterlist { | 6 | struct scatterlist { |
7 | struct page * page; /* Location for highmem page, if any */ | 7 | unsigned long page_link; |
8 | unsigned int offset;/* for highmem, page offset */ | 8 | unsigned int offset;/* for highmem, page offset */ |
9 | dma_addr_t dma_address; | 9 | dma_addr_t dma_address; |
10 | unsigned int length; | 10 | unsigned int length; |
diff --git a/include/asm-sh64/scatterlist.h b/include/asm-sh64/scatterlist.h index 1c723f2d7a95..0afd856e218a 100644 --- a/include/asm-sh64/scatterlist.h +++ b/include/asm-sh64/scatterlist.h | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <asm/types.h> | 14 | #include <asm/types.h> |
15 | 15 | ||
16 | struct scatterlist { | 16 | struct scatterlist { |
17 | struct page * page; /* Location for highmem page, if any */ | 17 | unsigned long page_link; |
18 | unsigned int offset;/* for highmem, page offset */ | 18 | unsigned int offset;/* for highmem, page offset */ |
19 | dma_addr_t dma_address; | 19 | dma_addr_t dma_address; |
20 | unsigned int length; | 20 | unsigned int length; |
diff --git a/include/asm-sparc/scatterlist.h b/include/asm-sparc/scatterlist.h index 4055af90ad7e..45b16f1072be 100644 --- a/include/asm-sparc/scatterlist.h +++ b/include/asm-sparc/scatterlist.h | |||
@@ -5,7 +5,7 @@ | |||
5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
6 | 6 | ||
7 | struct scatterlist { | 7 | struct scatterlist { |
8 | struct page *page; | 8 | unsigned long page_link; |
9 | unsigned int offset; | 9 | unsigned int offset; |
10 | 10 | ||
11 | unsigned int length; | 11 | unsigned int length; |
diff --git a/include/asm-sparc64/scatterlist.h b/include/asm-sparc64/scatterlist.h index 703c5bbe6c8c..4cbaf7c6b0bb 100644 --- a/include/asm-sparc64/scatterlist.h +++ b/include/asm-sparc64/scatterlist.h | |||
@@ -6,7 +6,7 @@ | |||
6 | #include <asm/types.h> | 6 | #include <asm/types.h> |
7 | 7 | ||
8 | struct scatterlist { | 8 | struct scatterlist { |
9 | struct page *page; | 9 | unsigned long page_link; |
10 | unsigned int offset; | 10 | unsigned int offset; |
11 | 11 | ||
12 | unsigned int length; | 12 | unsigned int length; |
diff --git a/include/asm-v850/scatterlist.h b/include/asm-v850/scatterlist.h index 56f402920db9..db91febc2100 100644 --- a/include/asm-v850/scatterlist.h +++ b/include/asm-v850/scatterlist.h | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <asm/types.h> | 17 | #include <asm/types.h> |
18 | 18 | ||
19 | struct scatterlist { | 19 | struct scatterlist { |
20 | struct page *page; | 20 | unsigned long page_link; |
21 | unsigned offset; | 21 | unsigned offset; |
22 | dma_addr_t dma_address; | 22 | dma_addr_t dma_address; |
23 | unsigned length; | 23 | unsigned length; |
diff --git a/include/asm-x86/dma-mapping_32.h b/include/asm-x86/dma-mapping_32.h index 6a2d26cb5da6..55f01bd9e556 100644 --- a/include/asm-x86/dma-mapping_32.h +++ b/include/asm-x86/dma-mapping_32.h | |||
@@ -45,9 +45,9 @@ dma_map_sg(struct device *dev, struct scatterlist *sglist, int nents, | |||
45 | WARN_ON(nents == 0 || sglist[0].length == 0); | 45 | WARN_ON(nents == 0 || sglist[0].length == 0); |
46 | 46 | ||
47 | for_each_sg(sglist, sg, nents, i) { | 47 | for_each_sg(sglist, sg, nents, i) { |
48 | BUG_ON(!sg->page); | 48 | BUG_ON(!sg_page(sg)); |
49 | 49 | ||
50 | sg->dma_address = page_to_phys(sg->page) + sg->offset; | 50 | sg->dma_address = sg_phys(sg); |
51 | } | 51 | } |
52 | 52 | ||
53 | flush_write_buffers(); | 53 | flush_write_buffers(); |
diff --git a/include/asm-x86/scatterlist_32.h b/include/asm-x86/scatterlist_32.h index bd5164aa8f63..140a5b37fa77 100644 --- a/include/asm-x86/scatterlist_32.h +++ b/include/asm-x86/scatterlist_32.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <asm/types.h> | 4 | #include <asm/types.h> |
5 | 5 | ||
6 | struct scatterlist { | 6 | struct scatterlist { |
7 | struct page *page; | 7 | unsigned long page_link; |
8 | unsigned int offset; | 8 | unsigned int offset; |
9 | dma_addr_t dma_address; | 9 | dma_addr_t dma_address; |
10 | unsigned int length; | 10 | unsigned int length; |
diff --git a/include/asm-x86/scatterlist_64.h b/include/asm-x86/scatterlist_64.h index ef3986ba4b79..e3447846e03d 100644 --- a/include/asm-x86/scatterlist_64.h +++ b/include/asm-x86/scatterlist_64.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <asm/types.h> | 4 | #include <asm/types.h> |
5 | 5 | ||
6 | struct scatterlist { | 6 | struct scatterlist { |
7 | struct page *page; | 7 | unsigned long page_link; |
8 | unsigned int offset; | 8 | unsigned int offset; |
9 | unsigned int length; | 9 | unsigned int length; |
10 | dma_addr_t dma_address; | 10 | dma_addr_t dma_address; |
diff --git a/include/asm-xtensa/scatterlist.h b/include/asm-xtensa/scatterlist.h index ca337a294290..3b8aba5d2c68 100644 --- a/include/asm-xtensa/scatterlist.h +++ b/include/asm-xtensa/scatterlist.h | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <asm/types.h> | 14 | #include <asm/types.h> |
15 | 15 | ||
16 | struct scatterlist { | 16 | struct scatterlist { |
17 | struct page *page; | 17 | unsigned long page_link; |
18 | unsigned int offset; | 18 | unsigned int offset; |
19 | dma_addr_t dma_address; | 19 | dma_addr_t dma_address; |
20 | unsigned int length; | 20 | unsigned int length; |
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 1645795cbb13..c6136e8a7f58 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h | |||
@@ -2,9 +2,26 @@ | |||
2 | #define _LINUX_SCATTERLIST_H | 2 | #define _LINUX_SCATTERLIST_H |
3 | 3 | ||
4 | #include <asm/scatterlist.h> | 4 | #include <asm/scatterlist.h> |
5 | #include <asm/io.h> | ||
6 | #include <linux/mm.h> | 5 | #include <linux/mm.h> |
7 | #include <linux/string.h> | 6 | #include <linux/string.h> |
7 | #include <asm/io.h> | ||
8 | |||
9 | /* | ||
10 | * Notes on SG table design. | ||
11 | * | ||
12 | * Architectures must provide an unsigned long page_link field in the | ||
13 | * scatterlist struct. We use that to place the page pointer AND encode | ||
14 | * information about the sg table as well. The two lower bits are reserved | ||
15 | * for this information. | ||
16 | * | ||
17 | * If bit 0 is set, then the page_link contains a pointer to the next sg | ||
18 | * table list. Otherwise the next entry is at sg + 1. | ||
19 | * | ||
20 | * If bit 1 is set, then this sg entry is the last element in a list. | ||
21 | * | ||
22 | * See sg_next(). | ||
23 | * | ||
24 | */ | ||
8 | 25 | ||
9 | /** | 26 | /** |
10 | * sg_set_page - Set sg entry to point at given page | 27 | * sg_set_page - Set sg entry to point at given page |
@@ -20,11 +37,20 @@ | |||
20 | **/ | 37 | **/ |
21 | static inline void sg_set_page(struct scatterlist *sg, struct page *page) | 38 | static inline void sg_set_page(struct scatterlist *sg, struct page *page) |
22 | { | 39 | { |
23 | sg->page = page; | 40 | unsigned long page_link = sg->page_link & 0x3; |
41 | |||
42 | sg->page_link = page_link | (unsigned long) page; | ||
24 | } | 43 | } |
25 | 44 | ||
26 | #define sg_page(sg) ((sg)->page) | 45 | #define sg_page(sg) ((struct page *) ((sg)->page_link & ~0x3)) |
27 | 46 | ||
47 | /** | ||
48 | * sg_set_buf - Set sg entry to point at given data | ||
49 | * @sg: SG entry | ||
50 | * @buf: Data | ||
51 | * @buflen: Data length | ||
52 | * | ||
53 | **/ | ||
28 | static inline void sg_set_buf(struct scatterlist *sg, const void *buf, | 54 | static inline void sg_set_buf(struct scatterlist *sg, const void *buf, |
29 | unsigned int buflen) | 55 | unsigned int buflen) |
30 | { | 56 | { |
@@ -38,26 +64,27 @@ static inline void sg_set_buf(struct scatterlist *sg, const void *buf, | |||
38 | * a valid sg entry, or whether it points to the start of a new scatterlist. | 64 | * a valid sg entry, or whether it points to the start of a new scatterlist. |
39 | * Those low bits are there for everyone! (thanks mason :-) | 65 | * Those low bits are there for everyone! (thanks mason :-) |
40 | */ | 66 | */ |
41 | #define sg_is_chain(sg) ((unsigned long) (sg)->page & 0x01) | 67 | #define sg_is_chain(sg) ((sg)->page_link & 0x01) |
68 | #define sg_is_last(sg) ((sg)->page_link & 0x02) | ||
42 | #define sg_chain_ptr(sg) \ | 69 | #define sg_chain_ptr(sg) \ |
43 | ((struct scatterlist *) ((unsigned long) (sg)->page & ~0x01)) | 70 | ((struct scatterlist *) ((sg)->page_link & ~0x03)) |
44 | 71 | ||
45 | /** | 72 | /** |
46 | * sg_next - return the next scatterlist entry in a list | 73 | * sg_next - return the next scatterlist entry in a list |
47 | * @sg: The current sg entry | 74 | * @sg: The current sg entry |
48 | * | 75 | * |
49 | * Usually the next entry will be @sg@ + 1, but if this sg element is part | 76 | * Description: |
50 | * of a chained scatterlist, it could jump to the start of a new | 77 | * Usually the next entry will be @sg@ + 1, but if this sg element is part |
51 | * scatterlist array. | 78 | * of a chained scatterlist, it could jump to the start of a new |
52 | * | 79 | * scatterlist array. |
53 | * Note that the caller must ensure that there are further entries after | ||
54 | * the current entry, this function will NOT return NULL for an end-of-list. | ||
55 | * | 80 | * |
56 | */ | 81 | **/ |
57 | static inline struct scatterlist *sg_next(struct scatterlist *sg) | 82 | static inline struct scatterlist *sg_next(struct scatterlist *sg) |
58 | { | 83 | { |
59 | sg++; | 84 | if (sg_is_last(sg)) |
85 | return NULL; | ||
60 | 86 | ||
87 | sg++; | ||
61 | if (unlikely(sg_is_chain(sg))) | 88 | if (unlikely(sg_is_chain(sg))) |
62 | sg = sg_chain_ptr(sg); | 89 | sg = sg_chain_ptr(sg); |
63 | 90 | ||
@@ -75,14 +102,15 @@ static inline struct scatterlist *sg_next(struct scatterlist *sg) | |||
75 | * @sgl: First entry in the scatterlist | 102 | * @sgl: First entry in the scatterlist |
76 | * @nents: Number of entries in the scatterlist | 103 | * @nents: Number of entries in the scatterlist |
77 | * | 104 | * |
78 | * Should only be used casually, it (currently) scan the entire list | 105 | * Description: |
79 | * to get the last entry. | 106 | * Should only be used casually, it (currently) scan the entire list |
107 | * to get the last entry. | ||
80 | * | 108 | * |
81 | * Note that the @sgl@ pointer passed in need not be the first one, | 109 | * Note that the @sgl@ pointer passed in need not be the first one, |
82 | * the important bit is that @nents@ denotes the number of entries that | 110 | * the important bit is that @nents@ denotes the number of entries that |
83 | * exist from @sgl@. | 111 | * exist from @sgl@. |
84 | * | 112 | * |
85 | */ | 113 | **/ |
86 | static inline struct scatterlist *sg_last(struct scatterlist *sgl, | 114 | static inline struct scatterlist *sg_last(struct scatterlist *sgl, |
87 | unsigned int nents) | 115 | unsigned int nents) |
88 | { | 116 | { |
@@ -105,16 +133,17 @@ static inline struct scatterlist *sg_last(struct scatterlist *sgl, | |||
105 | * @prv_nents: Number of entries in prv | 133 | * @prv_nents: Number of entries in prv |
106 | * @sgl: Second scatterlist | 134 | * @sgl: Second scatterlist |
107 | * | 135 | * |
108 | * Links @prv@ and @sgl@ together, to form a longer scatterlist. | 136 | * Description: |
137 | * Links @prv@ and @sgl@ together, to form a longer scatterlist. | ||
109 | * | 138 | * |
110 | */ | 139 | **/ |
111 | static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents, | 140 | static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents, |
112 | struct scatterlist *sgl) | 141 | struct scatterlist *sgl) |
113 | { | 142 | { |
114 | #ifndef ARCH_HAS_SG_CHAIN | 143 | #ifndef ARCH_HAS_SG_CHAIN |
115 | BUG(); | 144 | BUG(); |
116 | #endif | 145 | #endif |
117 | prv[prv_nents - 1].page = (struct page *) ((unsigned long) sgl | 0x01); | 146 | prv[prv_nents - 1].page_link = (unsigned long) sgl | 0x01; |
118 | } | 147 | } |
119 | 148 | ||
120 | /** | 149 | /** |
@@ -128,13 +157,14 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents, | |||
128 | **/ | 157 | **/ |
129 | static inline void sg_mark_end(struct scatterlist *sgl, unsigned int nents) | 158 | static inline void sg_mark_end(struct scatterlist *sgl, unsigned int nents) |
130 | { | 159 | { |
160 | sgl[nents - 1].page_link = 0x02; | ||
131 | } | 161 | } |
132 | 162 | ||
133 | static inline void __sg_mark_end(struct scatterlist *sg) | 163 | static inline void __sg_mark_end(struct scatterlist *sg) |
134 | { | 164 | { |
165 | sg->page_link |= 0x02; | ||
135 | } | 166 | } |
136 | 167 | ||
137 | |||
138 | /** | 168 | /** |
139 | * sg_init_one - Initialize a single entry sg list | 169 | * sg_init_one - Initialize a single entry sg list |
140 | * @sg: SG entry | 170 | * @sg: SG entry |
@@ -187,7 +217,7 @@ static inline unsigned long sg_phys(struct scatterlist *sg) | |||
187 | 217 | ||
188 | /** | 218 | /** |
189 | * sg_virt - Return virtual address of an sg entry | 219 | * sg_virt - Return virtual address of an sg entry |
190 | * @sg: SG entry | 220 | * @sg: SG entry |
191 | * | 221 | * |
192 | * Description: | 222 | * Description: |
193 | * This calls page_address() on the page in this sg entry, and adds the | 223 | * This calls page_address() on the page in this sg entry, and adds the |