All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Dan Malek <dan@embeddededge.com>, Ralph Blach <rcblach@us.ibm.com>
Cc: <linuxppc-dev@lists.linuxppc.org>
Subject: Re: IO_BASE woes.
Date: Wed, 5 Dec 2001 21:08:26 +0100	[thread overview]
Message-ID: <20011205200826.9049@smtp.wanadoo.fr> (raw)
In-Reply-To: <3C0E7378.9040706@embeddededge.com>


>
>Ralph Blach wrote:
>
>
>> Along with the PCI, this spells a lot of rewrite of code.
>
>Well, I wouldn't say lots.
>
>A properly written PCI driver isn't an issue, since it shouldn't
>use in/out with IO_BASE any more, especially on PowerPC.  When
>you stumble into drivers that don't do this, they should be modified
>and changes submitted to the author.
>
>For "ISA" chips on processor busses, you just need to get into the
>habit of doing something similar as we should be doing with PCI.
>Simply ioremap the address and use the I/O memory read/write operations.
>I regularly do this, it only requires changes to a few lines of code,
>and sometimes the authors will actually accept the changes.

Well... I can still understand why this is a problem for him. First
there are still PCI drivers that need ibx/outx & PIO, and for
PCMCIA, the current PCMCIA code & drivers more/less makes it
mandatory to support PIO as well.

The best solution I beleive is along those lines:

 - Change 4xx _IO_BASE definition to use the software IO base as used
by the common platform (CONFIG_ALL_PPC). Provided that you properly
set isa_io_base in arch, PCI IOs will still work out of the box.

 - Treat PCMCIA like if it was on a different PCI domain. AFAIK, all
pcmcia drivers can grok beeing passed a base to use for their IO
accesses. Pass them a virtual address which is the virtual address
of the IO space of the PCMCIA bridge minus _IO_BASE (the vitual
address of the PCI IO space). If drivers are written properly,
pointer arithmetic will then make their inx/outx tap the proper
IO space. Example:

   pcmcia_io_base = ioremap(PCMCIA_PHYS_IO_BASE, 0x10000);

Then pass to the pcmcia layer an available IO resource of the
form pcmcia_io_base - _IO_BASE + whatever offset. The net result
for drivers will be to pass inx/outx an address of the form
pcmcia_io_base - _IO_BASE + port. inx/outx will then do +_IO_BASE,
thus causing an access to pcmcia_io_base + port, which is what
you want.

 - For ISA-like devices on EBC, if those drivers can use a base address,
use the exact same trick as PCMCIA. Else, hack the drivers to use mmio
instead, in most cases it's just a matter of search/replace inx/outx
occurence with a driver custom macro that takes into account an
ioremap'ed base.

Note: The reason most of this is so crappy is that x86 still has
separate IO instructions with no remapping facility and some devices
still make use of that. In 2.5, there will hopefully be mandatory
use of an ioremap-like function for PIO as well, which will let
the platform code "cook" whatever virtual pointer is needed.

Ben.


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

      reply	other threads:[~2001-12-05 20:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-05 18:59 IO_BASE woes Ralph Blach
2001-12-05 19:20 ` Dan Malek
2001-12-05 20:08   ` Benjamin Herrenschmidt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20011205200826.9049@smtp.wanadoo.fr \
    --to=benh@kernel.crashing.org \
    --cc=dan@embeddededge.com \
    --cc=linuxppc-dev@lists.linuxppc.org \
    --cc=rcblach@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.