diff --git a/bsd-core/ati_pcigart.c b/bsd-core/ati_pcigart.c index 89598cb7..2254238c 100644 --- a/bsd-core/ati_pcigart.c +++ b/bsd-core/ati_pcigart.c @@ -46,17 +46,17 @@ static unsigned long DRM(ati_alloc_pcigart_table)( void ) { unsigned long address; - DRM_DEBUG( "%s\n", __FUNCTION__ ); + DRM_DEBUG( "\n" ); address = (unsigned long) malloc( (1 << ATI_PCIGART_TABLE_ORDER) * PAGE_SIZE, DRM(M_DRM), M_WAITOK ); - DRM_DEBUG( "%s: returning 0x%08lx\n", __FUNCTION__, address ); + DRM_DEBUG( "returning 0x%08lx\n", address ); return address; } static void DRM(ati_free_pcigart_table)( unsigned long address ) { - DRM_DEBUG( "%s\n", __FUNCTION__ ); + DRM_DEBUG( "\n" ); free( (void *)address, DRM(M_DRM)); } @@ -81,11 +81,6 @@ int DRM(ati_pcigart_init)( drm_device_t *dev, goto done; } - if ( !dev->pdev ) { - DRM_ERROR( "PCI device unknown!\n" ); - goto done; - } - /* FIXME non-vtophys==bustophys-arches */ bus_address = vtophys( pci_gart ); /*pci_map_single(dev->pdev, (void *)address, @@ -105,7 +100,7 @@ int DRM(ati_pcigart_init)( drm_device_t *dev, for ( i = 0 ; i < pages ; i++ ) { /* we need to support large memory configurations */ - /* FIXME non-vtophys==bustophys-arches */ entry->busaddr[i] = vtophys( entry->handle + (i*PAGE_SIZE) ); + /* FIXME non-vtophys==vtobus-arches */ entry->busaddr[i] = vtophys( entry->handle + (i*PAGE_SIZE) ); if (entry->busaddr[i] == 0) { DRM_ERROR( "unable to map PCIGART pages!\n" ); DRM(ati_pcigart_cleanup)( dev, (unsigned long)pci_gart, bus_address ); @@ -123,7 +118,7 @@ int DRM(ati_pcigart_init)( drm_device_t *dev, ret = 1; - DRM_OS_READMEMORYBARRIER; + DRM_OS_READMEMORYBARRIER(); done: *addr = (unsigned long)pci_gart; diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h index ce5b1f36..69a7f6cb 100644 --- a/bsd-core/drmP.h +++ b/bsd-core/drmP.h @@ -493,7 +493,6 @@ struct drm_device { #if __REALLY_HAVE_AGP drm_agp_head_t *agp; #endif - struct pci_dev *pdev; drm_sg_mem_t *sg; /* Scatter gather memory */ atomic_t *ctx_bitmap; void *dev_private; diff --git a/bsd-core/drm_os_freebsd.h b/bsd-core/drm_os_freebsd.h index f4279347..83c246ae 100644 --- a/bsd-core/drm_os_freebsd.h +++ b/bsd-core/drm_os_freebsd.h @@ -43,8 +43,8 @@ #define __REALLY_HAVE_AGP __HAVE_AGP #endif -#define __REALLY_HAVE_MTRR 1 -#define __REALLY_HAVE_SG 0 +#define __REALLY_HAVE_MTRR (__HAVE_MTRR) +#define __REALLY_HAVE_SG (__HAVE_SG) #if __REALLY_HAVE_AGP #include diff --git a/bsd-core/drm_scatter.c b/bsd-core/drm_scatter.c index 1a02bb0b..17c9998d 100644 --- a/bsd-core/drm_scatter.c +++ b/bsd-core/drm_scatter.c @@ -69,7 +69,7 @@ int DRM(sg_alloc)( DRM_OS_IOCTL ) bzero( entry, sizeof(*entry) ); - pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE; + pages = round_page(request.size) / PAGE_SIZE; DRM_DEBUG( "sg size=%ld pages=%ld\n", request.size, pages ); entry->pages = pages; diff --git a/bsd-core/drm_vm.c b/bsd-core/drm_vm.c index f902bdd4..ada9f1eb 100644 --- a/bsd-core/drm_vm.c +++ b/bsd-core/drm_vm.c @@ -74,6 +74,7 @@ paddr_t DRM(mmap)(dev_t kdev, off_t offset, int prot) case _DRM_REGISTERS: case _DRM_AGP: return atop(offset); + case _DRM_SCATTER_GATHER: case _DRM_SHM: return atop(vtophys(offset)); default: diff --git a/bsd/ati_pcigart.h b/bsd/ati_pcigart.h index 89598cb7..2254238c 100644 --- a/bsd/ati_pcigart.h +++ b/bsd/ati_pcigart.h @@ -46,17 +46,17 @@ static unsigned long DRM(ati_alloc_pcigart_table)( void ) { unsigned long address; - DRM_DEBUG( "%s\n", __FUNCTION__ ); + DRM_DEBUG( "\n" ); address = (unsigned long) malloc( (1 << ATI_PCIGART_TABLE_ORDER) * PAGE_SIZE, DRM(M_DRM), M_WAITOK ); - DRM_DEBUG( "%s: returning 0x%08lx\n", __FUNCTION__, address ); + DRM_DEBUG( "returning 0x%08lx\n", address ); return address; } static void DRM(ati_free_pcigart_table)( unsigned long address ) { - DRM_DEBUG( "%s\n", __FUNCTION__ ); + DRM_DEBUG( "\n" ); free( (void *)address, DRM(M_DRM)); } @@ -81,11 +81,6 @@ int DRM(ati_pcigart_init)( drm_device_t *dev, goto done; } - if ( !dev->pdev ) { - DRM_ERROR( "PCI device unknown!\n" ); - goto done; - } - /* FIXME non-vtophys==bustophys-arches */ bus_address = vtophys( pci_gart ); /*pci_map_single(dev->pdev, (void *)address, @@ -105,7 +100,7 @@ int DRM(ati_pcigart_init)( drm_device_t *dev, for ( i = 0 ; i < pages ; i++ ) { /* we need to support large memory configurations */ - /* FIXME non-vtophys==bustophys-arches */ entry->busaddr[i] = vtophys( entry->handle + (i*PAGE_SIZE) ); + /* FIXME non-vtophys==vtobus-arches */ entry->busaddr[i] = vtophys( entry->handle + (i*PAGE_SIZE) ); if (entry->busaddr[i] == 0) { DRM_ERROR( "unable to map PCIGART pages!\n" ); DRM(ati_pcigart_cleanup)( dev, (unsigned long)pci_gart, bus_address ); @@ -123,7 +118,7 @@ int DRM(ati_pcigart_init)( drm_device_t *dev, ret = 1; - DRM_OS_READMEMORYBARRIER; + DRM_OS_READMEMORYBARRIER(); done: *addr = (unsigned long)pci_gart; diff --git a/bsd/drmP.h b/bsd/drmP.h index ce5b1f36..69a7f6cb 100644 --- a/bsd/drmP.h +++ b/bsd/drmP.h @@ -493,7 +493,6 @@ struct drm_device { #if __REALLY_HAVE_AGP drm_agp_head_t *agp; #endif - struct pci_dev *pdev; drm_sg_mem_t *sg; /* Scatter gather memory */ atomic_t *ctx_bitmap; void *dev_private; diff --git a/bsd/drm_os_freebsd.h b/bsd/drm_os_freebsd.h index f4279347..83c246ae 100644 --- a/bsd/drm_os_freebsd.h +++ b/bsd/drm_os_freebsd.h @@ -43,8 +43,8 @@ #define __REALLY_HAVE_AGP __HAVE_AGP #endif -#define __REALLY_HAVE_MTRR 1 -#define __REALLY_HAVE_SG 0 +#define __REALLY_HAVE_MTRR (__HAVE_MTRR) +#define __REALLY_HAVE_SG (__HAVE_SG) #if __REALLY_HAVE_AGP #include diff --git a/bsd/drm_scatter.h b/bsd/drm_scatter.h index 1a02bb0b..17c9998d 100644 --- a/bsd/drm_scatter.h +++ b/bsd/drm_scatter.h @@ -69,7 +69,7 @@ int DRM(sg_alloc)( DRM_OS_IOCTL ) bzero( entry, sizeof(*entry) ); - pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE; + pages = round_page(request.size) / PAGE_SIZE; DRM_DEBUG( "sg size=%ld pages=%ld\n", request.size, pages ); entry->pages = pages; diff --git a/bsd/drm_vm.h b/bsd/drm_vm.h index f902bdd4..ada9f1eb 100644 --- a/bsd/drm_vm.h +++ b/bsd/drm_vm.h @@ -74,6 +74,7 @@ paddr_t DRM(mmap)(dev_t kdev, off_t offset, int prot) case _DRM_REGISTERS: case _DRM_AGP: return atop(offset); + case _DRM_SCATTER_GATHER: case _DRM_SHM: return atop(vtophys(offset)); default: