1 /* radeon_drv.c -- ATI Radeon driver -*- linux-c -*-
2 * Created: Wed Feb 14 17:10:04 2001 by gareth@valinux.com
5 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice (including the next
16 * paragraph) shall be included in all copies or substantial portions of the
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
28 * Gareth Hughes <gareth@valinux.com>
30 * $DragonFly: src/sys/dev/drm/radeon_drv.c,v 1.1 2008/04/05 18:12:29 hasso Exp $
35 #include "radeon_drm.h"
36 #include "radeon_drv.h"
37 #include "drm_pciids.h"
41 /* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
42 static drm_pci_id_list_t radeon_pciidlist
[] = {
46 static void radeon_configure(drm_device_t
*dev
)
48 dev
->driver
.buf_priv_size
= sizeof(drm_radeon_buf_priv_t
);
49 dev
->driver
.load
= radeon_driver_load
;
50 dev
->driver
.unload
= radeon_driver_unload
;
51 dev
->driver
.firstopen
= radeon_driver_firstopen
;
52 dev
->driver
.open
= radeon_driver_open
;
53 dev
->driver
.preclose
= radeon_driver_preclose
;
54 dev
->driver
.postclose
= radeon_driver_postclose
;
55 dev
->driver
.lastclose
= radeon_driver_lastclose
;
56 dev
->driver
.vblank_wait
= radeon_driver_vblank_wait
;
57 dev
->driver
.vblank_wait2
= radeon_driver_vblank_wait2
;
58 dev
->driver
.irq_preinstall
= radeon_driver_irq_preinstall
;
59 dev
->driver
.irq_postinstall
= radeon_driver_irq_postinstall
;
60 dev
->driver
.irq_uninstall
= radeon_driver_irq_uninstall
;
61 dev
->driver
.irq_handler
= radeon_driver_irq_handler
;
62 dev
->driver
.dma_ioctl
= radeon_cp_buffers
;
64 dev
->driver
.ioctls
= radeon_ioctls
;
65 dev
->driver
.max_ioctl
= radeon_max_ioctl
;
67 dev
->driver
.name
= DRIVER_NAME
;
68 dev
->driver
.desc
= DRIVER_DESC
;
69 dev
->driver
.date
= DRIVER_DATE
;
70 dev
->driver
.major
= DRIVER_MAJOR
;
71 dev
->driver
.minor
= DRIVER_MINOR
;
72 dev
->driver
.patchlevel
= DRIVER_PATCHLEVEL
;
74 dev
->driver
.use_agp
= 1;
75 dev
->driver
.use_mtrr
= 1;
76 dev
->driver
.use_pci_dma
= 1;
77 dev
->driver
.use_sg
= 1;
78 dev
->driver
.use_dma
= 1;
79 dev
->driver
.use_irq
= 1;
80 dev
->driver
.use_vbl_irq
= 1;
81 dev
->driver
.use_vbl_irq2
= 1;
84 #if defined(__FreeBSD__) || defined(__DragonFly__)
86 radeon_probe(device_t dev
)
88 return drm_probe(dev
, radeon_pciidlist
);
92 radeon_attach(device_t nbdev
)
94 drm_device_t
*dev
= device_get_softc(nbdev
);
96 bzero(dev
, sizeof(drm_device_t
));
97 radeon_configure(dev
);
98 return drm_attach(nbdev
, radeon_pciidlist
);
101 static device_method_t radeon_methods
[] = {
102 /* Device interface */
103 DEVMETHOD(device_probe
, radeon_probe
),
104 DEVMETHOD(device_attach
, radeon_attach
),
105 DEVMETHOD(device_detach
, drm_detach
),
110 static driver_t radeon_driver
= {
116 extern devclass_t drm_devclass
;
117 #if __FreeBSD_version >= 700010
118 DRIVER_MODULE(radeon
, vgapci
, radeon_driver
, drm_devclass
, 0, 0);
120 DRIVER_MODULE(radeon
, pci
, radeon_driver
, drm_devclass
, 0, 0);
122 MODULE_DEPEND(radeon
, drm
, 1, 1, 1);
124 #elif defined(__NetBSD__) || defined(__OpenBSD__)
126 CFDRIVER_DECL(radeon
, DV_TTY
, NULL
);
128 CFATTACH_DECL(radeon
, sizeof(drm_device_t
), drm_probe
, drm_attach
, drm_detach
,
131 #endif /* __FreeBSD__ || __DragonFly__ */