aboutsummaryrefslogtreecommitdiffstats
path: root/lib/swiotlb.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/swiotlb.c')
-rw-r--r--lib/swiotlb.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index 1661af593914..fa2dc4e5f9ba 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -156,6 +156,32 @@ static dma_addr_t swiotlb_sg_to_bus(struct scatterlist *sg)
156 return swiotlb_phys_to_bus(page_to_phys(sg_page(sg)) + sg->offset); 156 return swiotlb_phys_to_bus(page_to_phys(sg_page(sg)) + sg->offset);
157} 157}
158 158
159static void swiotlb_print_info(unsigned long bytes)
160{
161 phys_addr_t pstart, pend;
162 dma_addr_t bstart, bend;
163
164 pstart = virt_to_phys(io_tlb_start);
165 pend = virt_to_phys(io_tlb_end);
166
167 bstart = swiotlb_phys_to_bus(pstart);
168 bend = swiotlb_phys_to_bus(pend);
169
170 printk(KERN_INFO "Placing %luMB software IO TLB between %p - %p\n",
171 bytes >> 20, io_tlb_start, io_tlb_end);
172 if (pstart != bstart || pend != bend)
173 printk(KERN_INFO "software IO TLB at phys %#llx - %#llx"
174 " bus %#llx - %#llx\n",
175 (unsigned long long)pstart,
176 (unsigned long long)pend,
177 (unsigned long long)bstart,
178 (unsigned long long)bend);
179 else
180 printk(KERN_INFO "software IO TLB at phys %#llx - %#llx\n",
181 (unsigned long long)pstart,
182 (unsigned long long)pend);
183}
184
159/* 185/*
160 * Statically reserve bounce buffer space and initialize bounce buffer data 186 * Statically reserve bounce buffer space and initialize bounce buffer data
161 * structures for the software IO TLB used to implement the DMA API. 187 * structures for the software IO TLB used to implement the DMA API.
@@ -198,8 +224,7 @@ swiotlb_init_with_default_size(size_t default_size)
198 if (!io_tlb_overflow_buffer) 224 if (!io_tlb_overflow_buffer)
199 panic("Cannot allocate SWIOTLB overflow buffer!\n"); 225 panic("Cannot allocate SWIOTLB overflow buffer!\n");
200 226
201 printk(KERN_INFO "Placing software IO TLB between 0x%lx - 0x%lx\n", 227 swiotlb_print_info(bytes);
202 swiotlb_virt_to_bus(io_tlb_start), swiotlb_virt_to_bus(io_tlb_end));
203} 228}
204 229
205void __init 230void __init
@@ -279,9 +304,7 @@ swiotlb_late_init_with_default_size(size_t default_size)
279 if (!io_tlb_overflow_buffer) 304 if (!io_tlb_overflow_buffer)
280 goto cleanup4; 305 goto cleanup4;
281 306
282 printk(KERN_INFO "Placing %luMB software IO TLB between 0x%lx - " 307 swiotlb_print_info(bytes);
283 "0x%lx\n", bytes >> 20,
284 swiotlb_virt_to_bus(io_tlb_start), swiotlb_virt_to_bus(io_tlb_end));
285 308
286 return 0; 309 return 0;
287 310