]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/dev/drm/mach64_drv.c
This commit was generated by cvs2svn to compensate for changes in r150765,
[FreeBSD/FreeBSD.git] / sys / dev / drm / mach64_drv.c
1 /* mach64_drv.c -- ATI Rage 128 driver -*- linux-c -*-
2  * Created: Mon Dec 13 09:47:27 1999 by faith@precisioninsight.com
3  */
4 /*-
5  * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
6  * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
7  * All Rights Reserved.
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  * VA LINUX SYSTEMS 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
26  * OTHER DEALINGS IN THE SOFTWARE.
27  *
28  * Authors:
29  *    Rickard E. (Rik) Faith <faith@valinux.com>
30  *    Gareth Hughes <gareth@valinux.com>
31  *
32  * $FreeBSD$
33  */
34
35
36 #include <sys/types.h>
37
38 #include "dev/drm/drmP.h"
39 #include "dev/drm/drm.h"
40 #include "dev/drm/mach64_drm.h"
41 #include "dev/drm/mach64_drv.h"
42 #include "dev/drm/drm_pciids.h"
43
44 /* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
45 static drm_pci_id_list_t mach64_pciidlist[] = {
46         mach64_PCI_IDS
47 };
48
49 extern drm_ioctl_desc_t mach64_ioctls[];
50 extern int mach64_max_ioctl;
51
52 static void mach64_configure(drm_device_t *dev)
53 {
54         dev->dev_priv_size = 1; /* No dev_priv */
55         dev->pretakedown = mach64_driver_pretakedown;
56         dev->vblank_wait = mach64_driver_vblank_wait;
57         dev->irq_preinstall = mach64_driver_irq_preinstall;
58         dev->irq_postinstall = mach64_driver_irq_postinstall;
59         dev->irq_uninstall = mach64_driver_irq_uninstall;
60         dev->irq_handler = mach64_driver_irq_handler;
61         dev->dma_ioctl = mach64_dma_buffers;
62
63         dev->driver_ioctls = mach64_ioctls;
64         dev->max_driver_ioctl = mach64_max_ioctl;
65
66         dev->driver_name = DRIVER_NAME;
67         dev->driver_desc = DRIVER_DESC;
68         dev->driver_date = DRIVER_DATE;
69         dev->driver_major = DRIVER_MAJOR;
70         dev->driver_minor = DRIVER_MINOR;
71         dev->driver_patchlevel = DRIVER_PATCHLEVEL;
72
73         dev->use_agp = 1;
74         dev->use_mtrr = 1;
75         dev->use_pci_dma = 1;
76         dev->use_dma = 1;
77         dev->use_irq = 1;
78         dev->use_vbl_irq = 1;
79 }
80
81 #ifdef __FreeBSD__
82 static int
83 mach64_probe(device_t dev)
84 {
85         return drm_probe(dev, mach64_pciidlist);
86 }
87
88 static int
89 mach64_attach(device_t nbdev)
90 {
91         drm_device_t *dev = device_get_softc(nbdev);
92
93         bzero(dev, sizeof(drm_device_t));
94         mach64_configure(dev);
95         return drm_attach(nbdev, mach64_pciidlist);
96 }
97
98 static device_method_t mach64_methods[] = {
99         /* Device interface */
100         DEVMETHOD(device_probe,         mach64_probe),
101         DEVMETHOD(device_attach,        mach64_attach),
102         DEVMETHOD(device_detach,        drm_detach),
103
104         { 0, 0 }
105 };
106
107 static driver_t mach64_driver = {
108         "drm",
109         mach64_methods,
110         sizeof(drm_device_t)
111 };
112
113 extern devclass_t drm_devclass;
114 DRIVER_MODULE(mach64, pci, mach64_driver, drm_devclass, 0, 0);
115 MODULE_DEPEND(mach64, drm, 1, 1, 1);
116
117 #elif defined(__NetBSD__) || defined(__OpenBSD__)
118 CFDRIVER_DECL(mach64, DV_TTY, NULL);
119 #endif