Commit 399516ab0fee ("MAINTAINERS: Add a bunch of legacy (UMS) DRM drivers") marked sis driver obsolete 7 years ago. And the mesa UMD of this drm driver already in deprecated list in the link: https://docs.mesa3d.org/systems.html Silicon Integrated Systems->drivers/gpu/drm/sis It's time to remove this driver.
Unified · Split
| @@ -405,15 +405,6 @@ config DRM_TDFX · 404 unmodified lines | ||
| 405 | 405 | Choose this option if you have a 3dfx Banshee or Voodoo3 (or later), |
| 406 | 406 | graphics card. If M is selected, the module will be called tdfx. |
| 407 | 407 | |
| 408 | −config DRM_SIS | |
| 409 | − tristate "SiS video cards" | |
| 410 | − depends on DRM && AGP | |
| 411 | − depends on FB_SIS || FB_SIS=n | |
| 412 | − help | |
| 413 | − Choose this option if you have a SiS 630 or compatible video | |
| 414 | − chipset. If M is selected the module will be called sis. AGP | |
| 415 | − support is required for this driver to work. | |
| 416 | − | |
| 417 | 408 | config DRM_VIA |
| 418 | 409 | tristate "Via unichrome video cards" |
| 419 | 410 | depends on DRM && PCI |
| @@ -141,7 +141,6 @@ obj-$(CONFIG_DRM_KMB_DISPLAY) += kmb/ · 140 unmodified lines | ||
| 141 | 141 | obj-$(CONFIG_DRM_MGAG200) += mgag200/ |
| 142 | 142 | obj-$(CONFIG_DRM_V3D) += v3d/ |
| 143 | 143 | obj-$(CONFIG_DRM_VC4) += vc4/ |
| 144 | −obj-$(CONFIG_DRM_SIS) += sis/ | |
| 145 | 144 | obj-$(CONFIG_DRM_VMWGFX)+= vmwgfx/ |
| 146 | 145 | obj-$(CONFIG_DRM_VIA) +=via/ |
| 147 | 146 | obj-$(CONFIG_DRM_VGEM) += vgem/ |
| @@ -1,10 +0,0 @@ | ||
| 1 | −# SPDX-License-Identifier: GPL-2.0-only | |
| 2 | −# | |
| 3 | −# Makefile for the drm device driver. This driver provides support for the | |
| 4 | −# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. | |
| 5 | − | |
| 6 | −sis-y := sis_drv.o sis_mm.o | |
| 7 | − | |
| 8 | −obj-$(CONFIG_DRM_SIS) += sis.o | |
| 9 | − | |
| 10 | − | |
| @@ -1,143 +0,0 @@ | ||
| 1 | −/* sis.c -- sis driver -*- linux-c -*- | |
| 2 | − * | |
| 3 | − * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. | |
| 4 | − * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. | |
| 5 | − * All Rights Reserved. | |
| 6 | − * | |
| 7 | − * Permission is hereby granted, free of charge, to any person obtaining a | |
| 8 | − * copy of this software and associated documentation files (the "Software"), | |
| 9 | − * to deal in the Software without restriction, including without limitation | |
| 10 | − * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 11 | − * and/or sell copies of the Software, and to permit persons to whom the | |
| 12 | − * Software is furnished to do so, subject to the following conditions: | |
| 13 | − * | |
| 14 | − * The above copyright notice and this permission notice (including the next | |
| 15 | − * paragraph) shall be included in all copies or substantial portions of the | |
| 16 | − * Software. | |
| 17 | − * | |
| 18 | − * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 19 | − * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 20 | − * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 21 | − * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
| 22 | − * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
| 23 | − * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |
| 24 | − * DEALINGS IN THE SOFTWARE. | |
| 25 | − * | |
| 26 | − */ | |
| 27 | − | |
| 28 | −#include <linux/module.h> | |
| 29 | −#include <linux/pci.h> | |
| 30 | − | |
| 31 | −#include <drm/drm_drv.h> | |
| 32 | −#include <drm/drm_file.h> | |
| 33 | −#include <drm/drm_pciids.h> | |
| 34 | −#include <drm/sis_drm.h> | |
| 35 | − | |
| 36 | −#include "sis_drv.h" | |
| 37 | − | |
| 38 | −static struct pci_device_id pciidlist[] = { | |
| 39 | − sisdrv_PCI_IDS | |
| 40 | −}; | |
| 41 | − | |
| 42 | −static int sis_driver_load(struct drm_device *dev, unsigned long chipset) | |
| 43 | −{ | |
| 44 | − struct pci_dev *pdev = to_pci_dev(dev->dev); | |
| 45 | − drm_sis_private_t *dev_priv; | |
| 46 | − | |
| 47 | − pci_set_master(pdev); | |
| 48 | − | |
| 49 | − dev_priv = kzalloc(sizeof(drm_sis_private_t), GFP_KERNEL); | |
| 50 | − if (dev_priv == NULL) | |
| 51 | − return -ENOMEM; | |
| 52 | − | |
| 53 | − idr_init_base(&dev_priv->object_idr, 1); | |
| 54 | − dev->dev_private = (void *)dev_priv; | |
| 55 | − dev_priv->chipset = chipset; | |
| 56 | − | |
| 57 | − return 0; | |
| 58 | −} | |
| 59 | − | |
| 60 | −static void sis_driver_unload(struct drm_device *dev) | |
| 61 | −{ | |
| 62 | − drm_sis_private_t *dev_priv = dev->dev_private; | |
| 63 | − | |
| 64 | − idr_destroy(&dev_priv->object_idr); | |
| 65 | − | |
| 66 | − kfree(dev_priv); | |
| 67 | −} | |
| 68 | − | |
| 69 | −static const struct file_operations sis_driver_fops = { | |
| 70 | − .owner = THIS_MODULE, | |
| 71 | − .open = drm_open, | |
| 72 | − .release = drm_release, | |
| 73 | − .unlocked_ioctl = drm_ioctl, | |
| 74 | − .mmap = drm_legacy_mmap, | |
| 75 | − .poll = drm_poll, | |
| 76 | − .compat_ioctl = drm_compat_ioctl, | |
| 77 | − .llseek = noop_llseek, | |
| 78 | −}; | |
| 79 | − | |
| 80 | −static int sis_driver_open(struct drm_device *dev, struct drm_file *file) | |
| 81 | −{ | |
| 82 | − struct sis_file_private *file_priv; | |
| 83 | − | |
| 84 | − DRM_DEBUG_DRIVER("\n"); | |
| 85 | − file_priv = kmalloc(sizeof(*file_priv), GFP_KERNEL); | |
| 86 | − if (!file_priv) | |
| 87 | − return -ENOMEM; | |
| 88 | − | |
| 89 | − file->driver_priv = file_priv; | |
| 90 | − | |
| 91 | − INIT_LIST_HEAD(&file_priv->obj_list); | |
| 92 | − | |
| 93 | − return 0; | |
| 94 | −} | |
| 95 | − | |
| 96 | −static void sis_driver_postclose(struct drm_device *dev, struct drm_file *file) | |
| 97 | −{ | |
| 98 | − struct sis_file_private *file_priv = file->driver_priv; | |
| 99 | − | |
| 100 | − kfree(file_priv); | |
| 101 | −} | |
| 102 | − | |
| 103 | −static struct drm_driver driver = { | |
| 104 | − .driver_features = DRIVER_USE_AGP | DRIVER_LEGACY, | |
| 105 | − .load = sis_driver_load, | |
| 106 | − .unload = sis_driver_unload, | |
| 107 | − .open = sis_driver_open, | |
| 108 | − .preclose = sis_reclaim_buffers_locked, | |
| 109 | − .postclose = sis_driver_postclose, | |
| 110 | − .dma_quiescent = sis_idle, | |
| 111 | − .lastclose = sis_lastclose, | |
| 112 | − .ioctls = sis_ioctls, | |
| 113 | − .fops = &sis_driver_fops, | |
| 114 | − .name = DRIVER_NAME, | |
| 115 | − .desc = DRIVER_DESC, | |
| 116 | − .date = DRIVER_DATE, | |
| 117 | − .major = DRIVER_MAJOR, | |
| 118 | − .minor = DRIVER_MINOR, | |
| 119 | − .patchlevel = DRIVER_PATCHLEVEL, | |
| 120 | −}; | |
| 121 | − | |
| 122 | −static struct pci_driver sis_pci_driver = { | |
| 123 | − .name = DRIVER_NAME, | |
| 124 | − .id_table = pciidlist, | |
| 125 | −}; | |
| 126 | − | |
| 127 | −static int __init sis_init(void) | |
| 128 | −{ | |
| 129 | − driver.num_ioctls = sis_max_ioctl; | |
| 130 | − return drm_legacy_pci_init(&driver, &sis_pci_driver); | |
| 131 | −} | |
| 132 | − | |
| 133 | −static void __exit sis_exit(void) | |
| 134 | −{ | |
| 135 | − drm_legacy_pci_exit(&driver, &sis_pci_driver); | |
| 136 | −} | |
| 137 | − | |
| 138 | −module_init(sis_init); | |
| 139 | −module_exit(sis_exit); | |
| 140 | − | |
| 141 | −MODULE_AUTHOR(DRIVER_AUTHOR); | |
| 142 | −MODULE_DESCRIPTION(DRIVER_DESC); | |
| 143 | −MODULE_LICENSE("GPL and additional rights"); | |
| @@ -1,80 +0,0 @@ | ||
| 1 | −/* sis_drv.h -- Private header for sis driver -*- linux-c -*- */ | |
| 2 | −/* | |
| 3 | − * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. | |
| 4 | − * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. | |
| 5 | − * All rights reserved. | |
| 6 | − * | |
| 7 | − * Permission is hereby granted, free of charge, to any person obtaining a | |
| 8 | − * copy of this software and associated documentation files (the "Software"), | |
| 9 | − * to deal in the Software without restriction, including without limitation | |
| 10 | − * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 11 | − * and/or sell copies of the Software, and to permit persons to whom the | |
| 12 | − * Software is furnished to do so, subject to the following conditions: | |
| 13 | − * | |
| 14 | − * The above copyright notice and this permission notice (including the next | |
| 15 | − * paragraph) shall be included in all copies or substantial portions of the | |
| 16 | − * Software. | |
| 17 | − * | |
| 18 | − * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 19 | − * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 20 | − * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 21 | − * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
| 22 | − * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
| 23 | − * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |
| 24 | − * DEALINGS IN THE SOFTWARE. | |
| 25 | − * | |
| 26 | − */ | |
| 27 | − | |
| 28 | −#ifndef _SIS_DRV_H_ | |
| 29 | −#define _SIS_DRV_H_ | |
| 30 | − | |
| 31 | −#include <drm/drm_ioctl.h> | |
| 32 | −#include <drm/drm_legacy.h> | |
| 33 | −#include <drm/drm_mm.h> | |
| 34 | − | |
| 35 | −/* General customization: | |
| 36 | − */ | |
| 37 | − | |
| 38 | −#define DRIVER_AUTHOR "SIS, Tungsten Graphics" | |
| 39 | −#define DRIVER_NAME "sis" | |
| 40 | −#define DRIVER_DESC "SIS 300/630/540 and XGI V3XE/V5/V8" | |
| 41 | −#define DRIVER_DATE "20070626" | |
| 42 | −#define DRIVER_MAJOR 1 | |
| 43 | −#define DRIVER_MINOR 3 | |
| 44 | −#define DRIVER_PATCHLEVEL 0 | |
| 45 | − | |
| 46 | −enum sis_family { | |
| 47 | − SIS_OTHER = 0, | |
| 48 | − SIS_CHIP_315 = 1, | |
| 49 | −}; | |
| 50 | − | |
| 51 | −#define SIS_READ(reg) readl(((void __iomem *)dev_priv->mmio->handle) + (reg)) | |
| 52 | −#define SIS_WRITE(reg, val) writel(val, ((void __iomem *)dev_priv->mmio->handle) + (reg)) | |
| 53 | − | |
| 54 | −typedef struct drm_sis_private { | |
| 55 | − drm_local_map_t *mmio; | |
| 56 | − unsigned int idle_fault; | |
| 57 | − unsigned int chipset; | |
| 58 | − int vram_initialized; | |
| 59 | − int agp_initialized; | |
| 60 | − unsigned long vram_offset; | |
| 61 | − unsigned long agp_offset; | |
| 62 | − struct drm_mm vram_mm; | |
| 63 | − struct drm_mm agp_mm; | |
| 64 | − /** Mapping of userspace keys to mm objects */ | |
| 65 | − struct idr object_idr; | |
| 66 | −} drm_sis_private_t; | |
| 67 | − | |
| 68 | −struct sis_file_private { | |
| 69 | − struct list_head obj_list; | |
| 70 | −}; | |
| 71 | − | |
| 72 | −extern int sis_idle(struct drm_device *dev); | |
| 73 | −extern void sis_reclaim_buffers_locked(struct drm_device *dev, | |
| 74 | − struct drm_file *file_priv); | |
| 75 | −extern void sis_lastclose(struct drm_device *dev); | |
| 76 | − | |
| 77 | −extern const struct drm_ioctl_desc sis_ioctls[]; | |
| 78 | −extern int sis_max_ioctl; | |
| 79 | − | |
| 80 | −#endif | |
| @@ -1,363 +0,0 @@ | ||
| 1 | −/************************************************************************** | |
| 2 | − * | |
| 3 | − * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA. | |
| 4 | − * All Rights Reserved. | |
| 5 | − * | |
| 6 | − * Permission is hereby granted, free of charge, to any person obtaining a | |
| 7 | − * copy of this software and associated documentation files (the | |
| 8 | − * "Software"), to deal in the Software without restriction, including | |
| 9 | − * without limitation the rights to use, copy, modify, merge, publish, | |
| 10 | − * distribute, sub license, and/or sell copies of the Software, and to | |
| 11 | − * permit persons to whom the Software is furnished to do so, subject to | |
| 12 | − * the following conditions: | |
| 13 | − * | |
| 14 | − * The above copyright notice and this permission notice (including the | |
| 15 | − * next paragraph) shall be included in all copies or substantial portions | |
| 16 | − * of the Software. | |
| 17 | − * | |
| 18 | − * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 19 | − * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 20 | − * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | |
| 21 | − * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | |
| 22 | − * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | |
| 23 | − * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | |
| 24 | − * USE OR OTHER DEALINGS IN THE SOFTWARE. | |
| 25 | − * | |
| 26 | − * | |
| 27 | − **************************************************************************/ | |
| 28 | − | |
| 29 | −/* | |
| 30 | − * Authors: | |
| 31 | − * Thomas Hellström <thomas-at-tungstengraphics-dot-com> | |
| 32 | − */ | |
| 33 | − | |
| 34 | −#include <video/sisfb.h> | |
| 35 | − | |
| 36 | −#include <drm/drm_device.h> | |
| 37 | −#include <drm/drm_file.h> | |
| 38 | −#include <drm/sis_drm.h> | |
| 39 | − | |
| 40 | −#include "sis_drv.h" | |
| 41 | − | |
| 42 | − | |
| 43 | −#define VIDEO_TYPE 0 | |
| 44 | −#define AGP_TYPE 1 | |
| 45 | − | |
| 46 | − | |
| 47 | −struct sis_memblock { | |
| 48 | − struct drm_mm_node mm_node; | |
| 49 | − struct sis_memreq req; | |
| 50 | − struct list_head owner_list; | |
| 51 | −}; | |
| 52 | − | |
| 53 | −#if defined(CONFIG_FB_SIS) || defined(CONFIG_FB_SIS_MODULE) | |
| 54 | −/* fb management via fb device */ | |
| 55 | − | |
| 56 | −#define SIS_MM_ALIGN_SHIFT 0 | |
| 57 | −#define SIS_MM_ALIGN_MASK 0 | |
| 58 | − | |
| 59 | −#else /* CONFIG_FB_SIS[_MODULE] */ | |
| 60 | − | |
| 61 | −#define SIS_MM_ALIGN_SHIFT 4 | |
| 62 | −#define SIS_MM_ALIGN_MASK ((1 << SIS_MM_ALIGN_SHIFT) - 1) | |
| 63 | − | |
| 64 | −#endif /* CONFIG_FB_SIS[_MODULE] */ | |
| 65 | − | |
| 66 | −static int sis_fb_init(struct drm_device *dev, void *data, struct drm_file *file_priv) | |
| 67 | −{ | |
| 68 | − drm_sis_private_t *dev_priv = dev->dev_private; | |
| 69 | − drm_sis_fb_t *fb = data; | |
| 70 | − | |
| 71 | − mutex_lock(&dev->struct_mutex); | |
| 72 | − /* Unconditionally init the drm_mm, even though we don't use it when the | |
| 73 | − * fb sis driver is available - make cleanup easier. */ | |
| 74 | − drm_mm_init(&dev_priv->vram_mm, 0, fb->size >> SIS_MM_ALIGN_SHIFT); | |
| 75 | − | |
| 76 | − dev_priv->vram_initialized = 1; | |
| 77 | − dev_priv->vram_offset = fb->offset; | |
| 78 | − | |
| 79 | − mutex_unlock(&dev->struct_mutex); | |
| 80 | − DRM_DEBUG("offset = %lu, size = %lu\n", fb->offset, fb->size); | |
| 81 | − | |
| 82 | − return 0; | |
| 83 | −} | |
| 84 | − | |
| 85 | −static int sis_drm_alloc(struct drm_device *dev, struct drm_file *file, | |
| 86 | − void *data, int pool) | |
| 87 | −{ | |
| 88 | − drm_sis_private_t *dev_priv = dev->dev_private; | |
| 89 | − drm_sis_mem_t *mem = data; | |
| 90 | − int retval = 0, user_key; | |
| 91 | − struct sis_memblock *item; | |
| 92 | − struct sis_file_private *file_priv = file->driver_priv; | |
| 93 | − unsigned long offset; | |
| 94 | − | |
| 95 | − mutex_lock(&dev->struct_mutex); | |
| 96 | − | |
| 97 | − if (0 == ((pool == 0) ? dev_priv->vram_initialized : | |
| 98 | − dev_priv->agp_initialized)) { | |
| 99 | − DRM_ERROR | |
| 100 | − ("Attempt to allocate from uninitialized memory manager.\n"); | |
| 101 | − mutex_unlock(&dev->struct_mutex); | |
| 102 | − return -EINVAL; | |
| 103 | − } | |
| 104 | − | |
| 105 | − item = kzalloc(sizeof(*item), GFP_KERNEL); | |
| 106 | − if (!item) { | |
| 107 | − retval = -ENOMEM; | |
| 108 | − goto fail_alloc; | |
| 109 | − } | |
| 110 | − | |
| 111 | − mem->size = (mem->size + SIS_MM_ALIGN_MASK) >> SIS_MM_ALIGN_SHIFT; | |
| 112 | − if (pool == AGP_TYPE) { | |
| 113 | − retval = drm_mm_insert_node(&dev_priv->agp_mm, | |
| 114 | − &item->mm_node, | |
| 115 | − mem->size); | |
| 116 | − offset = item->mm_node.start; | |
| 117 | − } else { | |
| 118 | −#if defined(CONFIG_FB_SIS) || defined(CONFIG_FB_SIS_MODULE) | |
| 119 | − item->req.size = mem->size; | |
| 120 | − sis_malloc(&item->req); | |
| 121 | − if (item->req.size == 0) | |
| 122 | − retval = -ENOMEM; | |
| 123 | − offset = item->req.offset; | |
| 124 | −#else | |
| 125 | − retval = drm_mm_insert_node(&dev_priv->vram_mm, | |
| 126 | − &item->mm_node, | |
| 127 | − mem->size); | |
| 128 | − offset = item->mm_node.start; | |
| 129 | −#endif | |
| 130 | − } | |
| 131 | − if (retval) | |
| 132 | − goto fail_alloc; | |
| 133 | − | |
| 134 | − retval = idr_alloc(&dev_priv->object_idr, item, 1, 0, GFP_KERNEL); | |
| 135 | − if (retval < 0) | |
| 136 | − goto fail_idr; | |
| 137 | − user_key = retval; | |
| 138 | − | |
| 139 | − list_add(&item->owner_list, &file_priv->obj_list); | |
| 140 | − mutex_unlock(&dev->struct_mutex); | |
| 141 | − | |
| 142 | − mem->offset = ((pool == 0) ? | |
| 143 | − dev_priv->vram_offset : dev_priv->agp_offset) + | |
| 144 | − (offset << SIS_MM_ALIGN_SHIFT); | |
| 145 | − mem->free = user_key; | |
| 146 | − mem->size = mem->size << SIS_MM_ALIGN_SHIFT; | |
| 147 | − | |
| 148 | − return 0; | |
| 149 | − | |
| 150 | −fail_idr: | |
| 151 | − drm_mm_remove_node(&item->mm_node); | |
| 152 | −fail_alloc: | |
| 153 | − kfree(item); | |
| 154 | − mutex_unlock(&dev->struct_mutex); | |
| 155 | − | |
| 156 | − mem->offset = 0; | |
| 157 | − mem->size = 0; | |
| 158 | − mem->free = 0; | |
| 159 | − | |
| 160 | − DRM_DEBUG("alloc %d, size = %ld, offset = %ld\n", pool, mem->size, | |
| 161 | − mem->offset); | |
| 162 | − | |
| 163 | − return retval; | |
| 164 | −} | |
| 165 | − | |
| 166 | −static int sis_drm_free(struct drm_device *dev, void *data, struct drm_file *file_priv) | |
| 167 | −{ | |
| 168 | − drm_sis_private_t *dev_priv = dev->dev_private; | |
| 169 | − drm_sis_mem_t *mem = data; | |
| 170 | − struct sis_memblock *obj; | |
| 171 | − | |
| 172 | − mutex_lock(&dev->struct_mutex); | |
| 173 | − obj = idr_find(&dev_priv->object_idr, mem->free); | |
| 174 | − if (obj == NULL) { | |
| 175 | − mutex_unlock(&dev->struct_mutex); | |
| 176 | − return -EINVAL; | |
| 177 | − } | |
| 178 | − | |
| 179 | − idr_remove(&dev_priv->object_idr, mem->free); | |
| 180 | − list_del(&obj->owner_list); | |
| 181 | − if (drm_mm_node_allocated(&obj->mm_node)) | |
| 182 | − drm_mm_remove_node(&obj->mm_node); | |
| 183 | −#if defined(CONFIG_FB_SIS) || defined(CONFIG_FB_SIS_MODULE) | |
| 184 | − else | |
| 185 | − sis_free(obj->req.offset); | |
| 186 | −#endif | |
| 187 | − kfree(obj); | |
| 188 | − mutex_unlock(&dev->struct_mutex); | |
| 189 | − DRM_DEBUG("free = 0x%lx\n", mem->free); | |
| 190 | − | |
| 191 | − return 0; | |
| 192 | −} | |
| 193 | − | |
| 194 | −static int sis_fb_alloc(struct drm_device *dev, void *data, | |
| 195 | − struct drm_file *file_priv) | |
| 196 | −{ | |
| 197 | − return sis_drm_alloc(dev, file_priv, data, VIDEO_TYPE); | |
| 198 | −} | |
| 199 | − | |
| 200 | −static int sis_ioctl_agp_init(struct drm_device *dev, void *data, | |
| 201 | − struct drm_file *file_priv) | |
| 202 | −{ | |
| 203 | − drm_sis_private_t *dev_priv = dev->dev_private; | |
| 204 | − drm_sis_agp_t *agp = data; | |
| 205 | − dev_priv = dev->dev_private; | |
| 206 | − | |
| 207 | − mutex_lock(&dev->struct_mutex); | |
| 208 | − drm_mm_init(&dev_priv->agp_mm, 0, agp->size >> SIS_MM_ALIGN_SHIFT); | |
| 209 | − | |
| 210 | − dev_priv->agp_initialized = 1; | |
| 211 | − dev_priv->agp_offset = agp->offset; | |
| 212 | − mutex_unlock(&dev->struct_mutex); | |
| 213 | − | |
| 214 | − DRM_DEBUG("offset = %lu, size = %lu\n", agp->offset, agp->size); | |
| 215 | − return 0; | |
| 216 | −} | |
| 217 | − | |
| 218 | −static int sis_ioctl_agp_alloc(struct drm_device *dev, void *data, | |
| 219 | − struct drm_file *file_priv) | |
| 220 | −{ | |
| 221 | − | |
| 222 | − return sis_drm_alloc(dev, file_priv, data, AGP_TYPE); | |
| 223 | −} | |
| 224 | − | |
| 225 | −static drm_local_map_t *sis_reg_init(struct drm_device *dev) | |
| 226 | −{ | |
| 227 | − struct drm_map_list *entry; | |
| 228 | − drm_local_map_t *map; | |
| 229 | − | |
| 230 | − list_for_each_entry(entry, &dev->maplist, head) { | |
| 231 | − map = entry->map; | |
| 232 | − if (!map) | |
| 233 | − continue; | |
| 234 | − if (map->type == _DRM_REGISTERS) | |
| 235 | − return map; | |
| 236 | − } | |
| 237 | − return NULL; | |
| 238 | −} | |
| 239 | − | |
| 240 | −int sis_idle(struct drm_device *dev) | |
| 241 | −{ | |
| 242 | − drm_sis_private_t *dev_priv = dev->dev_private; | |
| 243 | − uint32_t idle_reg; | |
| 244 | − unsigned long end; | |
| 245 | − int i; | |
| 246 | − | |
| 247 | − if (dev_priv->idle_fault) | |
| 248 | − return 0; | |
| 249 | − | |
| 250 | − if (dev_priv->mmio == NULL) { | |
| 251 | − dev_priv->mmio = sis_reg_init(dev); | |
| 252 | − if (dev_priv->mmio == NULL) { | |
| 253 | − DRM_ERROR("Could not find register map.\n"); | |
| 254 | − return 0; | |
| 255 | − } | |
| 256 | − } | |
| 257 | − | |
| 258 | − /* | |
| 259 | − * Implement a device switch here if needed | |
| 260 | − */ | |
| 261 | − | |
| 262 | − if (dev_priv->chipset != SIS_CHIP_315) | |
| 263 | − return 0; | |
| 264 | − | |
| 265 | − /* | |
| 266 | − * Timeout after 3 seconds. We cannot use DRM_WAIT_ON here | |
| 267 | − * because its polling frequency is too low. | |
| 268 | − */ | |
| 269 | − | |
| 270 | − end = jiffies + (HZ * 3); | |
| 271 | − | |
| 272 | − for (i = 0; i < 4; ++i) { | |
| 273 | − do { | |
| 274 | − idle_reg = SIS_READ(0x85cc); | |
| 275 | − } while (!time_after_eq(jiffies, end) && | |
| 276 | − ((idle_reg & 0x80000000) != 0x80000000)); | |
| 277 | − } | |
| 278 | − | |
| 279 | − if (time_after_eq(jiffies, end)) { | |
| 280 | − DRM_ERROR("Graphics engine idle timeout. " | |
| 281 | − "Disabling idle check\n"); | |
| 282 | − dev_priv->idle_fault = 1; | |
| 283 | − } | |
| 284 | − | |
| 285 | − /* | |
| 286 | − * The caller never sees an error code. It gets trapped | |
| 287 | − * in libdrm. | |
| 288 | − */ | |
| 289 | − | |
| 290 | − return 0; | |
| 291 | −} | |
| 292 | − | |
| 293 | − | |
| 294 | −void sis_lastclose(struct drm_device *dev) | |
| 295 | −{ | |
| 296 | − drm_sis_private_t *dev_priv = dev->dev_private; | |
| 297 | − | |
| 298 | − if (!dev_priv) | |
| 299 | − return; | |
| 300 | − | |
| 301 | − mutex_lock(&dev->struct_mutex); | |
| 302 | − if (dev_priv->vram_initialized) { | |
| 303 | − drm_mm_takedown(&dev_priv->vram_mm); | |
| 304 | − dev_priv->vram_initialized = 0; | |
| 305 | − } | |
| 306 | − if (dev_priv->agp_initialized) { | |
| 307 | − drm_mm_takedown(&dev_priv->agp_mm); | |
| 308 | − dev_priv->agp_initialized = 0; | |
| 309 | − } | |
| 310 | − dev_priv->mmio = NULL; | |
| 311 | − mutex_unlock(&dev->struct_mutex); | |
| 312 | −} | |
| 313 | − | |
| 314 | −void sis_reclaim_buffers_locked(struct drm_device *dev, | |
| 315 | − struct drm_file *file) | |
| 316 | −{ | |
| 317 | − struct sis_file_private *file_priv = file->driver_priv; | |
| 318 | − struct sis_memblock *entry, *next; | |
| 319 | − | |
| 320 | − if (!(dev->master && file->master->lock.hw_lock)) | |
| 321 | − return; | |
| 322 | − | |
| 323 | − drm_legacy_idlelock_take(&file->master->lock); | |
| 324 | − | |
| 325 | − mutex_lock(&dev->struct_mutex); | |
| 326 | − if (list_empty(&file_priv->obj_list)) { | |
| 327 | − mutex_unlock(&dev->struct_mutex); | |
| 328 | − drm_legacy_idlelock_release(&file->master->lock); | |
| 329 | − | |
| 330 | − return; | |
| 331 | − } | |
| 332 | − | |
| 333 | − sis_idle(dev); | |
| 334 | − | |
| 335 | − | |
| 336 | − list_for_each_entry_safe(entry, next, &file_priv->obj_list, | |
| 337 | − owner_list) { | |
| 338 | − list_del(&entry->owner_list); | |
| 339 | − if (drm_mm_node_allocated(&entry->mm_node)) | |
| 340 | − drm_mm_remove_node(&entry->mm_node); | |
| 341 | −#if defined(CONFIG_FB_SIS) || defined(CONFIG_FB_SIS_MODULE) | |
| 342 | − else | |
| 343 | − sis_free(entry->req.offset); | |
| 344 | −#endif | |
| 345 | − kfree(entry); | |
| 346 | − } | |
| 347 | − mutex_unlock(&dev->struct_mutex); | |
| 348 | − | |
| 349 | − drm_legacy_idlelock_release(&file->master->lock); | |
| 350 | − | |
| 351 | − return; | |
| 352 | −} | |
| 353 | − | |
| 354 | −const struct drm_ioctl_desc sis_ioctls[] = { | |
| 355 | − DRM_IOCTL_DEF_DRV(SIS_FB_ALLOC, sis_fb_alloc, DRM_AUTH), | |
| 356 | − DRM_IOCTL_DEF_DRV(SIS_FB_FREE, sis_drm_free, DRM_AUTH), | |
| 357 | − DRM_IOCTL_DEF_DRV(SIS_AGP_INIT, sis_ioctl_agp_init, DRM_AUTH | DRM_MASTER | DRM_ROOT_ONLY), | |
| 358 | − DRM_IOCTL_DEF_DRV(SIS_AGP_ALLOC, sis_ioctl_agp_alloc, DRM_AUTH), | |
| 359 | − DRM_IOCTL_DEF_DRV(SIS_AGP_FREE, sis_drm_free, DRM_AUTH), | |
| 360 | − DRM_IOCTL_DEF_DRV(SIS_FB_INIT, sis_fb_init, DRM_AUTH | DRM_MASTER | DRM_ROOT_ONLY), | |
| 361 | −}; | |
| 362 | − | |
| 363 | −int sis_max_ioctl = ARRAY_SIZE(sis_ioctls); | |
| @@ -1,77 +0,0 @@ | ||
| 1 | −/* sis_drv.h -- Private header for sis driver -*- linux-c -*- */ | |
| 2 | −/* | |
| 3 | − * Copyright 2005 Eric Anholt | |
| 4 | − * All Rights Reserved. | |
| 5 | − * | |
| 6 | − * Permission is hereby granted, free of charge, to any person obtaining a | |
| 7 | − * copy of this software and associated documentation files (the "Software"), | |
| 8 | − * to deal in the Software without restriction, including without limitation | |
| 9 | − * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 10 | − * and/or sell copies of the Software, and to permit persons to whom the | |
| 11 | − * Software is furnished to do so, subject to the following conditions: | |
| 12 | − * | |
| 13 | − * The above copyright notice and this permission notice (including the next | |
| 14 | − * paragraph) shall be included in all copies or substantial portions of the | |
| 15 | − * Software. | |
| 16 | − * | |
| 17 | − * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 18 | − * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 19 | − * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 20 | − * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| 21 | − * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| 22 | − * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
| 23 | − * SOFTWARE. | |
| 24 | − * | |
| 25 | − */ | |
| 26 | − | |
| 27 | −#ifndef __SIS_DRM_H__ | |
| 28 | −#define __SIS_DRM_H__ | |
| 29 | − | |
| 30 | −#include "drm.h" | |
| 31 | − | |
| 32 | −#if defined(__cplusplus) | |
| 33 | −extern "C" { | |
| 34 | −#endif | |
| 35 | − | |
| 36 | −/* SiS specific ioctls */ | |
| 37 | −#define NOT_USED_0_3 | |
| 38 | −#define DRM_SIS_FB_ALLOC 0x04 | |
| 39 | −#define DRM_SIS_FB_FREE 0x05 | |
| 40 | −#define NOT_USED_6_12 | |
| 41 | −#define DRM_SIS_AGP_INIT 0x13 | |
| 42 | −#define DRM_SIS_AGP_ALLOC 0x14 | |
| 43 | −#define DRM_SIS_AGP_FREE 0x15 | |
| 44 | −#define DRM_SIS_FB_INIT 0x16 | |
| 45 | − | |
| 46 | −#define DRM_IOCTL_SIS_FB_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_SIS_FB_ALLOC, drm_sis_mem_t) | |
| 47 | −#define DRM_IOCTL_SIS_FB_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_SIS_FB_FREE, drm_sis_mem_t) | |
| 48 | −#define DRM_IOCTL_SIS_AGP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_SIS_AGP_INIT, drm_sis_agp_t) | |
| 49 | −#define DRM_IOCTL_SIS_AGP_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_SIS_AGP_ALLOC, drm_sis_mem_t) | |
| 50 | −#define DRM_IOCTL_SIS_AGP_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_SIS_AGP_FREE, drm_sis_mem_t) | |
| 51 | −#define DRM_IOCTL_SIS_FB_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_SIS_FB_INIT, drm_sis_fb_t) | |
| 52 | −/* | |
| 53 | −#define DRM_IOCTL_SIS_FLIP DRM_IOW( 0x48, drm_sis_flip_t) | |
| 54 | −#define DRM_IOCTL_SIS_FLIP_INIT DRM_IO( 0x49) | |
| 55 | −#define DRM_IOCTL_SIS_FLIP_FINAL DRM_IO( 0x50) | |
| 56 | −*/ | |
| 57 | − | |
| 58 | −typedef struct { | |
| 59 | − int context; | |
| 60 | − unsigned long offset; | |
| 61 | − unsigned long size; | |
| 62 | − unsigned long free; | |
| 63 | −} drm_sis_mem_t; | |
| 64 | − | |
| 65 | −typedef struct { | |
| 66 | − unsigned long offset, size; | |
| 67 | −} drm_sis_agp_t; | |
| 68 | − | |
| 69 | −typedef struct { | |
| 70 | − unsigned long offset, size; | |
| 71 | −} drm_sis_fb_t; | |
| 72 | − | |
| 73 | −#if defined(__cplusplus) | |
| 74 | −} | |
| 75 | −#endif | |
| 76 | − | |
| 77 | −#endif /* __SIS_DRM_H__ */ | |