Re: [RFC] I/O Access Abstractions

2001-07-07 Thread Geert Uytterhoeven
On Tue, 3 Jul 2001, David Howells wrote: > > The question I think being ignored here is. Why not leave things as is. The > > multiple bus stuff is a port specific detail hidden behind readb() and > > friends. > > This isn't so much for the case where the address generation is done by a > simple a

Re: [RFC] I/O Access Abstractions

2001-07-07 Thread Geert Uytterhoeven
On Tue, 3 Jul 2001, David Howells wrote: > * It should make drivers easier to write: they don't have to worry about >whether a resource refers to memory or to I/O or to something more exotic. > > * It makes some drivers more flexible. For example, the ne2k-pci driver has >to be set at _

Re: [RFC] I/O Access Abstractions

2001-07-03 Thread Benjamin Herrenschmidt
>> I'm more concerned about having all that space mapped permanently in >> kernel virtual space. I'd prefer mapping on-demand, and that would >> require a specific ioremap for IOs. > >I have no problem with the idea of a function to indicate which I/O maps you >are and are not using. But passing r

Re: [RFC] I/O Access Abstractions

2001-07-03 Thread Alan Cox
> I'm more concerned about having all that space mapped permanently in > kernel virtual space. I'd prefer mapping on-demand, and that would > require a specific ioremap for IOs. I have no problem with the idea of a function to indicate which I/O maps you are and are not using. But passing resourc

Re: [RFC] I/O Access Abstractions

2001-07-03 Thread Alan Cox
> For example, one board I've got doesn't allow you to do a straight > memory-mapped I/O access to your PCI device directly, but have to reposition a > window in the CPU's memory space over part of the PCI memory space first, and > then hold a spinlock whilst you do it. What does this prove. PA-R

Re: [RFC] I/O Access Abstractions

2001-07-03 Thread Jeff Garzik
David Howells wrote: > Of course, however, this still requires cookie decoding to be done in readb > and writeb (even on the i386). So why not use resource struct? IMHO that makes the operation too heavyweight on architectures where that level of abstraction is not needed. -- Jeff Garzik |

Re: [RFC] I/O Access Abstractions

2001-07-03 Thread David Howells
> I also point out that using ioremap for PIO adds flexibility while > keeping most drivers relatively unchanged. Everyone uses a base address > anyway, so whether its obtained directly (address from PCI BAR) or > indirectly (via ioremap), you already store it and use it. I see what you're gett

Re: [RFC] I/O Access Abstractions

2001-07-03 Thread David Howells
Jeff Garzik <[EMAIL PROTECTED]> wrote: > Alan Cox wrote: > > > > > > > You pass a single cookie to the readb code > > > > > Odd platforms decode it > > > > > > > > Last time I checked, ioremap didn't work for inb() and outb(). > > > > > > It should :) > > > > it doesnt need to. > >

Re: [RFC] I/O Access Abstractions

2001-07-03 Thread Jeff Garzik
I also point out that using ioremap for PIO adds flexibility while keeping most drivers relatively unchanged. Everyone uses a base address anyway, so whether its obtained directly (address from PCI BAR) or indirectly (via ioremap), you already store it and use it. Further, code lacking ioremap f

Re: [RFC] I/O Access Abstractions

2001-07-03 Thread Jeff Garzik
David Howells wrote: > > Jeff Garzik <[EMAIL PROTECTED]> wrote: > > Russell King wrote: > > > > > > On Mon, Jul 02, 2001 at 05:56:56PM +0100, Alan Cox wrote: > > > > Case 1: > > > > You pass a single cookie to the readb code > > > > Odd platforms decode it > > > > > > Last time I chec

Re: [RFC] I/O Access Abstractions

2001-07-03 Thread David Howells
Jeff Garzik <[EMAIL PROTECTED]> wrote: > Russell King wrote: > > > > On Mon, Jul 02, 2001 at 05:56:56PM +0100, Alan Cox wrote: > > > Case 1: > > > You pass a single cookie to the readb code > > > Odd platforms decode it > > > > Last time I checked, ioremap didn't work for inb() and

Re: [RFC] I/O Access Abstractions

2001-07-03 Thread David Howells
Russell King <[EMAIL PROTECTED]> wrote: > They _ARE_ different, because people connect these chips in many different > ways. For example: Also hence the mess in serial.c. On the board I'm currently dealing with, the PC16550 chip is connected to the memory space with registers at 4-byte interval

Re: [RFC] I/O Access Abstractions

2001-07-03 Thread David Howells
> David Howells wrote: > > For example, one board I've got doesn't allow you to do a straight > > memory-mapped I/O access to your PCI device directly, but have to > > reposition a window in the CPU's memory space over part of the PCI memory > > space first, and then hold a spinlock whilst you do

Re: [RFC] I/O Access Abstractions

2001-07-03 Thread Jeff Garzik
David Howells wrote: > For example, one board I've got doesn't allow you to do a straight > memory-mapped I/O access to your PCI device directly, but have to reposition a > window in the CPU's memory space over part of the PCI memory space first, and > then hold a spinlock whilst you do it. Yuck.

Re: [RFC] I/O Access Abstractions

2001-07-03 Thread David Howells
> The question I think being ignored here is. Why not leave things as is. The > multiple bus stuff is a port specific detail hidden behind readb() and > friends. This isn't so much for the case where the address generation is done by a simple addition. That could be optimised away by the compile

Re: [RFC] I/O Access Abstractions

2001-07-02 Thread Jeff Garzik
Alan Cox wrote: > > > > > You pass a single cookie to the readb code > > > > Odd platforms decode it > > > > > > Last time I checked, ioremap didn't work for inb() and outb(). > > > > It should :) > > it doesnt need to. > > pci_find_device returns the io address and can return a coo

Re: [RFC] I/O Access Abstractions

2001-07-02 Thread Benjamin Herrenschmidt
> >Can you give me an idea of what sort of cookie decoding a PPC/PMac would need >and why - Im working off things like pa-risc so I dont have a full picture. Each domain provide an IO space (size depends on the bridge, recent Apple UniNorth hosts have 16Mb per domain). That IO space can be in a

Re: [RFC] I/O Access Abstractions

2001-07-02 Thread Alan Cox
> - Parsing of this cookie on each inx/outx access, which can > take a bit of time (typically looking up the host bridge) It depends on the implementation obviously, but its typically something like take lock writew(port&0x, port&0x); writew(data, port&0x

Re: [RFC] I/O Access Abstractions

2001-07-02 Thread Benjamin Herrenschmidt
>Last time I checked, ioremap didn't work for inb() and outb(). ioremap itself cannot work for inb/outb as they are different address spaces with potentially overlapping addresses, I don't see how a single function would handle both... except if we pass it a struct resource instead of the address

Re: [RFC] I/O Access Abstractions

2001-07-02 Thread Benjamin Herrenschmidt
>> > Last time I checked, ioremap didn't work for inb() and outb(). >> >> It should :) > >it doesnt need to. > >pci_find_device returns the io address and can return a cookie, ditto >isapnp etc Yes, but doing that require 2 annoying things: - Parsing of this cookie on each inx/outx access, wh

Re: [RFC] I/O Access Abstractions

2001-07-02 Thread Alan Cox
> > > You pass a single cookie to the readb code > > > Odd platforms decode it > > > > Last time I checked, ioremap didn't work for inb() and outb(). > > It should :) it doesnt need to. pci_find_device returns the io address and can return a cookie, ditto isapnp etc - To unsubscr

Re: [RFC] I/O Access Abstractions

2001-07-02 Thread Jeff Garzik
Russell King wrote: > > On Mon, Jul 02, 2001 at 05:56:56PM +0100, Alan Cox wrote: > > Case 1: > > You pass a single cookie to the readb code > > Odd platforms decode it > > Last time I checked, ioremap didn't work for inb() and outb(). It should :) -- Jeff Garzik | "I respect

Re: [RFC] I/O Access Abstractions

2001-07-02 Thread Russell King
On Mon, Jul 02, 2001 at 05:56:56PM +0100, Alan Cox wrote: > Case 1: > You pass a single cookie to the readb code > Odd platforms decode it Last time I checked, ioremap didn't work for inb() and outb(). -- Russell King ([EMAIL PROTECTED])The developer of ARM Linux

Re: [RFC] I/O Access Abstractions

2001-07-02 Thread Alan Cox
> Because if we just pass in this one extra piece of information which is > normally already available in the driver, we can avoid a whole lot of ugly > cruft in the out-of-line functions by plugging in the correct out-of-line > function to match the resource. Case 1: You pass a single

Re: [RFC] I/O Access Abstractions

2001-07-02 Thread David Woodhouse
[EMAIL PROTECTED] said: > The question I think being ignored here is. Why not leave things as > is. Because if we just pass in this one extra piece of information which is normally already available in the driver, we can avoid a whole lot of ugly cruft in the out-of-line functions by plugging i

Re: [RFC] I/O Access Abstractions

2001-07-02 Thread Alan Cox
> [EMAIL PROTECTED] said: > > I think the second #define should be: > > #define res_readb(res, adr) readb(res->start+adr) > > for consistency. > > You're right that it should be consistent. But it doesn't really matter > whether we pass an offset within the resource, or whether we continue

Re: [RFC] I/O Access Abstractions

2001-07-02 Thread David Woodhouse
[EMAIL PROTECTED] said: > I think the second #define should be: > #define res_readb(res, adr) readb(res->start+adr) > for consistency. You're right that it should be consistent. But it doesn't really matter whether we pass an offset within the resource, or whether we continue to pass the

Re: [RFC] I/O Access Abstractions

2001-07-02 Thread David Howells
> #ifdef OUT_OF_LINE_MMIO > #define res_readb(res, adr) (res->access_ops->readb(res, adr) > #else > #define res_readb(res, adr) readb(adr) > #endif I think the second #define should be: #define res_readb(res, adr) readb(res->start+adr) for consistency. David - To unsubscribe from this

Re: [RFC] I/O Access Abstractions

2001-07-02 Thread David Woodhouse
[EMAIL PROTECTED] said: > But it's going to cost for the ones who do not support this. You don't need to make it out-of-line for all cases - or indeed in any case where it isn't out-of-line already. Some architectures may have only IO calls out-of-line (many already do). Some may have MMIO cal

Re: [RFC] I/O Access Abstractions

2001-06-29 Thread Jes Sorensen
> "David" == David Howells <[EMAIL PROTECTED]> writes: David> Jes Sorensen <[EMAIL PROTECTED]> wrote: >> Have you considered the method used by the 8390 Ethernet driver? >> For each device, add a pointer to the registers and a register >> shift. David> And also flags to specify which addres

Re: [RFC] I/O Access Abstractions

2001-06-29 Thread David Howells
Jes Sorensen <[EMAIL PROTECTED]> wrote: > > "David" == David Woodhouse <[EMAIL PROTECTED]> writes: > > David> Having per-resource I/O methods would help us to remove some of > David> the cruft which is accumulating in various non-x86 code. Note > David> that the below is the _core_ routines

Re: [RFC] I/O Access Abstractions

2001-06-28 Thread Jes Sorensen
> "David" == David Woodhouse <[EMAIL PROTECTED]> writes: David> Having per-resource I/O methods would help us to remove some of David> the cruft which is accumulating in various non-x86 code. Note David> that the below is the _core_ routines for _one_ board - I'm not David> even including the

Re: [RFC] I/O Access Abstractions

2001-06-28 Thread David Woodhouse
[EMAIL PROTECTED] said: > PCI memory (and sometimes I/O) writes are posted, Since x86 memory > writes are also parallelisable instructions and since the CPU merely > has to retire the writes in order your stall basically doesnt exist. True. I can envisage a situation where the overhead of the f

Re: [RFC] I/O Access Abstractions

2001-06-28 Thread Alan Cox
>Also on an i386, the actual I/O instruction itself is going to take a >comparatively long time anyway, given the speed differential between CPU >and external buses. PCI memory (and sometimes I/O) writes are posted, Since x86 memory writes are also parallelisable instructions and sinc