From: "Steven A. Falco" <sfalco@harris.com>
To: linuxppc-dev@ozlabs.org
Subject: mmap question on ppc440
Date: Mon, 05 Nov 2007 16:02:59 -0500 [thread overview]
Message-ID: <472F8503.2080705@harris.com> (raw)
I am attempting to access the CPLD on the AMCC Sequoia board from
user-land. I open /dev/mem, and mmap it, then try to access the
resulting pointer. That works fine when accessing physical addresses
that correspond to RAM, but as soon as I try to access the CPLD at
physical address 0xc0000000, I get an infinite machine check.
I've done this successfully on the ARM architecture, and I've found
examples where people do this on PPC, so I would expect this to work.
Here are a few successful reads:
bash-3.00# ./mm -r -a 0
paddr 00000000, map_base 0x30018000
00000000: c0348200
bash-3.00# ./mm -r -a 100
paddr 00000000, map_base 0x30018100
00000100: 7c0004ac
And here is the machine check:
bash-3.00# ./mm -r -a c0000000
paddr c0000000, Machine check in kernel mode.
Machine check in kernel mode.
Machine check in kernel mode.
Machine check in kernel mode.
My code looks like this (I'll post the whole program if anybody wants to
see it:
if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) {
fprintf(stderr, "cannot open\n");
exit(1);
}
offset = addr & MAP_MASK;
paddr = addr & ~MAP_MASK;
map_base = (unsigned long *)mmap(NULL, MAP_SIZE,
PROT_READ | PROT_WRITE, MAP_SHARED, fd, paddr);
Is it possible to access devices like this from user-land? If so, what
am I doing wrong?
Thanks,
Steve
next reply other threads:[~2007-11-05 21:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-05 21:02 Steven A. Falco [this message]
2007-11-05 21:16 ` mmap question on ppc440 Josh Boyer
2007-11-06 6:50 ` Stefan Roese
2007-11-06 22:02 ` Benjamin Herrenschmidt
2007-11-06 22:59 ` Josh Boyer
2007-11-06 23:31 ` Benjamin Herrenschmidt
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=472F8503.2080705@harris.com \
--to=sfalco@harris.com \
--cc=linuxppc-dev@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).