mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-27 14:45:04 +07:00
94668ac796
The data structure |struct drm_vram_mm| and its helpers replace mgag200's TTM-based memory manager. It's the same implementation; except for the type names. v4: * don't select DRM_TTM or DRM_VRAM_MM_HELPER v3: * use drm_gem_vram_mm_funcs * convert driver to drm_device-based instance v2: * implement mgag200_mmap() with drm_vram_mm_mmap() Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Link: http://patchwork.freedesktop.org/patch/msgid/20190508082630.15116-16-tzimmermann@suse.de Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
108 lines
2.8 KiB
C
108 lines
2.8 KiB
C
/*
|
|
* Copyright 2012 Red Hat
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU General
|
|
* Public License version 2. See the file COPYING in the main
|
|
* directory of this archive for more details.
|
|
*
|
|
* Authors: Matthew Garrett
|
|
* Dave Airlie
|
|
*/
|
|
#include <linux/module.h>
|
|
#include <linux/console.h>
|
|
#include <drm/drmP.h>
|
|
|
|
#include "mgag200_drv.h"
|
|
|
|
#include <drm/drm_pciids.h>
|
|
|
|
/*
|
|
* This is the generic driver code. This binds the driver to the drm core,
|
|
* which then performs further device association and calls our graphics init
|
|
* functions
|
|
*/
|
|
int mgag200_modeset = -1;
|
|
|
|
MODULE_PARM_DESC(modeset, "Disable/Enable modesetting");
|
|
module_param_named(modeset, mgag200_modeset, int, 0400);
|
|
|
|
static struct drm_driver driver;
|
|
|
|
static const struct pci_device_id pciidlist[] = {
|
|
{ PCI_VENDOR_ID_MATROX, 0x522, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_SE_A },
|
|
{ PCI_VENDOR_ID_MATROX, 0x524, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_SE_B },
|
|
{ PCI_VENDOR_ID_MATROX, 0x530, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_EV },
|
|
{ PCI_VENDOR_ID_MATROX, 0x532, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_WB },
|
|
{ PCI_VENDOR_ID_MATROX, 0x533, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_EH },
|
|
{ PCI_VENDOR_ID_MATROX, 0x534, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_ER },
|
|
{ PCI_VENDOR_ID_MATROX, 0x536, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_EW3 },
|
|
{ PCI_VENDOR_ID_MATROX, 0x538, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_EH3 },
|
|
{0,}
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(pci, pciidlist);
|
|
|
|
|
|
static int mga_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|
{
|
|
drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, 0, "mgag200drmfb");
|
|
|
|
return drm_get_pci_dev(pdev, ent, &driver);
|
|
}
|
|
|
|
static void mga_pci_remove(struct pci_dev *pdev)
|
|
{
|
|
struct drm_device *dev = pci_get_drvdata(pdev);
|
|
|
|
drm_put_dev(dev);
|
|
}
|
|
|
|
static const struct file_operations mgag200_driver_fops = {
|
|
.owner = THIS_MODULE,
|
|
DRM_VRAM_MM_FILE_OPERATIONS
|
|
};
|
|
|
|
static struct drm_driver driver = {
|
|
.driver_features = DRIVER_GEM | DRIVER_MODESET,
|
|
.load = mgag200_driver_load,
|
|
.unload = mgag200_driver_unload,
|
|
.fops = &mgag200_driver_fops,
|
|
.name = DRIVER_NAME,
|
|
.desc = DRIVER_DESC,
|
|
.date = DRIVER_DATE,
|
|
.major = DRIVER_MAJOR,
|
|
.minor = DRIVER_MINOR,
|
|
.patchlevel = DRIVER_PATCHLEVEL,
|
|
DRM_GEM_VRAM_DRIVER
|
|
};
|
|
|
|
static struct pci_driver mgag200_pci_driver = {
|
|
.name = DRIVER_NAME,
|
|
.id_table = pciidlist,
|
|
.probe = mga_pci_probe,
|
|
.remove = mga_pci_remove,
|
|
};
|
|
|
|
static int __init mgag200_init(void)
|
|
{
|
|
if (vgacon_text_force() && mgag200_modeset == -1)
|
|
return -EINVAL;
|
|
|
|
if (mgag200_modeset == 0)
|
|
return -EINVAL;
|
|
|
|
return pci_register_driver(&mgag200_pci_driver);
|
|
}
|
|
|
|
static void __exit mgag200_exit(void)
|
|
{
|
|
pci_unregister_driver(&mgag200_pci_driver);
|
|
}
|
|
|
|
module_init(mgag200_init);
|
|
module_exit(mgag200_exit);
|
|
|
|
MODULE_AUTHOR(DRIVER_AUTHOR);
|
|
MODULE_DESCRIPTION(DRIVER_DESC);
|
|
MODULE_LICENSE("GPL");
|