AW: MPC5200 mmap, ioremap

Achim Machura achim.machura at berghof.com
Tue Aug 23 00:12:52 EST 2005


Hello Ulrich,

> mem =12 M
i think it means the kernel knows about 12 MB

This code below works fine at our board, but we use only a few kb in the
protected ram.
I don't Know whats happen if size is bigger as one page.

int asi_common_mmap(struct file *filp, struct vm_area_struct *vma)
{
//	unsigned long off = vma->vm_pgoff << PAGE_SHIFT;
	unsigned long physical = ASI_IOMEM_BASE;
	unsigned long vsize = vma->vm_end - vma->vm_start;
//	unsigned long psize = ASI_IOMEM_SIZE - off;

//	rt_printk("start : 0x%08lX\n", vma->vm_start);
//	rt_printk("end   : 0x%08lX\n", vma->vm_end);
//	rt_printk("offset: 0x%08lX\n", off);
//	rt_printk("phys  : 0x%08lX\n", physical);
//	rt_printk("vsize : 0x%08lX\n", vsize);
//	rt_printk("psize : 0x%08lX\n", psize);

	if (filp->f_flags & O_SYNC)
	{
//		rt_printk("I/O-Mem");
		vma->vm_flags |= VM_IO;
	}
	vma->vm_flags |= VM_RESERVED;
	//if (vsize > psize) return -EINVAL; /* spans too high */
	if(remap_page_range(vma->vm_start, physical, vsize, vma->vm_page_prot))
	{
		return -EAGAIN;
	}
	return(0);
}

Achim




More information about the Linuxppc-embedded mailing list