lkml.org 
[lkml]   [2004]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
Subjectremap_page_range
All,

I'm having a problem with remap_page_range in the 2.6 kernel series. I
use remap_page_range inside the mmap function of a module I wrote in
order to map a given device's memory into user space.

Apparently, everything works fine but I just can't access the device's
memory (even tough I get a valid point from the mmap system call). This
is the mmap function I wrote:


static int
pcimap_mmap (struct file *filp, struct vm_area_struct *vma)
{

int unit, reg;
unsigned long size, phy_addr;

unit = MINOR(filp->f_dentry->d_inode->i_rdev) >> 4;
reg = MINOR(filp->f_dentry->d_inode->i_rdev) & 0x0f;

size = vma->vm_end - vma->vm_start;

/* Mapping must be page aligned and not larger than the region size */
if ((size + vma->vm_pgoff * PAGE_SIZE) > pcidevs[unit].reg[reg].size)
{
return -EINVAL;
}

/* Get device's memory physical address for mapping */
phy_addr = pcidevs[unit].reg[reg].phy_addr + vma->vm_pgoff * PAGE_SIZE;

/* Map device's memory in the requested address space range */
if (remap_page_range (vma, phy_addr, 0, size, vma->vm_page_prot))
{
return -EAGAIN;
}

filp->f_dentry->d_inode->i_count.counter++;

return 0;
}



Can anyone help me?


Thanks in advance.


Thiago Robert[unhandled content-type:application/octet-stream]
\
 
 \ /
  Last update: 2005-03-22 14:08    [W:0.030 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site