]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - drivers/gpu/drm/i915/i915_irq.c
i915: Use more consistent names for regs, and store them in a separate file.
[linux-2.6-omap-h63xx.git] / drivers / gpu / drm / i915 / i915_irq.c
1 /* i915_irq.c -- IRQ support for the I915 -*- linux-c -*-
2  */
3 /*
4  * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
5  * All Rights Reserved.
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a
8  * copy of this software and associated documentation files (the
9  * "Software"), to deal in the Software without restriction, including
10  * without limitation the rights to use, copy, modify, merge, publish,
11  * distribute, sub license, and/or sell copies of the Software, and to
12  * permit persons to whom the Software is furnished to do so, subject to
13  * the following conditions:
14  *
15  * The above copyright notice and this permission notice (including the
16  * next paragraph) shall be included in all copies or substantial portions
17  * of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22  * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
23  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26  *
27  */
28
29 #include "drmP.h"
30 #include "drm.h"
31 #include "i915_drm.h"
32 #include "i915_drv.h"
33
34 #define MAX_NOPID ((u32)~0)
35
36 /**
37  * Emit blits for scheduled buffer swaps.
38  *
39  * This function will be called with the HW lock held.
40  */
41 static void i915_vblank_tasklet(struct drm_device *dev)
42 {
43         drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
44         unsigned long irqflags;
45         struct list_head *list, *tmp, hits, *hit;
46         int nhits, nrects, slice[2], upper[2], lower[2], i;
47         unsigned counter[2] = { atomic_read(&dev->vbl_received),
48                                 atomic_read(&dev->vbl_received2) };
49         struct drm_drawable_info *drw;
50         drm_i915_sarea_t *sarea_priv = dev_priv->sarea_priv;
51         u32 cpp = dev_priv->cpp;
52         u32 cmd = (cpp == 4) ? (XY_SRC_COPY_BLT_CMD |
53                                 XY_SRC_COPY_BLT_WRITE_ALPHA |
54                                 XY_SRC_COPY_BLT_WRITE_RGB)
55                              : XY_SRC_COPY_BLT_CMD;
56         u32 src_pitch = sarea_priv->pitch * cpp;
57         u32 dst_pitch = sarea_priv->pitch * cpp;
58         u32 ropcpp = (0xcc << 16) | ((cpp - 1) << 24);
59         RING_LOCALS;
60
61         if (IS_I965G(dev) && sarea_priv->front_tiled) {
62                 cmd |= XY_SRC_COPY_BLT_DST_TILED;
63                 dst_pitch >>= 2;
64         }
65         if (IS_I965G(dev) && sarea_priv->back_tiled) {
66                 cmd |= XY_SRC_COPY_BLT_SRC_TILED;
67                 src_pitch >>= 2;
68         }
69
70         DRM_DEBUG("\n");
71
72         INIT_LIST_HEAD(&hits);
73
74         nhits = nrects = 0;
75
76         spin_lock_irqsave(&dev_priv->swaps_lock, irqflags);
77
78         /* Find buffer swaps scheduled for this vertical blank */
79         list_for_each_safe(list, tmp, &dev_priv->vbl_swaps.head) {
80                 drm_i915_vbl_swap_t *vbl_swap =
81                         list_entry(list, drm_i915_vbl_swap_t, head);
82
83                 if ((counter[vbl_swap->pipe] - vbl_swap->sequence) > (1<<23))
84                         continue;
85
86                 list_del(list);
87                 dev_priv->swaps_pending--;
88
89                 spin_unlock(&dev_priv->swaps_lock);
90                 spin_lock(&dev->drw_lock);
91
92                 drw = drm_get_drawable_info(dev, vbl_swap->drw_id);
93
94                 if (!drw) {
95                         spin_unlock(&dev->drw_lock);
96                         drm_free(vbl_swap, sizeof(*vbl_swap), DRM_MEM_DRIVER);
97                         spin_lock(&dev_priv->swaps_lock);
98                         continue;
99                 }
100
101                 list_for_each(hit, &hits) {
102                         drm_i915_vbl_swap_t *swap_cmp =
103                                 list_entry(hit, drm_i915_vbl_swap_t, head);
104                         struct drm_drawable_info *drw_cmp =
105                                 drm_get_drawable_info(dev, swap_cmp->drw_id);
106
107                         if (drw_cmp &&
108                             drw_cmp->rects[0].y1 > drw->rects[0].y1) {
109                                 list_add_tail(list, hit);
110                                 break;
111                         }
112                 }
113
114                 spin_unlock(&dev->drw_lock);
115
116                 /* List of hits was empty, or we reached the end of it */
117                 if (hit == &hits)
118                         list_add_tail(list, hits.prev);
119
120                 nhits++;
121
122                 spin_lock(&dev_priv->swaps_lock);
123         }
124
125         if (nhits == 0) {
126                 spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags);
127                 return;
128         }
129
130         spin_unlock(&dev_priv->swaps_lock);
131
132         i915_kernel_lost_context(dev);
133
134         if (IS_I965G(dev)) {
135                 BEGIN_LP_RING(4);
136
137                 OUT_RING(GFX_OP_DRAWRECT_INFO_I965);
138                 OUT_RING(0);
139                 OUT_RING(((sarea_priv->width - 1) & 0xffff) | ((sarea_priv->height - 1) << 16));
140                 OUT_RING(0);
141                 ADVANCE_LP_RING();
142         } else {
143                 BEGIN_LP_RING(6);
144
145                 OUT_RING(GFX_OP_DRAWRECT_INFO);
146                 OUT_RING(0);
147                 OUT_RING(0);
148                 OUT_RING(sarea_priv->width | sarea_priv->height << 16);
149                 OUT_RING(sarea_priv->width | sarea_priv->height << 16);
150                 OUT_RING(0);
151
152                 ADVANCE_LP_RING();
153         }
154
155         sarea_priv->ctxOwner = DRM_KERNEL_CONTEXT;
156
157         upper[0] = upper[1] = 0;
158         slice[0] = max(sarea_priv->pipeA_h / nhits, 1);
159         slice[1] = max(sarea_priv->pipeB_h / nhits, 1);
160         lower[0] = sarea_priv->pipeA_y + slice[0];
161         lower[1] = sarea_priv->pipeB_y + slice[0];
162
163         spin_lock(&dev->drw_lock);
164
165         /* Emit blits for buffer swaps, partitioning both outputs into as many
166          * slices as there are buffer swaps scheduled in order to avoid tearing
167          * (based on the assumption that a single buffer swap would always
168          * complete before scanout starts).
169          */
170         for (i = 0; i++ < nhits;
171              upper[0] = lower[0], lower[0] += slice[0],
172              upper[1] = lower[1], lower[1] += slice[1]) {
173                 if (i == nhits)
174                         lower[0] = lower[1] = sarea_priv->height;
175
176                 list_for_each(hit, &hits) {
177                         drm_i915_vbl_swap_t *swap_hit =
178                                 list_entry(hit, drm_i915_vbl_swap_t, head);
179                         struct drm_clip_rect *rect;
180                         int num_rects, pipe;
181                         unsigned short top, bottom;
182
183                         drw = drm_get_drawable_info(dev, swap_hit->drw_id);
184
185                         if (!drw)
186                                 continue;
187
188                         rect = drw->rects;
189                         pipe = swap_hit->pipe;
190                         top = upper[pipe];
191                         bottom = lower[pipe];
192
193                         for (num_rects = drw->num_rects; num_rects--; rect++) {
194                                 int y1 = max(rect->y1, top);
195                                 int y2 = min(rect->y2, bottom);
196
197                                 if (y1 >= y2)
198                                         continue;
199
200                                 BEGIN_LP_RING(8);
201
202                                 OUT_RING(cmd);
203                                 OUT_RING(ropcpp | dst_pitch);
204                                 OUT_RING((y1 << 16) | rect->x1);
205                                 OUT_RING((y2 << 16) | rect->x2);
206                                 OUT_RING(sarea_priv->front_offset);
207                                 OUT_RING((y1 << 16) | rect->x1);
208                                 OUT_RING(src_pitch);
209                                 OUT_RING(sarea_priv->back_offset);
210
211                                 ADVANCE_LP_RING();
212                         }
213                 }
214         }
215
216         spin_unlock_irqrestore(&dev->drw_lock, irqflags);
217
218         list_for_each_safe(hit, tmp, &hits) {
219                 drm_i915_vbl_swap_t *swap_hit =
220                         list_entry(hit, drm_i915_vbl_swap_t, head);
221
222                 list_del(hit);
223
224                 drm_free(swap_hit, sizeof(*swap_hit), DRM_MEM_DRIVER);
225         }
226 }
227
228 irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
229 {
230         struct drm_device *dev = (struct drm_device *) arg;
231         drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
232         u16 temp;
233         u32 pipea_stats, pipeb_stats;
234
235         pipea_stats = I915_READ(PIPEASTAT);
236         pipeb_stats = I915_READ(PIPEBSTAT);
237
238         temp = I915_READ16(IIR);
239
240         temp &= (I915_USER_INTERRUPT |
241                  I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT |
242                  I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT);
243
244         DRM_DEBUG("%s flag=%08x\n", __FUNCTION__, temp);
245
246         if (temp == 0)
247                 return IRQ_NONE;
248
249         I915_WRITE16(IIR, temp);
250         (void) I915_READ16(IIR);
251         DRM_READMEMORYBARRIER();
252
253         dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv);
254
255         if (temp & I915_USER_INTERRUPT)
256                 DRM_WAKEUP(&dev_priv->irq_queue);
257
258         if (temp & (I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT |
259                     I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT)) {
260                 int vblank_pipe = dev_priv->vblank_pipe;
261
262                 if ((vblank_pipe &
263                      (DRM_I915_VBLANK_PIPE_A | DRM_I915_VBLANK_PIPE_B))
264                     == (DRM_I915_VBLANK_PIPE_A | DRM_I915_VBLANK_PIPE_B)) {
265                         if (temp & I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT)
266                                 atomic_inc(&dev->vbl_received);
267                         if (temp & I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT)
268                                 atomic_inc(&dev->vbl_received2);
269                 } else if (((temp & I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT) &&
270                             (vblank_pipe & DRM_I915_VBLANK_PIPE_A)) ||
271                            ((temp & I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT) &&
272                             (vblank_pipe & DRM_I915_VBLANK_PIPE_B)))
273                         atomic_inc(&dev->vbl_received);
274
275                 DRM_WAKEUP(&dev->vbl_queue);
276                 drm_vbl_send_signals(dev);
277
278                 if (dev_priv->swaps_pending > 0)
279                         drm_locked_tasklet(dev, i915_vblank_tasklet);
280                 I915_WRITE(PIPEASTAT,
281                         pipea_stats|I915_VBLANK_INTERRUPT_ENABLE|
282                         PIPE_VBLANK_INTERRUPT_STATUS);
283                 I915_WRITE(PIPEBSTAT,
284                         pipeb_stats|I915_VBLANK_INTERRUPT_ENABLE|
285                         PIPE_VBLANK_INTERRUPT_STATUS);
286         }
287
288         return IRQ_HANDLED;
289 }
290
291 static int i915_emit_irq(struct drm_device * dev)
292 {
293         drm_i915_private_t *dev_priv = dev->dev_private;
294         RING_LOCALS;
295
296         i915_kernel_lost_context(dev);
297
298         DRM_DEBUG("\n");
299
300         dev_priv->sarea_priv->last_enqueue = ++dev_priv->counter;
301
302         if (dev_priv->counter > 0x7FFFFFFFUL)
303                 dev_priv->sarea_priv->last_enqueue = dev_priv->counter = 1;
304
305         BEGIN_LP_RING(6);
306         OUT_RING(MI_STORE_DWORD_INDEX);
307         OUT_RING(5 << MI_STORE_DWORD_INDEX_SHIFT);
308         OUT_RING(dev_priv->counter);
309         OUT_RING(0);
310         OUT_RING(0);
311         OUT_RING(MI_USER_INTERRUPT);
312         ADVANCE_LP_RING();
313
314         return dev_priv->counter;
315 }
316
317 static int i915_wait_irq(struct drm_device * dev, int irq_nr)
318 {
319         drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
320         int ret = 0;
321
322         DRM_DEBUG("irq_nr=%d breadcrumb=%d\n", irq_nr,
323                   READ_BREADCRUMB(dev_priv));
324
325         if (READ_BREADCRUMB(dev_priv) >= irq_nr)
326                 return 0;
327
328         dev_priv->sarea_priv->perf_boxes |= I915_BOX_WAIT;
329
330         DRM_WAIT_ON(ret, dev_priv->irq_queue, 3 * DRM_HZ,
331                     READ_BREADCRUMB(dev_priv) >= irq_nr);
332
333         if (ret == -EBUSY) {
334                 DRM_ERROR("EBUSY -- rec: %d emitted: %d\n",
335                           READ_BREADCRUMB(dev_priv), (int)dev_priv->counter);
336         }
337
338         dev_priv->sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv);
339         return ret;
340 }
341
342 static int i915_driver_vblank_do_wait(struct drm_device *dev, unsigned int *sequence,
343                                       atomic_t *counter)
344 {
345         drm_i915_private_t *dev_priv = dev->dev_private;
346         unsigned int cur_vblank;
347         int ret = 0;
348
349         if (!dev_priv) {
350                 DRM_ERROR("called with no initialization\n");
351                 return -EINVAL;
352         }
353
354         DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ,
355                     (((cur_vblank = atomic_read(counter))
356                         - *sequence) <= (1<<23)));
357
358         *sequence = cur_vblank;
359
360         return ret;
361 }
362
363
364 int i915_driver_vblank_wait(struct drm_device *dev, unsigned int *sequence)
365 {
366         return i915_driver_vblank_do_wait(dev, sequence, &dev->vbl_received);
367 }
368
369 int i915_driver_vblank_wait2(struct drm_device *dev, unsigned int *sequence)
370 {
371         return i915_driver_vblank_do_wait(dev, sequence, &dev->vbl_received2);
372 }
373
374 /* Needs the lock as it touches the ring.
375  */
376 int i915_irq_emit(struct drm_device *dev, void *data,
377                          struct drm_file *file_priv)
378 {
379         drm_i915_private_t *dev_priv = dev->dev_private;
380         drm_i915_irq_emit_t *emit = data;
381         int result;
382
383         LOCK_TEST_WITH_RETURN(dev, file_priv);
384
385         if (!dev_priv) {
386                 DRM_ERROR("called with no initialization\n");
387                 return -EINVAL;
388         }
389
390         result = i915_emit_irq(dev);
391
392         if (DRM_COPY_TO_USER(emit->irq_seq, &result, sizeof(int))) {
393                 DRM_ERROR("copy_to_user\n");
394                 return -EFAULT;
395         }
396
397         return 0;
398 }
399
400 /* Doesn't need the hardware lock.
401  */
402 int i915_irq_wait(struct drm_device *dev, void *data,
403                          struct drm_file *file_priv)
404 {
405         drm_i915_private_t *dev_priv = dev->dev_private;
406         drm_i915_irq_wait_t *irqwait = data;
407
408         if (!dev_priv) {
409                 DRM_ERROR("called with no initialization\n");
410                 return -EINVAL;
411         }
412
413         return i915_wait_irq(dev, irqwait->irq_seq);
414 }
415
416 static void i915_enable_interrupt (struct drm_device *dev)
417 {
418         drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
419         u16 flag;
420
421         flag = 0;
422         if (dev_priv->vblank_pipe & DRM_I915_VBLANK_PIPE_A)
423                 flag |= I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT;
424         if (dev_priv->vblank_pipe & DRM_I915_VBLANK_PIPE_B)
425                 flag |= I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT;
426
427         I915_WRITE16(IER, I915_USER_INTERRUPT | flag);
428 }
429
430 /* Set the vblank monitor pipe
431  */
432 int i915_vblank_pipe_set(struct drm_device *dev, void *data,
433                          struct drm_file *file_priv)
434 {
435         drm_i915_private_t *dev_priv = dev->dev_private;
436         drm_i915_vblank_pipe_t *pipe = data;
437
438         if (!dev_priv) {
439                 DRM_ERROR("called with no initialization\n");
440                 return -EINVAL;
441         }
442
443         if (pipe->pipe & ~(DRM_I915_VBLANK_PIPE_A|DRM_I915_VBLANK_PIPE_B)) {
444                 DRM_ERROR("called with invalid pipe 0x%x\n", pipe->pipe);
445                 return -EINVAL;
446         }
447
448         dev_priv->vblank_pipe = pipe->pipe;
449
450         i915_enable_interrupt (dev);
451
452         return 0;
453 }
454
455 int i915_vblank_pipe_get(struct drm_device *dev, void *data,
456                          struct drm_file *file_priv)
457 {
458         drm_i915_private_t *dev_priv = dev->dev_private;
459         drm_i915_vblank_pipe_t *pipe = data;
460         u16 flag;
461
462         if (!dev_priv) {
463                 DRM_ERROR("called with no initialization\n");
464                 return -EINVAL;
465         }
466
467         flag = I915_READ(IER);
468         pipe->pipe = 0;
469         if (flag & I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT)
470                 pipe->pipe |= DRM_I915_VBLANK_PIPE_A;
471         if (flag & I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT)
472                 pipe->pipe |= DRM_I915_VBLANK_PIPE_B;
473
474         return 0;
475 }
476
477 /**
478  * Schedule buffer swap at given vertical blank.
479  */
480 int i915_vblank_swap(struct drm_device *dev, void *data,
481                      struct drm_file *file_priv)
482 {
483         drm_i915_private_t *dev_priv = dev->dev_private;
484         drm_i915_vblank_swap_t *swap = data;
485         drm_i915_vbl_swap_t *vbl_swap;
486         unsigned int pipe, seqtype, curseq;
487         unsigned long irqflags;
488         struct list_head *list;
489
490         if (!dev_priv) {
491                 DRM_ERROR("%s called with no initialization\n", __func__);
492                 return -EINVAL;
493         }
494
495         if (dev_priv->sarea_priv->rotation) {
496                 DRM_DEBUG("Rotation not supported\n");
497                 return -EINVAL;
498         }
499
500         if (swap->seqtype & ~(_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE |
501                              _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS)) {
502                 DRM_ERROR("Invalid sequence type 0x%x\n", swap->seqtype);
503                 return -EINVAL;
504         }
505
506         pipe = (swap->seqtype & _DRM_VBLANK_SECONDARY) ? 1 : 0;
507
508         seqtype = swap->seqtype & (_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE);
509
510         if (!(dev_priv->vblank_pipe & (1 << pipe))) {
511                 DRM_ERROR("Invalid pipe %d\n", pipe);
512                 return -EINVAL;
513         }
514
515         spin_lock_irqsave(&dev->drw_lock, irqflags);
516
517         if (!drm_get_drawable_info(dev, swap->drawable)) {
518                 spin_unlock_irqrestore(&dev->drw_lock, irqflags);
519                 DRM_DEBUG("Invalid drawable ID %d\n", swap->drawable);
520                 return -EINVAL;
521         }
522
523         spin_unlock_irqrestore(&dev->drw_lock, irqflags);
524
525         curseq = atomic_read(pipe ? &dev->vbl_received2 : &dev->vbl_received);
526
527         if (seqtype == _DRM_VBLANK_RELATIVE)
528                 swap->sequence += curseq;
529
530         if ((curseq - swap->sequence) <= (1<<23)) {
531                 if (swap->seqtype & _DRM_VBLANK_NEXTONMISS) {
532                         swap->sequence = curseq + 1;
533                 } else {
534                         DRM_DEBUG("Missed target sequence\n");
535                         return -EINVAL;
536                 }
537         }
538
539         spin_lock_irqsave(&dev_priv->swaps_lock, irqflags);
540
541         list_for_each(list, &dev_priv->vbl_swaps.head) {
542                 vbl_swap = list_entry(list, drm_i915_vbl_swap_t, head);
543
544                 if (vbl_swap->drw_id == swap->drawable &&
545                     vbl_swap->pipe == pipe &&
546                     vbl_swap->sequence == swap->sequence) {
547                         spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags);
548                         DRM_DEBUG("Already scheduled\n");
549                         return 0;
550                 }
551         }
552
553         spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags);
554
555         if (dev_priv->swaps_pending >= 100) {
556                 DRM_DEBUG("Too many swaps queued\n");
557                 return -EBUSY;
558         }
559
560         vbl_swap = drm_calloc(1, sizeof(*vbl_swap), DRM_MEM_DRIVER);
561
562         if (!vbl_swap) {
563                 DRM_ERROR("Failed to allocate memory to queue swap\n");
564                 return -ENOMEM;
565         }
566
567         DRM_DEBUG("\n");
568
569         vbl_swap->drw_id = swap->drawable;
570         vbl_swap->pipe = pipe;
571         vbl_swap->sequence = swap->sequence;
572
573         spin_lock_irqsave(&dev_priv->swaps_lock, irqflags);
574
575         list_add_tail(&vbl_swap->head, &dev_priv->vbl_swaps.head);
576         dev_priv->swaps_pending++;
577
578         spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags);
579
580         return 0;
581 }
582
583 /* drm_dma.h hooks
584 */
585 void i915_driver_irq_preinstall(struct drm_device * dev)
586 {
587         drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
588
589         I915_WRITE16(HWSTAM, 0xfffe);
590         I915_WRITE16(IMR, 0x0);
591         I915_WRITE16(IER, 0x0);
592 }
593
594 void i915_driver_irq_postinstall(struct drm_device * dev)
595 {
596         drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
597
598         spin_lock_init(&dev_priv->swaps_lock);
599         INIT_LIST_HEAD(&dev_priv->vbl_swaps.head);
600         dev_priv->swaps_pending = 0;
601
602         if (!dev_priv->vblank_pipe)
603                 dev_priv->vblank_pipe = DRM_I915_VBLANK_PIPE_A;
604         i915_enable_interrupt(dev);
605         DRM_INIT_WAITQUEUE(&dev_priv->irq_queue);
606 }
607
608 void i915_driver_irq_uninstall(struct drm_device * dev)
609 {
610         drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
611         u16 temp;
612
613         if (!dev_priv)
614                 return;
615
616         I915_WRITE16(HWSTAM, 0xffff);
617         I915_WRITE16(IMR, 0xffff);
618         I915_WRITE16(IER, 0x0);
619
620         temp = I915_READ16(IIR);
621         I915_WRITE16(IIR, temp);
622 }