diff options
-rw-r--r-- | linux-core/ati_pcigart.c | 14 | ||||
-rw-r--r-- | linux-core/drmP.h | 6 | ||||
-rw-r--r-- | linux-core/drm_agpsupport.c | 8 | ||||
-rw-r--r-- | linux-core/drm_context.c | 2 | ||||
-rw-r--r-- | linux-core/drm_drv.c | 1 | ||||
-rw-r--r-- | linux-core/drm_ioctl.c | 4 | ||||
-rw-r--r-- | linux-core/drm_scatter.c | 6 | ||||
-rw-r--r-- | linux-core/drm_vm.c | 30 | ||||
-rw-r--r-- | linux/ati_pcigart.h | 14 | ||||
-rw-r--r-- | linux/drmP.h | 6 | ||||
-rw-r--r-- | linux/drm_agpsupport.h | 8 | ||||
-rw-r--r-- | linux/drm_context.h | 2 | ||||
-rw-r--r-- | linux/drm_drv.h | 1 | ||||
-rw-r--r-- | linux/drm_ioctl.h | 4 | ||||
-rw-r--r-- | linux/drm_scatter.h | 6 | ||||
-rw-r--r-- | linux/drm_vm.h | 30 | ||||
-rw-r--r-- | linux/r128_cce.c | 9 | ||||
-rw-r--r-- | linux/radeon_cp.c | 16 |
18 files changed, 69 insertions, 98 deletions
diff --git a/linux-core/ati_pcigart.c b/linux-core/ati_pcigart.c index d5d7c0ad..8b486c10 100644 --- a/linux-core/ati_pcigart.c +++ b/linux-core/ati_pcigart.c @@ -103,7 +103,6 @@ int DRM(ati_pcigart_init)( drm_device_t *dev, goto done; } -#if defined(__alpha__) if ( !dev->pdev ) { DRM_ERROR( "PCI device unknown!\n" ); goto done; @@ -118,9 +117,6 @@ int DRM(ati_pcigart_init)( drm_device_t *dev, address = 0; goto done; } -#else - bus_address = virt_to_bus( (void *)address ); -#endif pci_gart = (u32 *)address; @@ -130,7 +126,6 @@ int DRM(ati_pcigart_init)( drm_device_t *dev, memset( pci_gart, 0, ATI_MAX_PCIGART_PAGES * sizeof(u32) ); for ( i = 0 ; i < pages ; i++ ) { -#if defined(__alpha__) /* we need to support large memory configurations */ entry->busaddr[i] = pci_map_single(dev->pdev, page_address( entry->pagelist[i] ), @@ -144,9 +139,7 @@ int DRM(ati_pcigart_init)( drm_device_t *dev, goto done; } page_base = (u32) entry->busaddr[i]; -#else - page_base = page_to_bus( entry->pagelist[i] ); -#endif + for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) { *pci_gart++ = cpu_to_le32( page_base ); page_base += ATI_PCIGART_PAGE_SIZE; @@ -155,7 +148,7 @@ int DRM(ati_pcigart_init)( drm_device_t *dev, ret = 1; -#if __i386__ +#if defined(__i386__) || defined(__x86_64__) asm volatile ( "wbinvd" ::: "memory" ); #else mb(); @@ -171,7 +164,6 @@ int DRM(ati_pcigart_cleanup)( drm_device_t *dev, unsigned long addr, dma_addr_t bus_addr) { -#if defined(__alpha__) drm_sg_mem_t *entry = dev->sg; unsigned long pages; int i; @@ -197,8 +189,6 @@ int DRM(ati_pcigart_cleanup)( drm_device_t *dev, } } -#endif - if ( addr ) { DRM(ati_free_pcigart_table)( addr ); } diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 13a21f3b..4786ba9e 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -443,6 +443,8 @@ typedef struct drm_agp_head { int acquired; unsigned long base; int agp_mtrr; + int cant_use_aperture; + unsigned long page_mask; } drm_agp_head_t; #endif @@ -451,9 +453,7 @@ typedef struct drm_sg_mem { void *virtual; int pages; struct page **pagelist; -#if defined(__alpha__) dma_addr_t *busaddr; -#endif } drm_sg_mem_t; typedef struct drm_sigdata { @@ -544,8 +544,8 @@ typedef struct drm_device { #if __REALLY_HAVE_AGP drm_agp_head_t *agp; #endif -#ifdef __alpha__ struct pci_dev *pdev; +#ifdef __alpha__ #if LINUX_VERSION_CODE < 0x020403 struct pci_controler *hose; #else diff --git a/linux-core/drm_agpsupport.c b/linux-core/drm_agpsupport.c index b4b85abd..28cc5a26 100644 --- a/linux-core/drm_agpsupport.c +++ b/linux-core/drm_agpsupport.c @@ -308,6 +308,14 @@ drm_agp_head_t *DRM(agp_init)(void) default: head->chipset = "Unknown"; break; } +#if LINUX_VERSION_CODE <= 0x020408 + head->cant_use_aperture = 0; + head->page_mask = ~(0xfff); +#else + head->cant_use_aperture = head->agp_info.cant_use_aperture; + head->page_mask = head->agp_info.page_mask; +#endif + DRM_INFO("AGP %d.%d on %s @ 0x%08lx %ZuMB\n", head->agp_info.version.major, head->agp_info.version.minor, diff --git a/linux-core/drm_context.c b/linux-core/drm_context.c index eb4d61c8..33d6112e 100644 --- a/linux-core/drm_context.c +++ b/linux-core/drm_context.c @@ -181,7 +181,7 @@ int DRM(setsareactx)(struct inode *inode, struct file *filp, drm_device_t *dev = priv->dev; drm_ctx_priv_map_t request; drm_map_t *map = NULL; - drm_map_list_t *r_list; + drm_map_list_t *r_list = NULL; struct list_head *list; if (copy_from_user(&request, diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c index 43186632..1ae3ec25 100644 --- a/linux-core/drm_drv.c +++ b/linux-core/drm_drv.c @@ -220,6 +220,7 @@ static char *drm_opts = NULL; MODULE_AUTHOR( DRIVER_AUTHOR ); MODULE_DESCRIPTION( DRIVER_DESC ); MODULE_PARM( drm_opts, "s" ); +MODULE_LICENSE("GPL and additional rights"); static int DRM(setup)( drm_device_t *dev ) { diff --git a/linux-core/drm_ioctl.c b/linux-core/drm_ioctl.c index adcb22c8..0d8a1259 100644 --- a/linux-core/drm_ioctl.c +++ b/linux-core/drm_ioctl.c @@ -98,7 +98,6 @@ int DRM(setunique)(struct inode *inode, struct file *filp, } sprintf(dev->devname, "%s@%s", dev->name, dev->unique); -#ifdef __alpha__ do { struct pci_dev *pci_dev; int b, d, f; @@ -116,10 +115,11 @@ int DRM(setunique)(struct inode *inode, struct file *filp, pci_dev = pci_find_slot(b, PCI_DEVFN(d,f)); if (pci_dev) { dev->pdev = pci_dev; +#ifdef __alpha__ dev->hose = pci_dev->sysdata; +#endif } } while(0); -#endif return 0; } diff --git a/linux-core/drm_scatter.c b/linux-core/drm_scatter.c index f0074450..a6b8275f 100644 --- a/linux-core/drm_scatter.c +++ b/linux-core/drm_scatter.c @@ -47,11 +47,9 @@ void DRM(sg_cleanup)( drm_sg_mem_t *entry ) vfree( entry->virtual ); -#if defined(__alpha__) DRM(free)( entry->busaddr, entry->pages * sizeof(*entry->busaddr), DRM_MEM_PAGES ); -#endif DRM(free)( entry->pagelist, entry->pages * sizeof(*entry->pagelist), DRM_MEM_PAGES ); @@ -99,7 +97,6 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp, return -ENOMEM; } -#if defined(__alpha__) entry->busaddr = DRM(alloc)( pages * sizeof(*entry->busaddr), DRM_MEM_PAGES ); if ( !entry->busaddr ) { @@ -112,15 +109,12 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp, return -ENOMEM; } memset( (void *)entry->busaddr, 0, pages * sizeof(*entry->busaddr) ); -#endif entry->virtual = vmalloc_32( pages << PAGE_SHIFT ); if ( !entry->virtual ) { -#if defined(__alpha__) DRM(free)( entry->busaddr, entry->pages * sizeof(*entry->busaddr), DRM_MEM_PAGES ); -#endif DRM(free)( entry->pagelist, entry->pages * sizeof(*entry->pagelist), DRM_MEM_PAGES ); diff --git a/linux-core/drm_vm.c b/linux-core/drm_vm.c index 43ef500a..ce66f908 100644 --- a/linux-core/drm_vm.c +++ b/linux-core/drm_vm.c @@ -60,7 +60,7 @@ struct page *DRM(vm_nopage)(struct vm_area_struct *vma, unsigned long address, int write_access) { -#if defined(__alpha__) && __REALLY_HAVE_AGP +#if __REALLY_HAVE_AGP drm_file_t *priv = vma->vm_file->private_data; drm_device_t *dev = priv->dev; drm_map_t *map = NULL; @@ -70,6 +70,9 @@ struct page *DRM(vm_nopage)(struct vm_area_struct *vma, /* * Find the right map */ + + if(!dev->agp->cant_use_aperture) goto vm_nopage_error; + list_for_each(list, &dev->maplist->head) { r_list = (drm_map_list_t *)list; map = r_list->map; @@ -83,10 +86,12 @@ struct page *DRM(vm_nopage)(struct vm_area_struct *vma, struct drm_agp_mem *agpmem; struct page *page; +#if __alpha__ /* - * Make it a bus-relative address + * Adjust to a bus-relative address */ baddr -= dev->hose->mem_space->start; +#endif /* * It's AGP memory - find the real physical page to map @@ -97,27 +102,24 @@ struct page *DRM(vm_nopage)(struct vm_area_struct *vma, break; } - if (!agpmem) { - /* - * Oops - no memory found - */ - return NOPAGE_SIGBUS; /* couldn't find it */ - } + if (!agpmem) goto vm_nopage_error; /* * Get the page, inc the use count, and return it */ offset = (baddr - agpmem->bound) >> PAGE_SHIFT; - agpmem->memory->memory[offset] &= ~1UL; /* HACK */ + agpmem->memory->memory[offset] &= dev->agp->page_mask; page = virt_to_page(__va(agpmem->memory->memory[offset])); -#if 0 - DRM_ERROR("baddr = 0x%lx page = 0x%lx, offset = 0x%lx\n", - baddr, __va(agpmem->memory->memory[offset]), offset); -#endif get_page(page); + + DRM_DEBUG("baddr = 0x%lx page = 0x%p, offset = 0x%lx\n", + baddr, __va(agpmem->memory->memory[offset]), offset); + return page; } -#endif +vm_nopage_error: +#endif /* __REALLY_HAVE_AGP */ + return NOPAGE_SIGBUS; /* Disallow mremap */ } diff --git a/linux/ati_pcigart.h b/linux/ati_pcigart.h index d5d7c0ad..8b486c10 100644 --- a/linux/ati_pcigart.h +++ b/linux/ati_pcigart.h @@ -103,7 +103,6 @@ int DRM(ati_pcigart_init)( drm_device_t *dev, goto done; } -#if defined(__alpha__) if ( !dev->pdev ) { DRM_ERROR( "PCI device unknown!\n" ); goto done; @@ -118,9 +117,6 @@ int DRM(ati_pcigart_init)( drm_device_t *dev, address = 0; goto done; } -#else - bus_address = virt_to_bus( (void *)address ); -#endif pci_gart = (u32 *)address; @@ -130,7 +126,6 @@ int DRM(ati_pcigart_init)( drm_device_t *dev, memset( pci_gart, 0, ATI_MAX_PCIGART_PAGES * sizeof(u32) ); for ( i = 0 ; i < pages ; i++ ) { -#if defined(__alpha__) /* we need to support large memory configurations */ entry->busaddr[i] = pci_map_single(dev->pdev, page_address( entry->pagelist[i] ), @@ -144,9 +139,7 @@ int DRM(ati_pcigart_init)( drm_device_t *dev, goto done; } page_base = (u32) entry->busaddr[i]; -#else - page_base = page_to_bus( entry->pagelist[i] ); -#endif + for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) { *pci_gart++ = cpu_to_le32( page_base ); page_base += ATI_PCIGART_PAGE_SIZE; @@ -155,7 +148,7 @@ int DRM(ati_pcigart_init)( drm_device_t *dev, ret = 1; -#if __i386__ +#if defined(__i386__) || defined(__x86_64__) asm volatile ( "wbinvd" ::: "memory" ); #else mb(); @@ -171,7 +164,6 @@ int DRM(ati_pcigart_cleanup)( drm_device_t *dev, unsigned long addr, dma_addr_t bus_addr) { -#if defined(__alpha__) drm_sg_mem_t *entry = dev->sg; unsigned long pages; int i; @@ -197,8 +189,6 @@ int DRM(ati_pcigart_cleanup)( drm_device_t *dev, } } -#endif - if ( addr ) { DRM(ati_free_pcigart_table)( addr ); } diff --git a/linux/drmP.h b/linux/drmP.h index 13a21f3b..4786ba9e 100644 --- a/linux/drmP.h +++ b/linux/drmP.h @@ -443,6 +443,8 @@ typedef struct drm_agp_head { int acquired; unsigned long base; int agp_mtrr; + int cant_use_aperture; + unsigned long page_mask; } drm_agp_head_t; #endif @@ -451,9 +453,7 @@ typedef struct drm_sg_mem { void *virtual; int pages; struct page **pagelist; -#if defined(__alpha__) dma_addr_t *busaddr; -#endif } drm_sg_mem_t; typedef struct drm_sigdata { @@ -544,8 +544,8 @@ typedef struct drm_device { #if __REALLY_HAVE_AGP drm_agp_head_t *agp; #endif -#ifdef __alpha__ struct pci_dev *pdev; +#ifdef __alpha__ #if LINUX_VERSION_CODE < 0x020403 struct pci_controler *hose; #else diff --git a/linux/drm_agpsupport.h b/linux/drm_agpsupport.h index b4b85abd..28cc5a26 100644 --- a/linux/drm_agpsupport.h +++ b/linux/drm_agpsupport.h @@ -308,6 +308,14 @@ drm_agp_head_t *DRM(agp_init)(void) default: head->chipset = "Unknown"; break; } +#if LINUX_VERSION_CODE <= 0x020408 + head->cant_use_aperture = 0; + head->page_mask = ~(0xfff); +#else + head->cant_use_aperture = head->agp_info.cant_use_aperture; + head->page_mask = head->agp_info.page_mask; +#endif + DRM_INFO("AGP %d.%d on %s @ 0x%08lx %ZuMB\n", head->agp_info.version.major, head->agp_info.version.minor, diff --git a/linux/drm_context.h b/linux/drm_context.h index eb4d61c8..33d6112e 100644 --- a/linux/drm_context.h +++ b/linux/drm_context.h @@ -181,7 +181,7 @@ int DRM(setsareactx)(struct inode *inode, struct file *filp, drm_device_t *dev = priv->dev; drm_ctx_priv_map_t request; drm_map_t *map = NULL; - drm_map_list_t *r_list; + drm_map_list_t *r_list = NULL; struct list_head *list; if (copy_from_user(&request, diff --git a/linux/drm_drv.h b/linux/drm_drv.h index 43186632..1ae3ec25 100644 --- a/linux/drm_drv.h +++ b/linux/drm_drv.h @@ -220,6 +220,7 @@ static char *drm_opts = NULL; MODULE_AUTHOR( DRIVER_AUTHOR ); MODULE_DESCRIPTION( DRIVER_DESC ); MODULE_PARM( drm_opts, "s" ); +MODULE_LICENSE("GPL and additional rights"); static int DRM(setup)( drm_device_t *dev ) { diff --git a/linux/drm_ioctl.h b/linux/drm_ioctl.h index adcb22c8..0d8a1259 100644 --- a/linux/drm_ioctl.h +++ b/linux/drm_ioctl.h @@ -98,7 +98,6 @@ int DRM(setunique)(struct inode *inode, struct file *filp, } sprintf(dev->devname, "%s@%s", dev->name, dev->unique); -#ifdef __alpha__ do { struct pci_dev *pci_dev; int b, d, f; @@ -116,10 +115,11 @@ int DRM(setunique)(struct inode *inode, struct file *filp, pci_dev = pci_find_slot(b, PCI_DEVFN(d,f)); if (pci_dev) { dev->pdev = pci_dev; +#ifdef __alpha__ dev->hose = pci_dev->sysdata; +#endif } } while(0); -#endif return 0; } diff --git a/linux/drm_scatter.h b/linux/drm_scatter.h index f0074450..a6b8275f 100644 --- a/linux/drm_scatter.h +++ b/linux/drm_scatter.h @@ -47,11 +47,9 @@ void DRM(sg_cleanup)( drm_sg_mem_t *entry ) vfree( entry->virtual ); -#if defined(__alpha__) DRM(free)( entry->busaddr, entry->pages * sizeof(*entry->busaddr), DRM_MEM_PAGES ); -#endif DRM(free)( entry->pagelist, entry->pages * sizeof(*entry->pagelist), DRM_MEM_PAGES ); @@ -99,7 +97,6 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp, return -ENOMEM; } -#if defined(__alpha__) entry->busaddr = DRM(alloc)( pages * sizeof(*entry->busaddr), DRM_MEM_PAGES ); if ( !entry->busaddr ) { @@ -112,15 +109,12 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp, return -ENOMEM; } memset( (void *)entry->busaddr, 0, pages * sizeof(*entry->busaddr) ); -#endif entry->virtual = vmalloc_32( pages << PAGE_SHIFT ); if ( !entry->virtual ) { -#if defined(__alpha__) DRM(free)( entry->busaddr, entry->pages * sizeof(*entry->busaddr), DRM_MEM_PAGES ); -#endif DRM(free)( entry->pagelist, entry->pages * sizeof(*entry->pagelist), DRM_MEM_PAGES ); diff --git a/linux/drm_vm.h b/linux/drm_vm.h index 43ef500a..ce66f908 100644 --- a/linux/drm_vm.h +++ b/linux/drm_vm.h @@ -60,7 +60,7 @@ struct page *DRM(vm_nopage)(struct vm_area_struct *vma, unsigned long address, int write_access) { -#if defined(__alpha__) && __REALLY_HAVE_AGP +#if __REALLY_HAVE_AGP drm_file_t *priv = vma->vm_file->private_data; drm_device_t *dev = priv->dev; drm_map_t *map = NULL; @@ -70,6 +70,9 @@ struct page *DRM(vm_nopage)(struct vm_area_struct *vma, /* * Find the right map */ + + if(!dev->agp->cant_use_aperture) goto vm_nopage_error; + list_for_each(list, &dev->maplist->head) { r_list = (drm_map_list_t *)list; map = r_list->map; @@ -83,10 +86,12 @@ struct page *DRM(vm_nopage)(struct vm_area_struct *vma, struct drm_agp_mem *agpmem; struct page *page; +#if __alpha__ /* - * Make it a bus-relative address + * Adjust to a bus-relative address */ baddr -= dev->hose->mem_space->start; +#endif /* * It's AGP memory - find the real physical page to map @@ -97,27 +102,24 @@ struct page *DRM(vm_nopage)(struct vm_area_struct *vma, break; } - if (!agpmem) { - /* - * Oops - no memory found - */ - return NOPAGE_SIGBUS; /* couldn't find it */ - } + if (!agpmem) goto vm_nopage_error; /* * Get the page, inc the use count, and return it */ offset = (baddr - agpmem->bound) >> PAGE_SHIFT; - agpmem->memory->memory[offset] &= ~1UL; /* HACK */ + agpmem->memory->memory[offset] &= dev->agp->page_mask; page = virt_to_page(__va(agpmem->memory->memory[offset])); -#if 0 - DRM_ERROR("baddr = 0x%lx page = 0x%lx, offset = 0x%lx\n", - baddr, __va(agpmem->memory->memory[offset]), offset); -#endif get_page(page); + + DRM_DEBUG("baddr = 0x%lx page = 0x%p, offset = 0x%lx\n", + baddr, __va(agpmem->memory->memory[offset]), offset); + return page; } -#endif +vm_nopage_error: +#endif /* __REALLY_HAVE_AGP */ + return NOPAGE_SIGBUS; /* Disallow mremap */ } diff --git a/linux/r128_cce.c b/linux/r128_cce.c index a78a9e69..ef11a497 100644 --- a/linux/r128_cce.c +++ b/linux/r128_cce.c @@ -350,20 +350,11 @@ static void r128_cce_init_ring_buffer( drm_device_t *dev, tmp_ofs = dev_priv->ring_rptr->offset - dev->sg->handle; page_ofs = tmp_ofs >> PAGE_SHIFT; -#if defined(__alpha__) R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR, entry->busaddr[page_ofs]); DRM_DEBUG( "ring rptr: offset=0x%08x handle=0x%08lx\n", entry->busaddr[page_ofs], entry->handle + tmp_ofs ); -#else - R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR, - page_to_bus(entry->pagelist[page_ofs])); - - DRM_DEBUG( "ring rptr: offset=0x%08x handle=0x%08lx\n", - page_to_bus(entry->pagelist[page_ofs]), - entry->handle + tmp_ofs ); -#endif } /* Set watermark control */ diff --git a/linux/radeon_cp.c b/linux/radeon_cp.c index fa74e9b9..904c8b77 100644 --- a/linux/radeon_cp.c +++ b/linux/radeon_cp.c @@ -543,8 +543,7 @@ static int radeon_do_engine_reset( drm_device_t *dev ) RADEON_SOFT_RESET_RE | RADEON_SOFT_RESET_PP | RADEON_SOFT_RESET_E2 | - RADEON_SOFT_RESET_RB | - RADEON_SOFT_RESET_HDP ) ); + RADEON_SOFT_RESET_RB ) ); RADEON_READ( RADEON_RBBM_SOFT_RESET ); RADEON_WRITE( RADEON_RBBM_SOFT_RESET, ( rbbm_soft_reset & ~( RADEON_SOFT_RESET_CP | @@ -553,8 +552,7 @@ static int radeon_do_engine_reset( drm_device_t *dev ) RADEON_SOFT_RESET_RE | RADEON_SOFT_RESET_PP | RADEON_SOFT_RESET_E2 | - RADEON_SOFT_RESET_RB | - RADEON_SOFT_RESET_HDP ) ) ); + RADEON_SOFT_RESET_RB ) ) ); RADEON_READ( RADEON_RBBM_SOFT_RESET ); @@ -622,20 +620,12 @@ static void radeon_cp_init_ring_buffer( drm_device_t *dev, tmp_ofs = dev_priv->ring_rptr->offset - dev->sg->handle; page_ofs = tmp_ofs >> PAGE_SHIFT; -#if defined(__alpha__) + RADEON_WRITE( RADEON_CP_RB_RPTR_ADDR, entry->busaddr[page_ofs]); DRM_DEBUG( "ring rptr: offset=0x%08x handle=0x%08lx\n", entry->busaddr[page_ofs], entry->handle + tmp_ofs ); -#else - RADEON_WRITE( RADEON_CP_RB_RPTR_ADDR, - page_to_bus(entry->pagelist[page_ofs])); - - DRM_DEBUG( "ring rptr: offset=0x%08x handle=0x%08lx\n", - page_to_bus(entry->pagelist[page_ofs]), - entry->handle + tmp_ofs ); -#endif } /* Set ring buffer size */ |