11.2Sriastrad/*	$NetBSD: tdfx_drv.c,v 1.4 2021/12/18 23:45:44 riastradh Exp $	*/
21.2Sriastrad
31.1Sriastrad/* tdfx_drv.c -- tdfx driver -*- linux-c -*-
41.1Sriastrad * Created: Thu Oct  7 10:38:32 1999 by faith@precisioninsight.com
51.1Sriastrad *
61.1Sriastrad * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
71.1Sriastrad * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
81.1Sriastrad * All Rights Reserved.
91.1Sriastrad *
101.1Sriastrad * Permission is hereby granted, free of charge, to any person obtaining a
111.1Sriastrad * copy of this software and associated documentation files (the "Software"),
121.1Sriastrad * to deal in the Software without restriction, including without limitation
131.1Sriastrad * the rights to use, copy, modify, merge, publish, distribute, sublicense,
141.1Sriastrad * and/or sell copies of the Software, and to permit persons to whom the
151.1Sriastrad * Software is furnished to do so, subject to the following conditions:
161.1Sriastrad *
171.1Sriastrad * The above copyright notice and this permission notice (including the next
181.1Sriastrad * paragraph) shall be included in all copies or substantial portions of the
191.1Sriastrad * Software.
201.1Sriastrad *
211.1Sriastrad * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
221.1Sriastrad * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
231.1Sriastrad * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
241.1Sriastrad * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
251.1Sriastrad * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
261.1Sriastrad * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
271.1Sriastrad * DEALINGS IN THE SOFTWARE.
281.1Sriastrad *
291.1Sriastrad * Authors:
301.1Sriastrad *    Rickard E. (Rik) Faith <faith@valinux.com>
311.1Sriastrad *    Daryll Strauss <daryll@valinux.com>
321.1Sriastrad *    Gareth Hughes <gareth@valinux.com>
331.1Sriastrad */
341.1Sriastrad
351.2Sriastrad#include <sys/cdefs.h>
361.2Sriastrad__KERNEL_RCSID(0, "$NetBSD: tdfx_drv.c,v 1.4 2021/12/18 23:45:44 riastradh Exp $");
371.2Sriastrad
381.1Sriastrad#include <linux/module.h>
391.4Sriastrad#include <linux/pci.h>
401.4Sriastrad
411.4Sriastrad#include <drm/drm_drv.h>
421.4Sriastrad#include <drm/drm_file.h>
431.4Sriastrad#include <drm/drm_ioctl.h>
441.4Sriastrad#include <drm/drm_legacy.h>
451.4Sriastrad#include <drm/drm_pciids.h>
461.1Sriastrad
471.1Sriastrad#include "tdfx_drv.h"
481.1Sriastrad
491.1Sriastradstatic struct pci_device_id pciidlist[] = {
501.1Sriastrad	tdfx_PCI_IDS
511.1Sriastrad};
521.1Sriastrad
531.1Sriastradstatic const struct file_operations tdfx_driver_fops = {
541.1Sriastrad	.owner = THIS_MODULE,
551.1Sriastrad	.open = drm_open,
561.1Sriastrad	.release = drm_release,
571.1Sriastrad	.unlocked_ioctl = drm_ioctl,
581.2Sriastrad	.mmap = drm_legacy_mmap,
591.1Sriastrad	.poll = drm_poll,
601.1Sriastrad	.compat_ioctl = drm_compat_ioctl,
611.1Sriastrad	.llseek = noop_llseek,
621.1Sriastrad};
631.1Sriastrad
641.1Sriastradstatic struct drm_driver driver = {
651.4Sriastrad	.driver_features = DRIVER_LEGACY,
661.1Sriastrad	.fops = &tdfx_driver_fops,
671.1Sriastrad	.name = DRIVER_NAME,
681.1Sriastrad	.desc = DRIVER_DESC,
691.1Sriastrad	.date = DRIVER_DATE,
701.1Sriastrad	.major = DRIVER_MAJOR,
711.1Sriastrad	.minor = DRIVER_MINOR,
721.1Sriastrad	.patchlevel = DRIVER_PATCHLEVEL,
731.1Sriastrad};
741.1Sriastrad
751.1Sriastradstatic struct pci_driver tdfx_pci_driver = {
761.1Sriastrad	.name = DRIVER_NAME,
771.1Sriastrad	.id_table = pciidlist,
781.1Sriastrad};
791.1Sriastrad
801.1Sriastradstatic int __init tdfx_init(void)
811.1Sriastrad{
821.4Sriastrad	return drm_legacy_pci_init(&driver, &tdfx_pci_driver);
831.1Sriastrad}
841.1Sriastrad
851.1Sriastradstatic void __exit tdfx_exit(void)
861.1Sriastrad{
871.4Sriastrad	drm_legacy_pci_exit(&driver, &tdfx_pci_driver);
881.1Sriastrad}
891.1Sriastrad
901.1Sriastradmodule_init(tdfx_init);
911.1Sriastradmodule_exit(tdfx_exit);
921.1Sriastrad
931.1SriastradMODULE_AUTHOR(DRIVER_AUTHOR);
941.1SriastradMODULE_DESCRIPTION(DRIVER_DESC);
951.1SriastradMODULE_LICENSE("GPL and additional rights");
96