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/savage_drv.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 /* savage_drv.c -- Savage DRI driver
    2  */
    3 /*-
    4  * Copyright 2005 Eric Anholt
    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 "Software"),
    9  * to deal in the Software without restriction, including without limitation
   10  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
   11  * and/or sell copies of the Software, and to permit persons to whom the
   12  * Software is furnished to do so, subject to the following conditions:
   13  *
   14  * The above copyright notice and this permission notice (including the next
   15  * paragraph) shall be included in all copies or substantial portions of the
   16  * Software.
   17  *
   18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
   21  * ERIC ANHOLT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
   22  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   23  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   24  *
   25  * Authors:
   26  *    Eric Anholt <anholt@FreeBSD.org>
   27  */
   28 
   29 #include <sys/cdefs.h>
   30 __FBSDID("$FreeBSD: releng/6.4/sys/dev/drm/savage_drv.c 158686 2006-05-17 07:40:12Z anholt $");
   31 
   32 #include "dev/drm/drmP.h"
   33 #include "dev/drm/drm.h"
   34 #include "dev/drm/savage_drm.h"
   35 #include "dev/drm/savage_drv.h"
   36 #include "dev/drm/drm_pciids.h"
   37 
   38 /* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
   39 static drm_pci_id_list_t savage_pciidlist[] = {
   40         savage_PCI_IDS
   41 };
   42 
   43 static void savage_configure(drm_device_t *dev)
   44 {
   45         dev->driver.buf_priv_size       = sizeof(drm_savage_buf_priv_t);
   46         dev->driver.load                = savage_driver_load;
   47         dev->driver.firstopen           = savage_driver_firstopen;
   48         dev->driver.lastclose           = savage_driver_lastclose;
   49         dev->driver.unload              = savage_driver_unload;
   50         dev->driver.reclaim_buffers_locked = savage_reclaim_buffers;
   51         dev->driver.dma_ioctl           = savage_bci_buffers;
   52 
   53         dev->driver.ioctls              = savage_ioctls;
   54         dev->driver.max_ioctl           = savage_max_ioctl;
   55 
   56         dev->driver.name                = DRIVER_NAME;
   57         dev->driver.desc                = DRIVER_DESC;
   58         dev->driver.date                = DRIVER_DATE;
   59         dev->driver.major               = DRIVER_MAJOR;
   60         dev->driver.minor               = DRIVER_MINOR;
   61         dev->driver.patchlevel          = DRIVER_PATCHLEVEL;
   62 
   63         dev->driver.use_agp             = 1;
   64         dev->driver.use_mtrr            = 1;
   65         dev->driver.use_pci_dma         = 1;
   66         dev->driver.use_dma             = 1;
   67 }
   68 
   69 #ifdef __FreeBSD__
   70 static int
   71 savage_probe(device_t dev)
   72 {
   73         return drm_probe(dev, savage_pciidlist);
   74 }
   75 
   76 static int
   77 savage_attach(device_t nbdev)
   78 {
   79         drm_device_t *dev = device_get_softc(nbdev);
   80 
   81         bzero(dev, sizeof(drm_device_t));
   82         savage_configure(dev);
   83         return drm_attach(nbdev, savage_pciidlist);
   84 }
   85 
   86 static device_method_t savage_methods[] = {
   87         /* Device interface */
   88         DEVMETHOD(device_probe,         savage_probe),
   89         DEVMETHOD(device_attach,        savage_attach),
   90         DEVMETHOD(device_detach,        drm_detach),
   91 
   92         { 0, 0 }
   93 };
   94 
   95 static driver_t savage_driver = {
   96         "drm",
   97         savage_methods,
   98         sizeof(drm_device_t)
   99 };
  100 
  101 extern devclass_t drm_devclass;
  102 #if __FreeBSD_version >= 700010
  103 DRIVER_MODULE(savage, vgapci, savage_driver, drm_devclass, 0, 0);
  104 #else
  105 DRIVER_MODULE(savage, pci, savage_driver, drm_devclass, 0, 0);
  106 #endif
  107 MODULE_DEPEND(savage, drm, 1, 1, 1);
  108 
  109 #elif defined(__NetBSD__) || defined(__OpenBSD__)
  110 CFDRIVER_DECL(savage, DV_TTY, NULL);
  111 #endif

Cache object: e431fea17b11096333edc6fd48dc65c0


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