The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/drm/mga_irq.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* mga_irq.c -- IRQ handling for radeon -*- linux-c -*- */
    2 /*-
    3  * Copyright (C) The Weather Channel, Inc.  2002.  All Rights Reserved.
    4  * 
    5  * The Weather Channel (TM) funded Tungsten Graphics to develop the
    6  * initial release of the Radeon 8500 driver under the XFree86 license.
    7  * This notice must be preserved.
    8  *
    9  * Permission is hereby granted, free of charge, to any person obtaining a
   10  * copy of this software and associated documentation files (the "Software"),
   11  * to deal in the Software without restriction, including without limitation
   12  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
   13  * and/or sell copies of the Software, and to permit persons to whom the
   14  * Software is furnished to do so, subject to the following conditions:
   15  *
   16  * The above copyright notice and this permission notice (including the next
   17  * paragraph) shall be included in all copies or substantial portions of the
   18  * Software.
   19  *
   20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   21  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   22  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
   23  * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
   24  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
   25  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
   26  * DEALINGS IN THE SOFTWARE.
   27  *
   28  * Authors:
   29  *    Keith Whitwell <keith@tungstengraphics.com>
   30  *    Eric Anholt <anholt@FreeBSD.org>
   31  *
   32  * $FreeBSD$
   33  */
   34 
   35 #include "dev/drm/mga.h"
   36 #include "dev/drm/drmP.h"
   37 #include "dev/drm/drm.h"
   38 #include "dev/drm/mga_drm.h"
   39 #include "dev/drm/mga_drv.h"
   40 
   41 irqreturn_t mga_irq_handler( DRM_IRQ_ARGS )
   42 {
   43         drm_device_t *dev = (drm_device_t *) arg;
   44         drm_mga_private_t *dev_priv = 
   45            (drm_mga_private_t *)dev->dev_private;
   46         int status;
   47 
   48         status = MGA_READ( MGA_STATUS );
   49         
   50         /* VBLANK interrupt */
   51         if ( status & MGA_VLINEPEN ) {
   52                 MGA_WRITE( MGA_ICLEAR, MGA_VLINEICLR );
   53                 atomic_inc(&dev->vbl_received);
   54                 DRM_WAKEUP(&dev->vbl_queue);
   55                 DRM(vbl_send_signals)( dev );
   56                 return IRQ_HANDLED;
   57         }
   58         return IRQ_NONE;
   59 }
   60 
   61 int mga_vblank_wait(drm_device_t *dev, unsigned int *sequence)
   62 {
   63         unsigned int cur_vblank;
   64         int ret = 0;
   65 
   66         /* Assume that the user has missed the current sequence number
   67          * by about a day rather than she wants to wait for years
   68          * using vertical blanks... 
   69          */
   70         DRM_WAIT_ON( ret, dev->vbl_queue, 3*DRM_HZ, 
   71                      ( ( ( cur_vblank = atomic_read(&dev->vbl_received ) )
   72                          - *sequence ) <= (1<<23) ) );
   73 
   74         *sequence = cur_vblank;
   75 
   76         return ret;
   77 }
   78 
   79 void mga_driver_irq_preinstall( drm_device_t *dev ) {
   80         drm_mga_private_t *dev_priv = 
   81            (drm_mga_private_t *)dev->dev_private;
   82 
   83         /* Disable *all* interrupts */
   84         MGA_WRITE( MGA_IEN, 0 );
   85         /* Clear bits if they're already high */
   86         MGA_WRITE( MGA_ICLEAR, ~0 );
   87 }
   88 
   89 void mga_driver_irq_postinstall( drm_device_t *dev ) {
   90         drm_mga_private_t *dev_priv = 
   91            (drm_mga_private_t *)dev->dev_private;
   92 
   93         /* Turn on VBL interrupt */
   94         MGA_WRITE( MGA_IEN, MGA_VLINEIEN );
   95 }
   96 
   97 void mga_driver_irq_uninstall( drm_device_t *dev ) {
   98         drm_mga_private_t *dev_priv = 
   99            (drm_mga_private_t *)dev->dev_private;
  100         if (!dev_priv)
  101                 return;
  102 
  103         /* Disable *all* interrupts */
  104         MGA_WRITE( MGA_IEN, 0 );
  105 }

Cache object: 1a7844d99893380cae258d0176aefdbd


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.