1 /* mga_drv.c -- Matrox G200/G400 driver -*- linux-c -*-
2 * Created: Mon Dec 13 01:56:22 1999 by jhartmann@precisioninsight.com
4 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
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 * Rickard E. (Rik) Faith <faith@valinux.com>
29 * Gareth Hughes <gareth@valinux.com>
35 #include <linux/config.h>
36 #endif /* __linux__ */
39 #include <sys/types.h>
41 #include <pci/pcivar.h>
42 #endif /* __FreeBSD__ */
44 #include "dev/drm/mga.h"
45 #include "dev/drm/drmP.h"
46 #include "dev/drm/mga_drm.h"
47 #include "dev/drm/mga_drv.h"
49 #define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc."
51 #define DRIVER_NAME "mga"
52 #define DRIVER_DESC "Matrox G200/G400"
53 #define DRIVER_DATE "20010321"
55 #define DRIVER_MAJOR 3
56 #define DRIVER_MINOR 0
57 #define DRIVER_PATCHLEVEL 2
60 /* List acquired from xc/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h
61 * Please report to eanholt@gladstone.uoregon.edu if your chip isn't
62 * represented in the list or if the information is incorrect.
64 /* PCI cards are not supported with DRI under FreeBSD.
66 drm_chipinfo_t DRM(devicelist)[] = {
67 {0x102b, 0x0520, 0, "Matrox G200 (PCI)"},
68 {0x102b, 0x0521, 1, "Matrox G200 (AGP)"},
69 {0x102b, 0x0525, 1, "Matrox G400/G450 (AGP)"},
70 {0x102b, 0x2527, 1, "Matrox G550 (AGP)"},
73 #endif /* __FreeBSD__ */
75 #define DRIVER_IOCTLS \
76 [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { mga_dma_buffers, 1, 0 }, \
77 [DRM_IOCTL_NR(DRM_IOCTL_MGA_INIT)] = { mga_dma_init, 1, 1 }, \
78 [DRM_IOCTL_NR(DRM_IOCTL_MGA_FLUSH)] = { mga_dma_flush, 1, 0 }, \
79 [DRM_IOCTL_NR(DRM_IOCTL_MGA_RESET)] = { mga_dma_reset, 1, 0 }, \
80 [DRM_IOCTL_NR(DRM_IOCTL_MGA_SWAP)] = { mga_dma_swap, 1, 0 }, \
81 [DRM_IOCTL_NR(DRM_IOCTL_MGA_CLEAR)] = { mga_dma_clear, 1, 0 }, \
82 [DRM_IOCTL_NR(DRM_IOCTL_MGA_VERTEX)] = { mga_dma_vertex, 1, 0 }, \
83 [DRM_IOCTL_NR(DRM_IOCTL_MGA_INDICES)] = { mga_dma_indices, 1, 0 }, \
84 [DRM_IOCTL_NR(DRM_IOCTL_MGA_ILOAD)] = { mga_dma_iload, 1, 0 }, \
85 [DRM_IOCTL_NR(DRM_IOCTL_MGA_BLIT)] = { mga_dma_blit, 1, 0 },
88 #define __HAVE_COUNTERS 3
89 #define __HAVE_COUNTER6 _DRM_STAT_IRQ
90 #define __HAVE_COUNTER7 _DRM_STAT_PRIMARY
91 #define __HAVE_COUNTER8 _DRM_STAT_SECONDARY
94 #include "dev/drm/drm_agpsupport.h"
95 #include "dev/drm/drm_auth.h"
96 #include "dev/drm/drm_bufs.h"
97 #include "dev/drm/drm_context.h"
98 #include "dev/drm/drm_dma.h"
99 #include "dev/drm/drm_drawable.h"
100 #include "dev/drm/drm_drv.h"
104 /* DRM(options) is called by the kernel to parse command-line options
105 * passed via the boot-loader (e.g., LILO). It calls the insmod option
106 * routine, drm_parse_drm.
109 /* JH- We have to hand expand the string ourselves because of the cpp. If
110 * anyone can think of a way that we can fit into the __setup macro without
111 * changing it, then please send the solution my way.
113 static int __init mga_options( char *str )
115 DRM(parse_options)( str );
119 __setup( DRIVER_NAME "=", mga_options );
121 #endif /* __linux__ */
123 #include "dev/drm/drm_fops.h"
124 #include "dev/drm/drm_init.h"
125 #include "dev/drm/drm_ioctl.h"
126 #include "dev/drm/drm_lock.h"
127 #include "dev/drm/drm_memory.h"
128 #include "dev/drm/drm_vm.h"
130 #include "dev/drm/drm_proc.h"
131 #include "dev/drm/drm_stub.h"
132 #endif /* __linux__ */
134 #include "dev/drm/drm_sysctl.h"
136 DRIVER_MODULE(mga, pci, mga_driver, mga_devclass, 0, 0);
137 #endif /* __FreeBSD__ */