[ide] add pci_get_legacy_ide_irq()

This patch adds pci_get_legacy_ide_irq() to the PCI layer for dealing
with PCI IDE chipsets that use the "legacy mode" IRQ routing, thus
violating the normal PCI routing.  The generic implementation provides
IRQ numbers 14 and 15, and it adds a ppc64 specific one with platform
callbacks so that a plaform can provide different IRQ numbers for "legacy"
IDE.  I only fixed the amd7xxx.c driver for now, I expect people using
this interface will slowly fix their drivers (I will fix via soon as I'll
need it too, and maybe a few others).
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 9568aa90
......@@ -416,8 +416,8 @@ static void __init init_hwif_amd74xx(ide_hwif_t *hwif)
{
int i;
if (!hwif->irq)
hwif->irq = hwif->channel ? 15 : 14;
if (hwif->irq == 0) /* 0 is bogus but will do for now */
hwif->irq = pci_get_legacy_ide_irq(hwif->pci_dev, hwif->channel);
hwif->autodma = 0;
......
......@@ -24,4 +24,11 @@ pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
#define pcibios_scan_all_fns(a, b) 0
#ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
{
return channel ? 15 : 14;
}
#endif /* HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ */
#endif
......@@ -119,6 +119,9 @@ struct machdep_calls {
/* Check availability of legacy devices like i8042 */
int (*check_legacy_ioport)(unsigned int baseport);
/* Get legacy PCI/IDE interrupt mapping */
int (*pci_get_legacy_ide_irq)(struct pci_dev *dev, int channel);
};
extern struct machdep_calls ppc_md;
......
......@@ -13,6 +13,7 @@
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/dma-mapping.h>
#include <asm/machdep.h>
#include <asm/scatterlist.h>
#include <asm/io.h>
#include <asm/prom.h>
......@@ -20,6 +21,8 @@
#define PCIBIOS_MIN_IO 0x1000
#define PCIBIOS_MIN_MEM 0x10000000
struct pci_dev;
#ifdef CONFIG_PPC_ISERIES
#define pcibios_scan_all_fns(a, b) 0
#else
......@@ -36,7 +39,13 @@ static inline void pcibios_penalize_isa_irq(int irq)
/* We don't do dynamic PCI IRQ allocation */
}
struct pci_dev;
#define HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
{
if (ppc_md.pci_get_legacy_ide_irq)
return ppc_md.pci_get_legacy_ide_irq(dev, channel);
return channel ? 15 : 14;
}
#define HAVE_ARCH_PCI_MWI 1
static inline int pcibios_prep_mwi(struct pci_dev *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment