18c2ecf20Sopenharmony_ci/* tdfx_drv.c -- tdfx driver -*- linux-c -*-
28c2ecf20Sopenharmony_ci * Created: Thu Oct  7 10:38:32 1999 by faith@precisioninsight.com
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
58c2ecf20Sopenharmony_ci * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
68c2ecf20Sopenharmony_ci * All Rights Reserved.
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
98c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
108c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation
118c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
128c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
138c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice (including the next
168c2ecf20Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
178c2ecf20Sopenharmony_ci * Software.
188c2ecf20Sopenharmony_ci *
198c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
208c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
218c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
228c2ecf20Sopenharmony_ci * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
238c2ecf20Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
248c2ecf20Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
258c2ecf20Sopenharmony_ci * DEALINGS IN THE SOFTWARE.
268c2ecf20Sopenharmony_ci *
278c2ecf20Sopenharmony_ci * Authors:
288c2ecf20Sopenharmony_ci *    Rickard E. (Rik) Faith <faith@valinux.com>
298c2ecf20Sopenharmony_ci *    Daryll Strauss <daryll@valinux.com>
308c2ecf20Sopenharmony_ci *    Gareth Hughes <gareth@valinux.com>
318c2ecf20Sopenharmony_ci */
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#include <linux/module.h>
348c2ecf20Sopenharmony_ci#include <linux/pci.h>
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#include <drm/drm_drv.h>
378c2ecf20Sopenharmony_ci#include <drm/drm_file.h>
388c2ecf20Sopenharmony_ci#include <drm/drm_ioctl.h>
398c2ecf20Sopenharmony_ci#include <drm/drm_legacy.h>
408c2ecf20Sopenharmony_ci#include <drm/drm_pciids.h>
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#include "tdfx_drv.h"
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_cistatic struct pci_device_id pciidlist[] = {
458c2ecf20Sopenharmony_ci	tdfx_PCI_IDS
468c2ecf20Sopenharmony_ci};
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_cistatic const struct file_operations tdfx_driver_fops = {
498c2ecf20Sopenharmony_ci	.owner = THIS_MODULE,
508c2ecf20Sopenharmony_ci	.open = drm_open,
518c2ecf20Sopenharmony_ci	.release = drm_release,
528c2ecf20Sopenharmony_ci	.unlocked_ioctl = drm_ioctl,
538c2ecf20Sopenharmony_ci	.mmap = drm_legacy_mmap,
548c2ecf20Sopenharmony_ci	.poll = drm_poll,
558c2ecf20Sopenharmony_ci	.compat_ioctl = drm_compat_ioctl,
568c2ecf20Sopenharmony_ci	.llseek = noop_llseek,
578c2ecf20Sopenharmony_ci};
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_cistatic struct drm_driver driver = {
608c2ecf20Sopenharmony_ci	.driver_features = DRIVER_LEGACY,
618c2ecf20Sopenharmony_ci	.fops = &tdfx_driver_fops,
628c2ecf20Sopenharmony_ci	.name = DRIVER_NAME,
638c2ecf20Sopenharmony_ci	.desc = DRIVER_DESC,
648c2ecf20Sopenharmony_ci	.date = DRIVER_DATE,
658c2ecf20Sopenharmony_ci	.major = DRIVER_MAJOR,
668c2ecf20Sopenharmony_ci	.minor = DRIVER_MINOR,
678c2ecf20Sopenharmony_ci	.patchlevel = DRIVER_PATCHLEVEL,
688c2ecf20Sopenharmony_ci};
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_cistatic struct pci_driver tdfx_pci_driver = {
718c2ecf20Sopenharmony_ci	.name = DRIVER_NAME,
728c2ecf20Sopenharmony_ci	.id_table = pciidlist,
738c2ecf20Sopenharmony_ci};
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_cistatic int __init tdfx_init(void)
768c2ecf20Sopenharmony_ci{
778c2ecf20Sopenharmony_ci	return drm_legacy_pci_init(&driver, &tdfx_pci_driver);
788c2ecf20Sopenharmony_ci}
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_cistatic void __exit tdfx_exit(void)
818c2ecf20Sopenharmony_ci{
828c2ecf20Sopenharmony_ci	drm_legacy_pci_exit(&driver, &tdfx_pci_driver);
838c2ecf20Sopenharmony_ci}
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_cimodule_init(tdfx_init);
868c2ecf20Sopenharmony_cimodule_exit(tdfx_exit);
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ciMODULE_AUTHOR(DRIVER_AUTHOR);
898c2ecf20Sopenharmony_ciMODULE_DESCRIPTION(DRIVER_DESC);
908c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL and additional rights");
91