]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/dev/drm/radeon_drv.c
This commit was generated by cvs2svn to compensate for changes in r96295,
[FreeBSD/FreeBSD.git] / sys / dev / drm / radeon_drv.c
1 /* radeon_drv.c -- ATI Radeon driver -*- linux-c -*-
2  * Created: Wed Feb 14 17:10:04 2001 by gareth@valinux.com
3  *
4  * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
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  * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
22  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24  * OTHER DEALINGS IN THE SOFTWARE.
25  *
26  * Authors:
27  *    Gareth Hughes <gareth@valinux.com>
28  *
29  * $FreeBSD$
30  */
31
32
33 #ifdef __linux__
34 #include <linux/config.h>
35 #endif /* __linux__ */
36
37 #ifdef __FreeBSD__
38 #include <sys/types.h>
39 #include <sys/bus.h>
40 #include <pci/pcivar.h>
41 #endif /* __FreeBSD__ */
42
43 #include "dev/drm/radeon.h"
44 #include "dev/drm/drmP.h"
45 #include "dev/drm/radeon_drm.h"
46 #include "dev/drm/radeon_drv.h"
47 #if __REALLY_HAVE_SG
48 #include "ati_pcigart.h"
49 #endif
50
51 #define DRIVER_AUTHOR           "Gareth Hughes, VA Linux Systems Inc."
52
53 #define DRIVER_NAME             "radeon"
54 #define DRIVER_DESC             "ATI Radeon"
55 #define DRIVER_DATE             "20010405"
56
57 #define DRIVER_MAJOR            1
58 #define DRIVER_MINOR            1
59 #define DRIVER_PATCHLEVEL       1
60
61 #ifdef __FreeBSD__
62 /* List acquired from xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h
63  * Please report to eanholt@gladstone.uoregon.edu if your chip isn't
64  * represented in the list or if the information is incorrect.
65  */
66 /* PCI cards are not supported with DRI under FreeBSD, and the 8500
67  * is not supported on any platform yet.
68  */
69 drm_chipinfo_t DRM(devicelist)[] = {
70         {0x1002, 0x4242, 0, "ATI Radeon BB 8500 (AGP)"},
71         {0x1002, 0x4C57, 1, "ATI Radeon LW Mobility 7 (AGP)"},
72         {0x1002, 0x4C59, 1, "ATI Radeon LY Mobility 6 (AGP)"},
73         {0x1002, 0x4C5A, 1, "ATI Radeon LZ Mobility 6 (AGP)"},
74         {0x1002, 0x5144, 1, "ATI Radeon QD (AGP)"},
75         {0x1002, 0x5145, 1, "ATI Radeon QE (AGP)"},
76         {0x1002, 0x5146, 1, "ATI Radeon QF (AGP)"},
77         {0x1002, 0x5147, 1, "ATI Radeon QG (AGP)"},
78         {0x1002, 0x514C, 0, "ATI Radeon QL 8500 (AGP)"},
79         {0x1002, 0x514E, 0, "ATI Radeon QN 8500 (AGP)"},
80         {0x1002, 0x514F, 0, "ATI Radeon QO 8500 (AGP)"},
81         {0x1002, 0x5157, 1, "ATI Radeon QW 7500 (AGP)"},
82         {0x1002, 0x5159, 1, "ATI Radeon QY VE (AGP)"},
83         {0x1002, 0x515A, 1, "ATI Radeon QZ VE (AGP)"},
84         {0x1002, 0x516C, 0, "ATI Radeon Ql 8500 (AGP)"},
85         {0, 0, 0, NULL}
86 };
87 #endif /* __FreeBSD__ */
88
89 #define DRIVER_IOCTLS                                                        \
90  [DRM_IOCTL_NR(DRM_IOCTL_DMA)]               = { radeon_cp_buffers,  1, 0 }, \
91  [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_INIT)]    = { radeon_cp_init,     1, 1 }, \
92  [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_START)]   = { radeon_cp_start,    1, 1 }, \
93  [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_STOP)]    = { radeon_cp_stop,     1, 1 }, \
94  [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_RESET)]   = { radeon_cp_reset,    1, 1 }, \
95  [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_IDLE)]    = { radeon_cp_idle,     1, 0 }, \
96  [DRM_IOCTL_NR(DRM_IOCTL_RADEON_RESET)]    = { radeon_engine_reset,  1, 0 }, \
97  [DRM_IOCTL_NR(DRM_IOCTL_RADEON_FULLSCREEN)] = { radeon_fullscreen,  1, 0 }, \
98  [DRM_IOCTL_NR(DRM_IOCTL_RADEON_SWAP)]       = { radeon_cp_swap,     1, 0 }, \
99  [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CLEAR)]      = { radeon_cp_clear,    1, 0 }, \
100  [DRM_IOCTL_NR(DRM_IOCTL_RADEON_VERTEX)]     = { radeon_cp_vertex,   1, 0 }, \
101  [DRM_IOCTL_NR(DRM_IOCTL_RADEON_INDICES)]    = { radeon_cp_indices,  1, 0 }, \
102  [DRM_IOCTL_NR(DRM_IOCTL_RADEON_TEXTURE)]    = { radeon_cp_texture,  1, 0 }, \
103  [DRM_IOCTL_NR(DRM_IOCTL_RADEON_STIPPLE)]    = { radeon_cp_stipple,  1, 0 }, \
104  [DRM_IOCTL_NR(DRM_IOCTL_RADEON_INDIRECT)]   = { radeon_cp_indirect, 1, 1 },
105
106
107 #if 0
108 /* GH: Count data sent to card via ring or vertex/indirect buffers.
109  */
110 #define __HAVE_COUNTERS         3
111 #define __HAVE_COUNTER6         _DRM_STAT_IRQ
112 #define __HAVE_COUNTER7         _DRM_STAT_PRIMARY
113 #define __HAVE_COUNTER8         _DRM_STAT_SECONDARY
114 #endif
115
116
117 #include "dev/drm/drm_agpsupport.h"
118 #include "dev/drm/drm_auth.h"
119 #include "dev/drm/drm_bufs.h"
120 #include "dev/drm/drm_context.h"
121 #include "dev/drm/drm_dma.h"
122 #include "dev/drm/drm_drawable.h"
123 #include "dev/drm/drm_drv.h"
124
125 #ifdef __linux__
126 #ifndef MODULE
127 /* DRM(options) is called by the kernel to parse command-line options
128  * passed via the boot-loader (e.g., LILO).  It calls the insmod option
129  * routine, drm_parse_drm.
130  */
131
132 /* JH- We have to hand expand the string ourselves because of the cpp.  If
133  * anyone can think of a way that we can fit into the __setup macro without
134  * changing it, then please send the solution my way.
135  */
136 static int __init radeon_options( char *str )
137 {
138         DRM(parse_options)( str );
139         return 1;
140 }
141
142 __setup( DRIVER_NAME "=", radeon_options );
143 #endif
144 #endif /* __linux__ */
145
146 #include "dev/drm/drm_fops.h"
147 #include "dev/drm/drm_init.h"
148 #include "dev/drm/drm_ioctl.h"
149 #include "dev/drm/drm_lock.h"
150 #include "dev/drm/drm_memory.h"
151 #include "dev/drm/drm_vm.h"
152 #ifdef __linux__
153 #include "dev/drm/drm_proc.h"
154 #include "dev/drm/drm_stub.h"
155 #endif /* __linux__ */
156 #ifdef __FreeBSD__
157 #include "dev/drm/drm_sysctl.h"
158 #endif /* __FreeBSD__ */
159 #if __REALLY_HAVE_SG
160 #include "dev/drm/drm_scatter.h"
161 #endif
162
163 #ifdef __FreeBSD__
164 DRIVER_MODULE(radeon, pci, radeon_driver, radeon_devclass, 0, 0);
165 #endif /* __FreeBSD__ */