diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2010-05-10 15:15:12 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2010-06-07 11:59:25 -0400 |
commit | abbceff7d7a884968e876e52578da1db4a4f6b54 (patch) | |
tree | 9a78609a90866a3a5313b35208e2e761ce4f3a77 /lib | |
parent | eb605a5754d050a25a9f00d718fb173f24c486ef (diff) |
swiotlb: add the swiotlb initialization function with iotlb memory
This enables the caller to initialize swiotlb with its own iotlb
memory.
See "swiotlb: swiotlb: add swiotlb_tbl_map_single library function" for
full description of patchset.
[v2: changed ..with_tlb to ..with_tbl]
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tested-by: Albert Herranz <albert_herranz@yahoo.es>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/swiotlb.c | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/lib/swiotlb.c b/lib/swiotlb.c index 783aff00024c..ec61e1507d0a 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c | |||
@@ -140,28 +140,14 @@ void swiotlb_print_info(void) | |||
140 | (unsigned long long)pend); | 140 | (unsigned long long)pend); |
141 | } | 141 | } |
142 | 142 | ||
143 | /* | 143 | void __init swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose) |
144 | * Statically reserve bounce buffer space and initialize bounce buffer data | ||
145 | * structures for the software IO TLB used to implement the DMA API. | ||
146 | */ | ||
147 | void __init | ||
148 | swiotlb_init_with_default_size(size_t default_size, int verbose) | ||
149 | { | 144 | { |
150 | unsigned long i, bytes; | 145 | unsigned long i, bytes; |
151 | 146 | ||
152 | if (!io_tlb_nslabs) { | 147 | bytes = nslabs << IO_TLB_SHIFT; |
153 | io_tlb_nslabs = (default_size >> IO_TLB_SHIFT); | ||
154 | io_tlb_nslabs = ALIGN(io_tlb_nslabs, IO_TLB_SEGSIZE); | ||
155 | } | ||
156 | 148 | ||
157 | bytes = io_tlb_nslabs << IO_TLB_SHIFT; | 149 | io_tlb_nslabs = nslabs; |
158 | 150 | io_tlb_start = tlb; | |
159 | /* | ||
160 | * Get IO TLB memory from the low pages | ||
161 | */ | ||
162 | io_tlb_start = alloc_bootmem_low_pages(bytes); | ||
163 | if (!io_tlb_start) | ||
164 | panic("Cannot allocate SWIOTLB buffer"); | ||
165 | io_tlb_end = io_tlb_start + bytes; | 151 | io_tlb_end = io_tlb_start + bytes; |
166 | 152 | ||
167 | /* | 153 | /* |
@@ -185,6 +171,32 @@ swiotlb_init_with_default_size(size_t default_size, int verbose) | |||
185 | swiotlb_print_info(); | 171 | swiotlb_print_info(); |
186 | } | 172 | } |
187 | 173 | ||
174 | /* | ||
175 | * Statically reserve bounce buffer space and initialize bounce buffer data | ||
176 | * structures for the software IO TLB used to implement the DMA API. | ||
177 | */ | ||
178 | void __init | ||
179 | swiotlb_init_with_default_size(size_t default_size, int verbose) | ||
180 | { | ||
181 | unsigned long bytes; | ||
182 | |||
183 | if (!io_tlb_nslabs) { | ||
184 | io_tlb_nslabs = (default_size >> IO_TLB_SHIFT); | ||
185 | io_tlb_nslabs = ALIGN(io_tlb_nslabs, IO_TLB_SEGSIZE); | ||
186 | } | ||
187 | |||
188 | bytes = io_tlb_nslabs << IO_TLB_SHIFT; | ||
189 | |||
190 | /* | ||
191 | * Get IO TLB memory from the low pages | ||
192 | */ | ||
193 | io_tlb_start = alloc_bootmem_low_pages(bytes); | ||
194 | if (!io_tlb_start) | ||
195 | panic("Cannot allocate SWIOTLB buffer"); | ||
196 | |||
197 | swiotlb_init_with_tbl(io_tlb_start, io_tlb_nslabs, verbose); | ||
198 | } | ||
199 | |||
188 | void __init | 200 | void __init |
189 | swiotlb_init(int verbose) | 201 | swiotlb_init(int verbose) |
190 | { | 202 | { |