tdfx_drv.c revision 1.4
1/*	$NetBSD: tdfx_drv.c,v 1.4 2021/12/18 23:45:44 riastradh Exp $	*/
2
3/* tdfx_drv.c -- tdfx driver -*- linux-c -*-
4 * Created: Thu Oct  7 10:38:32 1999 by faith@precisioninsight.com
5 *
6 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
7 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
8 * All Rights Reserved.
9 *
10 * Permission is hereby granted, free of charge, to any person obtaining a
11 * copy of this software and associated documentation files (the "Software"),
12 * to deal in the Software without restriction, including without limitation
13 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 * and/or sell copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following conditions:
16 *
17 * The above copyright notice and this permission notice (including the next
18 * paragraph) shall be included in all copies or substantial portions of the
19 * Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
24 * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 * DEALINGS IN THE SOFTWARE.
28 *
29 * Authors:
30 *    Rickard E. (Rik) Faith <faith@valinux.com>
31 *    Daryll Strauss <daryll@valinux.com>
32 *    Gareth Hughes <gareth@valinux.com>
33 */
34
35#include <sys/cdefs.h>
36__KERNEL_RCSID(0, "$NetBSD: tdfx_drv.c,v 1.4 2021/12/18 23:45:44 riastradh Exp $");
37
38#include <linux/module.h>
39#include <linux/pci.h>
40
41#include <drm/drm_drv.h>
42#include <drm/drm_file.h>
43#include <drm/drm_ioctl.h>
44#include <drm/drm_legacy.h>
45#include <drm/drm_pciids.h>
46
47#include "tdfx_drv.h"
48
49static struct pci_device_id pciidlist[] = {
50	tdfx_PCI_IDS
51};
52
53static const struct file_operations tdfx_driver_fops = {
54	.owner = THIS_MODULE,
55	.open = drm_open,
56	.release = drm_release,
57	.unlocked_ioctl = drm_ioctl,
58	.mmap = drm_legacy_mmap,
59	.poll = drm_poll,
60	.compat_ioctl = drm_compat_ioctl,
61	.llseek = noop_llseek,
62};
63
64static struct drm_driver driver = {
65	.driver_features = DRIVER_LEGACY,
66	.fops = &tdfx_driver_fops,
67	.name = DRIVER_NAME,
68	.desc = DRIVER_DESC,
69	.date = DRIVER_DATE,
70	.major = DRIVER_MAJOR,
71	.minor = DRIVER_MINOR,
72	.patchlevel = DRIVER_PATCHLEVEL,
73};
74
75static struct pci_driver tdfx_pci_driver = {
76	.name = DRIVER_NAME,
77	.id_table = pciidlist,
78};
79
80static int __init tdfx_init(void)
81{
82	return drm_legacy_pci_init(&driver, &tdfx_pci_driver);
83}
84
85static void __exit tdfx_exit(void)
86{
87	drm_legacy_pci_exit(&driver, &tdfx_pci_driver);
88}
89
90module_init(tdfx_init);
91module_exit(tdfx_exit);
92
93MODULE_AUTHOR(DRIVER_AUTHOR);
94MODULE_DESCRIPTION(DRIVER_DESC);
95MODULE_LICENSE("GPL and additional rights");
96