Skip to contentSkip to conversation

Why does printk helps PCMCIA card to initialise?

DISCUSSION David Hinds 1 participant 1 message Feb 22, 2005

lore
Share & tools
lore
#0 lore raw
Quoted 9 lines · Linus Torvalds
Quoted 6 lines · Russell King

In cs.c, alloc_io_space(), find the line:

if (*base & ~(align-1)) {

delete the ~ and rebuild. This may resolve your problem.

Unlikely. The code is too broken for words.

The original code is correct; you are misinterpreting the meaning of the "align" variable here. PCMCIA cards can request a specific base IO address, and can also specify how many IO address lines they decode. The number of decoded lines determines a maximal alignment restriction for a card; if it only decodes 3 lines, then it should not reasonably ask for an IO region with more specificity than being on an 8 port boundary. The "align" variable here holds this alignment. The "oddness" here is that the card is providing conflicting information, that it needs IO ports at a specific address, but is only decoding 3 address lines (i.e. align=8).

The names of "base" and "align" have the expected meanings when a card only specifies one or the other. It's only for the case where both are specified that the meaning is complicated. Then, "base" is more like an offset into a block that has "align" alignment

Given an "odd" request for a base=0x260 and align=8, the allocator promotes this to align=0x400, and would allow addresses 0x260, 0x660, 0xa60, 0xe60, etc, subject to restrictions in /etc/pcmcia/config.opts.

The real problem here is that all the IO address ranges the card claims to support were unavailable. I'd first try adding:

include port 0x0600-0x07ff

to /etc/pcmcia/config.opts to give the allocator more flexibility in choosing port ranges.

-- Dave