Re: PCI/cardbus resources (was Re: xircom_tulip_cb ...)

From: Linus Torvalds (torvalds@transmeta.com)
Date: Mon May 15 2000 - 15:40:14 EST


In article <20000515102236.G903@informatics.muni.cz>,
Jan Kasprzak <kas@informatics.muni.cz> wrote:
>
> Howewer, I haven't been able to make the modem part of this
>card working under 2.3 (2.2 works fine). The problem seems to be that
>the PCI allocation resource code fails to allocate the I/O ports resource
>for the modem part. It seems it tries to allocate the I/O ports from
>wrong resource root.

Ok, this is due to a rather buggy pcibios_align_resource() in
arch/i386/kernel/pci-i386.c. It refuses to allocate any IO ports at
anything but 1024-byte aligned addresses, which makes it quite hard
(read: impossible) to sanely sub-divide the IO window that we have
allocated for CardBus cards..

Can you try to replace the current one with this one instead, and see if
it works for you?

Martin, comments? This new alignment version should much more closely
match what we really want to do.

                Linus

----
/*
 * We need to avoid collisions with `mirrored' VGA ports
 * and other strange ISA hardware, so we always want the
 * addresses to be allocated in the 0x000-0x0ff region
 * modulo 0x400.
 * 
 * Why? Because some silly external IO cards only decode
 * the low 10 bits of the IO address. The 0x00-0xff region
 * is reserved for motherboard devices that decode all 16
 * bits, so it's ok to allocate at, say, 0x2800-0x28ff,
 * but we want to try to avoid allocating at 0x2900-0x2bff
 * which might have be mirrored at 0x0100-0x03ff..
 */
void
pcibios_align_resource(void *data, struct resource *res, unsigned long size)
{ 
	struct pci_dev *dev = data;

if (res->flags & IORESOURCE_IO) { unsigned long start = res->start;

if (size > 0x100) { printk(KERN_ERR "PCI: I/O Region %s/%d too large" " (%ld bytes)\n", dev->slot_name, dev->resource - res, size); }

if (start & 0x300) { start = (start + 0x3ff) & ~0x3ff; res->start = start; } } }

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon May 15 2000 - 21:00:26 EST