diff options
Diffstat (limited to 'linux-core')
-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 |
8 files changed, 33 insertions, 38 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 */ } |