summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Hartmann <jhartmann@valinux.com>2001-01-22 22:11:17 +0000
committerJeff Hartmann <jhartmann@valinux.com>2001-01-22 22:11:17 +0000
commit75ad0a3174130d361c0eeb50d62ab8c921681835 (patch)
tree713ec155b6b9127fa0b3c2bb6eab220797164d37
parentf0951dc4533f8fe5b443c0269ceb918d814b0e66 (diff)
Removed debugging output, warning cleanup, removed some ifdefs
-rw-r--r--linux-core/drmP.h1
-rw-r--r--linux/Makefile.linux4
-rw-r--r--linux/drmP.h1
-rw-r--r--linux/r128_cce.c45
-rw-r--r--linux/r128_drv.h4
-rw-r--r--linux/r128_pcigart.c23
-rw-r--r--linux/scatter.c14
7 files changed, 34 insertions, 58 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index 5dca6ca6..72fa5e8e 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -854,6 +854,7 @@ extern int drm_sg_alloc(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int drm_sg_free(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
+extern void drm_sg_cleanup(drm_sg_mem_t *entry);
#define page_to_pfn( page ) ((unsigned long)((page)-mem_map))
diff --git a/linux/Makefile.linux b/linux/Makefile.linux
index 3422c161..51cc843f 100644
--- a/linux/Makefile.linux
+++ b/linux/Makefile.linux
@@ -47,7 +47,7 @@
# **** End of SMP/MODVERSIONS detection
CC= gcc
-MODS= gamma.o tdfx.o r128.o radeon.o
+MODS= gamma.o tdfx.o
LIBS= libdrm.a
DRMOBJS= init.o memory.o proc.o auth.o context.o drawable.o bufs.o \
@@ -129,7 +129,7 @@ endif
ifeq ($(AGP),1)
MODCFLAGS += -DCONFIG_AGP -DCONFIG_AGP_MODULE
DRMOBJS += agpsupport.o
-MODS += mga.o
+MODS += mga.o r128.o radeon.o
ifeq ($(MACHINE),i386)
MODS += i810.o
endif
diff --git a/linux/drmP.h b/linux/drmP.h
index 5dca6ca6..72fa5e8e 100644
--- a/linux/drmP.h
+++ b/linux/drmP.h
@@ -854,6 +854,7 @@ extern int drm_sg_alloc(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int drm_sg_free(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
+extern void drm_sg_cleanup(drm_sg_mem_t *entry);
#define page_to_pfn( page ) ((unsigned long)((page)-mem_map))
diff --git a/linux/r128_cce.c b/linux/r128_cce.c
index 5490d5d3..4cd36bc6 100644
--- a/linux/r128_cce.c
+++ b/linux/r128_cce.c
@@ -230,18 +230,12 @@ static void r128_do_cce_flush( drm_r128_private_t *dev_priv )
/* Wait for the CCE to go idle.
*/
-static int r128_do_cce_idle( drm_r128_private_t *dev_priv )
+int r128_do_cce_idle( drm_r128_private_t *dev_priv )
{
int i;
for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) {
-#if 0
- if ( R128_READ( R128_PM4_BUFFER_DL_WPTR ) ==
- R128_READ( R128_PM4_BUFFER_DL_RPTR ) )
-#else
- if ( *dev_priv->ring.head == dev_priv->ring.tail )
-#endif
- {
+ if ( *dev_priv->ring.head == dev_priv->ring.tail ) {
u32 pm4stat = R128_READ( R128_PM4_STAT );
if ( ( (pm4stat & R128_PM4_FIFOCNT_MASK) >=
dev_priv->cce_fifo_size ) &&
@@ -373,7 +367,7 @@ static void r128_cce_init_ring_buffer( drm_device_t *dev )
R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR,
virt_to_bus(entry->pagelist[page_ofs]->virtual));
- DRM_INFO( "ring rptr: offset=0x%08lx handle=0x%08lx\n",
+ DRM_DEBUG( "ring rptr: offset=0x%08lx handle=0x%08lx\n",
virt_to_bus(entry->pagelist[page_ofs]->virtual),
entry->handle + tmp_ofs );
}
@@ -423,7 +417,6 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
dev_priv->usec_timeout > R128_MAX_USEC_TIMEOUT ) {
drm_free( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER );
dev->dev_private = NULL;
- printk("USec timeout is screwed\n");
return -EINVAL;
}
@@ -444,7 +437,6 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
( init->cce_mode != R128_PM4_64BM_64VCBM_64INDBM ) ) {
drm_free( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER );
dev->dev_private = NULL;
- printk("CCE mode is screwed\n");
return -EINVAL;
}
@@ -516,29 +508,20 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
init->sarea_priv_offset);
if(dev_priv->is_pci) {
- printk("dev->sg->virtual (cce_ring): %p\n", dev->sg->virtual);
-
dev_priv->cce_ring->handle =
(void *)dev_priv->cce_ring->offset;
- printk("cce_ring : %p\n", dev_priv->cce_ring->handle);
-
dev_priv->ring_rptr->handle =
(void *)dev_priv->ring_rptr->offset;
- printk("ring_rptr : %p\n", dev_priv->ring_rptr->handle);
-
dev_priv->buffers->handle = (void *)dev_priv->buffers->offset;
- printk("buffers : %p\n", dev_priv->buffers->handle);
} else {
DO_IOREMAP( dev_priv->cce_ring );
DO_IOREMAP( dev_priv->ring_rptr );
DO_IOREMAP( dev_priv->buffers );
}
-#if 0
if ( !dev_priv->is_pci ) {
DO_IOREMAP( dev_priv->agp_textures );
}
-#endif
dev_priv->ring.head = ((__volatile__ u32 *)
dev_priv->ring_rptr->handle);
@@ -567,17 +550,16 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
return -EINVAL;
}
- printk("Initializing ring buffer\n");
r128_cce_init_ring_buffer( dev );
- printk("Initializing microcode\n");
r128_cce_load_microcode( dev_priv );
- printk("Reseting engine\n");
r128_do_engine_reset( dev );
-
- printk("Waiting for idle\n");
r128_do_wait_for_idle( dev_priv );
+#if DEBUG_RING_AFTER_INIT
{
+ u32 last_dispatch;
+ RING_LOCALS;
+
printk( "GUI_STAT = 0x%08x\n",
(unsigned int)R128_READ( R128_GUI_STAT ) );
printk( "PM4_STAT = 0x%08x\n",
@@ -598,12 +580,6 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
(unsigned int)R128_READ( R128_PCI_GART_PAGE ) );
printk( "BM_CHUNK_0_VAL = 0x%08x\n",
(unsigned int)R128_READ( R128_BM_CHUNK_0_VAL ) );
- }
-
-#ifdef DEBUG_RING_AFTER_INIT
- {
- u32 last_dispatch;
- RING_LOCALS;
r128_do_cce_start( dev_priv );
@@ -635,7 +611,6 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
}
#endif
- printk("Returning zero\n");
return 0;
}
@@ -648,12 +623,10 @@ static int r128_do_cleanup_cce( drm_device_t *dev )
DO_IOREMAPFREE( dev_priv->cce_ring );
DO_IOREMAPFREE( dev_priv->ring_rptr );
DO_IOREMAPFREE( dev_priv->buffers );
- }
-#if 0
- if ( !dev_priv->is_pci ) {
DO_IOREMAPFREE( dev_priv->agp_textures );
}
-#endif
+
+ r128_pcigart_cleanup(dev);
drm_free( dev->dev_private, sizeof(drm_r128_private_t),
DRM_MEM_DRIVER );
diff --git a/linux/r128_drv.h b/linux/r128_drv.h
index b3cdc64d..e2075c73 100644
--- a/linux/r128_drv.h
+++ b/linux/r128_drv.h
@@ -140,6 +140,7 @@ extern int r128_fullscreen( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
extern int r128_cce_buffers( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );
+extern int r128_do_cce_idle( drm_r128_private_t *dev_priv );
extern void r128_freelist_reset( drm_device_t *dev );
extern drm_buf_t *r128_freelist_get( drm_device_t *dev );
@@ -192,6 +193,9 @@ extern int r128_rmctx(struct inode *inode, struct file *filp,
extern int r128_context_switch(drm_device_t *dev, int old, int new);
extern int r128_context_switch_complete(drm_device_t *dev, int new);
+ /* r128_pcigart.c */
+extern int r128_pcigart_cleanup(drm_device_t *dev);
+extern int r128_pcigart_init(drm_device_t *dev);
/* Register definitions, register access macros and drmAddMap constants
* for Rage 128 kernel driver.
diff --git a/linux/r128_pcigart.c b/linux/r128_pcigart.c
index d20f275a..fba22ccd 100644
--- a/linux/r128_pcigart.c
+++ b/linux/r128_pcigart.c
@@ -44,7 +44,7 @@ static unsigned long r128_alloc_pages( void )
unsigned long addr_end;
struct page *page;
- DRM_INFO( "%s\n", __FUNCTION__ );
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
address = __get_free_pages( GFP_KERNEL, 3 );
if ( address == 0UL ) {
@@ -59,7 +59,7 @@ static unsigned long r128_alloc_pages( void )
SetPageReserved( page );
}
- DRM_INFO( "%s: returning 0x%08lx\n", __FUNCTION__, address );
+ DRM_DEBUG( "%s: returning 0x%08lx\n", __FUNCTION__, address );
return address;
}
@@ -68,7 +68,7 @@ static void r128_free_pages( unsigned long address )
unsigned long addr_end;
struct page *page;
- DRM_INFO( "%s\n", __FUNCTION__ );
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
if ( !address ) return;
addr_end = address + ((PAGE_SIZE * (1 << 3)) - 1);
@@ -91,7 +91,7 @@ int r128_pcigart_init( drm_device_t *dev )
unsigned long pages;
unsigned long *pci_gart;
int i;
- DRM_INFO( "%s\n", __FUNCTION__ );
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
#if 0
dev_priv->phys_pci_gart_page = 0;
@@ -120,7 +120,7 @@ int r128_pcigart_init( drm_device_t *dev )
dev_priv->phys_pci_gart_page = address;
dev_priv->pci_gart_page = (unsigned long *)address;
- DRM_INFO( "%s: phys=0x%08lx virt=%p\n",
+ DRM_DEBUG( "%s: phys=0x%08lx virt=%p\n",
__FUNCTION__, dev_priv->phys_pci_gart_page,
dev_priv->pci_gart_page );
@@ -131,9 +131,9 @@ int r128_pcigart_init( drm_device_t *dev )
pci_gart[i] = virt_to_bus( entry->pagelist[i]->virtual );
}
- DRM_INFO( "%s: writing PCI_GART_PAGE...\n", __FUNCTION__ );
+ DRM_DEBUG( "%s: writing PCI_GART_PAGE...\n", __FUNCTION__ );
R128_WRITE( R128_PCI_GART_PAGE, virt_to_bus((void *)address) );
- DRM_INFO( "%s: writing PCI_GART_PAGE... done.\n", __FUNCTION__ );
+ DRM_DEBUG( "%s: writing PCI_GART_PAGE... done.\n", __FUNCTION__ );
asm volatile ( "wbinvd" ::: "memory" );
@@ -143,15 +143,12 @@ int r128_pcigart_init( drm_device_t *dev )
int r128_pcigart_cleanup( drm_device_t *dev )
{
drm_r128_private_t *dev_priv = dev->dev_private;
- DRM_INFO( "%s\n", __FUNCTION__ );
-#if 0
- if ( dev_priv->pci_gart_page ) {
- iounmap( dev_priv->pci_gart_page );
- }
-#endif
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
+
if ( dev_priv->phys_pci_gart_page ) {
r128_free_pages( dev_priv->phys_pci_gart_page );
}
return 0;
}
+
diff --git a/linux/scatter.c b/linux/scatter.c
index c5521098..70f848fe 100644
--- a/linux/scatter.c
+++ b/linux/scatter.c
@@ -33,9 +33,9 @@
#include "drmP.h"
#include <linux/wrapper.h>
-#define DEBUG_SCATTER 1
+#define DEBUG_SCATTER 0
-static void drm_sg_cleanup( drm_sg_mem_t *entry )
+void drm_sg_cleanup( drm_sg_mem_t *entry )
{
int i;
@@ -69,12 +69,12 @@ int drm_sg_alloc( struct inode *inode, struct file *filp,
drm_device_t *dev = priv->dev;
drm_scatter_gather_t request;
drm_sg_mem_t *entry;
- unsigned long pages;
+ unsigned long pages, i, j;
pgd_t *pgd;
pmd_t *pmd;
pte_t *pte;
- int i, j;
- DRM_INFO( "%s\n", __FUNCTION__ );
+
+ DRM_DEBUG( "%s\n", __FUNCTION__ );
if ( dev->sg ) return -EINVAL;
@@ -150,7 +150,7 @@ int drm_sg_alloc( struct inode *inode, struct file *filp,
dev->sg = entry;
-#ifdef DEBUG_SCATTER
+#if DEBUG_SCATTER
/* Verify that each page points to its virtual address, and vice
* versa.
*/
@@ -203,7 +203,7 @@ int drm_sg_free( struct inode *inode, struct file *filp,
if ( !entry || entry->handle != request.handle ) return -EINVAL;
- DRM_INFO( "sg free virtual = %p\n", entry->virtual );
+ DRM_DEBUG( "sg free virtual = %p\n", entry->virtual );
drm_sg_cleanup( entry );