Deleted Added
full compact
r128_drv.c (152909) r128_drv.c (153579)
1/* r128_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 */
33
34#include <sys/cdefs.h>
1/* r128_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 */
33
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/sys/dev/drm/r128_drv.c 152909 2005-11-28 23:13:57Z anholt $");
35__FBSDID("$FreeBSD: head/sys/dev/drm/r128_drv.c 153579 2005-12-20 22:44:36Z jhb $");
36
37#include "dev/drm/drmP.h"
38#include "dev/drm/drm.h"
39#include "dev/drm/r128_drm.h"
40#include "dev/drm/r128_drv.h"
41#include "dev/drm/drm_pciids.h"
42
43/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
44static drm_pci_id_list_t r128_pciidlist[] = {
45 r128_PCI_IDS
46};
47
48static void r128_configure(drm_device_t *dev)
49{
50 dev->driver.buf_priv_size = sizeof(drm_r128_buf_priv_t);
51 dev->driver.preclose = r128_driver_preclose;
52 dev->driver.lastclose = r128_driver_lastclose;
53 dev->driver.vblank_wait = r128_driver_vblank_wait;
54 dev->driver.irq_preinstall = r128_driver_irq_preinstall;
55 dev->driver.irq_postinstall = r128_driver_irq_postinstall;
56 dev->driver.irq_uninstall = r128_driver_irq_uninstall;
57 dev->driver.irq_handler = r128_driver_irq_handler;
58 dev->driver.dma_ioctl = r128_cce_buffers;
59
60 dev->driver.ioctls = r128_ioctls;
61 dev->driver.max_ioctl = r128_max_ioctl;
62
63 dev->driver.name = DRIVER_NAME;
64 dev->driver.desc = DRIVER_DESC;
65 dev->driver.date = DRIVER_DATE;
66 dev->driver.major = DRIVER_MAJOR;
67 dev->driver.minor = DRIVER_MINOR;
68 dev->driver.patchlevel = DRIVER_PATCHLEVEL;
69
70 dev->driver.use_agp = 1;
71 dev->driver.use_mtrr = 1;
72 dev->driver.use_pci_dma = 1;
73 dev->driver.use_sg = 1;
74 dev->driver.use_dma = 1;
75 dev->driver.use_irq = 1;
76 dev->driver.use_vbl_irq = 1;
77}
78
79#ifdef __FreeBSD__
80static int
81r128_probe(device_t dev)
82{
83 return drm_probe(dev, r128_pciidlist);
84}
85
86static int
87r128_attach(device_t nbdev)
88{
89 drm_device_t *dev = device_get_softc(nbdev);
90
91 bzero(dev, sizeof(drm_device_t));
92 r128_configure(dev);
93 return drm_attach(nbdev, r128_pciidlist);
94}
95
96static device_method_t r128_methods[] = {
97 /* Device interface */
98 DEVMETHOD(device_probe, r128_probe),
99 DEVMETHOD(device_attach, r128_attach),
100 DEVMETHOD(device_detach, drm_detach),
101
102 { 0, 0 }
103};
104
105static driver_t r128_driver = {
106 "drm",
107 r128_methods,
108 sizeof(drm_device_t)
109};
110
111extern devclass_t drm_devclass;
36
37#include "dev/drm/drmP.h"
38#include "dev/drm/drm.h"
39#include "dev/drm/r128_drm.h"
40#include "dev/drm/r128_drv.h"
41#include "dev/drm/drm_pciids.h"
42
43/* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
44static drm_pci_id_list_t r128_pciidlist[] = {
45 r128_PCI_IDS
46};
47
48static void r128_configure(drm_device_t *dev)
49{
50 dev->driver.buf_priv_size = sizeof(drm_r128_buf_priv_t);
51 dev->driver.preclose = r128_driver_preclose;
52 dev->driver.lastclose = r128_driver_lastclose;
53 dev->driver.vblank_wait = r128_driver_vblank_wait;
54 dev->driver.irq_preinstall = r128_driver_irq_preinstall;
55 dev->driver.irq_postinstall = r128_driver_irq_postinstall;
56 dev->driver.irq_uninstall = r128_driver_irq_uninstall;
57 dev->driver.irq_handler = r128_driver_irq_handler;
58 dev->driver.dma_ioctl = r128_cce_buffers;
59
60 dev->driver.ioctls = r128_ioctls;
61 dev->driver.max_ioctl = r128_max_ioctl;
62
63 dev->driver.name = DRIVER_NAME;
64 dev->driver.desc = DRIVER_DESC;
65 dev->driver.date = DRIVER_DATE;
66 dev->driver.major = DRIVER_MAJOR;
67 dev->driver.minor = DRIVER_MINOR;
68 dev->driver.patchlevel = DRIVER_PATCHLEVEL;
69
70 dev->driver.use_agp = 1;
71 dev->driver.use_mtrr = 1;
72 dev->driver.use_pci_dma = 1;
73 dev->driver.use_sg = 1;
74 dev->driver.use_dma = 1;
75 dev->driver.use_irq = 1;
76 dev->driver.use_vbl_irq = 1;
77}
78
79#ifdef __FreeBSD__
80static int
81r128_probe(device_t dev)
82{
83 return drm_probe(dev, r128_pciidlist);
84}
85
86static int
87r128_attach(device_t nbdev)
88{
89 drm_device_t *dev = device_get_softc(nbdev);
90
91 bzero(dev, sizeof(drm_device_t));
92 r128_configure(dev);
93 return drm_attach(nbdev, r128_pciidlist);
94}
95
96static device_method_t r128_methods[] = {
97 /* Device interface */
98 DEVMETHOD(device_probe, r128_probe),
99 DEVMETHOD(device_attach, r128_attach),
100 DEVMETHOD(device_detach, drm_detach),
101
102 { 0, 0 }
103};
104
105static driver_t r128_driver = {
106 "drm",
107 r128_methods,
108 sizeof(drm_device_t)
109};
110
111extern devclass_t drm_devclass;
112#if __FreeBSD_version >= 700010
113DRIVER_MODULE(r128, vgapci, r128_driver, drm_devclass, 0, 0);
114#else
112DRIVER_MODULE(r128, pci, r128_driver, drm_devclass, 0, 0);
115DRIVER_MODULE(r128, pci, r128_driver, drm_devclass, 0, 0);
116#endif
113MODULE_DEPEND(r128, drm, 1, 1, 1);
114
115#elif defined(__NetBSD__) || defined(__OpenBSD__)
116#ifdef _LKM
117CFDRIVER_DECL(r128, DV_TTY, NULL);
118#else
119CFATTACH_DECL(r128, sizeof(drm_device_t), drm_probe, drm_attach, drm_detach,
120 drm_activate);
121#endif
122#endif
117MODULE_DEPEND(r128, drm, 1, 1, 1);
118
119#elif defined(__NetBSD__) || defined(__OpenBSD__)
120#ifdef _LKM
121CFDRIVER_DECL(r128, DV_TTY, NULL);
122#else
123CFATTACH_DECL(r128, sizeof(drm_device_t), drm_probe, drm_attach, drm_detach,
124 drm_activate);
125#endif
126#endif