linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Writing to PCI Bridge in User Space - Problem
@ 2001-12-17 19:17 Steven Vacca
  2001-12-17 20:31 ` Dan Malek
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Vacca @ 2001-12-17 19:17 UTC (permalink / raw)
  To: LinuxEmbeddedMailList (E-mail)


I have a "resident" driver which reads and writes a PLX PCI Bridge
chip, which is mapped into 0x2000.0000 in MMU_init() (for the mpc860).

The driver controls an LED, attached to the PLX chip, by writing to the
one of the PLX chip regs whenever its ioctl() fops func is called.

The kernel space, of course, is mapped in at 0xc000.0000.


Immediately before executing  - execve("/sbin/init") -  in init(),
to get the app going, the kernel code can call the same func, say,
led_onOff(), that the driver's ioctl() calls to turn the LED on and OFF.
This works fine.

But when my app executes an ioctl(), and then the driver's ioctl() func
calls the same func, led_onOff(),  the LED doesn't turn ON and OFF
(doesn't do anything).  There are no addr exceptions errors.  The code
in led_onOff executes printk()'s OK.

This func, led_onOff() uses get_user() and put_user() to access the
non-kernel-space address 0x2000.0000 + PLX_reg_offset.


So, why does it work fine just before starting the app, from the non-driver
kernel code, but not from the driver's ioctl fops func?


"Thanks for your help  "
"my fellow linuxonians!"
     /
  \O/
   \/	<---- Steven
 _/\_


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

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

* Re: Writing to PCI Bridge in User Space - Problem
  2001-12-17 19:17 Writing to PCI Bridge in User Space - Problem Steven Vacca
@ 2001-12-17 20:31 ` Dan Malek
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Malek @ 2001-12-17 20:31 UTC (permalink / raw)
  To: svacca@valcom.com; +Cc: LinuxEmbeddedMailList (E-mail)


Steven Vacca wrote:

> I have a "resident" driver which reads and writes a PLX PCI Bridge
> chip, which is mapped into 0x2000.0000 in MMU_init() (for the mpc860).

Bzzzzt!!  Potentially wrong answer.  How are you "mapping" it?  If you
are using ioremap(), this isn't going to work.  You either need to map it
much later in the kernel initialization, after the kernel VM is set up,
or by carefully choosing addresses for io_block_mapping().


> So, why does it work fine just before starting the app, from the non-driver
> kernel code, but not from the driver's ioctl fops func?

Because if you just use ioremap(), it placed the virtual address into the
user space.  When you started up the user programs the mapping was used for
it's intended purpose (user space).  There are plenty of messages in the
archives and FAQs describing the memory mapping.

Thanks.


	-- Dan


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

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

end of thread, other threads:[~2001-12-17 20:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-17 19:17 Writing to PCI Bridge in User Space - Problem Steven Vacca
2001-12-17 20:31 ` Dan Malek

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