[PATCHES] 11-pcmciaresource

Pavel Roskin proski at gnu.org
Fri Mar 26 17:54:33 GMT 2004

On Fri, 26 Mar 2004, Russell King wrote:

> There may be some ports in the ISA bridge which need to be accessed at
> that address, or maybe the VGA card (I know some VGA cards have resources
> scattered around at, eg, 0x43f8, which VGA drivers and XFree may need
> to access.)
> Really, it is only safe to allocate within the first 256 bytes of every
> 1K of memory on PCI buses in x86 PCs, and for PCMCIA only the lower 1K,
> provided you have full usage information for the motherboard IO ports.

The problem is not specific to x86.  I had some very frustrating
experience with PCMCIA on my Blue&White PowerMac.  I'm writing from
memory, so excuse me possible missing details.

The PCI bus was mapped to 0x1000-0x20ff.  0x2000-0x20ff was taken by the
video card.  Some addresses in 0x1000-0x10ff (like 0x1060-0x106f) were
taken by IDE.  0x1400-0x14ff and 0x1800-0x18ff was used by TI1410.

After many attempts, I set up /etc/pcmcia/config.opts to use
0x1000-0x1fff, hoping that the driver will figure out what addresses to
use.  Initially, my wireless cards worked just fine.

Then I installed a Tulip network card, upgraded the kernel and changed
something in the kernel configuration.  Then I found that PCMCIA stopped
working.  I was getting errors like "IN from bad port 0x1100".

It took me several hours to figure it out.  I could not imagine that
adding a PCI card to this supposedly well engineered and legacy free
machine would be the culprit.

The Tulip card took 0x1000-0x10ff.  All ports above the first 256 bytes in
every kilobyte were indeed unavailable.  The kernel doesn't let any PCI
device to use those "excluded zones" - see pcibios_align_resource() in
arch/ppc/kernel/pci.c.  PCI I/O is mapped to memory on PowerPC, and I
suppose those zones weren't even mapped.

After I discovered that function, I changed config.opts to use
0x1c00-0x1cff.  By the way, the IDE resources moved to 0x1c60-0x1c6f.  If
I had a PCMCIA card that needs 256 ports, I would not be able to use it.

The most outrageous is the fact that the TI bridge was still using two
256-bytes I/O areas - half of the available I/O space!  It was given those
resources by the kernel (or maybe by Open Firmware) to use it for its
operations.  Instead, it was just holding those areas while allocating
other space for the cards.

I believe it's much safer to use preallocated areas rather than allocate
more.  Preallocated areas should take preference over those set up by
cardmgr.  If there are any weird cards that only work at specific
addresses, let's make an exception for them.  Wireless cards are working
fine at any 0x40-aligned address.

Pavel Roskin

More information about the linux-pcmcia mailing list