linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Re: [linux-fbdev] Retrace
@ 2000-02-08 10:02 Geert Uytterhoeven
  2000-02-09  2:45 ` Paul Mackerras
  0 siblings, 1 reply; 15+ messages in thread
From: Geert Uytterhoeven @ 2000-02-08 10:02 UTC (permalink / raw)
  To: Linux/PPC Development


---------- Forwarded message ----------
Date: Mon, 7 Feb 2000 18:16:21 +0100 (CET)
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Petr Vandrovec <VANDROVE@vc.cvut.cz>
Cc: Stefan Berndtsson <stefan@nocrew.org>, linux-fbdev@vuser.vu.union.edu,
     Linux/PPC Development <linuxppc-dev@cs.wisc.edu>
Subject: Re: [linux-fbdev] Retrace

On Tue, 1 Feb 2000, Petr Vandrovec wrote:
> On  1 Feb 00 at 13:14, Stefan Berndtsson wrote:
> > >   For now you have to do iopl(3); inb(0x3DA); iopl(0);... (you have to be
> > > root to do this. As alternative on matroxfb, you can mmap accelerator
> > > space and read register at offset 0x1FDA in this space. It contains
> > > same value as port 0x3DA does, but for mmapping /dev/fbX you do not
> > > need root rights.
> > You (or anyone really) wouldn't happen to know how to access 0x3da, or
> > whatever equivalent method there is, on an ATI Rage Pro LT, running
> > on PPC?
> I believe that on PReP it is byte in memory (/dev/mem) at physical address
> 0x800003DA, but Geert probably knows more details (maybe there is even

First you have to mmap() ISA I/O space using /dev/mem and put the mapped
address in isa_io_base. Then you can use inb() and friends (cfr.
include/asm-ppc/io.h).

And now the bad news: the address you have to mmap() depends on the machine
type :-(

> /dev/ioport on PPC).

Nope. But perhaps we should remove the #if !defined(CONFIG_PPC) around the
port operations in drivers/char/mem.c?

Gr{oetje,eeting}s,
--
Geert Uytterhoeven -- Linux/{m68k~Amiga,PPC~CHRP} -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: [linux-fbdev] Retrace
@ 2000-02-08 16:00 Andy
  0 siblings, 0 replies; 15+ messages in thread
From: Andy @ 2000-02-08 16:00 UTC (permalink / raw)
  To: amarder; +Cc: linuxppc-dev, linux-fbdev






On Tue, Feb 8, 2000, Gabriel Paubert <paubert@iram.es> wrote:

>On x86 you have /dev/port which is disabled on PPC. I once or twice
>suggested (but was greeted with a deafening silence) that we could
>resurrect it and add an mmap method so that privileged programs may access
>I/O ports with:
>
>	io_fd= open("/dev/port", O_RDWR);
>	iobase=mmap(0, device_size, PROT_READ|PROT_WRITE, MAP_SHARED,
>			io_fd, device_base);
>
>
>> Unfortunately, with weird host bridges like Apple Uni-N (that has 3
>> busses with 3 different io bases but the same bus number), it's almost
>> impossible to get it correct, or eventually by parsing /proc/device-tree.
>
>Not a problem if device_base is unique, you have to check that
>device_base+device_size fits within one area. It must be unique at one
>point to distinguish them from the processor perspective.

device_base may not be unique. Actually, that depends what is device_base
and how it's retreived. But for example, reading the BARs can give you
identical io base for devices on different sub-bridges, the distinction
beeing done by the iobase of the bridge itself.

The fact is that macos don't care, since it's completely based on the
device-tree, MacOS-drivers call in/out functions that use the base
address of the parent bridge.

I have in mind the possibility of defining fake bridges in the kernel to
work around the Uni-N problem as a whole, but this leads to a bunch of
other problems (like desynchro with the device-tree, which can be
annoying for other things) and I'm not familiar enough with 2.3.x PCI
layer yet.

What's the usual method used by X-like apps to get the base of a device ?
/proc/pci ?

We could also have /proc/pci export "fixed" bases that already take into
account the iobase of the bridge.

We are in a realm where I lack experience with Linux to be able to tell
which solution is better (and have more chances of beeing accepted ;)


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

^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: [linux-fbdev] Retrace
@ 2000-02-08 21:29 Benjamin Herrenschmidt
  2000-02-09  9:57 ` Gabriel Paubert
  0 siblings, 1 reply; 15+ messages in thread
From: Benjamin Herrenschmidt @ 2000-02-08 21:29 UTC (permalink / raw)
  To: Gabriel Paubert, linuxppc-dev, linux-fbdev


On Tue, Feb 8, 2000, Gabriel Paubert <paubert@iram.es> wrote:

>	deviobase = ioport_ptr(dev->resource[0]);
>
>	data = inl(deviobase+register_offset);
>
>and for an MMIO mapped area:
>
>	mmioptr = ioremap(ioremap_ptr(dev->resource[1]));
>
>	data = readl(mmioptr+register_offset);

Is it possible to "walk up" the resource tree from dev->resource[0] ? I
mean, the ioport_ptr function, to work on those weird Apple bridges, need
to go thru a special routine that looks up the device in OF device tree
to find out on which sub-bridge it is.
In order to do that, it needs the pci dev_fn. Can this be retreived from
dev->resource[0] ?

Also, this doesn't solve the userland problem.


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

^ permalink raw reply	[flat|nested] 15+ messages in thread
* RE: [linux-fbdev] Retrace
@ 2000-02-09 13:45 Patrick Lerda
  2000-02-09 14:09 ` Gabriel Paubert
  0 siblings, 1 reply; 15+ messages in thread
From: Patrick Lerda @ 2000-02-09 13:45 UTC (permalink / raw)
  To: Geert Uytterhoeven, linuxppc-dev, linux-fbdev,
	'Benjamin Herrenschmidt'


The best way to handle, PCI devices base_address[] on an independant
processor way, is
to use physical memory pointers, we can do this trick on the linux pcifixup
subroutine,
some PPC architectures don't change this value and leave the pci bus
address, this address
can't be used easely... Using the physical memory works with all well
written linux drivers, because
the base_address is taken and used as an argument to ioremap to get a
virtual pointer.


Patrick LERDA


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

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

end of thread, other threads:[~2000-02-09 14:09 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <Pine.LNX.4.10.10002071812050.1142-100000@cassiopeia.home>
2000-02-07 19:02 ` [linux-fbdev] Retrace Benjamin Herrenschmidt
2000-02-08  9:29   ` Gabriel Paubert
2000-02-08 14:56     ` Benjamin Herrenschmidt
2000-02-08 16:47       ` Gabriel Paubert
2000-02-08 16:51       ` Geert Uytterhoeven
2000-02-08 17:09         ` Gabriel Paubert
2000-02-08 21:30         ` Benjamin Herrenschmidt
2000-02-08 21:39           ` Geert Uytterhoeven
2000-02-08 10:02 Geert Uytterhoeven
2000-02-09  2:45 ` Paul Mackerras
  -- strict thread matches above, loose matches on Subject: below --
2000-02-08 16:00 Andy
2000-02-08 21:29 Benjamin Herrenschmidt
2000-02-09  9:57 ` Gabriel Paubert
2000-02-09 13:45 Patrick Lerda
2000-02-09 14:09 ` Gabriel Paubert

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