linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Achim Machura" <achim.machura@berghof.com>
To: "'Kunkel, Ulrich'" <Ulrich.Kunkel@hbm.com>
Cc: "Linuxppc-Embedded \(E-Mail\)" <linuxppc-embedded@ozlabs.org>
Subject: AW: MPC5200 mmap, ioremap
Date: Mon, 22 Aug 2005 16:12:52 +0200	[thread overview]
Message-ID: <002e01c5a723$9669d7a0$34f1ff0a@beint.local> (raw)
In-Reply-To: <D3524C0FFDC6A54F9D7B6BBEECD341D505618A78@hbmntx0.da.hbm.com>

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

      reply	other threads:[~2005-08-22 14:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-22  8:47 MPC5200 mmap, ioremap Kunkel, Ulrich
2005-08-22 14:12 ` Achim Machura [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='002e01c5a723$9669d7a0$34f1ff0a@beint.local' \
    --to=achim.machura@berghof.com \
    --cc=Ulrich.Kunkel@hbm.com \
    --cc=linuxppc-embedded@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).