Rev 5354 | Rev 6088 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5354 | Rev 6084 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | #include |
3 | #include |
4 | #include |
4 | #include |
5 | #include "i915_drv.h" |
5 | #include "i915_drv.h" |
6 | #include "intel_drv.h" |
6 | #include "intel_drv.h" |
7 | #include |
7 | #include |
8 | - | ||
- | 8 | #include |
|
- | 9 | #include |
|
Line 9... | Line 10... | ||
9 | 10 | ||
10 | struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags) |
11 | struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags) |
11 | { |
12 | { |
12 | struct file *filep; |
13 | struct file *filep; |
Line 313... | Line 314... | ||
313 | * linebuf, sizeof(linebuf), true); |
314 | * linebuf, sizeof(linebuf), true); |
314 | * |
315 | * |
315 | * example output buffer: |
316 | * example output buffer: |
316 | * 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f @ABCDEFGHIJKLMNO |
317 | * 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f @ABCDEFGHIJKLMNO |
317 | */ |
318 | */ |
318 | void hex_dump_to_buffer(const void *buf, size_t len, int rowsize, |
319 | int hex_dump_to_buffer(const void *buf, size_t len, int rowsize, int groupsize, |
319 | int groupsize, char *linebuf, size_t linebuflen, |
320 | char *linebuf, size_t linebuflen, bool ascii) |
320 | bool ascii) |
- | |
321 | { |
321 | { |
322 | const u8 *ptr = buf; |
322 | const u8 *ptr = buf; |
- | 323 | int ngroups; |
|
323 | u8 ch; |
324 | u8 ch; |
324 | int j, lx = 0; |
325 | int j, lx = 0; |
325 | int ascii_column; |
326 | int ascii_column; |
- | 327 | int ret; |
|
Line 326... | Line 328... | ||
326 | 328 | ||
327 | if (rowsize != 16 && rowsize != 32) |
329 | if (rowsize != 16 && rowsize != 32) |
Line 328... | Line -... | ||
328 | rowsize = 16; |
- | |
329 | - | ||
330 | if (!len) |
330 | rowsize = 16; |
331 | goto nil; |
331 | |
- | 332 | if (len > rowsize) /* limit to one line at a time */ |
|
- | 333 | len = rowsize; |
|
332 | if (len > rowsize) /* limit to one line at a time */ |
334 | if (!is_power_of_2(groupsize) || groupsize > 8) |
333 | len = rowsize; |
335 | groupsize = 1; |
Line 334... | Line 336... | ||
334 | if ((len % groupsize) != 0) /* no mixed size output */ |
336 | if ((len % groupsize) != 0) /* no mixed size output */ |
- | 337 | groupsize = 1; |
|
- | 338 | ||
- | 339 | ngroups = len / groupsize; |
|
- | 340 | ascii_column = rowsize * 2 + rowsize / groupsize + 1; |
|
- | 341 | ||
335 | groupsize = 1; |
342 | if (!linebuflen) |
- | 343 | goto overflow1; |
|
- | 344 | ||
- | 345 | if (!len) |
|
336 | 346 | goto nil; |
|
337 | switch (groupsize) { |
- | |
Line 338... | Line 347... | ||
338 | case 8: { |
347 | |
339 | const u64 *ptr8 = buf; |
348 | if (groupsize == 8) { |
340 | int ngroups = len / groupsize; |
349 | const u64 *ptr8 = buf; |
341 | 350 | ||
342 | for (j = 0; j < ngroups; j++) |
351 | for (j = 0; j < ngroups; j++) { |
- | 352 | ret = snprintf(linebuf + lx, linebuflen - lx, |
|
343 | lx += scnprintf(linebuf + lx, linebuflen - lx, |
353 | "%s%16.16llx", j ? " " : "", |
344 | "%s%16.16llx", j ? " " : "", |
354 | (unsigned long long)*(ptr8 + j)); |
345 | (unsigned long long)*(ptr8 + j)); |
- | |
346 | ascii_column = 17 * ngroups + 2; |
355 | if (ret >= linebuflen - lx) |
347 | break; |
356 | goto overflow1; |
348 | } |
- | |
Line 349... | Line 357... | ||
349 | 357 | lx += ret; |
|
350 | case 4: { |
358 | } |
351 | const u32 *ptr4 = buf; |
359 | } else if (groupsize == 4) { |
352 | int ngroups = len / groupsize; |
360 | const u32 *ptr4 = buf; |
- | 361 | ||
- | 362 | for (j = 0; j < ngroups; j++) { |
|
353 | 363 | ret = snprintf(linebuf + lx, linebuflen - lx, |
|
354 | for (j = 0; j < ngroups; j++) |
364 | "%s%8.8x", j ? " " : "", |
355 | lx += scnprintf(linebuf + lx, linebuflen - lx, |
- | |
356 | "%s%8.8x", j ? " " : "", *(ptr4 + j)); |
365 | *(ptr4 + j)); |
357 | ascii_column = 9 * ngroups + 2; |
366 | if (ret >= linebuflen - lx) |
358 | break; |
- | |
Line 359... | Line 367... | ||
359 | } |
367 | goto overflow1; |
360 | 368 | lx += ret; |
|
361 | case 2: { |
369 | } |
362 | const u16 *ptr2 = buf; |
370 | } else if (groupsize == 2) { |
- | 371 | const u16 *ptr2 = buf; |
|
- | 372 | ||
363 | int ngroups = len / groupsize; |
373 | for (j = 0; j < ngroups; j++) { |
364 | 374 | ret = snprintf(linebuf + lx, linebuflen - lx, |
|
365 | for (j = 0; j < ngroups; j++) |
- | |
366 | lx += scnprintf(linebuf + lx, linebuflen - lx, |
375 | "%s%4.4x", j ? " " : "", |
367 | "%s%4.4x", j ? " " : "", *(ptr2 + j)); |
376 | *(ptr2 + j)); |
- | 377 | if (ret >= linebuflen - lx) |
|
- | 378 | goto overflow1; |
|
368 | ascii_column = 5 * ngroups + 2; |
379 | lx += ret; |
369 | break; |
380 | } |
370 | } |
381 | } else { |
371 | 382 | for (j = 0; j < len; j++) { |
|
372 | default: |
383 | if (linebuflen < lx + 3) |
373 | for (j = 0; (j < len) && (lx + 3) <= linebuflen; j++) { |
384 | goto overflow2; |
374 | ch = ptr[j]; |
385 | ch = ptr[j]; |
375 | linebuf[lx++] = hex_asc_hi(ch); |
- | |
376 | linebuf[lx++] = hex_asc_lo(ch); |
- | |
377 | linebuf[lx++] = ' '; |
- | |
378 | } |
386 | linebuf[lx++] = hex_asc_hi(ch); |
379 | if (j) |
387 | linebuf[lx++] = hex_asc_lo(ch); |
380 | lx--; |
388 | linebuf[lx++] = ' '; |
Line 381... | Line 389... | ||
381 | 389 | } |
|
- | 390 | if (j) |
|
- | 391 | lx--; |
|
382 | ascii_column = 3 * rowsize + 2; |
392 | } |
- | 393 | if (!ascii) |
|
383 | break; |
394 | goto nil; |
- | 395 | ||
- | 396 | while (lx < ascii_column) { |
|
384 | } |
397 | if (linebuflen < lx + 2) |
385 | if (!ascii) |
398 | goto overflow2; |
386 | goto nil; |
399 | linebuf[lx++] = ' '; |
387 | 400 | } |
|
- | 401 | for (j = 0; j < len; j++) { |
|
- | 402 | if (linebuflen < lx + 2) |
|
- | 403 | goto overflow2; |
|
388 | while (lx < (linebuflen - 1) && lx < (ascii_column - 1)) |
404 | ch = ptr[j]; |
- | 405 | linebuf[lx++] = (isascii(ch) && isprint(ch)) ? ch : '.'; |
|
- | 406 | } |
|
389 | linebuf[lx++] = ' '; |
407 | nil: |
390 | for (j = 0; (j < len) && (lx + 2) < linebuflen; j++) { |
- | |
391 | ch = ptr[j]; |
408 | linebuf[lx] = '\0'; |
392 | linebuf[lx++] = (isascii(ch) && isprint(ch)) ? ch : '.'; |
409 | return lx; |
393 | } |
410 | overflow2: |
394 | nil: |
411 | linebuf[lx++] = '\0'; |
395 | linebuf[lx++] = '\0'; |
412 | overflow1: |
Line 772... | Line 789... | ||
772 | void call_rcu_sched(struct rcu_head *head, void (*func)(struct rcu_head *rcu)) |
789 | void call_rcu_sched(struct rcu_head *head, void (*func)(struct rcu_head *rcu)) |
773 | { |
790 | { |
774 | __call_rcu(head, func, &rcu_sched_ctrlblk); |
791 | __call_rcu(head, func, &rcu_sched_ctrlblk); |
775 | }>>12); |
792 | } |
Line -... | Line 793... | ||
- | 793 | ||
- | 794 | int seq_puts(struct seq_file *m, const char *s) |
|
- | 795 | { |
|
- | 796 | return 0; |
|
Line -... | Line 797... | ||
- | 797 | }; |
|
- | 798 | ||
- | 799 | __printf(2, 3) int seq_printf(struct seq_file *m, const char *f, ...) |
|
- | 800 | { |
|
- | 801 | return 0; |
|
- | 802 | } |
|
- | 803 | ||
- | 804 | ||
- | 805 | signed long |
|
- | 806 | fence_wait_timeout(struct fence *fence, bool intr, signed long timeout) |
|
- | 807 | { |
|
- | 808 | signed long ret; |
|
- | 809 | ||
- | 810 | if (WARN_ON(timeout < 0)) |
|
- | 811 | return -EINVAL; |
|
- | 812 | ||
- | 813 | // trace_fence_wait_start(fence); |
|
- | 814 | ret = fence->ops->wait(fence, intr, timeout); |
|
- | 815 | // trace_fence_wait_end(fence); |
|
- | 816 | return ret; |
|
- | 817 | } |
|
- | 818 | ||
- | 819 | void fence_release(struct kref *kref) |
|
- | 820 | { |
|
- | 821 | struct fence *fence = |
|
- | 822 | container_of(kref, struct fence, refcount); |
|
- | 823 | ||
- | 824 | // trace_fence_destroy(fence); |
|
- | 825 | ||
- | 826 | BUG_ON(!list_empty(&fence->cb_list)); |
|
- | 827 | ||
- | 828 | if (fence->ops->release) |
|
- | 829 | fence->ops->release(fence); |
|
- | 830 | else |
|
- | 831 | fence_free(fence); |
|
- | 832 | } |
|
- | 833 | ||
- | 834 | void fence_free(struct fence *fence) |
|
- | 835 | { |
|
- | 836 | kfree_rcu(fence, rcu); |
|
- | 837 | } |
|
- | 838 | EXPORT_SYMBOL(fence_free); |
|
- | 839 | ||
- | 840 | ||
- | 841 | ktime_t ktime_get(void) |
|
- | 842 | { |
|
- | 843 | ktime_t t; |
|
- | 844 | ||
- | 845 | t.tv64 = GetClockNs(); |
|
- | 846 |