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>
34 #include "radeon_drm.h"
35 #include "radeon_drv.h"
36 #include "drm_pciids.h"
40 /* drv_PCI_IDs comes from drm_pciids.h, generated from drm_pciids.txt. */
41 static drm_pci_id_list_t radeon_pciidlist[] = {
45 static void radeon_configure(struct drm_device *dev)
47 dev->driver.buf_priv_size = sizeof(drm_radeon_buf_priv_t);
48 dev->driver.load = radeon_driver_load;
49 dev->driver.unload = radeon_driver_unload;
50 dev->driver.firstopen = radeon_driver_firstopen;
51 dev->driver.open = radeon_driver_open;
52 dev->driver.preclose = radeon_driver_preclose;
53 dev->driver.postclose = radeon_driver_postclose;
54 dev->driver.lastclose = radeon_driver_lastclose;
55 dev->driver.get_vblank_counter = radeon_get_vblank_counter;
56 dev->driver.enable_vblank = radeon_enable_vblank;
57 dev->driver.disable_vblank = radeon_disable_vblank;
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;
86 radeon_probe(device_t dev)
88 return drm_probe(dev, radeon_pciidlist);
92 radeon_attach(device_t nbdev)
94 struct drm_device *dev = device_get_softc(nbdev);
96 bzero(dev, sizeof(struct drm_device));
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 = {
113 sizeof(struct drm_device)
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(struct drm_device), drm_probe, drm_attach,
129 drm_detach, drm_activate);
131 #endif /* __FreeBSD__ */