mmap doubt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi

  here is a piece of code from epson1356fb.c, inline
comments are what i understand, but i cant understand
somethings, kindly correct me where i am wrong and
thanks for your time in advance.

 start = info->fix.membase_phys & PAGE_MASK;
>>> "start" now has the pfn of the fb's starting
physical address
                                                      
                         
        len = PAGE_ALIGN((start & ~PAGE_MASK) +
info->fb_size);
>>> what does this line do ? , i think we get the
length of fb mem in "pages" .. like the total fb spans
2 pages, 3 pages etc .
                                                      
                         
        off = vma->vm_pgoff << PAGE_SHIFT;

>>> what does vma->vm_pgoff really have, i assume it
has the "page offset" from the beginning of the file,
where this has to be mapped, like the "3rd page from
beginning of the file", so by left shifting it we get
the "relative" physical address from the start of the
file
                                                      
                         
        if ((vma->vm_end - vma->vm_start + off) > len)
{
>>> "vma_end - vma_start" gives me the length of the
address to be mapped in bytes, which i add to off,
which currently is the relative address from the
beginnin of the file, but i dont do an & with
page_mask, hence i have some pfn+offset, this i
compare with a pure length in num of pages ???, am too
confused  so let me not go any further ....

>>> one last question, what is the offset value i need
to pass to ioremap_page ...() function ?
                DPRINTK("invalid vma\n");
                return -EINVAL;
        }
                                                      
                         
        off += start;
        vma->vm_pgoff = off >> PAGE_SHIFT;
                                                      
                         
        pgprot_val(vma->vm_page_prot) &= ~_CACHE_MASK;
#ifdef SHADOW_FRAME_BUFFER
        vma->vm_flags |= VM_RESERVED;
        pgprot_val(vma->vm_page_prot) &=
~_CACHE_UNCACHED;
#else
        pgprot_val(vma->vm_page_prot) |=
_CACHE_UNCACHED;
#endif


regards
Amit


		
__________________________________ 
Do you Yahoo!? 
Read only the mail you want - Yahoo! Mail SpamGuard. 
http://promotions.yahoo.com/new_mail 

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux