summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGareth Hughes <gareth@users.sourceforge.net>2000-11-21 06:48:38 +0000
committerGareth Hughes <gareth@users.sourceforge.net>2000-11-21 06:48:38 +0000
commitc071d03e7b5096dca1a73c589f7410d26b2e7f78 (patch)
tree65b32e47a9b68f55eb27f75c7941f57c9537bffa
parent2a39d83ffe0abade7b3283ca9a318b3ca71b10b6 (diff)
r128-specific parts of sync with 2.4.0-test11-pre5. Rest is coming shortly.
-rw-r--r--linux-core/r128_drv.c9
-rw-r--r--linux/agpsupport-pre24.h115
-rw-r--r--linux/r128_drv.c9
-rw-r--r--linux/r128_drv.h2
4 files changed, 124 insertions, 11 deletions
diff --git a/linux-core/r128_drv.c b/linux-core/r128_drv.c
index 1fc699168..e2568eb6c 100644
--- a/linux-core/r128_drv.c
+++ b/linux-core/r128_drv.c
@@ -37,7 +37,7 @@
#define R128_NAME "r128"
#define R128_DESC "ATI Rage 128"
-#define R128_DATE "20001115"
+#define R128_DATE "20001121"
#define R128_MAJOR 2
#define R128_MINOR 0
#define R128_PATCHLEVEL 0
@@ -261,8 +261,7 @@ static int r128_takedown(drm_device_t *dev)
}
dev->agp->memory = NULL;
- if (dev->agp->acquired && drm_agp.release)
- (*drm_agp.release)();
+ if (dev->agp->acquired) _drm_agp_release();
dev->agp->acquired = 0;
dev->agp->enabled = 0;
@@ -332,7 +331,7 @@ static int r128_takedown(drm_device_t *dev)
/* r128_init is called via init_module at module load time, or via
* linux/init/main.c (this is not currently supported). */
-static int r128_init(void)
+static int __init r128_init(void)
{
int retcode;
drm_device_t *dev = &r128_device;
@@ -396,7 +395,7 @@ static int r128_init(void)
/* r128_cleanup is called via cleanup_module at module unload time. */
-static void r128_cleanup(void)
+static void __exit r128_cleanup(void)
{
drm_device_t *dev = &r128_device;
diff --git a/linux/agpsupport-pre24.h b/linux/agpsupport-pre24.h
new file mode 100644
index 000000000..abcf9f51d
--- /dev/null
+++ b/linux/agpsupport-pre24.h
@@ -0,0 +1,115 @@
+/* agpsupport-pre24.h -- Support for pre-2.4.0 kernels -*- linux-c -*-
+ * Created: Mon Nov 13 10:54:15 2000 by faith@valinux.com
+ *
+ * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
+ * 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.
+ *
+ * Author: Rickard E. (Rik) Faith <faith@valinux.com>
+ *
+ */
+
+#ifndef _AGPSUPPORT_PRE24_H_
+#define _AGPSUPPORT_PRE24_H_
+typedef struct {
+ void (*free_memory)(agp_memory *);
+ agp_memory *(*allocate_memory)(size_t, u32);
+ int (*bind_memory)(agp_memory *, off_t);
+ int (*unbind_memory)(agp_memory *);
+ void (*enable)(u32);
+ int (*acquire)(void);
+ void (*release)(void);
+ void (*copy_info)(agp_kern_info *);
+} drm_agp_t;
+
+static drm_agp_t drm_agp_struct = {
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
+};
+
+/* The C standard says that 'void *' is not guaranteed to hold a function
+ pointer, so we use this union to define a generic pointer that is
+ guaranteed to hold any of the function pointers we care about. */
+typedef union {
+ void (*free_memory)(agp_memory *);
+ agp_memory *(*allocate_memory)(size_t, u32);
+ int (*bind_memory)(agp_memory *, off_t);
+ int (*unbind_memory)(agp_memory *);
+ void (*enable)(u32);
+ int (*acquire)(void);
+ void (*release)(void);
+ void (*copy_info)(agp_kern_info *);
+ unsigned long address;
+} drm_agp_func_u;
+
+typedef struct drm_agp_fill {
+ const char *name;
+ drm_agp_func_u *f;
+} drm_agp_fill_t;
+
+static drm_agp_fill_t drm_agp_fill[] = {
+ { __MODULE_STRING(agp_free_memory),
+ (drm_agp_func_u *)&drm_agp_struct.free_memory },
+ { __MODULE_STRING(agp_allocate_memory),
+ (drm_agp_func_u *)&drm_agp_struct.allocate_memory },
+ { __MODULE_STRING(agp_bind_memory),
+ (drm_agp_func_u *)&drm_agp_struct.bind_memory },
+ { __MODULE_STRING(agp_unbind_memory),
+ (drm_agp_func_u *)&drm_agp_struct.unbind_memory },
+ { __MODULE_STRING(agp_enable),
+ (drm_agp_func_u *)&drm_agp_struct.enable },
+ { __MODULE_STRING(agp_backend_acquire),
+ (drm_agp_func_u *)&drm_agp_struct.acquire },
+ { __MODULE_STRING(agp_backend_release),
+ (drm_agp_func_u *)&drm_agp_struct.release },
+ { __MODULE_STRING(agp_copy_info),
+ (drm_agp_func_u *)&drm_agp_struct.copy_info },
+ { NULL, NULL }
+};
+
+#define DRM_AGP_GET _drm_agp_get()
+#define DRM_AGP_PUT _drm_agp_put()
+
+static drm_agp_t *_drm_agp_get(void)
+{
+ drm_agp_fill_t *fill;
+ int agp_available = 1;
+
+ for (fill = &drm_agp_fill[0]; fill->name; fill++) {
+ char *n = (char *)fill->name;
+ *fill->f = (drm_agp_func_u)get_module_symbol(NULL, n);
+ DRM_DEBUG("%s resolves to 0x%08lx\n", n, (*fill->f).address);
+ if (!(*fill->f).address) agp_available = 0;
+ }
+ return &drm_agp_struct;
+}
+
+static void _drm_agp_put(void)
+{
+ drm_agp_fill_t *fill;
+
+ for (fill = &drm_agp_fill[0]; fill->name; fill++) {
+#if LINUX_VERSION_CODE >= 0x020400
+ if ((*fill->f).address) put_module_symbol((*fill->f).address);
+#endif
+ (*fill->f).address = 0;
+ }
+}
+#endif
diff --git a/linux/r128_drv.c b/linux/r128_drv.c
index 1fc699168..e2568eb6c 100644
--- a/linux/r128_drv.c
+++ b/linux/r128_drv.c
@@ -37,7 +37,7 @@
#define R128_NAME "r128"
#define R128_DESC "ATI Rage 128"
-#define R128_DATE "20001115"
+#define R128_DATE "20001121"
#define R128_MAJOR 2
#define R128_MINOR 0
#define R128_PATCHLEVEL 0
@@ -261,8 +261,7 @@ static int r128_takedown(drm_device_t *dev)
}
dev->agp->memory = NULL;
- if (dev->agp->acquired && drm_agp.release)
- (*drm_agp.release)();
+ if (dev->agp->acquired) _drm_agp_release();
dev->agp->acquired = 0;
dev->agp->enabled = 0;
@@ -332,7 +331,7 @@ static int r128_takedown(drm_device_t *dev)
/* r128_init is called via init_module at module load time, or via
* linux/init/main.c (this is not currently supported). */
-static int r128_init(void)
+static int __init r128_init(void)
{
int retcode;
drm_device_t *dev = &r128_device;
@@ -396,7 +395,7 @@ static int r128_init(void)
/* r128_cleanup is called via cleanup_module at module unload time. */
-static void r128_cleanup(void)
+static void __exit r128_cleanup(void)
{
drm_device_t *dev = &r128_device;
diff --git a/linux/r128_drv.h b/linux/r128_drv.h
index 7f044a33d..7ada6e5b7 100644
--- a/linux/r128_drv.h
+++ b/linux/r128_drv.h
@@ -379,7 +379,7 @@ extern int r128_context_switch_complete(drm_device_t *dev, int new);
#define R128_MAX_VB_VERTS (0xffff)
-#define R128_BASE(reg) ((unsigned long)(dev_priv->mmio->handle))
+#define R128_BASE(reg) ((u32)(dev_priv->mmio->handle))
#define R128_ADDR(reg) (R128_BASE(reg) + reg)
#define R128_DEREF(reg) *(__volatile__ int *)R128_ADDR(reg)