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
->render_ring
.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 seq_printf(m
, " %p: %s %8zd %08x %08x %d%s%s",
101 get_pin_flag(obj_priv
),
103 obj_priv
->base
.read_domains
,
104 obj_priv
->base
.write_domain
,
105 obj_priv
->last_rendering_seqno
,
106 obj_priv
->dirty
? " dirty" : "",
107 obj_priv
->madv
== I915_MADV_DONTNEED
? " purgeable" : "");
109 if (obj_priv
->base
.name
)
110 seq_printf(m
, " (name: %d)", obj_priv
->base
.name
);
111 if (obj_priv
->fence_reg
!= I915_FENCE_REG_NONE
)
112 seq_printf(m
, " (fence: %d)", obj_priv
->fence_reg
);
113 if (obj_priv
->gtt_space
!= NULL
)
114 seq_printf(m
, " (gtt_offset: %08x)", obj_priv
->gtt_offset
);
124 static int i915_gem_request_info(struct seq_file
*m
, void *data
)
126 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
127 struct drm_device
*dev
= node
->minor
->dev
;
128 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
129 struct drm_i915_gem_request
*gem_request
;
131 seq_printf(m
, "Request:\n");
132 list_for_each_entry(gem_request
, &dev_priv
->render_ring
.request_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
->render_ring
.status_page
.page_addr
!= NULL
) {
148 seq_printf(m
, "Current sequence: %d\n",
149 i915_get_gem_seqno(dev
, &dev_priv
->render_ring
));
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
->render_ring
.status_page
.page_addr
!= NULL
) {
200 seq_printf(m
, "Current sequence: %d\n",
201 i915_get_gem_seqno(dev
, &dev_priv
->render_ring
));
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
->render_ring
.status_page
.page_addr
;
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
->render_ring
.active_list
,
293 obj
= &obj_priv
->base
;
294 if (obj
->read_domains
& I915_GEM_DOMAIN_COMMAND
) {
295 ret
= i915_gem_object_get_pages(obj
, 0);
297 DRM_ERROR("Failed to get pages: %d\n", ret
);
298 spin_unlock(&dev_priv
->mm
.active_list_lock
);
302 seq_printf(m
, "--- gtt_offset = 0x%08x\n", obj_priv
->gtt_offset
);
303 i915_dump_pages(m
, obj_priv
->pages
, obj
->size
/ PAGE_SIZE
);
305 i915_gem_object_put_pages(obj
);
309 spin_unlock(&dev_priv
->mm
.active_list_lock
);
314 static int i915_ringbuffer_data(struct seq_file
*m
, void *data
)
316 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
317 struct drm_device
*dev
= node
->minor
->dev
;
318 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
322 if (!dev_priv
->render_ring
.gem_object
) {
323 seq_printf(m
, "No ringbuffer setup\n");
327 virt
= dev_priv
->render_ring
.virtual_start
;
329 for (off
= 0; off
< dev_priv
->render_ring
.size
; off
+= 4) {
330 ptr
= (uint32_t *)(virt
+ off
);
331 seq_printf(m
, "%08x : %08x\n", off
, *ptr
);
337 static int i915_ringbuffer_info(struct seq_file
*m
, void *data
)
339 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
340 struct drm_device
*dev
= node
->minor
->dev
;
341 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
342 unsigned int head
, tail
;
344 head
= I915_READ(PRB0_HEAD
) & HEAD_ADDR
;
345 tail
= I915_READ(PRB0_TAIL
) & TAIL_ADDR
;
347 seq_printf(m
, "RingHead : %08x\n", head
);
348 seq_printf(m
, "RingTail : %08x\n", tail
);
349 seq_printf(m
, "RingSize : %08lx\n", dev_priv
->render_ring
.size
);
350 seq_printf(m
, "Acthd : %08x\n", I915_READ(IS_I965G(dev
) ? ACTHD_I965
: ACTHD
));
355 static const char *pin_flag(int pinned
)
365 static const char *tiling_flag(int tiling
)
369 case I915_TILING_NONE
: return "";
370 case I915_TILING_X
: return " X";
371 case I915_TILING_Y
: return " Y";
375 static const char *dirty_flag(int dirty
)
377 return dirty
? " dirty" : "";
380 static const char *purgeable_flag(int purgeable
)
382 return purgeable
? " purgeable" : "";
385 static int i915_error_state(struct seq_file
*m
, void *unused
)
387 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
388 struct drm_device
*dev
= node
->minor
->dev
;
389 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
390 struct drm_i915_error_state
*error
;
392 int i
, page
, offset
, elt
;
394 spin_lock_irqsave(&dev_priv
->error_lock
, flags
);
395 if (!dev_priv
->first_error
) {
396 seq_printf(m
, "no error state collected\n");
400 error
= dev_priv
->first_error
;
402 seq_printf(m
, "Time: %ld s %ld us\n", error
->time
.tv_sec
,
403 error
->time
.tv_usec
);
404 seq_printf(m
, "PCI ID: 0x%04x\n", dev
->pci_device
);
405 seq_printf(m
, "EIR: 0x%08x\n", error
->eir
);
406 seq_printf(m
, " PGTBL_ER: 0x%08x\n", error
->pgtbl_er
);
407 seq_printf(m
, " INSTPM: 0x%08x\n", error
->instpm
);
408 seq_printf(m
, " IPEIR: 0x%08x\n", error
->ipeir
);
409 seq_printf(m
, " IPEHR: 0x%08x\n", error
->ipehr
);
410 seq_printf(m
, " INSTDONE: 0x%08x\n", error
->instdone
);
411 seq_printf(m
, " ACTHD: 0x%08x\n", error
->acthd
);
413 seq_printf(m
, " INSTPS: 0x%08x\n", error
->instps
);
414 seq_printf(m
, " INSTDONE1: 0x%08x\n", error
->instdone1
);
416 seq_printf(m
, "seqno: 0x%08x\n", error
->seqno
);
418 if (error
->active_bo_count
) {
419 seq_printf(m
, "Buffers [%d]:\n", error
->active_bo_count
);
421 for (i
= 0; i
< error
->active_bo_count
; i
++) {
422 seq_printf(m
, " %08x %8zd %08x %08x %08x%s%s%s%s",
423 error
->active_bo
[i
].gtt_offset
,
424 error
->active_bo
[i
].size
,
425 error
->active_bo
[i
].read_domains
,
426 error
->active_bo
[i
].write_domain
,
427 error
->active_bo
[i
].seqno
,
428 pin_flag(error
->active_bo
[i
].pinned
),
429 tiling_flag(error
->active_bo
[i
].tiling
),
430 dirty_flag(error
->active_bo
[i
].dirty
),
431 purgeable_flag(error
->active_bo
[i
].purgeable
));
433 if (error
->active_bo
[i
].name
)
434 seq_printf(m
, " (name: %d)", error
->active_bo
[i
].name
);
435 if (error
->active_bo
[i
].fence_reg
!= I915_FENCE_REG_NONE
)
436 seq_printf(m
, " (fence: %d)", error
->active_bo
[i
].fence_reg
);
442 for (i
= 0; i
< ARRAY_SIZE(error
->batchbuffer
); i
++) {
443 if (error
->batchbuffer
[i
]) {
444 struct drm_i915_error_object
*obj
= error
->batchbuffer
[i
];
446 seq_printf(m
, "--- gtt_offset = 0x%08x\n", obj
->gtt_offset
);
448 for (page
= 0; page
< obj
->page_count
; page
++) {
449 for (elt
= 0; elt
< PAGE_SIZE
/4; elt
++) {
450 seq_printf(m
, "%08x : %08x\n", offset
, obj
->pages
[page
][elt
]);
457 if (error
->ringbuffer
) {
458 struct drm_i915_error_object
*obj
= error
->ringbuffer
;
460 seq_printf(m
, "--- ringbuffer = 0x%08x\n", obj
->gtt_offset
);
462 for (page
= 0; page
< obj
->page_count
; page
++) {
463 for (elt
= 0; elt
< PAGE_SIZE
/4; elt
++) {
464 seq_printf(m
, "%08x : %08x\n", offset
, obj
->pages
[page
][elt
]);
471 spin_unlock_irqrestore(&dev_priv
->error_lock
, flags
);
476 static int i915_rstdby_delays(struct seq_file
*m
, void *unused
)
478 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
479 struct drm_device
*dev
= node
->minor
->dev
;
480 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
481 u16 crstanddelay
= I915_READ16(CRSTANDVID
);
483 seq_printf(m
, "w/ctx: %d, w/o ctx: %d\n", (crstanddelay
>> 8) & 0x3f, (crstanddelay
& 0x3f));
488 static int i915_cur_delayinfo(struct seq_file
*m
, void *unused
)
490 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
491 struct drm_device
*dev
= node
->minor
->dev
;
492 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
493 u16 rgvswctl
= I915_READ16(MEMSWCTL
);
494 u16 rgvstat
= I915_READ16(MEMSTAT_ILK
);
496 seq_printf(m
, "Requested P-state: %d\n", (rgvswctl
>> 8) & 0xf);
497 seq_printf(m
, "Requested VID: %d\n", rgvswctl
& 0x3f);
498 seq_printf(m
, "Current VID: %d\n", (rgvstat
& MEMSTAT_VID_MASK
) >>
500 seq_printf(m
, "Current P-state: %d\n",
501 (rgvstat
& MEMSTAT_PSTATE_MASK
) >> MEMSTAT_PSTATE_SHIFT
);
506 static int i915_delayfreq_table(struct seq_file
*m
, void *unused
)
508 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
509 struct drm_device
*dev
= node
->minor
->dev
;
510 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
514 for (i
= 0; i
< 16; i
++) {
515 delayfreq
= I915_READ(PXVFREQ_BASE
+ i
* 4);
516 seq_printf(m
, "P%02dVIDFREQ: 0x%08x (VID: %d)\n", i
, delayfreq
,
517 (delayfreq
& PXVFREQ_PX_MASK
) >> PXVFREQ_PX_SHIFT
);
523 static inline int MAP_TO_MV(int map
)
525 return 1250 - (map
* 25);
528 static int i915_inttoext_table(struct seq_file
*m
, void *unused
)
530 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
531 struct drm_device
*dev
= node
->minor
->dev
;
532 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
536 for (i
= 1; i
<= 32; i
++) {
537 inttoext
= I915_READ(INTTOEXT_BASE_ILK
+ i
* 4);
538 seq_printf(m
, "INTTOEXT%02d: 0x%08x\n", i
, inttoext
);
544 static int i915_drpc_info(struct seq_file
*m
, void *unused
)
546 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
547 struct drm_device
*dev
= node
->minor
->dev
;
548 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
549 u32 rgvmodectl
= I915_READ(MEMMODECTL
);
550 u32 rstdbyctl
= I915_READ(MCHBAR_RENDER_STANDBY
);
551 u16 crstandvid
= I915_READ16(CRSTANDVID
);
553 seq_printf(m
, "HD boost: %s\n", (rgvmodectl
& MEMMODE_BOOST_EN
) ?
555 seq_printf(m
, "Boost freq: %d\n",
556 (rgvmodectl
& MEMMODE_BOOST_FREQ_MASK
) >>
557 MEMMODE_BOOST_FREQ_SHIFT
);
558 seq_printf(m
, "HW control enabled: %s\n",
559 rgvmodectl
& MEMMODE_HWIDLE_EN
? "yes" : "no");
560 seq_printf(m
, "SW control enabled: %s\n",
561 rgvmodectl
& MEMMODE_SWMODE_EN
? "yes" : "no");
562 seq_printf(m
, "Gated voltage change: %s\n",
563 rgvmodectl
& MEMMODE_RCLK_GATE
? "yes" : "no");
564 seq_printf(m
, "Starting frequency: P%d\n",
565 (rgvmodectl
& MEMMODE_FSTART_MASK
) >> MEMMODE_FSTART_SHIFT
);
566 seq_printf(m
, "Max P-state: P%d\n",
567 (rgvmodectl
& MEMMODE_FMAX_MASK
) >> MEMMODE_FMAX_SHIFT
);
568 seq_printf(m
, "Min P-state: P%d\n", (rgvmodectl
& MEMMODE_FMIN_MASK
));
569 seq_printf(m
, "RS1 VID: %d\n", (crstandvid
& 0x3f));
570 seq_printf(m
, "RS2 VID: %d\n", ((crstandvid
>> 8) & 0x3f));
571 seq_printf(m
, "Render standby enabled: %s\n",
572 (rstdbyctl
& RCX_SW_EXIT
) ? "no" : "yes");
577 static int i915_fbc_status(struct seq_file
*m
, void *unused
)
579 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
580 struct drm_device
*dev
= node
->minor
->dev
;
581 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
583 if (!I915_HAS_FBC(dev
)) {
584 seq_printf(m
, "FBC unsupported on this chipset\n");
588 if (intel_fbc_enabled(dev
)) {
589 seq_printf(m
, "FBC enabled\n");
591 seq_printf(m
, "FBC disabled: ");
592 switch (dev_priv
->no_fbc_reason
) {
593 case FBC_STOLEN_TOO_SMALL
:
594 seq_printf(m
, "not enough stolen memory");
596 case FBC_UNSUPPORTED_MODE
:
597 seq_printf(m
, "mode not supported");
599 case FBC_MODE_TOO_LARGE
:
600 seq_printf(m
, "mode too large");
603 seq_printf(m
, "FBC unsupported on plane");
606 seq_printf(m
, "scanout buffer not tiled");
609 seq_printf(m
, "unknown reason");
616 static int i915_sr_status(struct seq_file
*m
, void *unused
)
618 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
619 struct drm_device
*dev
= node
->minor
->dev
;
620 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
621 bool sr_enabled
= false;
623 if (IS_I965G(dev
) || IS_I945G(dev
) || IS_I945GM(dev
))
624 sr_enabled
= I915_READ(FW_BLC_SELF
) & FW_BLC_SELF_EN
;
625 else if (IS_I915GM(dev
))
626 sr_enabled
= I915_READ(INSTPM
) & INSTPM_SELF_EN
;
627 else if (IS_PINEVIEW(dev
))
628 sr_enabled
= I915_READ(DSPFW3
) & PINEVIEW_SELF_REFRESH_EN
;
630 seq_printf(m
, "self-refresh: %s\n", sr_enabled
? "enabled" :
636 static int i915_emon_status(struct seq_file
*m
, void *unused
)
638 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
639 struct drm_device
*dev
= node
->minor
->dev
;
640 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
641 unsigned long temp
, chipset
, gfx
;
643 temp
= i915_mch_val(dev_priv
);
644 chipset
= i915_chipset_val(dev_priv
);
645 gfx
= i915_gfx_val(dev_priv
);
647 seq_printf(m
, "GMCH temp: %ld\n", temp
);
648 seq_printf(m
, "Chipset power: %ld\n", chipset
);
649 seq_printf(m
, "GFX power: %ld\n", gfx
);
650 seq_printf(m
, "Total power: %ld\n", chipset
+ gfx
);
655 static int i915_gfxec(struct seq_file
*m
, void *unused
)
657 struct drm_info_node
*node
= (struct drm_info_node
*) m
->private;
658 struct drm_device
*dev
= node
->minor
->dev
;
659 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
661 seq_printf(m
, "GFXEC: %ld\n", (unsigned long)I915_READ(0x112f4));
667 i915_wedged_open(struct inode
*inode
,
670 filp
->private_data
= inode
->i_private
;
675 i915_wedged_read(struct file
*filp
,
680 struct drm_device
*dev
= filp
->private_data
;
681 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
685 len
= snprintf(buf
, sizeof (buf
),
687 atomic_read(&dev_priv
->mm
.wedged
));
689 return simple_read_from_buffer(ubuf
, max
, ppos
, buf
, len
);
693 i915_wedged_write(struct file
*filp
,
694 const char __user
*ubuf
,
698 struct drm_device
*dev
= filp
->private_data
;
699 drm_i915_private_t
*dev_priv
= dev
->dev_private
;
704 if (cnt
> sizeof (buf
) - 1)
707 if (copy_from_user(buf
, ubuf
, cnt
))
711 val
= simple_strtoul(buf
, NULL
, 0);
714 DRM_INFO("Manually setting wedged to %d\n", val
);
716 atomic_set(&dev_priv
->mm
.wedged
, val
);
718 DRM_WAKEUP(&dev_priv
->irq_queue
);
719 queue_work(dev_priv
->wq
, &dev_priv
->error_work
);
725 static const struct file_operations i915_wedged_fops
= {
726 .owner
= THIS_MODULE
,
727 .open
= i915_wedged_open
,
728 .read
= i915_wedged_read
,
729 .write
= i915_wedged_write
,
732 /* As the drm_debugfs_init() routines are called before dev->dev_private is
733 * allocated we need to hook into the minor for release. */
735 drm_add_fake_info_node(struct drm_minor
*minor
,
739 struct drm_info_node
*node
;
741 node
= kmalloc(sizeof(struct drm_info_node
), GFP_KERNEL
);
749 node
->info_ent
= (void *) key
;
750 list_add(&node
->list
, &minor
->debugfs_nodes
.list
);
755 static int i915_wedged_create(struct dentry
*root
, struct drm_minor
*minor
)
757 struct drm_device
*dev
= minor
->dev
;
760 ent
= debugfs_create_file("i915_wedged",
767 return drm_add_fake_info_node(minor
, ent
, &i915_wedged_fops
);
770 static struct drm_info_list i915_debugfs_list
[] = {
771 {"i915_gem_active", i915_gem_object_list_info
, 0, (void *) ACTIVE_LIST
},
772 {"i915_gem_flushing", i915_gem_object_list_info
, 0, (void *) FLUSHING_LIST
},
773 {"i915_gem_inactive", i915_gem_object_list_info
, 0, (void *) INACTIVE_LIST
},
774 {"i915_gem_request", i915_gem_request_info
, 0},
775 {"i915_gem_seqno", i915_gem_seqno_info
, 0},
776 {"i915_gem_fence_regs", i915_gem_fence_regs_info
, 0},
777 {"i915_gem_interrupt", i915_interrupt_info
, 0},
778 {"i915_gem_hws", i915_hws_info
, 0},
779 {"i915_ringbuffer_data", i915_ringbuffer_data
, 0},
780 {"i915_ringbuffer_info", i915_ringbuffer_info
, 0},
781 {"i915_batchbuffers", i915_batchbuffer_info
, 0},
782 {"i915_error_state", i915_error_state
, 0},
783 {"i915_rstdby_delays", i915_rstdby_delays
, 0},
784 {"i915_cur_delayinfo", i915_cur_delayinfo
, 0},
785 {"i915_delayfreq_table", i915_delayfreq_table
, 0},
786 {"i915_inttoext_table", i915_inttoext_table
, 0},
787 {"i915_drpc_info", i915_drpc_info
, 0},
788 {"i915_emon_status", i915_emon_status
, 0},
789 {"i915_gfxec", i915_gfxec
, 0},
790 {"i915_fbc_status", i915_fbc_status
, 0},
791 {"i915_sr_status", i915_sr_status
, 0},
793 #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
795 int i915_debugfs_init(struct drm_minor
*minor
)
799 ret
= i915_wedged_create(minor
->debugfs_root
, minor
);
803 return drm_debugfs_create_files(i915_debugfs_list
,
804 I915_DEBUGFS_ENTRIES
,
805 minor
->debugfs_root
, minor
);
808 void i915_debugfs_cleanup(struct drm_minor
*minor
)
810 drm_debugfs_remove_files(i915_debugfs_list
,
811 I915_DEBUGFS_ENTRIES
, minor
);
812 drm_debugfs_remove_files((struct drm_info_list
*) &i915_wedged_fops
,
816 #endif /* CONFIG_DEBUG_FS */