linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Read in /dev/port with Segmentation Fault
@ 2005-06-09  7:30 scarayol
  2005-06-09  9:12 ` Matt Porter
  0 siblings, 1 reply; 3+ messages in thread
From: scarayol @ 2005-06-09  7:30 UTC (permalink / raw)
  To: linuxppc-embedded

Hi all,

I want to access to IO ports on a MPC885. The iopl() is not implemented, in
my distribution, to use inw() outw().
So I use /dev/port. It works for open("/dev/port",..) and lseek() but when
i do a read()  i have a segmentation fault. I gave all the right to
/dev/port
Does anybody have an idea ?
Thanks a lot.

Sophie CARAYOL

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Read in /dev/port with Segmentation Fault
  2005-06-09  7:30 Read in /dev/port with Segmentation Fault scarayol
@ 2005-06-09  9:12 ` Matt Porter
  0 siblings, 0 replies; 3+ messages in thread
From: Matt Porter @ 2005-06-09  9:12 UTC (permalink / raw)
  To: scarayol; +Cc: linuxppc-embedded

On Thu, Jun 09, 2005 at 09:30:43AM +0200, scarayol@assystembrime.com wrote:
> Hi all,
> 
> I want to access to IO ports on a MPC885. The iopl() is not implemented, in
> my distribution, to use inw() outw().
> So I use /dev/port. It works for open("/dev/port",..) and lseek() but when
> i do a read()  i have a segmentation fault. I gave all the right to
> /dev/port
> Does anybody have an idea ?

You are trying to use x86-specific interfaces to x86-specific IO space.
By "IO ports" you must mean memory mapped I/O registers since you are
on PPC. From userspace, use mmap() to map physical address space to a
user virtual address range.

-Matt

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Read in /dev/port with Segmentation  Fault
@ 2005-06-09 10:05 scarayol
  0 siblings, 0 replies; 3+ messages in thread
From: scarayol @ 2005-06-09 10:05 UTC (permalink / raw)
  To: Fillod Stephane; +Cc: linuxppc-embedded


Dear St=E9phane,

Yes i remember your mail about /dev/mem access. But, I never succeed to=

read or write physical memory with reliability so i wrote a driver and =
use
ioremap inside  intead of mmap (before i put all the needed memory on I=
O
memory with the boot command "mem=3DxM" and then it works. So, i think =
i have
some problems with "mmap"  :-).
I think my .../char/mem.c is OK for mmap support.
Why is it necessary to use size+ofs_addr for size and page_addr instead=
 of
physaddr, i thought mmap( ) do it itself ?

Thank you for your help.

Kenavo.

Sophie.




                                                                       =
                                                                       =
     =20
                    "Fillod Stephane"                                  =
                                                                       =
     =20
                    <stephane.fillod@th        Pour :  <scarayol@assyst=
embrime.com>                                                           =
     =20
                    omson.net>                 cc :    <linuxppc-embedd=
ed@ozlabs.org>                                                         =
     =20
                                               Objet :      RE: R=E9f. =
: Re: Read in /dev/port with Segmentation  Fault                       =
       =20
                    09/06/05 11:35                                     =
                                                                       =
     =20
                                                                       =
                                                                       =
     =20
                                                                       =
                                                                       =
     =20



Sophie CARAYOL wrote:
>Another question, if i use mmap to map physical addresses of I/O
registers,
>could i dereference the pointer on virtual adresse to access data or
should
>i use read/write on the file descriptor ?

Yes, you can dereference the pointer.
Don't you remember my past mail?

>From the Denx's FAQ (TFQ hits the list monthly) for accessing memory bu=
s:

http://www.denx.de/twiki/bin/view/PPCEmbedded/DeviceDrivers#Section_Acc=
essingPeripheralsFromUserSpace

or shorter: http://tinyurl.com/6c7th

See linux/drivers/char/mem.c to check if mmap support is ok on your arc=
h.

Kenavo
--
St=E9phane



=

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-06-09 10:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-09  7:30 Read in /dev/port with Segmentation Fault scarayol
2005-06-09  9:12 ` Matt Porter
  -- strict thread matches above, loose matches on Subject: below --
2005-06-09 10:05 scarayol

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).