linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* ioperm
@ 2004-04-27  7:51 Sergey Urvanov
  0 siblings, 0 replies; 9+ messages in thread
From: Sergey Urvanov @ 2004-04-27  7:51 UTC (permalink / raw)
  To: linuxppc-embedded


Hi
Anybody seen this error?
I'm getting it while trying to compile  for a ppc405EP based board,
using the ELDK 2.1 toolchain (ppc_4xx).

I have a problem with next test code:

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <asm/io.h>

#define BASEPORT 0x378


int main (int   argc,
          char  *argv[])
{
        int kz=0;
        if (ioperm(BASEPORT, 3, 1))
         {
                perror ("ioperm");
                exit (1);
         }
        outb(0, BASEPORT);
        printf ("status 1 %d\n", kz);
        usleep (100000);
        kz=inb(BASEPORT+1);
        printf ("status 2 %d\n", kz);
        if (ioperm(BASEPORT, 3, 0))
         {
                perror ("ioperm");
                exit (1);
         }
        printf ("Stop \n");
        return 0;
}


I try to make:

/opt/eldk/usr/ppc-linux/bin/gcc -o -O2 test test.o
/opt/eldk/usr/ppc-linux/bin/gcc -o test test.o

And in the answer:

test.o: In function `main':
test.o(.text+0x2c): undefined reference to `ioperm'
test.o(.text+0x2c): relocation truncated to fit: R_PPC_REL24 ioperm
test.o(.text+0x54): undefined reference to `outb'
test.o(.text+0x54): relocation truncated to fit: R_PPC_REL24 outb
test.o(.text+0x78): undefined reference to `inb'
test.o(.text+0x78): relocation truncated to fit: R_PPC_REL24 inb
test.o(.text+0x98): undefined reference to `ioperm'
test.o(.text+0x98): relocation truncated to fit: R_PPC_REL24 ioperm
collect2: ld returned 1 exit status

Any help would be appreciated.

Thanx and regards
Sergey Urvanov


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* ioperm
@ 2004-04-27  9:25 Sergey Urvanov
  2004-04-27 15:59 ` ioperm Christopher R. Johnson
  0 siblings, 1 reply; 9+ messages in thread
From: Sergey Urvanov @ 2004-04-27  9:25 UTC (permalink / raw)
  To: linuxppc-embedded


Hi
Anybody seen this error?
I'm getting it while trying to compile  for a ppc405EP based board,
using the ELDK 2.1 toolchain (ppc_4xx).

I have a problem with next test code:

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <asm/io.h>

#define BASEPORT 0x378


int main (int   argc,
          char  *argv[])
{
        int kz=0;
        if (ioperm(BASEPORT, 3, 1))
         {
                perror ("ioperm");
                exit (1);
         }
        outb(0, BASEPORT);
        printf ("status 1 %d\n", kz);
        usleep (100000);
        kz=inb(BASEPORT+1);
        printf ("status 2 %d\n", kz);
        if (ioperm(BASEPORT, 3, 0))
         {
                perror ("ioperm");
                exit (1);
         }
        printf ("Stop \n");
        return 0;
}


I try to make:

/opt/eldk/usr/ppc-linux/bin/gcc -c -O2 test.c
/opt/eldk/usr/ppc-linux/bin/gcc -o test test.o

And in the answer:

test.o: In function `main':
test.o(.text+0x2c): undefined reference to `ioperm'
test.o(.text+0x2c): relocation truncated to fit: R_PPC_REL24 ioperm
test.o(.text+0x54): undefined reference to `outb'
test.o(.text+0x54): relocation truncated to fit: R_PPC_REL24 outb
test.o(.text+0x78): undefined reference to `inb'
test.o(.text+0x78): relocation truncated to fit: R_PPC_REL24 inb
test.o(.text+0x98): undefined reference to `ioperm'
test.o(.text+0x98): relocation truncated to fit: R_PPC_REL24 ioperm
collect2: ld returned 1 exit status

Any help would be appreciated.

Thanx and regards
Sergey Urvanov


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* RE: ioperm
@ 2004-04-27  9:49 Fillod Stephane
  0 siblings, 0 replies; 9+ messages in thread
From: Fillod Stephane @ 2004-04-27  9:49 UTC (permalink / raw)
  To: 'Sergey Urvanov', linuxppc-embedded


>Anybody seen this error?

No :)

>I'm getting it while trying to compile  for a ppc405EP based board,
>using the ELDK 2.1 toolchain (ppc_4xx).

Don't use ioperm. There's no io bus, only memory bus.

Please have a look at Denx's FAQ for accessing memory bus:


http://www.denx.de/twiki/bin/view/PPCEmbedded/DeviceDrivers#Section_Accessin
gPeripheralsFromUserSpace

For more information, please follow this thread:
	http://lists.linuxppc.org/linuxppc-embedded/200403/msg00059.html


> #define BASEPORT 0x378

I don't know what your BASEPORT is, but it looks very wrong.


Welcome in ppc world.

Regards,
Stéphane

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: ioperm
  2004-04-27  9:25 ioperm Sergey Urvanov
@ 2004-04-27 15:59 ` Christopher R. Johnson
  2004-04-27 16:44   ` ioperm Wolfgang Denk
  0 siblings, 1 reply; 9+ messages in thread
From: Christopher R. Johnson @ 2004-04-27 15:59 UTC (permalink / raw)
  To: Sergey Urvanov; +Cc: linuxppc-embedded


I've seen that also - if I remember correctly, it was an issue with the
toolchain.  I don't use eldk however, I roll my own.  Check your include
paths and the linker.  Also, in my environment its #include <sys/io.h>
for ioperm stuff.

Sergey Urvanov wrote:

>Hi
>Anybody seen this error?
>I'm getting it while trying to compile  for a ppc405EP based board,
>using the ELDK 2.1 toolchain (ppc_4xx).
>
>I have a problem with next test code:
>
>#include <stdlib.h>
>#include <stdio.h>
>#include <unistd.h>
>#include <errno.h>
>#include <asm/io.h>
>
>#define BASEPORT 0x378
>
>
>int main (int   argc,
>          char  *argv[])
>{
>        int kz=0;
>        if (ioperm(BASEPORT, 3, 1))
>         {
>                perror ("ioperm");
>                exit (1);
>         }
>        outb(0, BASEPORT);
>        printf ("status 1 %d\n", kz);
>        usleep (100000);
>        kz=inb(BASEPORT+1);
>        printf ("status 2 %d\n", kz);
>        if (ioperm(BASEPORT, 3, 0))
>         {
>                perror ("ioperm");
>                exit (1);
>         }
>        printf ("Stop \n");
>        return 0;
>}
>
>
>I try to make:
>
>/opt/eldk/usr/ppc-linux/bin/gcc -c -O2 test.c
>/opt/eldk/usr/ppc-linux/bin/gcc -o test test.o
>
>And in the answer:
>
>test.o: In function `main':
>test.o(.text+0x2c): undefined reference to `ioperm'
>test.o(.text+0x2c): relocation truncated to fit: R_PPC_REL24 ioperm
>test.o(.text+0x54): undefined reference to `outb'
>test.o(.text+0x54): relocation truncated to fit: R_PPC_REL24 outb
>test.o(.text+0x78): undefined reference to `inb'
>test.o(.text+0x78): relocation truncated to fit: R_PPC_REL24 inb
>test.o(.text+0x98): undefined reference to `ioperm'
>test.o(.text+0x98): relocation truncated to fit: R_PPC_REL24 ioperm
>collect2: ld returned 1 exit status
>
>Any help would be appreciated.
>
>Thanx and regards
>Sergey Urvanov
>
>
>

--
Christopher R. Johnson
Principal Software Engineer
GCC Printers
(781)276-8763


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: ioperm
  2004-04-27 15:59 ` ioperm Christopher R. Johnson
@ 2004-04-27 16:44   ` Wolfgang Denk
  2004-04-27 18:55     ` ioperm Christopher R. Johnson
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Denk @ 2004-04-27 16:44 UTC (permalink / raw)
  To: cjohnson; +Cc: Sergey Urvanov, linuxppc-embedded


In message <408E8346.9070202@gcctech.com> you wrote:
>
> I've seen that also - if I remember correctly, it was an issue with the
> toolchain.  I don't use eldk however, I roll my own.  Check your include

I bet a few beer that this is not a toolchain issue.

> >I'm getting it while trying to compile  for a ppc405EP based board,
...
> >#define BASEPORT 0x378

That smells like x86 PC code. It cannot run on a PowerPC.


Best regards,

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
I've got a bad feeling about this.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: ioperm
  2004-04-27 16:44   ` ioperm Wolfgang Denk
@ 2004-04-27 18:55     ` Christopher R. Johnson
  2004-04-27 19:33       ` ioperm Tom Rini
  2004-04-27 19:50       ` ioperm Wolfgang Denk
  0 siblings, 2 replies; 9+ messages in thread
From: Christopher R. Johnson @ 2004-04-27 18:55 UTC (permalink / raw)
  To: Wolfgang Denk; +Cc: Sergey Urvanov, linuxppc-embedded


Normally I would agree, except that he's getting link errors with
ioperm, inb and outb - he's not even running the code.  As to whether
the code will work, you have an excellent point.  Maybe we're both
right, so beers all around!

Wolfgang Denk wrote:

>In message <408E8346.9070202@gcctech.com> you wrote:
>
>>I've seen that also - if I remember correctly, it was an issue with the
>>toolchain.  I don't use eldk however, I roll my own.  Check your include
>>
>
>I bet a few beer that this is not a toolchain issue.
>
>>>I'm getting it while trying to compile  for a ppc405EP based board,
>>>
>...
>
>>>#define BASEPORT 0x378
>>>
>
>That smells like x86 PC code. It cannot run on a PowerPC.
>
>
>Best regards,
>
>Wolfgang Denk
>
>--
>Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
>Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
>I've got a bad feeling about this.
>
>

--
Christopher R. Johnson
Principal Software Engineer
GCC Printers
(781)276-8763


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: ioperm
  2004-04-27 18:55     ` ioperm Christopher R. Johnson
@ 2004-04-27 19:33       ` Tom Rini
  2004-04-27 19:50       ` ioperm Wolfgang Denk
  1 sibling, 0 replies; 9+ messages in thread
From: Tom Rini @ 2004-04-27 19:33 UTC (permalink / raw)
  To: Christopher R. Johnson; +Cc: Wolfgang Denk, Sergey Urvanov, linuxppc-embedded


On Tue, Apr 27, 2004 at 02:55:33PM -0400, Christopher R. Johnson wrote:

>
> Normally I would agree, except that he's getting link errors with
> ioperm, inb and outb - he's not even running the code.  As to whether
> the code will work, you have an excellent point.  Maybe we're both
> right, so beers all around!

You get link errors on 'ioperm' 'inb' and 'outb' because they don't
exist on PPC.  Wolfgang is of course correct. :)

--
Tom Rini
http://gate.crashing.org/~trini/

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: ioperm
  2004-04-27 18:55     ` ioperm Christopher R. Johnson
  2004-04-27 19:33       ` ioperm Tom Rini
@ 2004-04-27 19:50       ` Wolfgang Denk
  2004-04-28 16:04         ` ioperm Christopher R. Johnson
  1 sibling, 1 reply; 9+ messages in thread
From: Wolfgang Denk @ 2004-04-27 19:50 UTC (permalink / raw)
  To: cjohnson; +Cc: Sergey Urvanov, linuxppc-embedded


In message <408EACA5.8090005@gcctech.com> you wrote:
> Normally I would agree, except that he's getting link errors with
> ioperm, inb and outb - he's not even running the code.  As to whether
> the code will work, you have an excellent point.  Maybe we're both
> right, so beers all around!

He's on a PowerPC system. Quoting "arch/ppc/kernel/syscalls.c":

int sys_ioperm(unsigned long from, unsigned long num, int on)
{
	printk(KERN_ERR "sys_ioperm()\n");
	return -EIO;
}

Guess what?

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
If you think the problem is bad now, just wait until we've solved it.
                                                        Epstein's Law

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: ioperm
  2004-04-27 19:50       ` ioperm Wolfgang Denk
@ 2004-04-28 16:04         ` Christopher R. Johnson
  0 siblings, 0 replies; 9+ messages in thread
From: Christopher R. Johnson @ 2004-04-28 16:04 UTC (permalink / raw)
  To: Wolfgang Denk; +Cc: Sergey Urvanov, linuxppc-embedded


I stand humbled before the master.  Not that I ever doubted, really.
 Please forward information regarding your favorite local bar or liquor
store, along with your beer preference.

Is there a concept of having "I/O permissions" for user mode programs on
ppc?  If so, how do they acquire such permission?

Wolfgang Denk wrote:

>In message <408EACA5.8090005@gcctech.com> you wrote:
>
>>Normally I would agree, except that he's getting link errors with
>>ioperm, inb and outb - he's not even running the code.  As to whether
>>the code will work, you have an excellent point.  Maybe we're both
>>right, so beers all around!
>>
>
>He's on a PowerPC system. Quoting "arch/ppc/kernel/syscalls.c":
>
>int sys_ioperm(unsigned long from, unsigned long num, int on)
>{
>	printk(KERN_ERR "sys_ioperm()\n");
>	return -EIO;
>}
>
>Guess what?
>
>Wolfgang Denk
>
>--
>Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
>Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
>If you think the problem is bad now, just wait until we've solved it.
>                                                        Epstein's Law
>
>

--
Christopher R. Johnson
Principal Software Engineer
GCC Printers
(781)276-8763


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

end of thread, other threads:[~2004-04-28 16:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-27  9:25 ioperm Sergey Urvanov
2004-04-27 15:59 ` ioperm Christopher R. Johnson
2004-04-27 16:44   ` ioperm Wolfgang Denk
2004-04-27 18:55     ` ioperm Christopher R. Johnson
2004-04-27 19:33       ` ioperm Tom Rini
2004-04-27 19:50       ` ioperm Wolfgang Denk
2004-04-28 16:04         ` ioperm Christopher R. Johnson
  -- strict thread matches above, loose matches on Subject: below --
2004-04-27  9:49 ioperm Fillod Stephane
2004-04-27  7:51 ioperm Sergey Urvanov

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