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/via_map.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 /*-
    2  * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
    3  * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
    4  *
    5  * Permission is hereby granted, free of charge, to any person obtaining a
    6  * copy of this software and associated documentation files (the "Software"),
    7  * to deal in the Software without restriction, including without limitation
    8  * the rights to use, copy, modify, merge, publish, distribute, sub license,
    9  * and/or sell copies of the Software, and to permit persons to whom the
   10  * Software is furnished to do so, subject to the following conditions:
   11  *
   12  * The above copyright notice and this permission notice (including the
   13  * next paragraph) shall be included in all copies or substantial portions
   14  * of the Software.
   15  *
   16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   18  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
   19  * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
   20  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
   21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
   22  * DEALINGS IN THE SOFTWARE.
   23  */
   24 
   25 #include <sys/cdefs.h>
   26 __FBSDID("$FreeBSD: releng/9.0/sys/dev/drm/via_map.c 207066 2010-04-22 18:21:25Z rnoland $");
   27 
   28 #include "dev/drm/drmP.h"
   29 #include "dev/drm/via_drm.h"
   30 #include "dev/drm/via_drv.h"
   31 
   32 static int via_do_init_map(struct drm_device * dev, drm_via_init_t * init)
   33 {
   34         drm_via_private_t *dev_priv = dev->dev_private;
   35 
   36         DRM_DEBUG("\n");
   37 
   38         dev_priv->sarea = drm_getsarea(dev);
   39         if (!dev_priv->sarea) {
   40                 DRM_ERROR("could not find sarea!\n");
   41                 dev->dev_private = (void *)dev_priv;
   42                 via_do_cleanup_map(dev);
   43                 return -EINVAL;
   44         }
   45 
   46         dev_priv->fb = drm_core_findmap(dev, init->fb_offset);
   47         if (!dev_priv->fb) {
   48                 DRM_ERROR("could not find framebuffer!\n");
   49                 dev->dev_private = (void *)dev_priv;
   50                 via_do_cleanup_map(dev);
   51                 return -EINVAL;
   52         }
   53         dev_priv->mmio = drm_core_findmap(dev, init->mmio_offset);
   54         if (!dev_priv->mmio) {
   55                 DRM_ERROR("could not find mmio region!\n");
   56                 dev->dev_private = (void *)dev_priv;
   57                 via_do_cleanup_map(dev);
   58                 return -EINVAL;
   59         }
   60 
   61         dev_priv->sarea_priv =
   62             (drm_via_sarea_t *) ((u8 *) dev_priv->sarea->virtual +
   63                                  init->sarea_priv_offset);
   64 
   65         dev_priv->agpAddr = init->agpAddr;
   66 
   67         via_init_futex(dev_priv);
   68 
   69         via_init_dmablit(dev);
   70 
   71         dev->dev_private = (void *)dev_priv;
   72         return 0;
   73 }
   74 
   75 int via_do_cleanup_map(struct drm_device * dev)
   76 {
   77         via_dma_cleanup(dev);
   78 
   79         return 0;
   80 }
   81 
   82 int via_map_init(struct drm_device *dev, void *data, struct drm_file *file_priv)
   83 {
   84         drm_via_init_t *init = data;
   85 
   86         DRM_DEBUG("\n");
   87 
   88         switch (init->func) {
   89         case VIA_INIT_MAP:
   90                 return via_do_init_map(dev, init);
   91         case VIA_CLEANUP_MAP:
   92                 return via_do_cleanup_map(dev);
   93         }
   94 
   95         return -EINVAL;
   96 }
   97 
   98 int via_driver_load(struct drm_device *dev, unsigned long chipset)
   99 {
  100         drm_via_private_t *dev_priv;
  101         int ret = 0;
  102 
  103         dev_priv = drm_alloc(sizeof(drm_via_private_t), DRM_MEM_DRIVER);
  104         if (dev_priv == NULL)
  105                 return -ENOMEM;
  106 
  107         dev->dev_private = (void *)dev_priv;
  108 
  109         dev_priv->chipset = chipset;
  110 
  111         ret = drm_sman_init(&dev_priv->sman, 2, 12, 8);
  112         if (ret) {
  113                 drm_free(dev_priv, sizeof(drm_via_private_t), DRM_MEM_DRIVER);
  114                 return ret;
  115         }
  116 
  117         ret = drm_vblank_init(dev, 1);
  118         if (ret) {
  119                 drm_sman_takedown(&dev_priv->sman);
  120                 drm_free(dev_priv, sizeof(drm_via_private_t), DRM_MEM_DRIVER);
  121                 return ret;
  122         }
  123 
  124         return 0;
  125 }
  126 
  127 int via_driver_unload(struct drm_device *dev)
  128 {
  129         drm_via_private_t *dev_priv = dev->dev_private;
  130 
  131         drm_sman_takedown(&dev_priv->sman);
  132 
  133         drm_free(dev_priv, sizeof(drm_via_private_t), DRM_MEM_DRIVER);
  134         dev->dev_private = NULL;
  135 
  136         return 0;
  137 }

Cache object: 778df553a93cbf346360f08f22c81676


[ 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.