diff options
Diffstat (limited to 'bsd/ati_pcigart.h')
-rw-r--r-- | bsd/ati_pcigart.h | 51 |
1 files changed, 6 insertions, 45 deletions
diff --git a/bsd/ati_pcigart.h b/bsd/ati_pcigart.h index 28723f56..ba0b81a7 100644 --- a/bsd/ati_pcigart.h +++ b/bsd/ati_pcigart.h @@ -42,25 +42,6 @@ # define ATI_MAX_PCIGART_PAGES 8192 /* 32 MB aperture, 4K pages */ # define ATI_PCIGART_PAGE_SIZE 4096 /* PCI GART page size */ -static unsigned long DRM(ati_alloc_pcigart_table)( void ) -{ - unsigned long address; - - DRM_DEBUG( "\n" ); - - address = (unsigned long) malloc( (1 << ATI_PCIGART_TABLE_ORDER) * PAGE_SIZE, DRM(M_DRM), M_WAITOK ); - - DRM_DEBUG( "returning 0x%08lx\n", address ); - return address; -} - -static void DRM(ati_free_pcigart_table)( unsigned long address ) -{ - DRM_DEBUG( "\n" ); - - free( (void *)address, DRM(M_DRM)); -} - int DRM(ati_pcigart_init)( drm_device_t *dev, unsigned long *addr, dma_addr_t *bus_addr) @@ -76,23 +57,15 @@ int DRM(ati_pcigart_init)( drm_device_t *dev, goto done; } - address = DRM(ati_alloc_pcigart_table)(); + address = (long)contigmalloc((1 << ATI_PCIGART_TABLE_ORDER) * PAGE_SIZE, + DRM(M_DRM), M_WAITOK, 0ul, 0xfffffffful, PAGE_SIZE, 0); if ( !address ) { DRM_ERROR( "cannot allocate PCI GART page!\n" ); goto done; } - /* FIXME non-vtophys==bustophys-arches */ + /* XXX: we need to busdma this */ bus_address = vtophys( address ); - /*pci_map_single(dev->pdev, (void *)address, - ATI_PCIGART_TABLE_PAGES * PAGE_SIZE, - PCI_DMA_TODEVICE);*/ -/* if (bus_address == 0) { - DRM_ERROR( "unable to map PCIGART pages!\n" ); - DRM(ati_free_pcigart_table)( (unsigned long)address ); - address = 0; - goto done; - }*/ pci_gart = (u32 *)address; @@ -102,16 +75,7 @@ int DRM(ati_pcigart_init)( drm_device_t *dev, bzero( pci_gart, ATI_MAX_PCIGART_PAGES * sizeof(u32) ); for ( i = 0 ; i < pages ; i++ ) { - /* we need to support large memory configurations */ - /* 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)address, bus_address ); - address = 0; - bus_address = 0; - goto done; - }*/ page_base = (u32) entry->busaddr[i]; for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) { @@ -122,8 +86,6 @@ int DRM(ati_pcigart_init)( drm_device_t *dev, ret = 1; - DRM_READMEMORYBARRIER(); - done: *addr = address; *bus_addr = bus_address; @@ -142,9 +104,8 @@ int DRM(ati_pcigart_cleanup)( drm_device_t *dev, return 0; } - if ( addr ) { - DRM(ati_free_pcigart_table)( addr ); - } - +#if __FreeBSD_version > 500000 + contigfree( (void *)addr, (1 << ATI_PCIGART_TABLE_ORDER) * PAGE_SIZE, DRM(M_DRM)); /* Not available on 4.x */ +#endif return 1; } |