2 * Copyright © 2008 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 * Eric Anholt <eric@anholt.net>
25 * Keith Packard <keithp@keithp.com>
29 #include <linux/seq_file.h>
30 #include <linux/debugfs.h>
31 #include <linux/slab.h>
37 #define DRM_I915_RING_DEBUG 1
40 #if defined(CONFIG_DEBUG_FS)
43 #define FLUSHING_LIST 2
44 #define INACTIVE_LIST 3
46 static const char *get_pin_flag(struct drm_i915_gem_object
*obj_priv
)
48 if (obj_priv
->user_pin_count
> 0)
50 else if (obj_priv
->pin_count
> 0)
56 static const char *get_tiling_flag(struct drm_i915_gem_object
*obj_priv
)
58 switch (obj_priv
->tiling_mode
) {
60 case I915_TILING_NONE
: return " ";
61 case I915_TILING_X
: return "X";
62 case I915_TILING_Y
: return "Y";
66 static int i915_gem_object_list_info(struct seq_file
*m
, void *data
)
68 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
69 uintptr_t list
= (uintptr_t) node
->info_ent
->data
;
70 struct list_head
*head
;
71 struct drm_device
*dev
= node
->minor
->dev
;
72 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
73 struct drm_i915_gem_object
*obj_priv
;
74 spinlock_t
*lock
= NULL
;
78 seq_printf(m
, "Active:\n");
79 lock
= &dev_priv
->mm
.active_list_lock
;
80 head
= &dev_priv
->mm
.active_list
;
83 seq_printf(m
, "Inactive:\n");
84 head
= &dev_priv
->mm
.inactive_list
;
87 seq_printf(m
, "Flushing:\n");
88 head
= &dev_priv
->mm
.flushing_list
;
91 DRM_INFO("Ooops, unexpected list\n");
97 list_for_each_entry(obj_priv
, head
, list
)
99 struct drm_gem_object
*obj
= obj_priv
->obj
;
101 seq_printf(m
, " %p: %s %8zd %08x %08x %d%s%s",
103 get_pin_flag(obj_priv
),
105 obj
->read_domains
, obj
->write_domain
,
106 obj_priv
->last_rendering_seqno
,
107 obj_priv
->dirty
? " dirty" : "",
108 obj_priv
->madv
== I915_MADV_DONTNEED
? " purgeable" : "");
111 seq_printf(m
, " (name: %d)", obj
->name
);
112 if (obj_priv
->fence_reg
!= I915_FENCE_REG_NONE
)
113 seq_printf(m
, " (fence: %d)", obj_priv
->fence_reg
);
114 if (obj_priv
->gtt_space
!= NULL
)
115 seq_printf(m
, " (gtt_offset: %08x)", obj_priv
->gtt_offset
);
125 static int i915_gem_request_info(struct seq_file
*m
, void *data
)
127 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
128 struct drm_device
*dev
= node
->minor
->dev
;
129 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
130 struct drm_i915_gem_request
*gem_request
;
132 seq_printf(m
, "Request:\n");
133 list_for_each_entry(gem_request
, &dev_priv
->mm
.request_list
, list
) {
134 seq_printf(m
, " %d @ %d\n",
136 (int) (jiffies
- gem_request
->emitted_jiffies
));
141 static int i915_gem_seqno_info(struct seq_file
*m
, void *data
)
143 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
144 struct drm_device
*dev
= node
->minor
->dev
;
145 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
147 if (dev_priv
->hw_status_page
!= NULL
) {
148 seq_printf(m
, "Current sequence: %d\n",
149 i915_get_gem_seqno(dev
));
151 seq_printf(m
, "Current sequence: hws uninitialized\n");
153 seq_printf(m
, "Waiter sequence: %d\n",
154 dev_priv
->mm
.waiting_gem_seqno
);
155 seq_printf(m
, "IRQ sequence: %d\n", dev_priv
->mm
.irq_gem_seqno
);
160 static int i915_interrupt_info(struct seq_file
*m
, void *data
)
162 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
163 struct drm_device
*dev
= node
->minor
->dev
;
164 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
166 if (!HAS_PCH_SPLIT(dev
)) {
167 seq_printf(m
, "Interrupt enable: %08x\n",
169 seq_printf(m
, "Interrupt identity: %08x\n",
171 seq_printf(m
, "Interrupt mask: %08x\n",
173 seq_printf(m
, "Pipe A stat: %08x\n",
174 I915_READ(PIPEASTAT
));
175 seq_printf(m
, "Pipe B stat: %08x\n",
176 I915_READ(PIPEBSTAT
));
178 seq_printf(m
, "North Display Interrupt enable: %08x\n",
180 seq_printf(m
, "North Display Interrupt identity: %08x\n",
182 seq_printf(m
, "North Display Interrupt mask: %08x\n",
184 seq_printf(m
, "South Display Interrupt enable: %08x\n",
186 seq_printf(m
, "South Display Interrupt identity: %08x\n",
188 seq_printf(m
, "South Display Interrupt mask: %08x\n",
190 seq_printf(m
, "Graphics Interrupt enable: %08x\n",
192 seq_printf(m
, "Graphics Interrupt identity: %08x\n",
194 seq_printf(m
, "Graphics Interrupt mask: %08x\n",
197 seq_printf(m
, "Interrupts received: %d\n",
198 atomic_read(&dev_priv
->irq_received
));
199 if (dev_priv
->hw_status_page
!= NULL
) {
200 seq_printf(m
, "Current sequence: %d\n",
201 i915_get_gem_seqno(dev
));
203 seq_printf(m
, "Current sequence: hws uninitialized\n");
205 seq_printf(m
, "Waiter sequence: %d\n",
206 dev_priv
->mm
.waiting_gem_seqno
);
207 seq_printf(m
, "IRQ sequence: %d\n",
208 dev_priv
->mm
.irq_gem_seqno
);
212 static int i915_gem_fence_regs_info(struct seq_file
*m
, void *data
)
214 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
215 struct drm_device
*dev
= node
->minor
->dev
;
216 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
219 seq_printf(m
, "Reserved fences = %d\n", dev_priv
->fence_reg_start
);
220 seq_printf(m
, "Total fences = %d\n", dev_priv
->num_fence_regs
);
221 for (i
= 0; i
< dev_priv
->num_fence_regs
; i
++) {
222 struct drm_gem_object
*obj
= dev_priv
->fence_regs
[i
].obj
;
225 seq_printf(m
, "Fenced object[%2d] = unused\n", i
);
227 struct drm_i915_gem_object
*obj_priv
;
229 obj_priv
= to_intel_bo(obj
);
230 seq_printf(m
, "Fenced object[%2d] = %p: %s "
231 "%08x %08zx %08x %s %08x %08x %d",
232 i
, obj
, get_pin_flag(obj_priv
),
233 obj_priv
->gtt_offset
,
234 obj
->size
, obj_priv
->stride
,
235 get_tiling_flag(obj_priv
),
236 obj
->read_domains
, obj
->write_domain
,
237 obj_priv
->last_rendering_seqno
);
239 seq_printf(m
, " (name: %d)", obj
->name
);
247 static int i915_hws_info(struct seq_file
*m
, void *data
)
249 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
250 struct drm_device
*dev
= node
->minor
->dev
;
251 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
255 hws
= (volatile u32
*)dev_priv
->hw_status_page
;
259 for (i
= 0; i
< 4096 / sizeof(u32
) / 4; i
+= 4) {
260 seq_printf(m
, "0x%08x: 0x%08x 0x%08x 0x%08x 0x%08x\n",
262 hws
[i
], hws
[i
+ 1], hws
[i
+ 2], hws
[i
+ 3]);
267 static void i915_dump_pages(struct seq_file
*m
, struct page
**pages
, int page_count
)
272 for (page
= 0; page
< page_count
; page
++) {
273 mem
= kmap_atomic(pages
[page
], KM_USER0
);
274 for (i
= 0; i
< PAGE_SIZE
; i
+= 4)
275 seq_printf(m
, "%08x : %08x\n", i
, mem
[i
/ 4]);
276 kunmap_atomic(mem
, KM_USER0
);
280 static int i915_batchbuffer_info(struct seq_file
*m
, void *data
)
282 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
283 struct drm_device
*dev
= node
->minor
->dev
;
284 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
285 struct drm_gem_object
*obj
;
286 struct drm_i915_gem_object
*obj_priv
;
289 spin_lock(&dev_priv
->mm
.active_list_lock
);
291 list_for_each_entry(obj_priv
, &dev_priv
->mm
.active_list
, list
) {
293 if (obj
->read_domains
& I915_GEM_DOMAIN_COMMAND
) {
294 ret
= i915_gem_object_get_pages(obj
, 0);
296 DRM_ERROR("Failed to get pages: %d\n", ret
);
297 spin_unlock(&dev_priv
->mm
.active_list_lock
);
301 seq_printf(m
, "--- gtt_offset = 0x%08x\n", obj_priv
->gtt_offset
);
302 i915_dump_pages(m
, obj_priv
->pages
, obj
->size
/ PAGE_SIZE
);
304 i915_gem_object_put_pages(obj
);
308 spin_unlock(&dev_priv
->mm
.active_list_lock
);
313 static int i915_ringbuffer_data(struct seq_file
*m
, void *data
)
315 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
316 struct drm_device
*dev
= node
->minor
->dev
;
317 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
321 if (!dev_priv
->ring
.ring_obj
) {
322 seq_printf(m
, "No ringbuffer setup\n");
326 virt
= dev_priv
->ring
.virtual_start
;
328 for (off
= 0; off
< dev_priv
->ring
.Size
; off
+= 4) {
329 ptr
= (uint32_t *)(virt
+ off
);
330 seq_printf(m
, "%08x : %08x\n", off
, *ptr
);
336 static int i915_ringbuffer_info(struct seq_file
*m
, void *data
)
338 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
339 struct drm_device
*dev
= node
->minor
->dev
;
340 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
341 unsigned int head
, tail
;
343 head
= I915_READ(PRB0_HEAD
) & HEAD_ADDR
;
344 tail
= I915_READ(PRB0_TAIL
) & TAIL_ADDR
;
346 seq_printf(m
, "RingHead : %08x\n", head
);
347 seq_printf(m
, "RingTail : %08x\n", tail
);
348 seq_printf(m
, "RingSize : %08lx\n", dev_priv
->ring
.Size
);
349 seq_printf(m
, "Acthd : %08x\n", I915_READ(IS_I965G(dev
) ? ACTHD_I965
: ACTHD
));
354 static const char *pin_flag(int pinned
)
364 static const char *tiling_flag(int tiling
)
368 case I915_TILING_NONE
: return "";
369 case I915_TILING_X
: return " X";
370 case I915_TILING_Y
: return " Y";
374 static const char *dirty_flag(int dirty
)
376 return dirty
? " dirty" : "";
379 static const char *purgeable_flag(int purgeable
)
381 return purgeable
? " purgeable" : "";
384 static int i915_error_state(struct seq_file
*m
, void *unused
)
386 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
387 struct drm_device
*dev
= node
->minor
->dev
;
388 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
389 struct drm_i915_error_state
*error
;
391 int i
, page
, offset
, elt
;
393 spin_lock_irqsave(&dev_priv
->error_lock
, flags
);
394 if (!dev_priv
->first_error
) {
395 seq_printf(m
, "no error state collected\n");
399 error
= dev_priv
->first_error
;
401 seq_printf(m
, "Time: %ld s %ld us\n", error
->time
.tv_sec
,
402 error
->time
.tv_usec
);
403 seq_printf(m
, "PCI ID: 0x%04x\n", dev
->pci_device
);
404 seq_printf(m
, "EIR: 0x%08x\n", error
->eir
);
405 seq_printf(m
, " PGTBL_ER: 0x%08x\n", error
->pgtbl_er
);
406 seq_printf(m
, " INSTPM: 0x%08x\n", error
->instpm
);
407 seq_printf(m
, " IPEIR: 0x%08x\n", error
->ipeir
);
408 seq_printf(m
, " IPEHR: 0x%08x\n", error
->ipehr
);
409 seq_printf(m
, " INSTDONE: 0x%08x\n", error
->instdone
);
410 seq_printf(m
, " ACTHD: 0x%08x\n", error
->acthd
);
412 seq_printf(m
, " INSTPS: 0x%08x\n", error
->instps
);
413 seq_printf(m
, " INSTDONE1: 0x%08x\n", error
->instdone1
);
415 seq_printf(m
, "seqno: 0x%08x\n", error
->seqno
);
417 if (error
->active_bo_count
) {
418 seq_printf(m
, "Buffers [%d]:\n", error
->active_bo_count
);
420 for (i
= 0; i
< error
->active_bo_count
; i
++) {
421 seq_printf(m
, " %08x %8zd %08x %08x %08x%s%s%s%s",
422 error
->active_bo
[i
].gtt_offset
,
423 error
->active_bo
[i
].size
,
424 error
->active_bo
[i
].read_domains
,
425 error
->active_bo
[i
].write_domain
,
426 error
->active_bo
[i
].seqno
,
427 pin_flag(error
->active_bo
[i
].pinned
),
428 tiling_flag(error
->active_bo
[i
].tiling
),
429 dirty_flag(error
->active_bo
[i
].dirty
),
430 purgeable_flag(error
->active_bo
[i
].purgeable
));
432 if (error
->active_bo
[i
].name
)
433 seq_printf(m
, " (name: %d)", error
->active_bo
[i
].name
);
434 if (error
->active_bo
[i
].fence_reg
!= I915_FENCE_REG_NONE
)
435 seq_printf(m
, " (fence: %d)", error
->active_bo
[i
].fence_reg
);
441 for (i
= 0; i
< ARRAY_SIZE(error
->batchbuffer
); i
++) {
442 if (error
->batchbuffer
[i
]) {
443 struct drm_i915_error_object
*obj
= error
->batchbuffer
[i
];
445 seq_printf(m
, "--- gtt_offset = 0x%08x\n", obj
->gtt_offset
);
447 for (page
= 0; page
< obj
->page_count
; page
++) {
448 for (elt
= 0; elt
< PAGE_SIZE
/4; elt
++) {
449 seq_printf(m
, "%08x : %08x\n", offset
, obj
->pages
[page
][elt
]);
456 if (error
->ringbuffer
) {
457 struct drm_i915_error_object
*obj
= error
->ringbuffer
;
459 seq_printf(m
, "--- ringbuffer = 0x%08x\n", obj
->gtt_offset
);
461 for (page
= 0; page
< obj
->page_count
; page
++) {
462 for (elt
= 0; elt
< PAGE_SIZE
/4; elt
++) {
463 seq_printf(m
, "%08x : %08x\n", offset
, obj
->pages
[page
][elt
]);
470 spin_unlock_irqrestore(&dev_priv
->error_lock
, flags
);
475 static int i915_rstdby_delays(struct seq_file
*m
, void *unused
)
477 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
478 struct drm_device
*dev
= node
->minor
->dev
;
479 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
480 u16 crstanddelay
= I915_READ16(CRSTANDVID
);
482 seq_printf(m
, "w/ctx: %d, w/o ctx: %d\n", (crstanddelay
>> 8) & 0x3f, (crstanddelay
& 0x3f));
487 static int i915_cur_delayinfo(struct seq_file
*m
, void *unused
)
489 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
490 struct drm_device
*dev
= node
->minor
->dev
;
491 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
492 u16 rgvswctl
= I915_READ16(MEMSWCTL
);
494 seq_printf(m
, "Last command: 0x%01x\n", (rgvswctl
>> 13) & 0x3);
495 seq_printf(m
, "Command status: %d\n", (rgvswctl
>> 12) & 1);
496 seq_printf(m
, "P%d DELAY 0x%02x\n", (rgvswctl
>> 8) & 0xf,
502 static int i915_delayfreq_table(struct seq_file
*m
, void *unused
)
504 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
505 struct drm_device
*dev
= node
->minor
->dev
;
506 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
510 for (i
= 0; i
< 16; i
++) {
511 delayfreq
= I915_READ(PXVFREQ_BASE
+ i
* 4);
512 seq_printf(m
, "P%02dVIDFREQ: 0x%08x\n", i
, delayfreq
);
518 static inline int MAP_TO_MV(int map
)
520 return 1250 - (map
* 25);
523 static int i915_inttoext_table(struct seq_file
*m
, void *unused
)
525 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
526 struct drm_device
*dev
= node
->minor
->dev
;
527 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
531 for (i
= 1; i
<= 32; i
++) {
532 inttoext
= I915_READ(INTTOEXT_BASE_ILK
+ i
* 4);
533 seq_printf(m
, "INTTOEXT%02d: 0x%08x\n", i
, inttoext
);
539 static int i915_drpc_info(struct seq_file
*m
, void *unused
)
541 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
542 struct drm_device
*dev
= node
->minor
->dev
;
543 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
544 u32 rgvmodectl
= I915_READ(MEMMODECTL
);
546 seq_printf(m
, "HD boost: %s\n", (rgvmodectl
& MEMMODE_BOOST_EN
) ?
548 seq_printf(m
, "Boost freq: %d\n",
549 (rgvmodectl
& MEMMODE_BOOST_FREQ_MASK
) >>
550 MEMMODE_BOOST_FREQ_SHIFT
);
551 seq_printf(m
, "HW control enabled: %s\n",
552 rgvmodectl
& MEMMODE_HWIDLE_EN
? "yes" : "no");
553 seq_printf(m
, "SW control enabled: %s\n",
554 rgvmodectl
& MEMMODE_SWMODE_EN
? "yes" : "no");
555 seq_printf(m
, "Gated voltage change: %s\n",
556 rgvmodectl
& MEMMODE_RCLK_GATE
? "yes" : "no");
557 seq_printf(m
, "Starting frequency: P%d\n",
558 (rgvmodectl
& MEMMODE_FSTART_MASK
) >> MEMMODE_FSTART_SHIFT
);
559 seq_printf(m
, "Max frequency: P%d\n",
560 (rgvmodectl
& MEMMODE_FMAX_MASK
) >> MEMMODE_FMAX_SHIFT
);
561 seq_printf(m
, "Min frequency: P%d\n", (rgvmodectl
& MEMMODE_FMIN_MASK
));
566 static int i915_fbc_status(struct seq_file
*m
, void *unused
)
568 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
569 struct drm_device
*dev
= node
->minor
->dev
;
570 struct drm_crtc
*crtc
;
571 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
572 bool fbc_enabled
= false;
574 if (!dev_priv
->display
.fbc_enabled
) {
575 seq_printf(m
, "FBC unsupported on this chipset\n");
579 list_for_each_entry(crtc
, &dev
->mode_config
.crtc_list
, head
) {
582 if (dev_priv
->display
.fbc_enabled(crtc
))
587 seq_printf(m
, "FBC enabled\n");
589 seq_printf(m
, "FBC disabled: ");
590 switch (dev_priv
->no_fbc_reason
) {
591 case FBC_STOLEN_TOO_SMALL
:
592 seq_printf(m
, "not enough stolen memory");
594 case FBC_UNSUPPORTED_MODE
:
595 seq_printf(m
, "mode not supported");
597 case FBC_MODE_TOO_LARGE
:
598 seq_printf(m
, "mode too large");
601 seq_printf(m
, "FBC unsupported on plane");
604 seq_printf(m
, "scanout buffer not tiled");
607 seq_printf(m
, "unknown reason");
614 static int i915_sr_status(struct seq_file
*m
, void *unused
)
616 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
617 struct drm_device
*dev
= node
->minor
->dev
;
618 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
619 bool sr_enabled
= false;
621 if (IS_I965GM(dev
) || IS_I945G(dev
) || IS_I945GM(dev
))
622 sr_enabled
= I915_READ(FW_BLC_SELF
) & FW_BLC_SELF_EN
;
623 else if (IS_I915GM(dev
))
624 sr_enabled
= I915_READ(INSTPM
) & INSTPM_SELF_EN
;
625 else if (IS_PINEVIEW(dev
))
626 sr_enabled
= I915_READ(DSPFW3
) & PINEVIEW_SELF_REFRESH_EN
;
628 seq_printf(m
, "self-refresh: %s\n", sr_enabled
? "enabled" :
635 i915_wedged_open(struct inode
*inode
,
638 filp
->private_data
= inode
->i_private
;
643 i915_wedged_read(struct file
*filp
,
648 struct drm_device
*dev
= filp
->private_data
;
649 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
653 len
= snprintf(buf
, sizeof (buf
),
655 atomic_read(&dev_priv
->mm
.wedged
));
657 return simple_read_from_buffer(ubuf
, max
, ppos
, buf
, len
);
661 i915_wedged_write(struct file
*filp
,
662 const char __user
*ubuf
,
666 struct drm_device
*dev
= filp
->private_data
;
667 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
672 if (cnt
> sizeof (buf
) - 1)
675 if (copy_from_user(buf
, ubuf
, cnt
))
679 val
= simple_strtoul(buf
, NULL
, 0);
682 DRM_INFO("Manually setting wedged to %d\n", val
);
684 atomic_set(&dev_priv
->mm
.wedged
, val
);
686 DRM_WAKEUP(&dev_priv
->irq_queue
);
687 queue_work(dev_priv
->wq
, &dev_priv
->error_work
);
693 static const struct file_operations i915_wedged_fops
= {
694 .owner
= THIS_MODULE
,
695 .open
= i915_wedged_open
,
696 .read
= i915_wedged_read
,
697 .write
= i915_wedged_write
,
700 /* As the drm_debugfs_init() routines are called before dev->dev_private is
701 * allocated we need to hook into the minor for release. */
703 drm_add_fake_info_node(struct drm_minor
*minor
,
707 struct drm_info_node
*node
;
709 node
= kmalloc(sizeof(struct drm_info_node
), GFP_KERNEL
);
717 node
->info_ent
= (void *) key
;
718 list_add(&node
->list
, &minor
->debugfs_nodes
.list
);
723 static int i915_wedged_create(struct dentry
*root
, struct drm_minor
*minor
)
725 struct drm_device
*dev
= minor
->dev
;
728 ent
= debugfs_create_file("i915_wedged",
735 return drm_add_fake_info_node(minor
, ent
, &i915_wedged_fops
);
738 static struct drm_info_list i915_debugfs_list
[] = {
739 {"i915_gem_active", i915_gem_object_list_info
, 0, (void *) ACTIVE_LIST
},
740 {"i915_gem_flushing", i915_gem_object_list_info
, 0, (void *) FLUSHING_LIST
},
741 {"i915_gem_inactive", i915_gem_object_list_info
, 0, (void *) INACTIVE_LIST
},
742 {"i915_gem_request", i915_gem_request_info
, 0},
743 {"i915_gem_seqno", i915_gem_seqno_info
, 0},
744 {"i915_gem_fence_regs", i915_gem_fence_regs_info
, 0},
745 {"i915_gem_interrupt", i915_interrupt_info
, 0},
746 {"i915_gem_hws", i915_hws_info
, 0},
747 {"i915_ringbuffer_data", i915_ringbuffer_data
, 0},
748 {"i915_ringbuffer_info", i915_ringbuffer_info
, 0},
749 {"i915_batchbuffers", i915_batchbuffer_info
, 0},
750 {"i915_error_state", i915_error_state
, 0},
751 {"i915_rstdby_delays", i915_rstdby_delays
, 0},
752 {"i915_cur_delayinfo", i915_cur_delayinfo
, 0},
753 {"i915_delayfreq_table", i915_delayfreq_table
, 0},
754 {"i915_inttoext_table", i915_inttoext_table
, 0},
755 {"i915_drpc_info", i915_drpc_info
, 0},
756 {"i915_fbc_status", i915_fbc_status
, 0},
757 {"i915_sr_status", i915_sr_status
, 0},
759 #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
761 int i915_debugfs_init(struct drm_minor
*minor
)
765 ret
= i915_wedged_create(minor
->debugfs_root
, minor
);
769 return drm_debugfs_create_files(i915_debugfs_list
,
770 I915_DEBUGFS_ENTRIES
,
771 minor
->debugfs_root
, minor
);
774 void i915_debugfs_cleanup(struct drm_minor
*minor
)
776 drm_debugfs_remove_files(i915_debugfs_list
,
777 I915_DEBUGFS_ENTRIES
, minor
);
778 drm_debugfs_remove_files((struct drm_info_list
*) &i915_wedged_fops
,
782 #endif /* CONFIG_DEBUG_FS */