summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Hartmann <jhartmann@valinux.com>2001-02-21 16:32:12 +0000
committerJeff Hartmann <jhartmann@valinux.com>2001-02-21 16:32:12 +0000
commit78b07aa0d7a25ffbc1a2c07737fcb7597c4e6694 (patch)
treee71f10ccf932ecabd4c5e2fba0d57d5125577065
parent89daf2d5ab8626b9287687a6b81da9d682520856 (diff)
Initial dev_private device mapping's rather than fixed map numbers
-rw-r--r--linux/gamma_dma.c57
-rw-r--r--linux/stubsupport-pre24.h44
2 files changed, 66 insertions, 35 deletions
diff --git a/linux/gamma_dma.c b/linux/gamma_dma.c
index d6c10fea..1b784f80 100644
--- a/linux/gamma_dma.c
+++ b/linux/gamma_dma.c
@@ -37,40 +37,6 @@
#include <linux/interrupt.h> /* For task queue support */
#include <linux/delay.h>
-#if 0
-#define DO_IOREMAP( _map ) \
-do { \
- (_map)->handle = DRM(ioremap)( (_map)->offset, (_map)->size ); \
-} while (0)
-
-#define DO_IOREMAPFREE( _map ) \
-do { \
- if ( (_map)->handle && (_map)->size ) \
- DRM(ioremapfree)( (_map)->handle, (_map)->size ); \
-} while (0)
-
-#define DO_FIND_MAP( _map, _offset ) \
-do { \
- int _i; \
- for ( _i = 0 ; _i < dev->map_count ; _i++ ) { \
- if ( dev->maplist[_i]->offset == _offset ) { \
- _map = dev->maplist[_i]; \
- break; \
- } \
- } \
-} while (0)
-#endif
-
-/* WARNING!!! MAGIC NUMBER!!! The number of regions already added to the
- kernel must be specified here. Currently, the number is 2. This must
- match the order the X server uses for instantiating register regions ,
- or must be passed in a new ioctl. */
-#define GAMMA_REG(reg) \
- (2 \
- + ((reg < 0x1000) \
- ? 0 \
- : ((reg < 0x10000) ? 1 : ((reg < 0x11000) ? 2 : 3))))
-
#define GAMMA_OFF(reg) \
((reg < 0x1000) \
? reg \
@@ -80,7 +46,12 @@ do { \
? (reg - 0x10000) \
: (reg - 0x11000))))
-#define GAMMA_BASE(reg) ((unsigned long)dev->maplist[GAMMA_REG(reg)]->handle)
+#define GAMMA_BASE(reg) ((unsigned long) \
+ ((reg < 0x1000) ? dev_priv->mmio0->handle : \
+ ((reg < 0x10000) ? dev_priv->mmio1->handle : \
+ ((reg < 0x11000) ? dev_priv->mmio2->handle : \
+ dev_priv->mmio3->handle))))
+
#define GAMMA_ADDR(reg) (GAMMA_BASE(reg) + GAMMA_OFF(reg))
#define GAMMA_DEREF(reg) *(__volatile__ int *)GAMMA_ADDR(reg)
#define GAMMA_READ(reg) GAMMA_DEREF(reg)
@@ -107,6 +78,8 @@ do { \
static inline void gamma_dma_dispatch(drm_device_t *dev, unsigned long address,
unsigned long length)
{
+ drm_gamma_private_t *dev_priv = (drm_gamma_private_t *)
+ dev->dev_private;
GAMMA_WRITE(GAMMA_DMAADDRESS, virt_to_phys((void *)address));
while (GAMMA_READ(GAMMA_GCOMMANDSTATUS) != 4)
;
@@ -115,6 +88,8 @@ static inline void gamma_dma_dispatch(drm_device_t *dev, unsigned long address,
void gamma_dma_quiescent_single(drm_device_t *dev)
{
+ drm_gamma_private_t *dev_priv = (drm_gamma_private_t *)
+ dev->dev_private;
while (GAMMA_READ(GAMMA_DMACOUNT))
;
while (GAMMA_READ(GAMMA_INFIFOSPACE) < 3)
@@ -131,6 +106,8 @@ void gamma_dma_quiescent_single(drm_device_t *dev)
void gamma_dma_quiescent_dual(drm_device_t *dev)
{
+ drm_gamma_private_t *dev_priv = (drm_gamma_private_t *)
+ dev->dev_private;
while (GAMMA_READ(GAMMA_DMACOUNT))
;
while (GAMMA_READ(GAMMA_INFIFOSPACE) < 3)
@@ -156,18 +133,24 @@ void gamma_dma_quiescent_dual(drm_device_t *dev)
void gamma_dma_ready(drm_device_t *dev)
{
+ drm_gamma_private_t *dev_priv = (drm_gamma_private_t *)
+ dev->dev_private;
while (GAMMA_READ(GAMMA_DMACOUNT))
;
}
static inline int gamma_dma_is_ready(drm_device_t *dev)
{
+ drm_gamma_private_t *dev_priv = (drm_gamma_private_t *)
+ dev->dev_private;
return !GAMMA_READ(GAMMA_DMACOUNT);
}
static void gamma_dma_service(int irq, void *device, struct pt_regs *regs)
{
drm_device_t *dev = (drm_device_t *)device;
+ drm_gamma_private_t *dev_priv = (drm_gamma_private_t *)
+ dev->dev_private;
drm_device_dma_t *dma = dev->dma;
atomic_inc(&dev->counts[6]); /* _DRM_STAT_IRQ */
@@ -638,6 +621,8 @@ int gamma_dma(struct inode *inode, struct file *filp, unsigned int cmd,
int gamma_irq_install(drm_device_t *dev, int irq)
{
+ drm_gamma_private_t *dev_priv = (drm_gamma_private_t *)
+ dev->dev_private;
int retcode;
if (!irq) return -EINVAL;
@@ -692,6 +677,8 @@ int gamma_irq_install(drm_device_t *dev, int irq)
int gamma_irq_uninstall(drm_device_t *dev)
{
+ drm_gamma_private_t *dev_priv = (drm_gamma_private_t *)
+ dev->dev_private;
int irq;
down(&dev->struct_sem);
diff --git a/linux/stubsupport-pre24.h b/linux/stubsupport-pre24.h
new file mode 100644
index 00000000..f5046f7f
--- /dev/null
+++ b/linux/stubsupport-pre24.h
@@ -0,0 +1,44 @@
+/* stubsupport.h -- -*- linux-c -*-
+ * Created: Fri Jan 19 10:48:35 2001 by faith@acm.org
+ *
+ * Copyright 2001 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.
+ *
+ * Authors:
+ * Rickard E. (Rik) Faith <faith@valinux.com>
+ *
+ */
+
+#ifndef _STUBSUPPORT_PRE24_H_
+#define _STUBSUPPORT_PRE24_H_
+struct drm_stub_info *DRM(_stub_pointer) = NULL;
+#define inter_module_put(x)
+#define inter_module_unregister(x)
+#define inter_module_get(x) DRM(_stub_pointer)
+#define inter_module_register(x,y,z) do { DRM(_stub_pointer) = z; } while (0)
+
+ /* This is a kludge for backward compatibility
+ that is only useful in DRM(stub_open) */
+#define fops_put(fops) MOD_DEC_USE_COUNT
+#define fops_get(fops) (fops); MOD_INC_USE_COUNT
+
+#endif