diff options
Diffstat (limited to 'drivers/iommu/omap-iommu-debug.c')
-rw-r--r-- | drivers/iommu/omap-iommu-debug.c | 114 |
1 files changed, 0 insertions, 114 deletions
diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c index 80fffba7f12d..531658d17333 100644 --- a/drivers/iommu/omap-iommu-debug.c +++ b/drivers/iommu/omap-iommu-debug.c | |||
@@ -213,116 +213,6 @@ static ssize_t debug_read_pagetable(struct file *file, char __user *userbuf, | |||
213 | return bytes; | 213 | return bytes; |
214 | } | 214 | } |
215 | 215 | ||
216 | static ssize_t debug_read_mmap(struct file *file, char __user *userbuf, | ||
217 | size_t count, loff_t *ppos) | ||
218 | { | ||
219 | struct device *dev = file->private_data; | ||
220 | struct omap_iommu *obj = dev_to_omap_iommu(dev); | ||
221 | char *p, *buf; | ||
222 | struct iovm_struct *tmp; | ||
223 | int uninitialized_var(i); | ||
224 | ssize_t bytes; | ||
225 | |||
226 | buf = (char *)__get_free_page(GFP_KERNEL); | ||
227 | if (!buf) | ||
228 | return -ENOMEM; | ||
229 | p = buf; | ||
230 | |||
231 | p += sprintf(p, "%-3s %-8s %-8s %6s %8s\n", | ||
232 | "No", "start", "end", "size", "flags"); | ||
233 | p += sprintf(p, "-------------------------------------------------\n"); | ||
234 | |||
235 | mutex_lock(&iommu_debug_lock); | ||
236 | |||
237 | list_for_each_entry(tmp, &obj->mmap, list) { | ||
238 | size_t len; | ||
239 | const char *str = "%3d %08x-%08x %6x %8x\n"; | ||
240 | const int maxcol = 39; | ||
241 | |||
242 | len = tmp->da_end - tmp->da_start; | ||
243 | p += snprintf(p, maxcol, str, | ||
244 | i, tmp->da_start, tmp->da_end, len, tmp->flags); | ||
245 | |||
246 | if (PAGE_SIZE - (p - buf) < maxcol) | ||
247 | break; | ||
248 | i++; | ||
249 | } | ||
250 | |||
251 | bytes = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); | ||
252 | |||
253 | mutex_unlock(&iommu_debug_lock); | ||
254 | free_page((unsigned long)buf); | ||
255 | |||
256 | return bytes; | ||
257 | } | ||
258 | |||
259 | static ssize_t debug_read_mem(struct file *file, char __user *userbuf, | ||
260 | size_t count, loff_t *ppos) | ||
261 | { | ||
262 | struct device *dev = file->private_data; | ||
263 | char *p, *buf; | ||
264 | struct iovm_struct *area; | ||
265 | ssize_t bytes; | ||
266 | |||
267 | count = min_t(ssize_t, count, PAGE_SIZE); | ||
268 | |||
269 | buf = (char *)__get_free_page(GFP_KERNEL); | ||
270 | if (!buf) | ||
271 | return -ENOMEM; | ||
272 | p = buf; | ||
273 | |||
274 | mutex_lock(&iommu_debug_lock); | ||
275 | |||
276 | area = omap_find_iovm_area(dev, (u32)ppos); | ||
277 | if (!area) { | ||
278 | bytes = -EINVAL; | ||
279 | goto err_out; | ||
280 | } | ||
281 | memcpy(p, area->va, count); | ||
282 | p += count; | ||
283 | |||
284 | bytes = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); | ||
285 | err_out: | ||
286 | mutex_unlock(&iommu_debug_lock); | ||
287 | free_page((unsigned long)buf); | ||
288 | |||
289 | return bytes; | ||
290 | } | ||
291 | |||
292 | static ssize_t debug_write_mem(struct file *file, const char __user *userbuf, | ||
293 | size_t count, loff_t *ppos) | ||
294 | { | ||
295 | struct device *dev = file->private_data; | ||
296 | struct iovm_struct *area; | ||
297 | char *p, *buf; | ||
298 | |||
299 | count = min_t(size_t, count, PAGE_SIZE); | ||
300 | |||
301 | buf = (char *)__get_free_page(GFP_KERNEL); | ||
302 | if (!buf) | ||
303 | return -ENOMEM; | ||
304 | p = buf; | ||
305 | |||
306 | mutex_lock(&iommu_debug_lock); | ||
307 | |||
308 | if (copy_from_user(p, userbuf, count)) { | ||
309 | count = -EFAULT; | ||
310 | goto err_out; | ||
311 | } | ||
312 | |||
313 | area = omap_find_iovm_area(dev, (u32)ppos); | ||
314 | if (!area) { | ||
315 | count = -EINVAL; | ||
316 | goto err_out; | ||
317 | } | ||
318 | memcpy(area->va, p, count); | ||
319 | err_out: | ||
320 | mutex_unlock(&iommu_debug_lock); | ||
321 | free_page((unsigned long)buf); | ||
322 | |||
323 | return count; | ||
324 | } | ||
325 | |||
326 | #define DEBUG_FOPS(name) \ | 216 | #define DEBUG_FOPS(name) \ |
327 | static const struct file_operations debug_##name##_fops = { \ | 217 | static const struct file_operations debug_##name##_fops = { \ |
328 | .open = simple_open, \ | 218 | .open = simple_open, \ |
@@ -342,8 +232,6 @@ DEBUG_FOPS_RO(ver); | |||
342 | DEBUG_FOPS_RO(regs); | 232 | DEBUG_FOPS_RO(regs); |
343 | DEBUG_FOPS_RO(tlb); | 233 | DEBUG_FOPS_RO(tlb); |
344 | DEBUG_FOPS(pagetable); | 234 | DEBUG_FOPS(pagetable); |
345 | DEBUG_FOPS_RO(mmap); | ||
346 | DEBUG_FOPS(mem); | ||
347 | 235 | ||
348 | #define __DEBUG_ADD_FILE(attr, mode) \ | 236 | #define __DEBUG_ADD_FILE(attr, mode) \ |
349 | { \ | 237 | { \ |
@@ -389,8 +277,6 @@ static int iommu_debug_register(struct device *dev, void *data) | |||
389 | DEBUG_ADD_FILE_RO(regs); | 277 | DEBUG_ADD_FILE_RO(regs); |
390 | DEBUG_ADD_FILE_RO(tlb); | 278 | DEBUG_ADD_FILE_RO(tlb); |
391 | DEBUG_ADD_FILE(pagetable); | 279 | DEBUG_ADD_FILE(pagetable); |
392 | DEBUG_ADD_FILE_RO(mmap); | ||
393 | DEBUG_ADD_FILE(mem); | ||
394 | 280 | ||
395 | return 0; | 281 | return 0; |
396 | 282 | ||