Sync with Linus 2.4.9-pre2 + make all nopage routines more alike
parent
2d4b2cf6f6
commit
aa09e36114
|
@ -133,9 +133,9 @@ int DRM(ati_pcigart_init)( drm_device_t *dev,
|
||||||
#if defined(__alpha__) && (LINUX_VERSION_CODE >= 0x020400)
|
#if defined(__alpha__) && (LINUX_VERSION_CODE >= 0x020400)
|
||||||
/* we need to support large memory configurations */
|
/* we need to support large memory configurations */
|
||||||
entry->busaddr[i] = pci_map_single(dev->pdev,
|
entry->busaddr[i] = pci_map_single(dev->pdev,
|
||||||
entry->pagelist[i]->virtual,
|
page_address( entry->pagelist[i] ),
|
||||||
PAGE_SIZE,
|
PAGE_SIZE,
|
||||||
PCI_DMA_TODEVICE);
|
PCI_DMA_TODEVICE);
|
||||||
if (entry->busaddr[i] == 0) {
|
if (entry->busaddr[i] == 0) {
|
||||||
DRM_ERROR( "unable to map PCIGART pages!\n" );
|
DRM_ERROR( "unable to map PCIGART pages!\n" );
|
||||||
DRM(ati_pcigart_cleanup)( dev, address, bus_address );
|
DRM(ati_pcigart_cleanup)( dev, address, bus_address );
|
||||||
|
@ -145,7 +145,7 @@ int DRM(ati_pcigart_init)( drm_device_t *dev,
|
||||||
}
|
}
|
||||||
page_base = (u32) entry->busaddr[i];
|
page_base = (u32) entry->busaddr[i];
|
||||||
#else
|
#else
|
||||||
page_base = virt_to_bus( entry->pagelist[i]->virtual );
|
page_base = page_to_bus( entry->pagelist[i] );
|
||||||
#endif
|
#endif
|
||||||
for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) {
|
for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) {
|
||||||
*pci_gart++ = cpu_to_le32( page_base );
|
*pci_gart++ = cpu_to_le32( page_base );
|
||||||
|
|
|
@ -76,6 +76,11 @@
|
||||||
#include <asm/pgalloc.h>
|
#include <asm/pgalloc.h>
|
||||||
#include "drm.h"
|
#include "drm.h"
|
||||||
|
|
||||||
|
/* page_to_bus for earlier kernels, not optimal in all cases */
|
||||||
|
#ifndef page_to_bus
|
||||||
|
#define page_to_bus(page) (virt_to_bus(page_address(page)))
|
||||||
|
#endif
|
||||||
|
|
||||||
/* DRM template customization defaults
|
/* DRM template customization defaults
|
||||||
*/
|
*/
|
||||||
#ifndef __HAVE_AGP
|
#ifndef __HAVE_AGP
|
||||||
|
|
|
@ -160,7 +160,7 @@ int DRM(getsareactx)(struct inode *inode, struct file *filp,
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
down(&dev->struct_sem);
|
down(&dev->struct_sem);
|
||||||
if ((int)request.ctx_id >= dev->max_context) {
|
if (dev->max_context < 0 || request.ctx_id >= (unsigned) dev->max_context) {
|
||||||
up(&dev->struct_sem);
|
up(&dev->struct_sem);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -193,22 +193,20 @@ int DRM(setsareactx)(struct inode *inode, struct file *filp,
|
||||||
list_for_each(list, &dev->maplist->head) {
|
list_for_each(list, &dev->maplist->head) {
|
||||||
r_list = (drm_map_list_t *)list;
|
r_list = (drm_map_list_t *)list;
|
||||||
if(r_list->map &&
|
if(r_list->map &&
|
||||||
r_list->map->handle == request.handle) break;
|
r_list->map->handle == request.handle)
|
||||||
|
goto found;
|
||||||
}
|
}
|
||||||
if (list == &(dev->maplist->head)) {
|
bad:
|
||||||
up(&dev->struct_sem);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
map = r_list->map;
|
|
||||||
up(&dev->struct_sem);
|
up(&dev->struct_sem);
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
if (!map) return -EINVAL;
|
found:
|
||||||
|
map = r_list->map;
|
||||||
down(&dev->struct_sem);
|
if (!map) goto bad;
|
||||||
if ((int)request.ctx_id >= dev->max_context) {
|
if (dev->max_context < 0)
|
||||||
up(&dev->struct_sem);
|
goto bad;
|
||||||
return -EINVAL;
|
if (request.ctx_id >= (unsigned) dev->max_context)
|
||||||
}
|
goto bad;
|
||||||
dev->context_sareas[request.ctx_id] = map;
|
dev->context_sareas[request.ctx_id] = map;
|
||||||
up(&dev->struct_sem);
|
up(&dev->struct_sem);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -179,7 +179,7 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp,
|
||||||
for ( i = 0 ; i < pages ; i++ ) {
|
for ( i = 0 ; i < pages ; i++ ) {
|
||||||
unsigned long *tmp;
|
unsigned long *tmp;
|
||||||
|
|
||||||
tmp = (unsigned long *)entry->pagelist[i]->virtual;
|
tmp = page_address( entry->pagelist[i] );
|
||||||
for ( j = 0 ;
|
for ( j = 0 ;
|
||||||
j < PAGE_SIZE / sizeof(unsigned long) ;
|
j < PAGE_SIZE / sizeof(unsigned long) ;
|
||||||
j++, tmp++ ) {
|
j++, tmp++ ) {
|
||||||
|
@ -197,7 +197,7 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp,
|
||||||
"virtual mapping\n" );
|
"virtual mapping\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tmp = (unsigned long *)entry->pagelist[i]->virtual;
|
tmp = page_address( entry->pagelist[i] );
|
||||||
for(j = 0 ;
|
for(j = 0 ;
|
||||||
j < PAGE_SIZE / sizeof(unsigned long) ;
|
j < PAGE_SIZE / sizeof(unsigned long) ;
|
||||||
j++, tmp++) {
|
j++, tmp++) {
|
||||||
|
|
|
@ -122,7 +122,11 @@ DRM_ERROR("baddr = 0x%lx page = 0x%lx, offset = 0x%lx\n",
|
||||||
baddr, __va(agpmem->memory->memory[offset]), offset);
|
baddr, __va(agpmem->memory->memory[offset]), offset);
|
||||||
#endif
|
#endif
|
||||||
get_page(page);
|
get_page(page);
|
||||||
|
#if LINUX_VERSION_CODE < 0x020317
|
||||||
|
return page_address(page);
|
||||||
|
#else
|
||||||
return page;
|
return page;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return NOPAGE_SIGBUS; /* Disallow mremap */
|
return NOPAGE_SIGBUS; /* Disallow mremap */
|
||||||
|
@ -144,12 +148,12 @@ struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma,
|
||||||
#else
|
#else
|
||||||
drm_map_t *map = (drm_map_t *)vma->vm_pte;
|
drm_map_t *map = (drm_map_t *)vma->vm_pte;
|
||||||
#endif
|
#endif
|
||||||
unsigned long physical;
|
|
||||||
unsigned long offset;
|
unsigned long offset;
|
||||||
unsigned long i;
|
unsigned long i;
|
||||||
pgd_t *pgd;
|
pgd_t *pgd;
|
||||||
pmd_t *pmd;
|
pmd_t *pmd;
|
||||||
pte_t *pte;
|
pte_t *pte;
|
||||||
|
struct page *page;
|
||||||
|
|
||||||
if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */
|
if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */
|
||||||
if (!map) return NOPAGE_OOM; /* Nothing allocated */
|
if (!map) return NOPAGE_OOM; /* Nothing allocated */
|
||||||
|
@ -165,14 +169,15 @@ struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma,
|
||||||
if( !pmd_present( *pmd ) ) return NOPAGE_OOM;
|
if( !pmd_present( *pmd ) ) return NOPAGE_OOM;
|
||||||
pte = pte_offset( pmd, i );
|
pte = pte_offset( pmd, i );
|
||||||
if( !pte_present( *pte ) ) return NOPAGE_OOM;
|
if( !pte_present( *pte ) ) return NOPAGE_OOM;
|
||||||
physical = (unsigned long)pte_page( *pte )->virtual;
|
|
||||||
atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */
|
|
||||||
|
|
||||||
DRM_DEBUG("0x%08lx => 0x%08lx\n", address, physical);
|
page = pte_page( *pte );
|
||||||
|
get_page(page);
|
||||||
|
|
||||||
|
DRM_DEBUG("0x%08lx => 0x%08lx\n", address, page_to_bus(page));
|
||||||
#if LINUX_VERSION_CODE < 0x020317
|
#if LINUX_VERSION_CODE < 0x020317
|
||||||
return physical;
|
return page_address(page);
|
||||||
#else
|
#else
|
||||||
return virt_to_page(physical);
|
return page;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,24 +282,27 @@ struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
|
||||||
drm_file_t *priv = vma->vm_file->private_data;
|
drm_file_t *priv = vma->vm_file->private_data;
|
||||||
drm_device_t *dev = priv->dev;
|
drm_device_t *dev = priv->dev;
|
||||||
drm_device_dma_t *dma = dev->dma;
|
drm_device_dma_t *dma = dev->dma;
|
||||||
unsigned long physical;
|
|
||||||
unsigned long offset;
|
unsigned long offset;
|
||||||
unsigned long page;
|
unsigned long page_nr;
|
||||||
|
struct page *page;
|
||||||
|
|
||||||
if (!dma) return NOPAGE_SIGBUS; /* Error */
|
if (!dma) return NOPAGE_SIGBUS; /* Error */
|
||||||
if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */
|
if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */
|
||||||
if (!dma->pagelist) return NOPAGE_OOM ; /* Nothing allocated */
|
if (!dma->pagelist) return NOPAGE_OOM ; /* Nothing allocated */
|
||||||
|
|
||||||
offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */
|
offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */
|
||||||
page = offset >> PAGE_SHIFT;
|
page_nr = offset >> PAGE_SHIFT;
|
||||||
physical = dma->pagelist[page] + (offset & (~PAGE_MASK));
|
page = virt_to_page((dma->pagelist[page_nr] +
|
||||||
atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */
|
(offset & (~PAGE_MASK))));
|
||||||
|
|
||||||
DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page, physical);
|
get_page(page);
|
||||||
|
|
||||||
|
DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page_nr,
|
||||||
|
page_to_bus(page));
|
||||||
#if LINUX_VERSION_CODE < 0x020317
|
#if LINUX_VERSION_CODE < 0x020317
|
||||||
return physical;
|
return page_address(page);
|
||||||
#else
|
#else
|
||||||
return virt_to_page(physical);
|
return page;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,10 +339,10 @@ struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma,
|
||||||
map_offset = map->offset - dev->sg->handle;
|
map_offset = map->offset - dev->sg->handle;
|
||||||
page_offset = (offset >> PAGE_SHIFT) + (map_offset >> PAGE_SHIFT);
|
page_offset = (offset >> PAGE_SHIFT) + (map_offset >> PAGE_SHIFT);
|
||||||
page = entry->pagelist[page_offset];
|
page = entry->pagelist[page_offset];
|
||||||
atomic_inc(&page->count); /* Dec. by kernel */
|
get_page(page);
|
||||||
|
|
||||||
#if LINUX_VERSION_CODE < 0x020317
|
#if LINUX_VERSION_CODE < 0x020317
|
||||||
return (unsigned long)virt_to_phys(page->virtual);
|
return page_address(page);
|
||||||
#else
|
#else
|
||||||
return page;
|
return page;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -133,9 +133,9 @@ int DRM(ati_pcigart_init)( drm_device_t *dev,
|
||||||
#if defined(__alpha__) && (LINUX_VERSION_CODE >= 0x020400)
|
#if defined(__alpha__) && (LINUX_VERSION_CODE >= 0x020400)
|
||||||
/* we need to support large memory configurations */
|
/* we need to support large memory configurations */
|
||||||
entry->busaddr[i] = pci_map_single(dev->pdev,
|
entry->busaddr[i] = pci_map_single(dev->pdev,
|
||||||
entry->pagelist[i]->virtual,
|
page_address( entry->pagelist[i] ),
|
||||||
PAGE_SIZE,
|
PAGE_SIZE,
|
||||||
PCI_DMA_TODEVICE);
|
PCI_DMA_TODEVICE);
|
||||||
if (entry->busaddr[i] == 0) {
|
if (entry->busaddr[i] == 0) {
|
||||||
DRM_ERROR( "unable to map PCIGART pages!\n" );
|
DRM_ERROR( "unable to map PCIGART pages!\n" );
|
||||||
DRM(ati_pcigart_cleanup)( dev, address, bus_address );
|
DRM(ati_pcigart_cleanup)( dev, address, bus_address );
|
||||||
|
@ -145,7 +145,7 @@ int DRM(ati_pcigart_init)( drm_device_t *dev,
|
||||||
}
|
}
|
||||||
page_base = (u32) entry->busaddr[i];
|
page_base = (u32) entry->busaddr[i];
|
||||||
#else
|
#else
|
||||||
page_base = virt_to_bus( entry->pagelist[i]->virtual );
|
page_base = page_to_bus( entry->pagelist[i] );
|
||||||
#endif
|
#endif
|
||||||
for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) {
|
for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) {
|
||||||
*pci_gart++ = cpu_to_le32( page_base );
|
*pci_gart++ = cpu_to_le32( page_base );
|
||||||
|
|
|
@ -76,6 +76,11 @@
|
||||||
#include <asm/pgalloc.h>
|
#include <asm/pgalloc.h>
|
||||||
#include "drm.h"
|
#include "drm.h"
|
||||||
|
|
||||||
|
/* page_to_bus for earlier kernels, not optimal in all cases */
|
||||||
|
#ifndef page_to_bus
|
||||||
|
#define page_to_bus(page) (virt_to_bus(page_address(page)))
|
||||||
|
#endif
|
||||||
|
|
||||||
/* DRM template customization defaults
|
/* DRM template customization defaults
|
||||||
*/
|
*/
|
||||||
#ifndef __HAVE_AGP
|
#ifndef __HAVE_AGP
|
||||||
|
|
|
@ -160,7 +160,7 @@ int DRM(getsareactx)(struct inode *inode, struct file *filp,
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
down(&dev->struct_sem);
|
down(&dev->struct_sem);
|
||||||
if ((int)request.ctx_id >= dev->max_context) {
|
if (dev->max_context < 0 || request.ctx_id >= (unsigned) dev->max_context) {
|
||||||
up(&dev->struct_sem);
|
up(&dev->struct_sem);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -193,22 +193,20 @@ int DRM(setsareactx)(struct inode *inode, struct file *filp,
|
||||||
list_for_each(list, &dev->maplist->head) {
|
list_for_each(list, &dev->maplist->head) {
|
||||||
r_list = (drm_map_list_t *)list;
|
r_list = (drm_map_list_t *)list;
|
||||||
if(r_list->map &&
|
if(r_list->map &&
|
||||||
r_list->map->handle == request.handle) break;
|
r_list->map->handle == request.handle)
|
||||||
|
goto found;
|
||||||
}
|
}
|
||||||
if (list == &(dev->maplist->head)) {
|
bad:
|
||||||
up(&dev->struct_sem);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
map = r_list->map;
|
|
||||||
up(&dev->struct_sem);
|
up(&dev->struct_sem);
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
if (!map) return -EINVAL;
|
found:
|
||||||
|
map = r_list->map;
|
||||||
down(&dev->struct_sem);
|
if (!map) goto bad;
|
||||||
if ((int)request.ctx_id >= dev->max_context) {
|
if (dev->max_context < 0)
|
||||||
up(&dev->struct_sem);
|
goto bad;
|
||||||
return -EINVAL;
|
if (request.ctx_id >= (unsigned) dev->max_context)
|
||||||
}
|
goto bad;
|
||||||
dev->context_sareas[request.ctx_id] = map;
|
dev->context_sareas[request.ctx_id] = map;
|
||||||
up(&dev->struct_sem);
|
up(&dev->struct_sem);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -179,7 +179,7 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp,
|
||||||
for ( i = 0 ; i < pages ; i++ ) {
|
for ( i = 0 ; i < pages ; i++ ) {
|
||||||
unsigned long *tmp;
|
unsigned long *tmp;
|
||||||
|
|
||||||
tmp = (unsigned long *)entry->pagelist[i]->virtual;
|
tmp = page_address( entry->pagelist[i] );
|
||||||
for ( j = 0 ;
|
for ( j = 0 ;
|
||||||
j < PAGE_SIZE / sizeof(unsigned long) ;
|
j < PAGE_SIZE / sizeof(unsigned long) ;
|
||||||
j++, tmp++ ) {
|
j++, tmp++ ) {
|
||||||
|
@ -197,7 +197,7 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp,
|
||||||
"virtual mapping\n" );
|
"virtual mapping\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tmp = (unsigned long *)entry->pagelist[i]->virtual;
|
tmp = page_address( entry->pagelist[i] );
|
||||||
for(j = 0 ;
|
for(j = 0 ;
|
||||||
j < PAGE_SIZE / sizeof(unsigned long) ;
|
j < PAGE_SIZE / sizeof(unsigned long) ;
|
||||||
j++, tmp++) {
|
j++, tmp++) {
|
||||||
|
|
|
@ -122,7 +122,11 @@ DRM_ERROR("baddr = 0x%lx page = 0x%lx, offset = 0x%lx\n",
|
||||||
baddr, __va(agpmem->memory->memory[offset]), offset);
|
baddr, __va(agpmem->memory->memory[offset]), offset);
|
||||||
#endif
|
#endif
|
||||||
get_page(page);
|
get_page(page);
|
||||||
|
#if LINUX_VERSION_CODE < 0x020317
|
||||||
|
return page_address(page);
|
||||||
|
#else
|
||||||
return page;
|
return page;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return NOPAGE_SIGBUS; /* Disallow mremap */
|
return NOPAGE_SIGBUS; /* Disallow mremap */
|
||||||
|
@ -144,12 +148,12 @@ struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma,
|
||||||
#else
|
#else
|
||||||
drm_map_t *map = (drm_map_t *)vma->vm_pte;
|
drm_map_t *map = (drm_map_t *)vma->vm_pte;
|
||||||
#endif
|
#endif
|
||||||
unsigned long physical;
|
|
||||||
unsigned long offset;
|
unsigned long offset;
|
||||||
unsigned long i;
|
unsigned long i;
|
||||||
pgd_t *pgd;
|
pgd_t *pgd;
|
||||||
pmd_t *pmd;
|
pmd_t *pmd;
|
||||||
pte_t *pte;
|
pte_t *pte;
|
||||||
|
struct page *page;
|
||||||
|
|
||||||
if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */
|
if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */
|
||||||
if (!map) return NOPAGE_OOM; /* Nothing allocated */
|
if (!map) return NOPAGE_OOM; /* Nothing allocated */
|
||||||
|
@ -165,14 +169,15 @@ struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma,
|
||||||
if( !pmd_present( *pmd ) ) return NOPAGE_OOM;
|
if( !pmd_present( *pmd ) ) return NOPAGE_OOM;
|
||||||
pte = pte_offset( pmd, i );
|
pte = pte_offset( pmd, i );
|
||||||
if( !pte_present( *pte ) ) return NOPAGE_OOM;
|
if( !pte_present( *pte ) ) return NOPAGE_OOM;
|
||||||
physical = (unsigned long)pte_page( *pte )->virtual;
|
|
||||||
atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */
|
|
||||||
|
|
||||||
DRM_DEBUG("0x%08lx => 0x%08lx\n", address, physical);
|
page = pte_page( *pte );
|
||||||
|
get_page(page);
|
||||||
|
|
||||||
|
DRM_DEBUG("0x%08lx => 0x%08lx\n", address, page_to_bus(page));
|
||||||
#if LINUX_VERSION_CODE < 0x020317
|
#if LINUX_VERSION_CODE < 0x020317
|
||||||
return physical;
|
return page_address(page);
|
||||||
#else
|
#else
|
||||||
return virt_to_page(physical);
|
return page;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,24 +282,27 @@ struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma,
|
||||||
drm_file_t *priv = vma->vm_file->private_data;
|
drm_file_t *priv = vma->vm_file->private_data;
|
||||||
drm_device_t *dev = priv->dev;
|
drm_device_t *dev = priv->dev;
|
||||||
drm_device_dma_t *dma = dev->dma;
|
drm_device_dma_t *dma = dev->dma;
|
||||||
unsigned long physical;
|
|
||||||
unsigned long offset;
|
unsigned long offset;
|
||||||
unsigned long page;
|
unsigned long page_nr;
|
||||||
|
struct page *page;
|
||||||
|
|
||||||
if (!dma) return NOPAGE_SIGBUS; /* Error */
|
if (!dma) return NOPAGE_SIGBUS; /* Error */
|
||||||
if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */
|
if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */
|
||||||
if (!dma->pagelist) return NOPAGE_OOM ; /* Nothing allocated */
|
if (!dma->pagelist) return NOPAGE_OOM ; /* Nothing allocated */
|
||||||
|
|
||||||
offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */
|
offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */
|
||||||
page = offset >> PAGE_SHIFT;
|
page_nr = offset >> PAGE_SHIFT;
|
||||||
physical = dma->pagelist[page] + (offset & (~PAGE_MASK));
|
page = virt_to_page((dma->pagelist[page_nr] +
|
||||||
atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */
|
(offset & (~PAGE_MASK))));
|
||||||
|
|
||||||
DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page, physical);
|
get_page(page);
|
||||||
|
|
||||||
|
DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page_nr,
|
||||||
|
page_to_bus(page));
|
||||||
#if LINUX_VERSION_CODE < 0x020317
|
#if LINUX_VERSION_CODE < 0x020317
|
||||||
return physical;
|
return page_address(page);
|
||||||
#else
|
#else
|
||||||
return virt_to_page(physical);
|
return page;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,10 +339,10 @@ struct page *DRM(vm_sg_nopage)(struct vm_area_struct *vma,
|
||||||
map_offset = map->offset - dev->sg->handle;
|
map_offset = map->offset - dev->sg->handle;
|
||||||
page_offset = (offset >> PAGE_SHIFT) + (map_offset >> PAGE_SHIFT);
|
page_offset = (offset >> PAGE_SHIFT) + (map_offset >> PAGE_SHIFT);
|
||||||
page = entry->pagelist[page_offset];
|
page = entry->pagelist[page_offset];
|
||||||
atomic_inc(&page->count); /* Dec. by kernel */
|
get_page(page);
|
||||||
|
|
||||||
#if LINUX_VERSION_CODE < 0x020317
|
#if LINUX_VERSION_CODE < 0x020317
|
||||||
return (unsigned long)virt_to_phys(page->virtual);
|
return page_address(page);
|
||||||
#else
|
#else
|
||||||
return page;
|
return page;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -358,10 +358,10 @@ static void r128_cce_init_ring_buffer( drm_device_t *dev,
|
||||||
entry->handle + tmp_ofs );
|
entry->handle + tmp_ofs );
|
||||||
#else
|
#else
|
||||||
R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR,
|
R128_WRITE( R128_PM4_BUFFER_DL_RPTR_ADDR,
|
||||||
virt_to_bus(entry->pagelist[page_ofs]->virtual));
|
page_to_bus(entry->pagelist[page_ofs]));
|
||||||
|
|
||||||
DRM_DEBUG( "ring rptr: offset=0x%08lx handle=0x%08lx\n",
|
DRM_DEBUG( "ring rptr: offset=0x%08lx handle=0x%08lx\n",
|
||||||
virt_to_bus(entry->pagelist[page_ofs]->virtual),
|
page_to_bus(entry->pagelist[page_ofs]),
|
||||||
entry->handle + tmp_ofs );
|
entry->handle + tmp_ofs );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -630,10 +630,10 @@ static void radeon_cp_init_ring_buffer( drm_device_t *dev,
|
||||||
entry->handle + tmp_ofs );
|
entry->handle + tmp_ofs );
|
||||||
#else
|
#else
|
||||||
RADEON_WRITE( RADEON_CP_RB_RPTR_ADDR,
|
RADEON_WRITE( RADEON_CP_RB_RPTR_ADDR,
|
||||||
virt_to_bus(entry->pagelist[page_ofs]->virtual));
|
page_to_bus(entry->pagelist[page_ofs]));
|
||||||
|
|
||||||
DRM_DEBUG( "ring rptr: offset=0x%08lx handle=0x%08lx\n",
|
DRM_DEBUG( "ring rptr: offset=0x%08lx handle=0x%08lx\n",
|
||||||
virt_to_bus(entry->pagelist[page_ofs]->virtual),
|
page_to_bus(entry->pagelist[page_ofs]),
|
||||||
entry->handle + tmp_ofs );
|
entry->handle + tmp_ofs );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue