diff options
author | Eric Anholt <anholt@freebsd.org> | 2002-05-29 08:28:22 +0000 |
---|---|---|
committer | Eric Anholt <anholt@freebsd.org> | 2002-05-29 08:28:22 +0000 |
commit | 92c17c6ceadd8880e70d516ff1e676894306fe8c (patch) | |
tree | bbf6d4976b45f59db9814479507d7407b159ce49 /bsd | |
parent | 5a0e2c2031a37da397199f42108f18877d72a0e4 (diff) |
Clean up some debugging output, strange diffs from linux. Clean up some
warnings. Remove alloc_pages/free_pages. There is no corresponding
function in FreeBSD, and were incorrectly implemented (using
contigmalloc instead of plain malloc).
Diffstat (limited to 'bsd')
-rw-r--r-- | bsd/drmP.h | 3 | ||||
-rw-r--r-- | bsd/drm_auth.h | 1 | ||||
-rw-r--r-- | bsd/drm_bufs.h | 11 | ||||
-rw-r--r-- | bsd/drm_dma.h | 5 | ||||
-rw-r--r-- | bsd/drm_drv.h | 6 | ||||
-rw-r--r-- | bsd/drm_memory.h | 52 | ||||
-rw-r--r-- | bsd/r128/r128_drv.h | 1 | ||||
-rw-r--r-- | bsd/radeon/radeon_drv.h | 1 |
8 files changed, 11 insertions, 69 deletions
@@ -511,9 +511,6 @@ extern void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, extern char *DRM(strdup)(const char *s, int area); extern void DRM(strfree)(char *s, int area); extern void DRM(free)(void *pt, size_t size, int area); -extern unsigned long DRM(alloc_pages)(int order, int area); -extern void DRM(free_pages)(unsigned long address, int order, - int area); extern void *DRM(ioremap)(unsigned long offset, unsigned long size); extern void *DRM(ioremap_nocache)(unsigned long offset, unsigned long size); extern void DRM(ioremapfree)(void *pt, unsigned long size); diff --git a/bsd/drm_auth.h b/bsd/drm_auth.h index db0c0118..2d9506ba 100644 --- a/bsd/drm_auth.h +++ b/bsd/drm_auth.h @@ -104,7 +104,6 @@ int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic) prev->next = pt->next; } DRM_OS_UNLOCK; - DRM(free)(pt, sizeof(*pt), DRM_MEM_MAGIC); return 0; } } diff --git a/bsd/drm_bufs.h b/bsd/drm_bufs.h index d55b36d8..5e5aba33 100644 --- a/bsd/drm_bufs.h +++ b/bsd/drm_bufs.h @@ -145,8 +145,7 @@ int DRM(addmap)( DRM_OS_IOCTL ) case _DRM_SHM: DRM_INFO( "%ld %d %d\n", map->size, DRM(order)( map->size ), PAGE_SHIFT); - map->handle = (void *)DRM(alloc_pages) - (DRM(order)(map->size) - PAGE_SHIFT, DRM_MEM_SAREA); + map->handle = (void *)DRM(alloc)(map->size, DRM_MEM_SAREA); DRM_DEBUG( "%ld %d %p\n", map->size, DRM(order)( map->size ), map->handle ); if ( !map->handle ) { @@ -249,7 +248,7 @@ int DRM(rmmap)( DRM_OS_IOCTL ) DRM(ioremapfree)(map->handle, map->size); break; case _DRM_SHM: - DRM(free_pages)( (unsigned long)map->handle, DRM(order)(map->size), DRM_MEM_SAREA ); + DRM(free)( map->handle, map->size, DRM_MEM_SAREA ); break; case _DRM_AGP: case _DRM_SCATTER_GATHER: @@ -270,8 +269,8 @@ static void DRM(cleanup_buf_error)(drm_buf_entry_t *entry) if (entry->seg_count) { for (i = 0; i < entry->seg_count; i++) { - DRM(free_pages)(entry->seglist[i], - entry->page_order, + DRM(free)((void *)entry->seglist[i], + entry->buf_size, DRM_MEM_DMA); } DRM(free)(entry->seglist, @@ -586,7 +585,7 @@ int DRM(addbufs_pci)( DRM_OS_IOCTL ) page_count = 0; while ( entry->buf_count < count ) { - page = DRM(alloc_pages)( page_order, DRM_MEM_DMA ); + page = (unsigned long)DRM(alloc)( size, DRM_MEM_DMA ); if ( !page ) break; entry->seglist[entry->seg_count++] = page; for ( i = 0 ; i < (1 << page_order) ; i++ ) { diff --git a/bsd/drm_dma.h b/bsd/drm_dma.h index 7c31a6e2..53086b73 100644 --- a/bsd/drm_dma.h +++ b/bsd/drm_dma.h @@ -85,8 +85,8 @@ void DRM(dma_takedown)(drm_device_t *dev) dma->bufs[i].buf_count, dma->bufs[i].seg_count); for (j = 0; j < dma->bufs[i].seg_count; j++) { - DRM(free_pages)(dma->bufs[i].seglist[j], - dma->bufs[i].page_order, + DRM(free)((void *)dma->bufs[i].seglist[j], + dma->bufs[i].buf_size, DRM_MEM_DMA); } DRM(free)(dma->bufs[i].seglist, @@ -604,7 +604,6 @@ int DRM(control)( DRM_OS_IOCTL ) int DRM(control)( DRM_OS_IOCTL ) { - DRM_OS_DEVICE; drm_control_t ctl; DRM_OS_KRNFROMUSR( ctl, (drm_control_t *) data, sizeof(ctl) ); diff --git a/bsd/drm_drv.h b/bsd/drm_drv.h index a6523367..44400d4d 100644 --- a/bsd/drm_drv.h +++ b/bsd/drm_drv.h @@ -231,7 +231,6 @@ static int DRM(probe)(device_t dev) int vendor = (pciid & 0x0000ffff); int device = (pciid & 0xffff0000) >> 16; int i=0, done=0; - DRM_INFO("Checking PCI vendor=%d, device=%d\n", vendor, device); while ( !done && (DRM(devicelist)[i].vendor != 0 ) ) { if ( (DRM(devicelist)[i].vendor == vendor) && (DRM(devicelist)[i].device == device) ) { @@ -504,9 +503,8 @@ static int DRM(takedown)( drm_device_t *dev ) DRM(ioremapfree)( map->handle, map->size ); break; case _DRM_SHM: - DRM(free_pages)((unsigned long)map->handle, - DRM(order)(map->size) - - PAGE_SHIFT, + DRM(free)(map->handle, + map->size, DRM_MEM_SAREA); break; diff --git a/bsd/drm_memory.h b/bsd/drm_memory.h index cad997d0..56573ad8 100644 --- a/bsd/drm_memory.h +++ b/bsd/drm_memory.h @@ -215,58 +215,6 @@ void DRM(free)(void *pt, size_t size, int area) } } -unsigned long DRM(alloc_pages)(int order, int area) -{ - vm_offset_t address; - unsigned long bytes = PAGE_SIZE << order; - - - address = (vm_offset_t) contigmalloc(bytes, DRM(M_DRM), M_WAITOK, 0, ~0, 1, 0); - if (!address) { - DRM_OS_SPINLOCK(&DRM(mem_lock)); - ++DRM(mem_stats)[area].fail_count; - DRM_OS_SPINUNLOCK(&DRM(mem_lock)); - return 0; - } - DRM_OS_SPINLOCK(&DRM(mem_lock)); - ++DRM(mem_stats)[area].succeed_count; - DRM(mem_stats)[area].bytes_allocated += bytes; - DRM(ram_used) += bytes; - DRM_OS_SPINUNLOCK(&DRM(mem_lock)); - - - /* Zero outside the lock */ - memset((void *)address, 0, bytes); - - - return address; -} - -void DRM(free_pages)(unsigned long address, int order, int area) -{ - unsigned long bytes = PAGE_SIZE << order; - int alloc_count; - int free_count; - - if (!address) { - DRM_MEM_ERROR(area, "Attempt to free address 0\n"); - } else { - contigfree((void *) address, bytes, DRM(M_DRM)); - } - - DRM_OS_SPINLOCK(&DRM(mem_lock)); - free_count = ++DRM(mem_stats)[area].free_count; - alloc_count = DRM(mem_stats)[area].succeed_count; - DRM(mem_stats)[area].bytes_freed += bytes; - DRM(ram_used) -= bytes; - DRM_OS_SPINUNLOCK(&DRM(mem_lock)); - if (free_count > alloc_count) { - DRM_MEM_ERROR(area, - "Excess frees: %d frees, %d allocs\n", - free_count, alloc_count); - } -} - void *DRM(ioremap)(unsigned long offset, unsigned long size) { void *pt; diff --git a/bsd/r128/r128_drv.h b/bsd/r128/r128_drv.h index 743e48e5..c727301b 100644 --- a/bsd/r128/r128_drv.h +++ b/bsd/r128/r128_drv.h @@ -465,6 +465,7 @@ do { \ DRM_OS_RETURN( EBUSY ); \ } \ __ring_space_done: \ + ; \ } while (0) #define VB_AGE_TEST_WITH_RETURN( dev_priv ) \ diff --git a/bsd/radeon/radeon_drv.h b/bsd/radeon/radeon_drv.h index cda5ef7d..0dad3146 100644 --- a/bsd/radeon/radeon_drv.h +++ b/bsd/radeon/radeon_drv.h @@ -650,6 +650,7 @@ do { \ DRM_OS_RETURN( EBUSY ); \ } \ __ring_space_done: \ + ; \ } while (0) #define VB_AGE_TEST_WITH_RETURN( dev_priv ) \ |