From f26c473cdf557ea6e8f267d34eee82d30473a363 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 2 Jan 2006 17:18:39 +1100 Subject: drm: update PCIGART support from CVS In order to work on FreeBSD the gart needed to use a local mapping This patch moves the mainline to the new code and aligns some comment changes From: Eric Anholt Signed-off-by: Dave Airlie --- drivers/char/drm/ati_pcigart.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'drivers/char/drm/ati_pcigart.c') diff --git a/drivers/char/drm/ati_pcigart.c b/drivers/char/drm/ati_pcigart.c index efff0eec618..5485382cade 100644 --- a/drivers/char/drm/ati_pcigart.c +++ b/drivers/char/drm/ati_pcigart.c @@ -52,7 +52,7 @@ # 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) +static void *drm_ati_alloc_pcigart_table(void) { unsigned long address; struct page *page; @@ -72,27 +72,26 @@ static unsigned long drm_ati_alloc_pcigart_table(void) } DRM_DEBUG("%s: returning 0x%08lx\n", __FUNCTION__, address); - return address; + return (void *)address; } -static void drm_ati_free_pcigart_table(unsigned long address) +static void drm_ati_free_pcigart_table(void *address) { struct page *page; int i; DRM_DEBUG("%s\n", __FUNCTION__); - page = virt_to_page(address); + page = virt_to_page((unsigned long)address); for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++) { __put_page(page); ClearPageReserved(page); } - free_pages(address, ATI_PCIGART_TABLE_ORDER); + free_pages((unsigned long)address, ATI_PCIGART_TABLE_ORDER); } -int drm_ati_pcigart_cleanup(drm_device_t * dev, - drm_ati_pcigart_info * gart_info) +int drm_ati_pcigart_cleanup(drm_device_t *dev, drm_ati_pcigart_info *gart_info) { drm_sg_mem_t *entry = dev->sg; unsigned long pages; @@ -136,10 +135,10 @@ int drm_ati_pcigart_cleanup(drm_device_t * dev, EXPORT_SYMBOL(drm_ati_pcigart_cleanup); -int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info * gart_info) +int drm_ati_pcigart_init(drm_device_t *dev, drm_ati_pcigart_info *gart_info) { drm_sg_mem_t *entry = dev->sg; - unsigned long address = 0; + void *address = NULL; unsigned long pages; u32 *pci_gart, page_base, bus_address = 0; int i, j, ret = 0; @@ -163,7 +162,7 @@ int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info * gart_info) goto done; } - bus_address = pci_map_single(dev->pdev, (void *)address, + bus_address = pci_map_single(dev->pdev, address, ATI_PCIGART_TABLE_PAGES * PAGE_SIZE, PCI_DMA_TODEVICE); if (bus_address == 0) { @@ -176,7 +175,7 @@ int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info * gart_info) address = gart_info->addr; bus_address = gart_info->bus_addr; DRM_DEBUG("PCI: Gart Table: VRAM %08X mapped at %08lX\n", - bus_address, address); + bus_address, (unsigned long)address); } pci_gart = (u32 *) address; @@ -195,7 +194,7 @@ int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info * gart_info) if (entry->busaddr[i] == 0) { DRM_ERROR("unable to map PCIGART pages!\n"); drm_ati_pcigart_cleanup(dev, gart_info); - address = 0; + address = NULL; bus_address = 0; goto done; } -- cgit v1.2.3