Skip to contentSkip to conversation

ide: IRQ setup fixes/sanitizations

PATCH In review Bartlomiej Zolnierkiewicz 2 participants 15 messages Jan 19, 2009 libata

lore
Share & tools
lore
#0 lore raw

cover ide: IRQ setup fixes/sanitizations

IRQ setup fixes/sanitizations.

For IDE PCI controllers we now always use pci_get_legacy_ide_irq() if device is in compatibility mode. This in turn allows us to remove no longer needed:
- IRQ hackery from both core code and host drivers
- optional IRQ auto-probing from core code

These patches are on top of:
- pata-2.6 tree
- "[PATCH 0/6] ide: more core code housekeeping" patchset
- "[PATCH] mn10300: add pci_get_legacy_ide_irq() to <asm/pci.h>"

diffstat:

 drivers/ide/amd74xx.c         |   12 ----
 drivers/ide/atiixp.c          |    3 -
 drivers/ide/ide-pci-generic.c |    4 -
 drivers/ide/ide-probe.c       |  114 +++++++-----------------------------------
 drivers/ide/ns87415.c         |    4 -
 drivers/ide/piix.c            |   11 ----
 drivers/ide/serverworks.c     |    9 ---
 drivers/ide/setup-pci.c       |   36 ++++++++-----
 drivers/ide/sis5513.c         |    2 
 drivers/ide/slc90e66.c        |    1 
 drivers/ide/trm290.c          |    3 -
 drivers/ide/via82cxxx.c       |   10 ---
 include/linux/ide.h           |   19 -------
 13 files changed, 49 insertions(+), 179 deletions(-)
#1 lore raw

PATCH 1/12 amd74xx: use ide_pci_is_in_compatibility_mode()

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] amd74xx: use ide_pci_is_in_compatibility_mode()

Fix ->init_hwif to check if IDE PCI controller is in compatibility mode instead of checking for hwif->irq == 0.

---
 drivers/ide/amd74xx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ide/amd74xx.c +1 -1
Index: b/drivers/ide/amd74xx.c
===================================================================
@@ -187,7 +187,7 @@ static void __devinit init_hwif_amd74xx(
 {
 	struct pci_dev *dev = to_pci_dev(hwif->dev);
 
-	if (hwif->irq == 0) /* 0 is bogus but will do for now */
+	if (ide_pci_is_in_compatibility_mode(dev))
 		hwif->irq = pci_get_legacy_ide_irq(dev, hwif->channel);
 }
 
#2 lore raw

PATCH 2/12 ns87415: use pci_get_legacy_ide_irq()

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ns87415: use pci_get_legacy_ide_irq()

Fix ->init_hwif to use pci_get_legacy_ide_irq() instead of __ide_default_irq().

---
 drivers/ide/ns87415.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ide/ns87415.c +1 -1
Index: b/drivers/ide/ns87415.c
===================================================================
@@ -286,7 +286,7 @@ static void __devinit init_hwif_ns87415 
 	}
 
 	if (!using_inta)
-		hwif->irq = __ide_default_irq(hwif->io_ports.data_addr);
+		hwif->irq = pci_get_legacy_ide_irq(dev, hwif->channel);
 	else if (!hwif->irq && hwif->mate && hwif->mate->irq)
 		hwif->irq = hwif->mate->irq;	/* share IRQ with mate */
 
#3 lore raw

PATCH 3/12 ns87415: small ->init_hwif cleanup

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ns87415: small ->init_hwif cleanup

Core IDE PCI code takes care of assigning hwif->irq for both ports.

There should be no functional changes caused by this patch.

---
 drivers/ide/ns87415.c |    2 --
 1 file changed, 2 deletions(-)
drivers/ide/ns87415.c +0 -2
Index: b/drivers/ide/ns87415.c
===================================================================
@@ -287,8 +287,6 @@ static void __devinit init_hwif_ns87415 
 
 	if (!using_inta)
 		hwif->irq = pci_get_legacy_ide_irq(dev, hwif->channel);
-	else if (!hwif->irq && hwif->mate && hwif->mate->irq)
-		hwif->irq = hwif->mate->irq;	/* share IRQ with mate */
 
 	if (!hwif->dma_base)
 		return;
#4 lore raw

PATCH 4/12 trm290: small ->init_hwif cleanup

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] trm290: small ->init_hwif cleanup

Core IDE PCI code takes care of assigning hwif->irq for both ports.

There should be no functional changes caused by this patch.

---
 drivers/ide/trm290.c |    3 ---
 1 file changed, 3 deletions(-)
drivers/ide/trm290.c +0 -3
Index: b/drivers/ide/trm290.c
===================================================================
@@ -277,9 +277,6 @@ static void __devinit init_hwif_trm290(i
 	if (reg & 0x10)
 		/* legacy mode */
 		hwif->irq = hwif->channel ? 15 : 14;
-	else if (!hwif->irq && hwif->mate && hwif->mate->irq)
-		/* sharing IRQ with mate */
-		hwif->irq = hwif->mate->irq;
 
 #if 1
 	{
#5 lore raw

PATCH 5/12 ide: handle IDE_HFLAG[_FORCE]_LEGACY_IRQS in ide_pci_init_{one,two}()

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: handle IDE_HFLAG[_FORCE]_LEGACY_IRQS in ide_pci_init_{one,two}()

Move handling of IDE_HFLAG[_FORCE]_LEGACY_IRQS from ide_init_port() to ide_pci_init_{one,two}().

There should be no functional changes caused by this patch.

---
 drivers/ide/ide-probe.c |    4 ----
 drivers/ide/setup-pci.c |   12 ++++++++++++
 2 files changed, 12 insertions(+), 4 deletions(-)
drivers/ide/ide-probe.c +0 -4
Index: b/drivers/ide/ide-probe.c
===================================================================
@@ -1169,10 +1169,6 @@ static void ide_init_port(ide_hwif_t *hw
 	if (d->init_iops)
 		d->init_iops(hwif);
 
-	if ((!hwif->irq && (d->host_flags & IDE_HFLAG_LEGACY_IRQS)) ||
-	    (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS))
-		hwif->irq = port ? 15 : 14;
-
 	/* ->host_flags may be set by ->init_iops (or even earlier...) */
 	hwif->host_flags |= d->host_flags;
 	hwif->pio_mask = d->pio_mask;
drivers/ide/setup-pci.c +12 -0
Index: b/drivers/ide/setup-pci.c
===================================================================
@@ -570,6 +570,12 @@ int ide_pci_init_one(struct pci_dev *dev
 	/* fixup IRQ */
 	hw[1].irq = hw[0].irq = ret;
 
+	if ((ret == 0 && (d->host_flags & IDE_HFLAG_LEGACY_IRQS)) ||
+	    (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS)) {
+		hw[0].irq = 14;
+		hw[1].irq = 15;
+	}
+
 	ret = ide_host_register(host, d, hws);
 	if (ret)
 		ide_host_free(host);
@@ -620,6 +626,12 @@ int ide_pci_init_two(struct pci_dev *dev
 
 		/* fixup IRQ */
 		hw[i*2 + 1].irq = hw[i*2].irq = ret;
+
+		if ((ret == 0 && (d->host_flags & IDE_HFLAG_LEGACY_IRQS)) ||
+		    (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS)) {
+			hw[i*2].irq = 14;
+			hw[i*2 + 1].irq = 15;
+		}
 	}
 
 	ret = ide_host_register(host, d, hws);
#6 lore raw

PATCH 6/12 ide: use pci_get_legacy_ide_irq() in ide_pci_init_{one,two}()

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: use pci_get_legacy_ide_irq() in ide_pci_init_{one,two}()

---
 drivers/ide/setup-pci.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/ide/setup-pci.c +4 -4
Index: b/drivers/ide/setup-pci.c
===================================================================
@@ -572,8 +572,8 @@ int ide_pci_init_one(struct pci_dev *dev
 
 	if ((ret == 0 && (d->host_flags & IDE_HFLAG_LEGACY_IRQS)) ||
 	    (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS)) {
-		hw[0].irq = 14;
-		hw[1].irq = 15;
+		hw[0].irq = pci_get_legacy_ide_irq(dev, 0);
+		hw[1].irq = pci_get_legacy_ide_irq(dev, 1);
 	}
 
 	ret = ide_host_register(host, d, hws);
@@ -629,8 +629,8 @@ int ide_pci_init_two(struct pci_dev *dev
 
 		if ((ret == 0 && (d->host_flags & IDE_HFLAG_LEGACY_IRQS)) ||
 		    (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS)) {
-			hw[i*2].irq = 14;
-			hw[i*2 + 1].irq = 15;
+			hw[i*2].irq = pci_get_legacy_ide_irq(pdev[i], 0);
+			hw[i*2 + 1].irq = pci_get_legacy_ide_irq(pdev[i], 1);
 		}
 	}
 
#7 lore raw

PATCH 7/12 ide: use ide_pci_is_in_compatibility_mode() in ide_pci_init_{one,two}()

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: use ide_pci_is_in_compatibility_mode() in ide_pci_init_{one,two}()

---
 drivers/ide/setup-pci.c |   16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/ide/setup-pci.c +6 -10
Index: b/drivers/ide/setup-pci.c
===================================================================
@@ -568,13 +568,11 @@ int ide_pci_init_one(struct pci_dev *dev
 		goto out;
 
 	/* fixup IRQ */
-	hw[1].irq = hw[0].irq = ret;
-
-	if ((ret == 0 && (d->host_flags & IDE_HFLAG_LEGACY_IRQS)) ||
-	    (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS)) {
+	if (ide_pci_is_in_compatibility_mode(dev)) {
 		hw[0].irq = pci_get_legacy_ide_irq(dev, 0);
 		hw[1].irq = pci_get_legacy_ide_irq(dev, 1);
-	}
+	} else
+		hw[1].irq = hw[0].irq = ret;
 
 	ret = ide_host_register(host, d, hws);
 	if (ret)
@@ -625,13 +623,11 @@ int ide_pci_init_two(struct pci_dev *dev
 			goto out;
 
 		/* fixup IRQ */
-		hw[i*2 + 1].irq = hw[i*2].irq = ret;
-
-		if ((ret == 0 && (d->host_flags & IDE_HFLAG_LEGACY_IRQS)) ||
-		    (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS)) {
+		if (ide_pci_is_in_compatibility_mode(pdev[i])) {
 			hw[i*2].irq = pci_get_legacy_ide_irq(pdev[i], 0);
 			hw[i*2 + 1].irq = pci_get_legacy_ide_irq(pdev[i], 1);
-		}
+		} else
+			hw[i*2 + 1].irq = hw[i*2].irq = ret;
 	}
 
 	ret = ide_host_register(host, d, hws);
#8 lore raw

PATCH 8/12 ide: remove no longer needed IDE_HFLAG[_FORCE]_LEGACY_IRQS

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: remove no longer needed IDE_HFLAG[_FORCE]_LEGACY_IRQS

There should be no functional changes caused by this patch.

---
 drivers/ide/atiixp.c          |    3 +--
 drivers/ide/ide-pci-generic.c |    4 +---
 drivers/ide/piix.c            |   11 +----------
 drivers/ide/serverworks.c     |    9 ++-------
 drivers/ide/sis5513.c         |    2 +-
 drivers/ide/slc90e66.c        |    1 -
 drivers/ide/via82cxxx.c       |   10 ----------
 include/linux/ide.h           |    4 ----
 8 files changed, 6 insertions(+), 38 deletions(-)
drivers/ide/atiixp.c +1 -2
Index: b/drivers/ide/atiixp.c
===================================================================
@@ -142,7 +142,6 @@ static const struct ide_port_info atiixp
 		.name		= DRV_NAME,
 		.enablebits	= {{0x48,0x01,0x00}, {0x48,0x08,0x00}},
 		.port_ops	= &atiixp_port_ops,
-		.host_flags	= IDE_HFLAG_LEGACY_IRQS,
 		.pio_mask	= ATA_PIO4,
 		.mwdma_mask	= ATA_MWDMA2,
 		.udma_mask	= ATA_UDMA5,
@@ -151,7 +150,7 @@ static const struct ide_port_info atiixp
 		.name		= DRV_NAME,
 		.enablebits	= {{0x48,0x01,0x00}, {0x00,0x00,0x00}},
 		.port_ops	= &atiixp_port_ops,
-		.host_flags	= IDE_HFLAG_SINGLE | IDE_HFLAG_LEGACY_IRQS,
+		.host_flags	= IDE_HFLAG_SINGLE,
 		.pio_mask	= ATA_PIO4,
 		.mwdma_mask	= ATA_MWDMA2,
 		.udma_mask	= ATA_UDMA5,
drivers/ide/ide-pci-generic.c +1 -3
Index: b/drivers/ide/ide-pci-generic.c
===================================================================
@@ -33,8 +33,6 @@ static int ide_generic_all;		/* Set to c
 module_param_named(all_generic_ide, ide_generic_all, bool, 0444);
 MODULE_PARM_DESC(all_generic_ide, "IDE generic will claim all unknown PCI IDE storage controllers.");
 
-#define IDE_HFLAGS_UMC (IDE_HFLAG_NO_DMA | IDE_HFLAG_FORCE_LEGACY_IRQS)
-
 #define DECLARE_GENERIC_PCI_DEV(extra_flags) \
 	{ \
 		.name		= DRV_NAME, \
@@ -61,7 +59,7 @@ static const struct ide_port_info generi
 	/*  2: SAMURAI / HT6565 / HINT_IDE */
 	DECLARE_GENERIC_PCI_DEV(0),
 	/*  3: UM8673F / UM8886A / UM8886BF */
-	DECLARE_GENERIC_PCI_DEV(IDE_HFLAGS_UMC),
+	DECLARE_GENERIC_PCI_DEV(IDE_HFLAG_NO_DMA),
 	/*  4: VIA_IDE / OPTI621V / Piccolo010{2,3,5} */
 	DECLARE_GENERIC_PCI_DEV(IDE_HFLAG_NO_AUTODMA),
 
drivers/ide/piix.c +1 -10
Index: b/drivers/ide/piix.c
===================================================================
@@ -318,19 +318,12 @@ static const struct ide_port_ops ich_por
 	.cable_detect		= piix_cable_detect,
 };
 
-#ifndef CONFIG_IA64
- #define IDE_HFLAGS_PIIX IDE_HFLAG_LEGACY_IRQS
-#else
- #define IDE_HFLAGS_PIIX 0
-#endif
-
 #define DECLARE_PIIX_DEV(udma) \
 	{						\
 		.name		= DRV_NAME,		\
 		.init_hwif	= init_hwif_piix,	\
 		.enablebits	= {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \
 		.port_ops	= &piix_port_ops,	\
-		.host_flags	= IDE_HFLAGS_PIIX,	\
 		.pio_mask	= ATA_PIO4,		\
 		.swdma_mask	= ATA_SWDMA2_ONLY,	\
 		.mwdma_mask	= ATA_MWDMA12_ONLY,	\
@@ -344,7 +337,6 @@ static const struct ide_port_ops ich_por
 		.init_hwif	= init_hwif_piix, \
 		.enablebits	= {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \
 		.port_ops	= &ich_port_ops, \
-		.host_flags	= IDE_HFLAGS_PIIX, \
 		.pio_mask	= ATA_PIO4, \
 		.swdma_mask	= ATA_SWDMA2_ONLY, \
 		.mwdma_mask	= ATA_MWDMA12_ONLY, \
@@ -360,8 +352,7 @@ static const struct ide_port_info piix_p
 		 */
 		.name		= DRV_NAME,
 		.enablebits	= {{0x6d,0xc0,0x80}, {0x6d,0xc0,0xc0}},
-		.host_flags	= IDE_HFLAG_ISA_PORTS | IDE_HFLAG_NO_DMA |
-				  IDE_HFLAGS_PIIX,
+		.host_flags	= IDE_HFLAG_ISA_PORTS | IDE_HFLAG_NO_DMA,
 		.pio_mask	= ATA_PIO4,
 		/* This is a painful system best to let it self tune for now */
 	},
drivers/ide/serverworks.c +2 -7
Index: b/drivers/ide/serverworks.c
===================================================================
@@ -353,14 +353,11 @@ static const struct ide_port_ops svwks_p
 	.cable_detect		= svwks_cable_detect,
 };
 
-#define IDE_HFLAGS_SVWKS IDE_HFLAG_LEGACY_IRQS
-
 static const struct ide_port_info serverworks_chipsets[] __devinitdata = {
 	{	/* 0: OSB4 */
 		.name		= DRV_NAME,
 		.init_chipset	= init_chipset_svwks,
 		.port_ops	= &osb4_port_ops,
-		.host_flags	= IDE_HFLAGS_SVWKS,
 		.pio_mask	= ATA_PIO4,
 		.mwdma_mask	= ATA_MWDMA2,
 		.udma_mask	= 0x00, /* UDMA is problematic on OSB4 */
@@ -369,7 +366,6 @@ static const struct ide_port_info server
 		.name		= DRV_NAME,
 		.init_chipset	= init_chipset_svwks,
 		.port_ops	= &svwks_port_ops,
-		.host_flags	= IDE_HFLAGS_SVWKS,
 		.pio_mask	= ATA_PIO4,
 		.mwdma_mask	= ATA_MWDMA2,
 		.udma_mask	= ATA_UDMA5,
@@ -378,7 +374,6 @@ static const struct ide_port_info server
 		.name		= DRV_NAME,
 		.init_chipset	= init_chipset_svwks,
 		.port_ops	= &svwks_port_ops,
-		.host_flags	= IDE_HFLAGS_SVWKS,
 		.pio_mask	= ATA_PIO4,
 		.mwdma_mask	= ATA_MWDMA2,
 		.udma_mask	= ATA_UDMA5,
@@ -387,7 +382,7 @@ static const struct ide_port_info server
 		.name		= DRV_NAME,
 		.init_chipset	= init_chipset_svwks,
 		.port_ops	= &svwks_port_ops,
-		.host_flags	= IDE_HFLAGS_SVWKS | IDE_HFLAG_SINGLE,
+		.host_flags	= IDE_HFLAG_SINGLE,
 		.pio_mask	= ATA_PIO4,
 		.mwdma_mask	= ATA_MWDMA2,
 		.udma_mask	= ATA_UDMA5,
@@ -396,7 +391,7 @@ static const struct ide_port_info server
 		.name		= DRV_NAME,
 		.init_chipset	= init_chipset_svwks,
 		.port_ops	= &svwks_port_ops,
-		.host_flags	= IDE_HFLAGS_SVWKS | IDE_HFLAG_SINGLE,
+		.host_flags	= IDE_HFLAG_SINGLE,
 		.pio_mask	= ATA_PIO4,
 		.mwdma_mask	= ATA_MWDMA2,
 		.udma_mask	= ATA_UDMA5,
drivers/ide/sis5513.c +1 -1
Index: b/drivers/ide/sis5513.c
===================================================================
@@ -563,7 +563,7 @@ static const struct ide_port_info sis551
 	.name		= DRV_NAME,
 	.init_chipset	= init_chipset_sis5513,
 	.enablebits	= { {0x4a, 0x02, 0x02}, {0x4a, 0x04, 0x04} },
-	.host_flags	= IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_NO_AUTODMA,
+	.host_flags	= IDE_HFLAG_NO_AUTODMA,
 	.pio_mask	= ATA_PIO4,
 	.mwdma_mask	= ATA_MWDMA2,
 };
drivers/ide/slc90e66.c +0 -1
Index: b/drivers/ide/slc90e66.c
===================================================================
@@ -136,7 +136,6 @@ static const struct ide_port_info slc90e
 	.name		= DRV_NAME,
 	.enablebits	= { {0x41, 0x80, 0x80}, {0x43, 0x80, 0x80} },
 	.port_ops	= &slc90e66_port_ops,
-	.host_flags	= IDE_HFLAG_LEGACY_IRQS,
 	.pio_mask	= ATA_PIO4,
 	.swdma_mask	= ATA_SWDMA2_ONLY,
 	.mwdma_mask	= ATA_MWDMA12_ONLY,
drivers/ide/via82cxxx.c +0 -10
Index: b/drivers/ide/via82cxxx.c
===================================================================
@@ -443,16 +443,6 @@ static int __devinit via_init_one(struct
 	if ((via_config->flags & VIA_NO_UNMASK) == 0)
 		d.host_flags |= IDE_HFLAG_UNMASK_IRQS;
 
-#ifdef CONFIG_PPC_CHRP
-	if (machine_is(chrp) && _chrp_type == _CHRP_Pegasos)
-		d.host_flags |= IDE_HFLAG_FORCE_LEGACY_IRQS;
-#endif
-
-#ifdef CONFIG_AMIGAONE
-	if (machine_is(amigaone))
-		d.host_flags |= IDE_HFLAG_FORCE_LEGACY_IRQS;
-#endif
-
 	d.udma_mask = via_config->udma_mask;
 
 	vdev = kzalloc(sizeof(*vdev), GFP_KERNEL);
include/linux/ide.h +0 -4
Index: b/include/linux/ide.h
===================================================================
@@ -1347,10 +1347,6 @@ enum {
 	IDE_HFLAG_ERROR_STOPS_FIFO	= (1 << 19),
 	/* serialize ports */
 	IDE_HFLAG_SERIALIZE		= (1 << 20),
-	/* use legacy IRQs */
-	IDE_HFLAG_LEGACY_IRQS		= (1 << 21),
-	/* force use of legacy IRQs */
-	IDE_HFLAG_FORCE_LEGACY_IRQS	= (1 << 22),
 	/* host is TRM290 */
 	IDE_HFLAG_TRM290		= (1 << 23),
 	/* use 32-bit I/O ops */
#9 lore raw

Re: [PATCH 08/12] ide: remove no longer needed IDE_HFLAG[_FORCE]_LEGACY_IRQS

Hi,

On Mon, Jan 19, 2009 at 3:14 PM, Bartlomiej Zolnierkiewicz <[email protected]> wrote:

[.. ]

Quoted 5 lines

Index: b/include/linux/ide.h
===================================================================

include/linux/ide.h enum { · line 1352

Quoted 10 lines
include/linux/ide.h +0 -4
@@ -1347,10 +1347,6 @@ enum {
       IDE_HFLAG_ERROR_STOPS_FIFO      = (1 << 19),
       /* serialize ports */
       IDE_HFLAG_SERIALIZE             = (1 << 20),
-       /* use legacy IRQs */
-       IDE_HFLAG_LEGACY_IRQS           = (1 << 21),
-       /* force use of legacy IRQs */
-       IDE_HFLAG_FORCE_LEGACY_IRQS     = (1 << 22),
       /* host is TRM290 */
       IDE_HFLAG_TRM290                = (1 << 23),
       /* use 32-bit I/O ops */

maybe contigious numbering of the enums here?

Signature · 2 lines
Regards/Gruss,
Boris
#10 lore raw

Re: [PATCH 08/12] ide: remove no longer needed IDE_HFLAG[_FORCE]_LEGACY_IRQS

Quoted 16 lines · Borislav Petkov

Hi,

On Mon, Jan 19, 2009 at 3:14 PM, Bartlomiej Zolnierkiewicz <[email protected]> wrote:

[.. ]

Quoted 9 lines

Index: b/include/linux/ide.h
===================================================================

include/linux/ide.h +0 -1
@@ -1347,10 +1347,6 @@ enum {
       IDE_HFLAG_ERROR_STOPS_FIFO      = (1 << 19),
       /* serialize ports */
       IDE_HFLAG_SERIALIZE             = (1 << 20),
-       /* use legacy IRQs */
Quoted 8 lines

include/linux/ide.h enum { · line 1352

Quoted 6 lines
include/linux/ide.h +0 -3
-       IDE_HFLAG_LEGACY_IRQS           = (1 << 21),
-       /* force use of legacy IRQs */
-       IDE_HFLAG_FORCE_LEGACY_IRQS     = (1 << 22),
       /* host is TRM290 */
       IDE_HFLAG_TRM290                = (1 << 23),
       /* use 32-bit I/O ops */

maybe contigious numbering of the enums here?

I plan to re-use these two flags quite soon for other purposes so I thought that I may save some time/noise on moving the rest of flags around... :)

#11 lore raw

PATCH 9/12 amd74xx: remove no longer needed ->init_hwif method

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] amd74xx: remove no longer needed ->init_hwif method

This is now handled by core IDE PCI code.

There should be no functional changes caused by this patch.

---
 drivers/ide/amd74xx.c |   10 ----------
 1 file changed, 10 deletions(-)
drivers/ide/amd74xx.c +0 -10
Index: b/drivers/ide/amd74xx.c
===================================================================
@@ -183,14 +183,6 @@ static u8 amd_cable_detect(ide_hwif_t *h
 		return ATA_CBL_PATA40;
 }
 
-static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
-{
-	struct pci_dev *dev = to_pci_dev(hwif->dev);
-
-	if (ide_pci_is_in_compatibility_mode(dev))
-		hwif->irq = pci_get_legacy_ide_irq(dev, hwif->channel);
-}
-
 static const struct ide_port_ops amd_port_ops = {
 	.set_pio_mode		= amd_set_pio_mode,
 	.set_dma_mode		= amd_set_drive,
@@ -207,7 +199,6 @@ static const struct ide_port_ops amd_por
 	{								\
 		.name		= DRV_NAME,				\
 		.init_chipset	= init_chipset_amd74xx,			\
-		.init_hwif	= init_hwif_amd74xx,			\
 		.enablebits	= {{0x40,0x02,0x02}, {0x40,0x01,0x01}},	\
 		.port_ops	= &amd_port_ops,			\
 		.host_flags	= IDE_HFLAGS_AMD,			\
@@ -221,7 +212,6 @@ static const struct ide_port_ops amd_por
 	{								\
 		.name		= DRV_NAME,				\
 		.init_chipset	= init_chipset_amd74xx,			\
-		.init_hwif	= init_hwif_amd74xx,			\
 		.enablebits	= {{0x50,0x02,0x02}, {0x50,0x01,0x01}},	\
 		.port_ops	= &amd_port_ops,			\
 		.host_flags	= IDE_HFLAGS_AMD,			\
#12 lore raw

PATCH 10/12 ide: remove no longer needed IRQ fallback code from hwif_init()

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: remove no longer needed IRQ fallback code from hwif_init()

Then remove no longer used __ide_default_irq().

---
 drivers/ide/ide-probe.c |   30 ++++--------------------------
 include/linux/ide.h     |   15 ---------------
 2 files changed, 4 insertions(+), 41 deletions(-)
drivers/ide/ide-probe.c +4 -26
Index: b/drivers/ide/ide-probe.c
===================================================================
@@ -1056,14 +1056,9 @@ static void drive_release_dev (struct de
 
 static int hwif_init(ide_hwif_t *hwif)
 {
-	int old_irq;
-
 	if (!hwif->irq) {
-		hwif->irq = __ide_default_irq(hwif->io_ports.data_addr);
-		if (!hwif->irq) {
-			printk(KERN_ERR "%s: disabled, no IRQ\n", hwif->name);
-			return 0;
-		}
+		printk(KERN_ERR "%s: disabled, no IRQ\n", hwif->name);
+		return 0;
 	}
 
 	if (register_blkdev(hwif->major, hwif->name))
@@ -1081,29 +1076,12 @@ static int hwif_init(ide_hwif_t *hwif)
 
 	sg_init_table(hwif->sg_table, hwif->sg_max_nents);
 	
-	if (init_irq(hwif) == 0)
-		goto done;
-
-	old_irq = hwif->irq;
-	/*
-	 *	It failed to initialise. Find the default IRQ for 
-	 *	this port and try that.
-	 */
-	hwif->irq = __ide_default_irq(hwif->io_ports.data_addr);
-	if (!hwif->irq) {
-		printk(KERN_ERR "%s: disabled, unable to get IRQ %d\n",
-			hwif->name, old_irq);
-		goto out;
-	}
 	if (init_irq(hwif)) {
-		printk(KERN_ERR "%s: probed IRQ %d and default IRQ %d failed\n",
-			hwif->name, old_irq, hwif->irq);
+		printk(KERN_ERR "%s: disabled, unable to get IRQ %d\n",
+			hwif->name, hwif->irq);
 		goto out;
 	}
-	printk(KERN_WARNING "%s: probed IRQ %d failed, using default\n",
-		hwif->name, hwif->irq);
 
-done:
 	blk_register_region(MKDEV(hwif->major, 0), MAX_DRIVES << PARTN_BITS,
 			    THIS_MODULE, ata_probe, ata_lock, hwif);
 	return 1;
include/linux/ide.h +0 -15
Index: b/include/linux/ide.h
===================================================================
@@ -193,21 +193,6 @@ static inline void ide_std_init_ports(hw
 	hw->io_ports.ctl_addr = ctl_addr;
 }
 
-/* for IDE PCI controllers in legacy mode, temporary */
-static inline int __ide_default_irq(unsigned long base)
-{
-	switch (base) {
-#ifdef CONFIG_IA64
-	case 0x1f0: return isa_irq_to_vector(14);
-	case 0x170: return isa_irq_to_vector(15);
-#else
-	case 0x1f0: return 14;
-	case 0x170: return 15;
-#endif
-	}
-	return 0;
-}
-
 #if defined(CONFIG_ARM) || defined(CONFIG_FRV) || defined(CONFIG_M68K) || \
     defined(CONFIG_MIPS) || defined(CONFIG_MN10300) || defined(CONFIG_PARISC) \
     || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || defined(CONFIG_SPARC64)
#13 lore raw

PATCH 11/12 ide: remove no longer needed IRQ auto-probing from try_to_identify()

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: remove no longer needed IRQ auto-probing from try_to_identify()

---
 drivers/ide/ide-probe.c |   46 ++++++----------------------------------------
 1 file changed, 6 insertions(+), 40 deletions(-)
drivers/ide/ide-probe.c +6 -40
Index: b/drivers/ide/ide-probe.c
===================================================================
@@ -334,56 +334,22 @@ static int actual_try_to_identify (ide_d
  *	@drive: drive to probe
  *	@cmd: command to use
  *
- *	Issue the identify command and then do IRQ probing to
- *	complete the identification when needed by finding the
- *	IRQ the drive is attached to
+ *	Issue the identify command.
  */
  
 static int try_to_identify (ide_drive_t *drive, u8 cmd)
 {
 	ide_hwif_t *hwif = drive->hwif;
 	const struct ide_tp_ops *tp_ops = hwif->tp_ops;
-	int retval;
-	int autoprobe = 0;
-	unsigned long cookie = 0;
 
 	/*
-	 * Disable device irq unless we need to
-	 * probe for it. Otherwise we'll get spurious
-	 * interrupts during the identify-phase that
-	 * the irq handler isn't expecting.
+	 * Disable device IRQ.  Otherwise we'll get spurious interrupts
+	 * during the identify phase that the IRQ handler isn't expecting.
 	 */
-	if (hwif->io_ports.ctl_addr) {
-		if (!hwif->irq) {
-			autoprobe = 1;
-			cookie = probe_irq_on();
-		}
-		tp_ops->set_irq(hwif, autoprobe);
-	}
-
-	retval = actual_try_to_identify(drive, cmd);
-
-	if (autoprobe) {
-		int irq;
-
+	if (hwif->io_ports.ctl_addr)
 		tp_ops->set_irq(hwif, 0);
-		/* clear drive IRQ */
-		(void)tp_ops->read_status(hwif);
-		udelay(5);
-		irq = probe_irq_off(cookie);
-		if (!hwif->irq) {
-			if (irq > 0) {
-				hwif->irq = irq;
-			} else {
-				/* Mmmm.. multiple IRQs..
-				 * don't know which was ours
-				 */
-				printk(KERN_ERR "%s: IRQ probe failed (0x%lx)\n",
-					drive->name, cookie);
-			}
-		}
-	}
-	return retval;
+
+	return actual_try_to_identify(drive, cmd);
 }
 
 int ide_busy_sleep(ide_hwif_t *hwif, unsigned long timeout, int altstatus)
#14 lore raw

PATCH 12/12 ide: remove try_to_identify() wrapper

In reply to Bartlomiej Zolnierkiewicz

From: Bartlomiej Zolnierkiewicz <[email protected]>
Subject: [PATCH] ide: remove try_to_identify() wrapper

There should be no functional changes caused by this patch.

---
 drivers/ide/ide-probe.c |   34 +++++++++-------------------------
 1 file changed, 9 insertions(+), 25 deletions(-)
drivers/ide/ide-probe.c +9 -25
Index: b/drivers/ide/ide-probe.c
===================================================================
@@ -250,7 +250,7 @@ err_misc:
 }
 
 /**
- *	actual_try_to_identify	-	send ata/atapi identify
+ *	try_to_identify	-	send ATA/ATAPI identify
  *	@drive: drive to identify
  *	@cmd: command to use
  *
@@ -264,7 +264,7 @@ err_misc:
  *			2  device aborted the command (refused to identify itself)
  */
 
-static int actual_try_to_identify (ide_drive_t *drive, u8 cmd)
+static int try_to_identify(ide_drive_t *drive, u8 cmd)
 {
 	ide_hwif_t *hwif = drive->hwif;
 	struct ide_io_ports *io_ports = &hwif->io_ports;
@@ -273,6 +273,13 @@ static int actual_try_to_identify (ide_d
 	unsigned long timeout;
 	u8 s = 0, a = 0;
 
+	/*
+	 * Disable device IRQ.  Otherwise we'll get spurious interrupts
+	 * during the identify phase that the IRQ handler isn't expecting.
+	 */
+	if (io_ports->ctl_addr)
+		tp_ops->set_irq(hwif, 0);
+
 	/* take a deep breath */
 	msleep(50);
 
@@ -329,29 +336,6 @@ static int actual_try_to_identify (ide_d
 	return rc;
 }
 
-/**
- *	try_to_identify	-	try to identify a drive
- *	@drive: drive to probe
- *	@cmd: command to use
- *
- *	Issue the identify command.
- */
- 
-static int try_to_identify (ide_drive_t *drive, u8 cmd)
-{
-	ide_hwif_t *hwif = drive->hwif;
-	const struct ide_tp_ops *tp_ops = hwif->tp_ops;
-
-	/*
-	 * Disable device IRQ.  Otherwise we'll get spurious interrupts
-	 * during the identify phase that the IRQ handler isn't expecting.
-	 */
-	if (hwif->io_ports.ctl_addr)
-		tp_ops->set_irq(hwif, 0);
-
-	return actual_try_to_identify(drive, cmd);
-}
-
 int ide_busy_sleep(ide_hwif_t *hwif, unsigned long timeout, int altstatus)
 {
 	u8 stat;