Re: 2.5.20 - Xircom PCI Cardbus doesn't work

From: Linus Torvalds (torvalds@transmeta.com)
Date: Sat Jun 15 2002 - 13:48:17 EST


On Fri, 14 Jun 2002, Jeff Garzik wrote:
>
> Can someone clarify for me the need of pci_request_irq??
>
> pci_enable_device() assigns the IRQ in routing, but it is not enabled
> until you call request_irq. I don't see any simplification that can be
> done in the PCI API.

The irq _is_ enabled ona hardware level.

Which can be a total disaster if there are shared PCI irq's, and the
interrupt is "screaming" (ie an active level-sensitive thing).

We've had this on cardbus, for example, where we need to do an
"pci_emable_device()" in order to get access to the PCI IO mappings, which
are needed to shut the device up.

Right now the solution to a screaming device can be something as nasty as

        cli();
        pci_enable_device();
        disable_irq(dev->irq);
        sti();

        /* IRQ handling needs this ioremapped */
        membase = ioremap(dev->resource[]);
        request_irq(dev->irq);

        /* Now we can enable the irq, because we have a valid handler */
        enable_irq(dev->irq);

which is horribly stupid. We really want to do

        pci_enable_mem(dev);
        membase = ioremap(dev->resource[]);

        pci_request_irq(dev, irq_handler);

where "pci_request_irq()" enables the interrupt and adds an interrupt
handler atomically.

> The only thing I've wanted is a cross-platform way to detect if
> pdev->irq returned by pci_enable_device is valid.

It's required to be valid, because if it isn't, then the platform is
broken. There are no cross-platform issues: complain to the platform
vendor and/or the linux code for that architecture.

                Linus

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



This archive was generated by hypermail 2b29 : Sat Jun 15 2002 - 22:00:33 EST