summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
Diffstat (limited to 'linux')
-rw-r--r--linux/Makefile.kernel1
-rw-r--r--linux/Makefile.linux16
-rw-r--r--linux/README.drm2
-rw-r--r--linux/agpsupport.c2
-rw-r--r--linux/auth.c1
-rw-r--r--linux/bufs.c1
-rw-r--r--linux/drm.h9
-rw-r--r--linux/drmP.h6
-rw-r--r--linux/fops.c1
-rw-r--r--linux/gamma_drv.c1
-rw-r--r--linux/gamma_drv.h1
-rw-r--r--linux/i810_context.c1
-rw-r--r--linux/i810_dma.c1
-rw-r--r--linux/i810_drv.c1
-rw-r--r--linux/i810_drv.h1
-rw-r--r--linux/init.c1
-rw-r--r--linux/lists.c1
-rw-r--r--linux/memory.c1
-rw-r--r--linux/mga_context.c1
-rw-r--r--linux/mga_dma.c1
-rw-r--r--linux/mga_drv.c1
-rw-r--r--linux/mga_drv.h1
-rw-r--r--linux/mga_state.c1
-rw-r--r--linux/picker.c9
-rw-r--r--linux/proc.c1
-rw-r--r--linux/r128_bufs.c1
-rw-r--r--linux/r128_context.c1
-rw-r--r--linux/r128_drv.c1
-rw-r--r--linux/r128_drv.h1
-rw-r--r--linux/sis_drv.c183
-rw-r--r--linux/sis_drv.h7
-rw-r--r--linux/sis_mm.c31
-rw-r--r--linux/tdfx_context.c1
-rw-r--r--linux/tdfx_drv.c1
-rw-r--r--linux/tdfx_drv.h1
-rw-r--r--linux/vm.c1
36 files changed, 184 insertions, 108 deletions
diff --git a/linux/Makefile.kernel b/linux/Makefile.kernel
index b1b8d976..0791af45 100644
--- a/linux/Makefile.kernel
+++ b/linux/Makefile.kernel
@@ -1,3 +1,4 @@
+# $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel,v 1.8 2000/08/28 02:43:14 tsi Exp $
#
# Makefile for the drm device driver. This driver provides support for
# the Direct Rendering Infrastructure (DRI) in XFree86 4.x.
diff --git a/linux/Makefile.linux b/linux/Makefile.linux
index 7fe57f8e..5f0465a4 100644
--- a/linux/Makefile.linux
+++ b/linux/Makefile.linux
@@ -24,7 +24,7 @@
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
-# $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux,v 1.9 2000/08/04 03:51:47 tsi Exp $
+# $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux,v 1.11 2000/09/01 02:31:38 tsi Exp $
#
# ***** NOTE NOTE NOTE NOTE NOTE *****
# To override the automatic Linux source tree determination, pass the
@@ -118,7 +118,9 @@ all:; @echo Error: Could not locate kernel tree in $A $B $C
else
SMP := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \
| grep -s 'SMP = ' | cut -d' ' -f3)
-MODVERSIONS := $(shell gcc -E -I $(TREE) picker.c 2>/dev/null \
+MODULES := $(shell gcc -E -nostdinc -I $(TREE) picker.c 2>/dev/null \
+ | grep -s 'MODULES = ' | cut -d' ' -f3)
+MODVERSIONS := $(shell gcc -E -nostdinc -I $(TREE) picker.c 2>/dev/null \
| grep -s 'MODVERSIONS = ' | cut -d' ' -f3)
AGP := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \
| grep -s 'AGP = ' | cut -d' ' -f3)
@@ -162,12 +164,20 @@ SISHEADERS= sis_drv.h sis_ds.h sis_drm.h $(DRMHEADERS)
endif
all::;@echo === KERNEL HEADERS IN $(TREE)
-all::;@echo === SMP=${SMP} MODVERSIONS=${MODVERSIONS} AGP=${AGP} SIS=${SIS}
+all::;@echo === SMP=${SMP} MODULES=${MODULES} MODVERSIONS=${MODVERSIONS} AGP=${AGP}
all::;@echo === kill_fasync has $(PARAMS) parameters
all::;@echo === Compiling for machine $(MACHINE)
+
+ifeq ($(MODULES),0)
+all::;@echo
+all::;@echo "*** Kernel modules must be configured. Build aborted."
+all::;@echo
+else
all:: $(LIBS) $(MODS) $(PROGS)
endif
+endif
+
# **** End of SMP/MODVERSIONS detection
# **** Handle SMP/MODVERSIONS
diff --git a/linux/README.drm b/linux/README.drm
index 6441e01e..97dd0d84 100644
--- a/linux/README.drm
+++ b/linux/README.drm
@@ -1,3 +1,5 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/README.drm,v 1.4 2000/08/28 02:43:14 tsi Exp $ */
+
************************************************************
* For the very latest on DRI development, please see: *
* http://dri.sourceforge.net/ *
diff --git a/linux/agpsupport.c b/linux/agpsupport.c
index 24fd59cd..c63f690c 100644
--- a/linux/agpsupport.c
+++ b/linux/agpsupport.c
@@ -28,6 +28,8 @@
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport.c,v 1.4 2000/08/28 02:43:14 tsi Exp $ */
+
#define __NO_VERSION__
#include "drmP.h"
#include <linux/module.h>
diff --git a/linux/auth.c b/linux/auth.c
index 80bb4b65..ad719cf1 100644
--- a/linux/auth.c
+++ b/linux/auth.c
@@ -28,6 +28,7 @@
* Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/auth.c,v 1.5 2000/08/28 02:43:14 tsi Exp $ */
#define __NO_VERSION__
#include "drmP.h"
diff --git a/linux/bufs.c b/linux/bufs.c
index 28e0eb5f..679a096f 100644
--- a/linux/bufs.c
+++ b/linux/bufs.c
@@ -28,6 +28,7 @@
* Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c,v 1.8 2000/08/28 02:43:14 tsi Exp $ */
#define __NO_VERSION__
#include <linux/config.h>
diff --git a/linux/drm.h b/linux/drm.h
index 5a979e1c..6cfe88fa 100644
--- a/linux/drm.h
+++ b/linux/drm.h
@@ -31,11 +31,16 @@
* Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic cmpxchg.
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h,v 1.9 2000/08/24 22:20:18 tsi Exp $ */
#ifndef _DRM_H_
#define _DRM_H_
+#if defined(__linux__)
#include <asm/ioctl.h> /* For _IO* macros */
+#elif defined(__FreeBSD__)
+#include <sys/ioccom.h>
+#endif
#define DRM_PROC_DEVICES "/proc/devices"
#define DRM_PROC_MISC "/proc/misc"
@@ -289,7 +294,11 @@ typedef struct drm_agp_info {
} drm_agp_info_t;
#define DRM_IOCTL_BASE 'd'
+#if defined(__linux__)
#define DRM_IOCTL_NR(n) _IOC_NR(n)
+#elif defined(__FreeBSD__)
+#define DRM_IOCTL_NR(n) ((n) & 0xff)
+#endif
#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr)
#define DRM_IOR(nr,size) _IOR(DRM_IOCTL_BASE,nr,size)
#define DRM_IOW(nr,size) _IOW(DRM_IOCTL_BASE,nr,size)
diff --git a/linux/drmP.h b/linux/drmP.h
index 2bfd4bef..bfd124dd 100644
--- a/linux/drmP.h
+++ b/linux/drmP.h
@@ -28,6 +28,7 @@
* Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h,v 1.9 2000/08/28 02:43:14 tsi Exp $ */
#ifndef _DRM_P_H_
#define _DRM_P_H_
@@ -152,6 +153,11 @@ typedef struct wait_queue *wait_queue_head_t;
#define module_exit(x) void cleanup_module(void) { x(); }
#endif
+ /* virt_to_page added in 2.4.0-test6 */
+#if LINUX_VERSION_CODE < 0x020400
+#define virt_to_page(kaddr) (mem_map + MAP_NR(kaddr))
+#endif
+
/* Generic cmpxchg added in 2.3.x */
#ifndef __HAVE_ARCH_CMPXCHG
/* Include this here so that driver can be
diff --git a/linux/fops.c b/linux/fops.c
index 8e373e5a..e6110a34 100644
--- a/linux/fops.c
+++ b/linux/fops.c
@@ -29,6 +29,7 @@
* Daryll Strauss <daryll@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c,v 1.9 2000/08/28 02:43:14 tsi Exp $ */
#define __NO_VERSION__
#include "drmP.h"
diff --git a/linux/gamma_drv.c b/linux/gamma_drv.c
index dba974c2..44dded04 100644
--- a/linux/gamma_drv.c
+++ b/linux/gamma_drv.c
@@ -28,6 +28,7 @@
* Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c,v 1.8 2000/08/28 02:43:14 tsi Exp $ */
#include <linux/config.h>
#include "drmP.h"
diff --git a/linux/gamma_drv.h b/linux/gamma_drv.h
index e9ce3958..f8bbe077 100644
--- a/linux/gamma_drv.h
+++ b/linux/gamma_drv.h
@@ -28,6 +28,7 @@
* Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h,v 1.6 2000/08/28 02:43:15 tsi Exp $ */
#ifndef _GAMMA_DRV_H_
#define _GAMMA_DRV_H_
diff --git a/linux/i810_context.c b/linux/i810_context.c
index c331beed..259c2991 100644
--- a/linux/i810_context.c
+++ b/linux/i810_context.c
@@ -28,6 +28,7 @@
* Jeff Hartmann <jhartmann@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_context.c,v 1.3 2000/08/28 02:43:15 tsi Exp $ */
#define __NO_VERSION__
#include "drmP.h"
diff --git a/linux/i810_dma.c b/linux/i810_dma.c
index e2a86606..8a279be8 100644
--- a/linux/i810_dma.c
+++ b/linux/i810_dma.c
@@ -29,6 +29,7 @@
* Keith Whitwell <keithw@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c,v 1.6 2000/08/28 02:43:15 tsi Exp $ */
#define __NO_VERSION__
#include "drmP.h"
diff --git a/linux/i810_drv.c b/linux/i810_drv.c
index 86d5e230..a001b544 100644
--- a/linux/i810_drv.c
+++ b/linux/i810_drv.c
@@ -28,6 +28,7 @@
* Jeff Hartmann <jhartmann@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c,v 1.5 2000/08/28 02:43:15 tsi Exp $ */
#include <linux/config.h>
#include "drmP.h"
diff --git a/linux/i810_drv.h b/linux/i810_drv.h
index 1c957401..9f46be50 100644
--- a/linux/i810_drv.h
+++ b/linux/i810_drv.h
@@ -28,6 +28,7 @@
* Jeff Hartmann <jhartmann@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h,v 1.5 2000/08/28 02:43:15 tsi Exp $ */
#ifndef _I810_DRV_H_
#define _I810_DRV_H_
diff --git a/linux/init.c b/linux/init.c
index 8de3dac9..81cbd8ff 100644
--- a/linux/init.c
+++ b/linux/init.c
@@ -28,6 +28,7 @@
* Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/init.c,v 1.5 2000/08/28 02:43:15 tsi Exp $ */
#define __NO_VERSION__
#include "drmP.h"
diff --git a/linux/lists.c b/linux/lists.c
index 5da7cc6c..0a21a910 100644
--- a/linux/lists.c
+++ b/linux/lists.c
@@ -28,6 +28,7 @@
* Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c,v 1.9 2000/08/28 02:43:15 tsi Exp $ */
#define __NO_VERSION__
#include "drmP.h"
diff --git a/linux/memory.c b/linux/memory.c
index 34d19b20..36d424fd 100644
--- a/linux/memory.c
+++ b/linux/memory.c
@@ -28,6 +28,7 @@
* Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c,v 1.8 2000/08/28 02:43:15 tsi Exp $ */
#define __NO_VERSION__
#include <linux/config.h>
diff --git a/linux/mga_context.c b/linux/mga_context.c
index 43733c14..36f23420 100644
--- a/linux/mga_context.c
+++ b/linux/mga_context.c
@@ -28,6 +28,7 @@
* Jeff Hartmann <jhartmann@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_context.c,v 1.4 2000/08/28 02:43:15 tsi Exp $ */
#define __NO_VERSION__
#include "drmP.h"
diff --git a/linux/mga_dma.c b/linux/mga_dma.c
index 4daa03ac..a718939b 100644
--- a/linux/mga_dma.c
+++ b/linux/mga_dma.c
@@ -29,6 +29,7 @@
* Keith Whitwell <keithw@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c,v 1.5 2000/08/28 02:43:15 tsi Exp $ */
#define __NO_VERSION__
#include "drmP.h"
diff --git a/linux/mga_drv.c b/linux/mga_drv.c
index c551ba6e..70d5d89f 100644
--- a/linux/mga_drv.c
+++ b/linux/mga_drv.c
@@ -29,6 +29,7 @@
*
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c,v 1.4 2000/08/28 02:43:15 tsi Exp $ */
#include <linux/config.h>
#include "drmP.h"
diff --git a/linux/mga_drv.h b/linux/mga_drv.h
index 6feba09a..f7f70538 100644
--- a/linux/mga_drv.h
+++ b/linux/mga_drv.h
@@ -28,6 +28,7 @@
* Jeff Hartmann <jhartmann@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h,v 1.4 2000/08/28 02:43:15 tsi Exp $ */
#ifndef _MGA_DRV_H_
#define _MGA_DRV_H_
diff --git a/linux/mga_state.c b/linux/mga_state.c
index 0c2f5729..5bdc0684 100644
--- a/linux/mga_state.c
+++ b/linux/mga_state.c
@@ -28,6 +28,7 @@
* Keith Whitwell <keithw@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c,v 1.5 2000/08/28 02:43:15 tsi Exp $ */
#define __NO_VERSION__
#include "drmP.h"
diff --git a/linux/picker.c b/linux/picker.c
index 6053a947..492e5350 100644
--- a/linux/picker.c
+++ b/linux/picker.c
@@ -1,10 +1,16 @@
-#include <linux/config.h>
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/picker.c,v 1.3 2000/09/01 02:31:40 tsi Exp $ */
+
+#include <linux/autoconf.h>
#include <linux/version.h>
#ifndef CONFIG_SMP
#define CONFIG_SMP 0
#endif
+#ifndef CONFIG_MODULES
+#define CONFIG_MODULES 0
+#endif
+
#ifndef CONFIG_MODVERSIONS
#define CONFIG_MODVERSIONS 0
#endif
@@ -22,6 +28,7 @@
#endif
SMP = CONFIG_SMP
+MODULES = CONFIG_MODULES
MODVERSIONS = CONFIG_MODVERSIONS
AGP = CONFIG_AGP
AGP_MODULE = CONFIG_AGP_MODULE
diff --git a/linux/proc.c b/linux/proc.c
index ca062a09..f585e915 100644
--- a/linux/proc.c
+++ b/linux/proc.c
@@ -27,6 +27,7 @@
* Authors:
* Rickard E. (Rik) Faith <faith@valinux.com>
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c,v 1.9 2000/08/28 02:43:15 tsi Exp $ */
#define __NO_VERSION__
#include "drmP.h"
diff --git a/linux/r128_bufs.c b/linux/r128_bufs.c
index 7e76441e..1712aa55 100644
--- a/linux/r128_bufs.c
+++ b/linux/r128_bufs.c
@@ -29,6 +29,7 @@
* Jeff Hartmann <jhartmann@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_bufs.c,v 1.3 2000/08/28 02:43:16 tsi Exp $ */
#define __NO_VERSION__
#include <linux/config.h>
diff --git a/linux/r128_context.c b/linux/r128_context.c
index 9cadadba..9ac4ad86 100644
--- a/linux/r128_context.c
+++ b/linux/r128_context.c
@@ -27,6 +27,7 @@
* Author: Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_context.c,v 1.3 2000/08/28 02:43:16 tsi Exp $ */
#define __NO_VERSION__
#include "drmP.h"
diff --git a/linux/r128_drv.c b/linux/r128_drv.c
index b58dcf06..8d4a3705 100644
--- a/linux/r128_drv.c
+++ b/linux/r128_drv.c
@@ -28,6 +28,7 @@
* Kevin E. Martin <martin@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c,v 1.3 2000/08/28 02:43:16 tsi Exp $ */
#include <linux/config.h>
#include "drmP.h"
diff --git a/linux/r128_drv.h b/linux/r128_drv.h
index da2f676d..dbb9ddcb 100644
--- a/linux/r128_drv.h
+++ b/linux/r128_drv.h
@@ -28,6 +28,7 @@
* Kevin E. Martin <martin@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h,v 1.4 2000/08/28 02:43:16 tsi Exp $ */
#ifndef _R128_DRV_H_
#define _R128_DRV_H_
diff --git a/linux/sis_drv.c b/linux/sis_drv.c
index 06ae7988..0b1990b0 100644
--- a/linux/sis_drv.c
+++ b/linux/sis_drv.c
@@ -1,6 +1,7 @@
/* sis.c -- sis driver -*- linux-c -*-
*
- * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -23,6 +24,7 @@
* DEALINGS IN THE SOFTWARE.
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.c,v 1.5 2000/09/22 11:35:47 alanh Exp $ */
#include <linux/config.h>
#include "drmP.h"
@@ -30,16 +32,20 @@
#include "sis_drv.h"
#define SIS_NAME "sis"
-#define SIS_DESC "sis"
-#define SIS_DATE "19991009"
-#define SIS_MAJOR 0
+#define SIS_DESC "SIS 300/630/540"
+#define SIS_DATE "20000831"
+#define SIS_MAJOR 1
#define SIS_MINOR 0
-#define SIS_PATCHLEVEL 1
+#define SIS_PATCHLEVEL 0
static drm_device_t sis_device;
drm_ctx_t sis_res_ctx;
static struct file_operations sis_fops = {
+#if LINUX_VERSION_CODE >= 0x020400
+ /* This started being used during 2.4.0-test */
+ owner: THIS_MODULE,
+#endif
open: sis_open,
flush: drm_flush,
release: sis_release,
@@ -65,14 +71,14 @@ static drm_ioctl_desc_t sis_ioctls[] = {
[DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)] = { drm_setunique, 1, 1 },
[DRM_IOCTL_NR(DRM_IOCTL_BLOCK)] = { drm_block, 1, 1 },
[DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = { drm_unblock, 1, 1 },
-
[DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = { drm_authmagic, 1, 1 },
[DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { drm_addmap, 1, 1 },
+
[DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { sis_addctx, 1, 1 },
[DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { sis_rmctx, 1, 1 },
[DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { sis_modctx, 1, 1 },
[DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { sis_getctx, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { sis_switchctx, 1, 1 },
+ [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { sis_switchctx, 1, 1 },
[DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { sis_newctx, 1, 1 },
[DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { sis_resctx, 1, 0 },
[DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)] = { drm_adddraw, 1, 1 },
@@ -80,18 +86,16 @@ static drm_ioctl_desc_t sis_ioctls[] = {
[DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { sis_lock, 1, 0 },
[DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { sis_unlock, 1, 0 },
[DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 },
-
-#ifdef DRM_AGP
- [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { drm_agp_acquire, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { drm_agp_release, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { drm_agp_enable, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = { drm_agp_info, 1, 0 },
- [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = { drm_agp_alloc, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = { drm_agp_free, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = { drm_agp_bind, 1, 1 },
- [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = { drm_agp_unbind, 1, 1 },
+#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = {drm_agp_acquire, 1, 1},
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = {drm_agp_release, 1, 1},
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = {drm_agp_enable, 1, 1},
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = {drm_agp_info, 1, 1},
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = {drm_agp_alloc, 1, 1},
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = {drm_agp_free, 1, 1},
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = {drm_agp_bind, 1, 1},
+ [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = {drm_agp_unbind, 1, 1},
#endif
-
/* FB Memory Management */
[DRM_IOCTL_NR(SIS_IOCTL_FB_ALLOC)] = { sis_fb_alloc, 1, 1 },
[DRM_IOCTL_NR(SIS_IOCTL_FB_FREE)] = { sis_fb_free, 1, 1 },
@@ -114,10 +118,25 @@ static drm_ioctl_desc_t sis_ioctls[] = {
static char *sis = NULL;
#endif
-MODULE_AUTHOR("Precision Insight, Inc., Cedar Park, Texas.");
+MODULE_AUTHOR("VA Linux Systems, Inc.");
MODULE_DESCRIPTION("sis");
MODULE_PARM(sis, "s");
+#ifndef MODULE
+/* sis_options is called by the kernel to parse command-line options
+ * passed via the boot-loader (e.g., LILO). It calls the insmod option
+ * routine, drm_parse_drm.
+ */
+
+static int __init sis_options(char *str)
+{
+ drm_parse_options(str);
+ return 1;
+}
+
+__setup("sis=", sis_options);
+#endif
+
static int sis_setup(drm_device_t *dev)
{
int i;
@@ -219,30 +238,22 @@ static int sis_takedown(drm_device_t *dev)
}
dev->magiclist[i].head = dev->magiclist[i].tail = NULL;
}
-#ifdef DRM_AGP
- /* Clear AGP information */
+#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
+ /* Clear AGP information */
if (dev->agp) {
- drm_agp_mem_t *entry;
- drm_agp_mem_t *nexte;
-
- /* Remove AGP resources, but leave dev->agp
- intact until cleanup is called. */
- for (entry = dev->agp->memory; entry; entry = nexte) {
- nexte = entry->next;
- if (entry->bound) drm_unbind_agp(entry->memory);
- drm_free_agp(entry->memory, entry->pages);
- drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
+ drm_agp_mem_t *temp;
+ drm_agp_mem_t *temp_next;
+
+ temp = dev->agp->memory;
+ while(temp != NULL) {
+ temp_next = temp->next;
+ drm_free_agp(temp->memory, temp->pages);
+ drm_free(temp, sizeof(*temp), DRM_MEM_AGPLISTS);
+ temp = temp_next;
}
- dev->agp->memory = NULL;
-
- if (dev->agp->acquired && drm_agp.release)
- (*drm_agp.release)();
-
- dev->agp->acquired = 0;
- dev->agp->enabled = 0;
- }
+ if (dev->agp->acquired) (*drm_agp.release)();
+ }
#endif
-
/* Clear vma list (only built for debugging) */
if (dev->vmalist) {
for (vma = dev->vmalist; vma; vma = vma_next) {
@@ -303,7 +314,7 @@ static int sis_takedown(drm_device_t *dev)
/* sis_init is called via init_module at module load time, or via
* linux/init/main.c (this is not currently supported). */
-int sis_init(void)
+static int sis_init(void)
{
int retcode;
drm_device_t *dev = &sis_device;
@@ -327,27 +338,16 @@ int sis_init(void)
drm_mem_init();
drm_proc_init(dev);
-
-#ifdef DRM_AGP
- DRM_DEBUG("doing agp init\n");
+#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
dev->agp = drm_agp_init();
- if(dev->agp == NULL) {
- /* TODO, if no agp, run MMIO mode */
- DRM_INFO("The sis drm module requires the agpgart module"
- " to function correctly\nPlease load the agpgart"
- " module before you load the mga module\n");
- drm_proc_cleanup();
- misc_deregister(&sis_misc);
- sis_takedown(dev);
- return -ENOMEM;
- }
-#ifdef CONFIG_MTRR
- dev->agp->agp_mtrr = mtrr_add(dev->agp->agp_info.aper_base,
- dev->agp->agp_info.aper_size * 1024 * 1024,
- MTRR_TYPE_WRCOMB,
- 1);
-#endif
#endif
+ if((retcode = drm_ctxbitmap_init(dev))) {
+ DRM_ERROR("Cannot allocate memory for context bitmap.\n");
+ drm_proc_cleanup();
+ misc_deregister(&sis_misc);
+ sis_takedown(dev);
+ return retcode;
+ }
DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
SIS_NAME,
@@ -362,7 +362,7 @@ int sis_init(void)
/* sis_cleanup is called via cleanup_module at module unload time. */
-void sis_cleanup(void)
+static void sis_cleanup(void)
{
drm_device_t *dev = &sis_device;
@@ -374,27 +374,21 @@ void sis_cleanup(void)
} else {
DRM_INFO("Module unloaded\n");
}
-#ifdef DRM_AGP
-#ifdef CONFIG_MTRR
- if(dev->agp && dev->agp->agp_mtrr) {
- int retval;
- retval = mtrr_del(dev->agp->agp_mtrr,
- dev->agp->agp_info.aper_base,
- dev->agp->agp_info.aper_size * 1024*1024);
- DRM_DEBUG("mtrr_del = %d\n", retval);
- }
-#endif
-#endif
-
+ drm_ctxbitmap_cleanup(dev);
sis_takedown(dev);
-#ifdef DRM_AGP
+#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)
if (dev->agp) {
+ drm_agp_uninit();
drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS);
dev->agp = NULL;
}
#endif
}
+module_init(sis_init);
+module_exit(sis_cleanup);
+
+
int sis_version(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
{
@@ -433,11 +427,12 @@ int sis_open(struct inode *inode, struct file *filp)
{
drm_device_t *dev = &sis_device;
int retcode = 0;
-
+
DRM_DEBUG("open_count = %d\n", dev->open_count);
-
if (!(retcode = drm_open_helper(inode, filp, dev))) {
- MOD_INC_USE_COUNT;
+#if LINUX_VERSION_CODE < 0x020333
+ MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */
+#endif
atomic_inc(&dev->total_open);
spin_lock(&dev->count_lock);
if (!dev->open_count++) {
@@ -452,13 +447,17 @@ int sis_open(struct inode *inode, struct file *filp)
int sis_release(struct inode *inode, struct file *filp)
{
drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->dev;
+ drm_device_t *dev;
int retcode = 0;
- DRM_DEBUG("open_count = %d\n", dev->open_count);
+ lock_kernel();
+ dev = priv->dev;
+ DRM_DEBUG("open_count = %d\n", dev->open_count);
if (!(retcode = drm_release(inode, filp))) {
- MOD_DEC_USE_COUNT;
+#if LINUX_VERSION_CODE < 0x020333
+ MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */
+#endif
atomic_inc(&dev->total_close);
spin_lock(&dev->count_lock);
if (!--dev->open_count) {
@@ -467,13 +466,17 @@ int sis_release(struct inode *inode, struct file *filp)
atomic_read(&dev->ioctl_count),
dev->blocked);
spin_unlock(&dev->count_lock);
+ unlock_kernel();
return -EBUSY;
}
spin_unlock(&dev->count_lock);
+ unlock_kernel();
return sis_takedown(dev);
}
spin_unlock(&dev->count_lock);
}
+
+ unlock_kernel();
return retcode;
}
@@ -588,7 +591,9 @@ int sis_lock(struct inode *inode, struct file *filp, unsigned int cmd,
/* Contention */
atomic_inc(&dev->total_sleeps);
current->state = TASK_INTERRUPTIBLE;
+#if 1
current->policy |= SCHED_YIELD;
+#endif
schedule();
if (signal_pending(current)) {
ret = -ERESTARTSYS;
@@ -689,21 +694,3 @@ int sis_unlock(struct inode *inode, struct file *filp, unsigned int cmd,
unblock_all_signals();
return 0;
}
-
-module_init(sis_init);
-module_exit(sis_cleanup);
-
-#ifndef MODULE
-/*
- * sis_setup is called by the kernel to parse command-line options passed
- * via the boot-loader (e.g., LILO). It calls the insmod option routine,
- * drm_parse_options.
- */
-static int __init sis_options(char *str)
-{
- drm_parse_options(str);
- return 1;
-}
-
-__setup("sis=", sis_options);
-#endif
diff --git a/linux/sis_drv.h b/linux/sis_drv.h
index 24523b8f..8dd25e0a 100644
--- a/linux/sis_drv.h
+++ b/linux/sis_drv.h
@@ -1,6 +1,7 @@
/* sis_drv.h -- Private header for sis driver -*- linux-c -*-
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -23,15 +24,12 @@
* DEALINGS IN THE SOFTWARE.
*
*/
-
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.h,v 1.2 2000/08/04 03:51:47 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.h,v 1.3 2000/09/22 11:35:47 alanh Exp $ */
#ifndef _SIS_DRV_H_
#define _SIS_DRV_H_
/* sis_drv.c */
-extern int sis_init(void);
-extern void sis_cleanup(void);
extern int sis_version(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int sis_open(struct inode *inode, struct file *filp);
@@ -72,7 +70,6 @@ int sis_fb_alloc(struct inode *inode, struct file *filp, unsigned int cmd,
int sis_fb_free(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg);
-
int sis_agp_init(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg);
int sis_agp_alloc(struct inode *inode, struct file *filp, unsigned int cmd,
diff --git a/linux/sis_mm.c b/linux/sis_mm.c
index 333b5196..f60da781 100644
--- a/linux/sis_mm.c
+++ b/linux/sis_mm.c
@@ -1,4 +1,33 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c,v 1.2 2000/08/04 03:51:48 tsi Exp $ */
+/* sis_mm.c -- Private header for Direct Rendering Manager -*- linux-c -*-
+ * Created: Mon Jan 4 10:05:05 1999 by sclin@sis.com.tw
+ *
+ * Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Sung-Ching Lin <sclin@sis.com.tw>
+ *
+ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c,v 1.4 2000/09/22 11:35:47 alanh Exp $ */
#define __NO_VERSION__
#include "drmP.h"
diff --git a/linux/tdfx_context.c b/linux/tdfx_context.c
index 1fd73310..9c07ed87 100644
--- a/linux/tdfx_context.c
+++ b/linux/tdfx_context.c
@@ -29,6 +29,7 @@
* Daryll Strauss <daryll@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_context.c,v 1.5 2000/08/28 02:43:16 tsi Exp $ */
#define __NO_VERSION__
#include "drmP.h"
diff --git a/linux/tdfx_drv.c b/linux/tdfx_drv.c
index 2026e9d0..689b360a 100644
--- a/linux/tdfx_drv.c
+++ b/linux/tdfx_drv.c
@@ -29,6 +29,7 @@
* Daryll Strauss <daryll@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c,v 1.6 2000/08/28 02:43:16 tsi Exp $ */
#include <linux/config.h>
#include "drmP.h"
diff --git a/linux/tdfx_drv.h b/linux/tdfx_drv.h
index bee840e1..e6ec7aa4 100644
--- a/linux/tdfx_drv.h
+++ b/linux/tdfx_drv.h
@@ -29,6 +29,7 @@
* Daryll Strauss <daryll@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.h,v 1.5 2000/08/28 02:43:16 tsi Exp $ */
#ifndef _TDFX_DRV_H_
#define _TDFX_DRV_H_
diff --git a/linux/vm.c b/linux/vm.c
index 7c5a24bc..074e75d9 100644
--- a/linux/vm.c
+++ b/linux/vm.c
@@ -28,6 +28,7 @@
* Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c,v 1.8 2000/08/28 02:43:16 tsi Exp $ */
#define __NO_VERSION__
#include "drmP.h"