From: Henry Bausley <hbausley@deltatau.com>
To: linuxppc-embedded@ozlabs.org
Subject: PPC460EX - Machine check in kernel mode - when accessing I/O in user space
Date: Tue, 09 Sep 2008 16:34:07 -0700 [thread overview]
Message-ID: <1221003247.5414.20.camel@lt-linuxhenry> (raw)
I am trying to give user space application access to I/O. Previously I
used 2.6.14 with RT Linux and made a kernel device driver with a mmap
routine on a 440EP.
I am converting to a PPC460Ex with 2.6.26-2 with Xenomai the same code
results in a Machine Check in Kernel mode when I attempt to use the code
in user space.
The io memory is in the device tree and with ioremap and I can read and
write to it in kernel mode with
of_address_to_resource(np,0,&res)
piom = (unsigned *) ioremap( res.start, RTL_SHIOM_SIZE);
In addition I tried
void *map_base, * virtAddr;
off_t target = ((unsigned int)addr) & ~MAP_MASK;
int fd;
if ((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) {
printf("/dev/mem could not be opened.\n");
exit(1);
}
/* Map one page */
map_base = mmap((void *)target, length, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, target);
if (map_base == (void *) -1) {
printf("Memory map failed for address 0x%lx\n", addr);
exit(1);
}
In my own driver I did the following for my mmap but it gives an error
as well.
//---------------------------------------
// map a pointer back for user mode usage
//----------------------------------------
static int ubus_mmap(struct file * filp, void * pvoidvma)
{
int ret;
struct vm_area_struct * vma = (struct vm_area_struct *)pvoidvma;
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
ret = remap_pfn_range(vma,
vma->vm_start,
UBUS_BASE_ADDRESS >> PAGE_SHIFT,
vma->vm_end-vma->vm_start,
vma->vm_page_prot);
if(ret != 0)
{
return -EAGAIN;
}
return 0;
}
next reply other threads:[~2008-09-09 23:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-09 23:34 Henry Bausley [this message]
2008-09-10 1:29 ` PPC460EX - Machine check in kernel mode - when accessing I/O in user space Josh Boyer
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=1221003247.5414.20.camel@lt-linuxhenry \
--to=hbausley@deltatau.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).