Skip to contentSkip to conversation

libata: irq_on/off restructuring

PATCH In review Albert Lee 2 participants 12 messages Jun 15, 2007 – Jun 18, 2007

Subsystems (2)
lore
Share & tools
lore

Albert Lee

author
#0 lore raw

cover libata: irq_on/off restructuring

For ATA, there are two levels of mechanism available to turn irq on/off.
- device level: nIEN bit in the control register. nIEN masks INTRQ from the device.
- host adapter level: some controller can mask out per-port irq from the host adapter.

Currently various parts of libata deal with irq on/off.
ex. tf_load() can alter the nIEN bit.
ex. irq_on() also alters the device level nIEN bit. ex. freeze()/thaw() deal with the host adapter irq mask.

It seems these irq on/off codes could be better structured. Draft patches for your review/advice, thanks.

1/9: remove irq_on from ata_bus_reset() and ata_std_postreset() 2/9: add ->irq_off() for symmetry
3/9: implement ->irq_off() in LLDDs
4/9: call irq_off from bmdma_freeze()
5/9: use freeze()/thaw() for polling
6/9: add freeze()/thaw() to old EH LLDDs
7/9: pdc_freeze() semantic change
8/9: remove writing of tf->ctl from ata_tf_load() 9/9: Remove irq_on/off. Rename freeze()/thaw() to irq_on/off.

author
#1 lore raw

PATCH 1/9 libata: remove irq_on from ata_bus_reset() and ata_std_postreset()

Patch 1/9:
It looks the calling of irq_on() in ata_bus_reset() and ata_std_postreset()
are leftover of the earlier EDD reset. Remove them.

---

drivers/ata/libata-core.c +0 -7
diff -Nrup 00_libata-dev/drivers/ata/libata-core.c 01_remove_leftover_irqon/drivers/ata/libata-core.c
@@ -3190,9 +3190,6 @@ void ata_bus_reset(struct ata_port *ap)
 	if ((slave_possible) && (err != 0x81))
 		ap->device[1].class = ata_dev_try_classify(ap, 1, &err);
 
-	/* re-enable interrupts */
-	ap->ops->irq_on(ap);
-
 	/* is double-select really necessary? */
 	if (ap->device[1].class != ATA_DEV_NONE)
 		ap->ops->dev_select(ap, 1);
@@ -3577,10 +3574,6 @@ void ata_std_postreset(struct ata_port *
 	if (sata_scr_read(ap, SCR_ERROR, &serror) == 0)
 		sata_scr_write(ap, SCR_ERROR, serror);
 
-	/* re-enable interrupts */
-	if (!ap->ops->error_handler)
-		ap->ops->irq_on(ap);
-
 	/* is double-select really necessary? */
 	if (classes[0] != ATA_DEV_NONE)
 		ap->ops->dev_select(ap, 1);
drivers/ata/pata_scc.c +0 -4
diff -Nrup 00_libata-dev/drivers/ata/pata_scc.c 01_remove_leftover_irqon/drivers/ata/pata_scc.c
@@ -892,10 +892,6 @@ static void scc_std_postreset (struct at
 {
 	DPRINTK("ENTER\n");
 
-	/* re-enable interrupts */
-	if (!ap->ops->error_handler)
-		ap->ops->irq_on(ap);
-
 	/* is double-select really necessary? */
 	if (classes[0] != ATA_DEV_NONE)
 		ap->ops->dev_select(ap, 1);
author
#2 lore raw

PATCH 2/9 libata: add irq_off() for symmetry

In reply to Albert Lee

Patch 2/9:
Currently there is irq_on() but no irq_off().
Turning irq off is done via altering the nIEN bit of qc->tf, together with tf_load(). This patch adds irq_off() for symmetry.
tf_load() and ata_qc_set_polling() will be fixed/removed in later patches.

---

drivers/ata/libata-core.c +2 -0
diff -Nrup 01_remove_leftover_irqon/drivers/ata/libata-core.c 02_add_irq_off/drivers/ata/libata-core.c
@@ -6906,6 +6906,8 @@ EXPORT_SYMBOL_GPL(ata_eh_qc_retry);
 EXPORT_SYMBOL_GPL(ata_do_eh);
 EXPORT_SYMBOL_GPL(ata_irq_on);
 EXPORT_SYMBOL_GPL(ata_dummy_irq_on);
+EXPORT_SYMBOL_GPL(ata_irq_off);
+EXPORT_SYMBOL_GPL(ata_dummy_irq_off);
 EXPORT_SYMBOL_GPL(ata_irq_ack);
 EXPORT_SYMBOL_GPL(ata_dummy_irq_ack);
 EXPORT_SYMBOL_GPL(ata_dev_try_classify);
drivers/ata/libata-sff.c +33 -0
diff -Nrup 01_remove_leftover_irqon/drivers/ata/libata-sff.c 02_add_irq_off/drivers/ata/libata-sff.c
@@ -67,6 +67,39 @@ u8 ata_irq_on(struct ata_port *ap)
 u8 ata_dummy_irq_on (struct ata_port *ap) 	{ return 0; }
 
 /**
+ *	ata_irq_off - Disable interrupts on a port.
+ *	@ap: Port on which interrupts are disabled.
+ *
+ *	Disable interrupts on a legacy IDE device using MMIO or PIO,
+ *	wait for idle, clear any pending interrupts.
+ *
+ *	LOCKING:
+ *	Inherited from caller.
+ */
+u8 ata_irq_off(struct ata_port *ap)
+{
+	struct ata_ioports *ioaddr = &ap->ioaddr;
+	u8 tmp;
+
+	ap->ctl |= ATA_NIEN;
+	ap->last_ctl = ap->ctl;
+
+	iowrite8(ap->ctl, ioaddr->ctl_addr);
+
+	/* Under certain circumstances, some controllers raise IRQ on
+	 * ATA_NIEN manipulation.  Also, many controllers fail to mask
+	 * previously pending IRQ on ATA_NIEN assertion.  Clear it.
+	 */
+	tmp = ata_wait_idle(ap);
+
+	ap->ops->irq_clear(ap);
+
+	return tmp;
+}
+
+u8 ata_dummy_irq_off (struct ata_port *ap) 	{ return 0; }
+
+/**
  *	ata_irq_ack - Acknowledge a device interrupt.
  *	@ap: Port on which interrupts are enabled.
  *
drivers/ata/libata.h +0 -2
diff -Nrup 01_remove_leftover_irqon/drivers/ata/libata.h 02_add_irq_off/drivers/ata/libata.h
@@ -156,7 +156,5 @@ extern void ata_port_wait_eh(struct ata_
 extern void ata_qc_schedule_eh(struct ata_queued_cmd *qc);
 
 /* libata-sff.c */
-extern u8 ata_irq_on(struct ata_port *ap);
-
 
 #endif /* __LIBATA_H__ */
include/linux/libata.h +3 -0
diff -Nrup 01_remove_leftover_irqon/include/linux/libata.h 02_add_irq_off/include/linux/libata.h
@@ -599,6 +599,7 @@ struct ata_port_operations {
 	irq_handler_t irq_handler;
 	void (*irq_clear) (struct ata_port *);
 	u8 (*irq_on) (struct ata_port *);
+	u8 (*irq_off) (struct ata_port *);
 	u8 (*irq_ack) (struct ata_port *ap, unsigned int chk_drq);
 
 	u32 (*scr_read) (struct ata_port *ap, unsigned int sc_reg);
@@ -805,6 +806,8 @@ extern struct ata_device *ata_dev_pair(s
 extern int ata_do_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev);
 extern u8 ata_irq_on(struct ata_port *ap);
 extern u8 ata_dummy_irq_on(struct ata_port *ap);
+extern u8 ata_irq_off(struct ata_port *ap);
+extern u8 ata_dummy_irq_off(struct ata_port *ap);
 extern u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq);
 extern u8 ata_dummy_irq_ack(struct ata_port *ap, unsigned int chk_drq);
 
author
#3 lore raw

PATCH 3/9 libata: add ->irq_off() to LLDDs

In reply to Albert Lee

Patch 3/9:

Minor patch to add the newly added ->irq_off() to LLDDs.

---

drivers/ata/ahci.c +2 -0
diff -Nrup 02_add_irq_off/drivers/ata/ahci.c 03_add_irq_off_lldd/drivers/ata/ahci.c
@@ -268,6 +268,7 @@ static const struct ata_port_operations 
 
 	.irq_clear		= ahci_irq_clear,
 	.irq_on			= ata_dummy_irq_on,
+	.irq_off		= ata_dummy_irq_off,
 	.irq_ack		= ata_dummy_irq_ack,
 
 	.scr_read		= ahci_scr_read,
@@ -302,6 +303,7 @@ static const struct ata_port_operations 
 
 	.irq_clear		= ahci_irq_clear,
 	.irq_on			= ata_dummy_irq_on,
+	.irq_off		= ata_dummy_irq_off,
 	.irq_ack		= ata_dummy_irq_ack,
 
 	.scr_read		= ahci_scr_read,
drivers/ata/ata_generic.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/ata_generic.c 03_add_irq_off_lldd/drivers/ata/ata_generic.c
@@ -121,6 +121,7 @@ static struct ata_port_operations generi
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/ata_piix.c +3 -0
diff -Nrup 02_add_irq_off/drivers/ata/ata_piix.c 03_add_irq_off_lldd/drivers/ata/ata_piix.c
@@ -305,6 +305,7 @@ static const struct ata_port_operations 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
@@ -339,6 +340,7 @@ static const struct ata_port_operations 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
@@ -369,6 +371,7 @@ static const struct ata_port_operations 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
drivers/ata/pata_ali.c +4 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_ali.c 03_add_irq_off_lldd/drivers/ata/pata_ali.c
@@ -320,6 +320,7 @@ static struct ata_port_operations ali_ea
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
@@ -362,6 +363,7 @@ static struct ata_port_operations ali_20
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
@@ -401,6 +403,7 @@ static struct ata_port_operations ali_c2
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
@@ -439,6 +442,7 @@ static struct ata_port_operations ali_c5
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_amd.c +6 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_amd.c 03_add_irq_off_lldd/drivers/ata/pata_amd.c
@@ -356,6 +356,7 @@ static struct ata_port_operations amd33_
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
@@ -391,6 +392,7 @@ static struct ata_port_operations amd66_
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
@@ -426,6 +428,7 @@ static struct ata_port_operations amd100
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
@@ -461,6 +464,7 @@ static struct ata_port_operations amd133
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
@@ -496,6 +500,7 @@ static struct ata_port_operations nv100_
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
@@ -531,6 +536,7 @@ static struct ata_port_operations nv133_
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_artop.c +2 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_artop.c 03_add_irq_off_lldd/drivers/ata/pata_artop.c
@@ -358,6 +358,7 @@ static const struct ata_port_operations 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
@@ -391,6 +392,7 @@ static const struct ata_port_operations 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
drivers/ata/pata_atiixp.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_atiixp.c 03_add_irq_off_lldd/drivers/ata/pata_atiixp.c
@@ -261,6 +261,7 @@ static struct ata_port_operations atiixp
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_cmd640.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_cmd640.c 03_add_irq_off_lldd/drivers/ata/pata_cmd640.c
@@ -213,6 +213,7 @@ static struct ata_port_operations cmd640
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= cmd640_port_start,
drivers/ata/pata_cmd64x.c +3 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_cmd64x.c 03_add_irq_off_lldd/drivers/ata/pata_cmd64x.c
@@ -298,6 +298,7 @@ static struct ata_port_operations cmd64x
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
@@ -333,6 +334,7 @@ static struct ata_port_operations cmd646
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
@@ -368,6 +370,7 @@ static struct ata_port_operations cmd648
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_cs5520.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_cs5520.c 03_add_irq_off_lldd/drivers/ata/pata_cs5520.c
@@ -184,6 +184,7 @@ static struct ata_port_operations cs5520
 
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
drivers/ata/pata_cs5530.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_cs5530.c 03_add_irq_off_lldd/drivers/ata/pata_cs5530.c
@@ -209,6 +209,7 @@ static struct ata_port_operations cs5530
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_cs5535.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_cs5535.c 03_add_irq_off_lldd/drivers/ata/pata_cs5535.c
@@ -206,6 +206,7 @@ static struct ata_port_operations cs5535
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_cypress.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_cypress.c 03_add_irq_off_lldd/drivers/ata/pata_cypress.c
@@ -158,6 +158,7 @@ static struct ata_port_operations cy82c6
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_efar.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_efar.c 03_add_irq_off_lldd/drivers/ata/pata_efar.c
@@ -278,6 +278,7 @@ static const struct ata_port_operations 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
drivers/ata/pata_hpt366.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_hpt366.c 03_add_irq_off_lldd/drivers/ata/pata_hpt366.c
@@ -342,6 +342,7 @@ static struct ata_port_operations hpt366
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_hpt37x.c +4 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_hpt37x.c 03_add_irq_off_lldd/drivers/ata/pata_hpt37x.c
@@ -673,6 +673,7 @@ static struct ata_port_operations hpt370
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
@@ -712,6 +713,7 @@ static struct ata_port_operations hpt370
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
@@ -752,6 +754,7 @@ static struct ata_port_operations hpt372
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
@@ -792,6 +795,7 @@ static struct ata_port_operations hpt374
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_hpt3x2n.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_hpt3x2n.c 03_add_irq_off_lldd/drivers/ata/pata_hpt3x2n.c
@@ -390,6 +390,7 @@ static struct ata_port_operations hpt3x2
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_hpt3x3.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_hpt3x3.c 03_add_irq_off_lldd/drivers/ata/pata_hpt3x3.c
@@ -133,6 +133,7 @@ static struct ata_port_operations hpt3x3
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_icside.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_icside.c 03_add_irq_off_lldd/drivers/ata/pata_icside.c
@@ -402,6 +402,7 @@ static struct ata_port_operations pata_i
 
 	.irq_clear		= ata_dummy_noret,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= pata_icside_irq_ack,
 
 	.port_start		= pata_icside_port_start,
drivers/ata/pata_isapnp.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_isapnp.c 03_add_irq_off_lldd/drivers/ata/pata_isapnp.c
@@ -58,6 +58,7 @@ static struct ata_port_operations isapnp
 
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_it8213.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_it8213.c 03_add_irq_off_lldd/drivers/ata/pata_it8213.c
@@ -288,6 +288,7 @@ static const struct ata_port_operations 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
drivers/ata/pata_it821x.c +2 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_it821x.c 03_add_irq_off_lldd/drivers/ata/pata_it821x.c
@@ -653,6 +653,7 @@ static struct ata_port_operations it821x
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= it821x_port_start,
@@ -690,6 +691,7 @@ static struct ata_port_operations it821x
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_handler	= ata_interrupt,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= it821x_port_start,
drivers/ata/pata_ixp4xx_cf.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_ixp4xx_cf.c 03_add_irq_off_lldd/drivers/ata/pata_ixp4xx_cf.c
@@ -133,6 +133,7 @@ static struct ata_port_operations ixp4xx
 
 	.irq_clear	= ixp4xx_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_jmicron.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_jmicron.c 03_add_irq_off_lldd/drivers/ata/pata_jmicron.c
@@ -168,6 +168,7 @@ static const struct ata_port_operations 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	/* Generic PATA PCI ATA helpers */
drivers/ata/pata_legacy.c +7 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_legacy.c 03_add_irq_off_lldd/drivers/ata/pata_legacy.c
@@ -172,6 +172,7 @@ static struct ata_port_operations simple
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
@@ -201,6 +202,7 @@ static struct ata_port_operations legacy
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
@@ -317,6 +319,7 @@ static struct ata_port_operations pdc202
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
@@ -373,6 +376,7 @@ static struct ata_port_operations ht6560
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
@@ -440,6 +444,7 @@ static struct ata_port_operations ht6560
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
@@ -562,6 +567,7 @@ static struct ata_port_operations opti82
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
@@ -696,6 +702,7 @@ static struct ata_port_operations opti82
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_marvell.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_marvell.c 03_add_irq_off_lldd/drivers/ata/pata_marvell.c
@@ -138,6 +138,7 @@ static const struct ata_port_operations 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	/* Generic PATA PCI ATA helpers */
drivers/ata/pata_mpc52xx.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_mpc52xx.c 03_add_irq_off_lldd/drivers/ata/pata_mpc52xx.c
@@ -299,6 +299,7 @@ static struct ata_port_operations mpc52x
 	.data_xfer		= ata_data_xfer,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 	.port_start		= ata_port_start,
 };
drivers/ata/pata_mpiix.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_mpiix.c 03_add_irq_off_lldd/drivers/ata/pata_mpiix.c
@@ -189,6 +189,7 @@ static struct ata_port_operations mpiix_
 
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_netcell.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_netcell.c 03_add_irq_off_lldd/drivers/ata/pata_netcell.c
@@ -68,6 +68,7 @@ static const struct ata_port_operations 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	/* Generic PATA PCI ATA helpers */
drivers/ata/pata_ns87410.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_ns87410.c 03_add_irq_off_lldd/drivers/ata/pata_ns87410.c
@@ -184,6 +184,7 @@ static struct ata_port_operations ns8741
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_oldpiix.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_oldpiix.c 03_add_irq_off_lldd/drivers/ata/pata_oldpiix.c
@@ -265,6 +265,7 @@ static const struct ata_port_operations 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
drivers/ata/pata_opti.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_opti.c 03_add_irq_off_lldd/drivers/ata/pata_opti.c
@@ -209,6 +209,7 @@ static struct ata_port_operations opti_p
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_optidma.c +2 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_optidma.c 03_add_irq_off_lldd/drivers/ata/pata_optidma.c
@@ -396,6 +396,7 @@ static struct ata_port_operations optidm
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
@@ -432,6 +433,7 @@ static struct ata_port_operations optipl
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_pcmcia.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_pcmcia.c 03_add_irq_off_lldd/drivers/ata/pata_pcmcia.c
@@ -127,6 +127,7 @@ static struct ata_port_operations pcmcia
 
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_pdc2027x.c +2 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_pdc2027x.c 03_add_irq_off_lldd/drivers/ata/pata_pdc2027x.c
@@ -173,6 +173,7 @@ static struct ata_port_operations pdc202
 
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
@@ -208,6 +209,7 @@ static struct ata_port_operations pdc202
 
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
drivers/ata/pata_pdc202xx_old.c +2 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_pdc202xx_old.c 03_add_irq_off_lldd/drivers/ata/pata_pdc202xx_old.c
@@ -275,6 +275,7 @@ static struct ata_port_operations pdc202
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
@@ -310,6 +311,7 @@ static struct ata_port_operations pdc202
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_platform.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_platform.c 03_add_irq_off_lldd/drivers/ata/pata_platform.c
@@ -91,6 +91,7 @@ static struct ata_port_operations pata_p
 
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_dummy_ret0,
drivers/ata/pata_qdi.c +2 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_qdi.c 03_add_irq_off_lldd/drivers/ata/pata_qdi.c
@@ -192,6 +192,7 @@ static struct ata_port_operations qdi650
 
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
@@ -220,6 +221,7 @@ static struct ata_port_operations qdi658
 
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_radisys.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_radisys.c 03_add_irq_off_lldd/drivers/ata/pata_radisys.c
@@ -231,6 +231,7 @@ static const struct ata_port_operations 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
drivers/ata/pata_rz1000.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_rz1000.c 03_add_irq_off_lldd/drivers/ata/pata_rz1000.c
@@ -100,6 +100,7 @@ static struct ata_port_operations rz1000
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_sc1200.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_sc1200.c 03_add_irq_off_lldd/drivers/ata/pata_sc1200.c
@@ -227,6 +227,7 @@ static struct ata_port_operations sc1200
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_scc.c +24 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_scc.c 03_add_irq_off_lldd/drivers/ata/pata_scc.c
@@ -812,6 +812,29 @@ static u8 scc_irq_on (struct ata_port *a
 }
 
 /**
+ *	scc_irq_off - Disable interrupts on a port.
+ *	@ap: Port on which interrupts are disabled.
+ *
+ *	Note: Original code is ata_irq_off().
+ */
+
+static u8 scc_irq_off (struct ata_port *ap)
+{
+	struct ata_ioports *ioaddr = &ap->ioaddr;
+	u8 tmp;
+
+	ap->ctl |= ATA_NIEN;
+	ap->last_ctl = ap->ctl;
+
+	out_be32(ioaddr->ctl_addr, ap->ctl);
+	tmp = ata_wait_idle(ap);
+
+	ap->ops->irq_clear(ap);
+
+	return tmp;
+}
+
+/**
  *	scc_irq_ack - Acknowledge a device interrupt.
  *	@ap: Port on which interrupts are enabled.
  *
@@ -1020,6 +1043,7 @@ static const struct ata_port_operations 
 
 	.irq_clear		= scc_bmdma_irq_clear,
 	.irq_on			= scc_irq_on,
+	.irq_off		= scc_irq_off,
 	.irq_ack		= scc_irq_ack,
 
 	.port_start		= scc_port_start,
drivers/ata/pata_serverworks.c +2 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_serverworks.c 03_add_irq_off_lldd/drivers/ata/pata_serverworks.c
@@ -348,6 +348,7 @@ static struct ata_port_operations server
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
@@ -384,6 +385,7 @@ static struct ata_port_operations server
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_sil680.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_sil680.c 03_add_irq_off_lldd/drivers/ata/pata_sil680.c
@@ -264,6 +264,7 @@ static struct ata_port_operations sil680
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_sis.c +5 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_sis.c 03_add_irq_off_lldd/drivers/ata/pata_sis.c
@@ -555,6 +555,7 @@ static const struct ata_port_operations 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
@@ -589,6 +590,7 @@ static const struct ata_port_operations 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
@@ -623,6 +625,7 @@ static const struct ata_port_operations 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
@@ -657,6 +660,7 @@ static const struct ata_port_operations 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
@@ -691,6 +695,7 @@ static const struct ata_port_operations 
 	.irq_handler		= ata_interrupt,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
drivers/ata/pata_sl82c105.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_sl82c105.c 03_add_irq_off_lldd/drivers/ata/pata_sl82c105.c
@@ -253,6 +253,7 @@ static struct ata_port_operations sl82c1
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_triflex.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_triflex.c 03_add_irq_off_lldd/drivers/ata/pata_triflex.c
@@ -226,6 +226,7 @@ static struct ata_port_operations trifle
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_via.c +2 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_via.c 03_add_irq_off_lldd/drivers/ata/pata_via.c
@@ -363,6 +363,7 @@ static struct ata_port_operations via_po
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
@@ -399,6 +400,7 @@ static struct ata_port_operations via_po
 	.irq_handler	= ata_interrupt,
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pata_winbond.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pata_winbond.c 03_add_irq_off_lldd/drivers/ata/pata_winbond.c
@@ -160,6 +160,7 @@ static struct ata_port_operations winbon
 
 	.irq_clear	= ata_bmdma_irq_clear,
 	.irq_on		= ata_irq_on,
+	.irq_off	= ata_irq_off,
 	.irq_ack	= ata_irq_ack,
 
 	.port_start	= ata_port_start,
drivers/ata/pdc_adma.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/pdc_adma.c 03_add_irq_off_lldd/drivers/ata/pdc_adma.c
@@ -173,6 +173,7 @@ static const struct ata_port_operations 
 	.data_xfer		= ata_data_xfer,
 	.irq_clear		= adma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 	.port_start		= adma_port_start,
 	.port_stop		= adma_port_stop,
drivers/ata/sata_inic162x.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/sata_inic162x.c 03_add_irq_off_lldd/drivers/ata/sata_inic162x.c
@@ -560,6 +560,7 @@ static struct ata_port_operations inic_p
 
 	.irq_clear		= inic_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.qc_prep	 	= ata_qc_prep,
drivers/ata/sata_mv.c +3 -0
diff -Nrup 02_add_irq_off/drivers/ata/sata_mv.c 03_add_irq_off_lldd/drivers/ata/sata_mv.c
@@ -455,6 +455,7 @@ static const struct ata_port_operations 
 
 	.irq_clear		= mv_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.scr_read		= mv5_scr_read,
@@ -484,6 +485,7 @@ static const struct ata_port_operations 
 
 	.irq_clear		= mv_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.scr_read		= mv_scr_read,
@@ -513,6 +515,7 @@ static const struct ata_port_operations 
 
 	.irq_clear		= mv_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.scr_read		= mv_scr_read,
drivers/ata/sata_nv.c +4 -0
diff -Nrup 02_add_irq_off/drivers/ata/sata_nv.c 03_add_irq_off_lldd/drivers/ata/sata_nv.c
@@ -358,6 +358,7 @@ static const struct ata_port_operations 
 	.data_xfer		= ata_data_xfer,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 	.scr_read		= nv_scr_read,
 	.scr_write		= nv_scr_write,
@@ -384,6 +385,7 @@ static const struct ata_port_operations 
 	.data_xfer		= ata_data_xfer,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 	.scr_read		= nv_scr_read,
 	.scr_write		= nv_scr_write,
@@ -410,6 +412,7 @@ static const struct ata_port_operations 
 	.data_xfer		= ata_data_xfer,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 	.scr_read		= nv_scr_read,
 	.scr_write		= nv_scr_write,
@@ -438,6 +441,7 @@ static const struct ata_port_operations 
 	.data_xfer		= ata_data_xfer,
 	.irq_clear		= nv_adma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 	.scr_read		= nv_scr_read,
 	.scr_write		= nv_scr_write,
drivers/ata/sata_promise.c +3 -0
diff -Nrup 02_add_irq_off/drivers/ata/sata_promise.c 03_add_irq_off_lldd/drivers/ata/sata_promise.c
@@ -187,6 +187,7 @@ static const struct ata_port_operations 
 	.data_xfer		= ata_data_xfer,
 	.irq_clear		= pdc_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.scr_read		= pdc_sata_scr_read,
@@ -214,6 +215,7 @@ static const struct ata_port_operations 
 	.data_xfer		= ata_data_xfer,
 	.irq_clear		= pdc_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.scr_read		= pdc_sata_scr_read,
@@ -240,6 +242,7 @@ static const struct ata_port_operations 
 	.data_xfer		= ata_data_xfer,
 	.irq_clear		= pdc_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.port_start		= pdc_common_port_start,
drivers/ata/sata_qstor.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/sata_qstor.c 03_add_irq_off_lldd/drivers/ata/sata_qstor.c
@@ -159,6 +159,7 @@ static const struct ata_port_operations 
 	.eng_timeout		= qs_eng_timeout,
 	.irq_clear		= qs_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 	.scr_read		= qs_scr_read,
 	.scr_write		= qs_scr_write,
drivers/ata/sata_sil.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/sata_sil.c 03_add_irq_off_lldd/drivers/ata/sata_sil.c
@@ -206,6 +206,7 @@ static const struct ata_port_operations 
 	.post_internal_cmd	= ata_bmdma_post_internal_cmd,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 	.scr_read		= sil_scr_read,
 	.scr_write		= sil_scr_write,
drivers/ata/sata_sil24.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/sata_sil24.c 03_add_irq_off_lldd/drivers/ata/sata_sil24.c
@@ -399,6 +399,7 @@ static const struct ata_port_operations 
 
 	.irq_clear		= sil24_irq_clear,
 	.irq_on			= ata_dummy_irq_on,
+	.irq_off		= ata_dummy_irq_off,
 	.irq_ack		= ata_dummy_irq_ack,
 
 	.scr_read		= sil24_scr_read,
drivers/ata/sata_sis.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/sata_sis.c 03_add_irq_off_lldd/drivers/ata/sata_sis.c
@@ -123,6 +123,7 @@ static const struct ata_port_operations 
 	.post_internal_cmd	= ata_bmdma_post_internal_cmd,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 	.scr_read		= sis_scr_read,
 	.scr_write		= sis_scr_write,
drivers/ata/sata_svw.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/sata_svw.c 03_add_irq_off_lldd/drivers/ata/sata_svw.c
@@ -347,6 +347,7 @@ static const struct ata_port_operations 
 	.post_internal_cmd	= ata_bmdma_post_internal_cmd,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 	.scr_read		= k2_sata_scr_read,
 	.scr_write		= k2_sata_scr_write,
drivers/ata/sata_sx4.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/sata_sx4.c 03_add_irq_off_lldd/drivers/ata/sata_sx4.c
@@ -205,6 +205,7 @@ static const struct ata_port_operations 
 	.eng_timeout		= pdc_eng_timeout,
 	.irq_clear		= pdc20621_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 	.port_start		= pdc_port_start,
 };
drivers/ata/sata_uli.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/sata_uli.c 03_add_irq_off_lldd/drivers/ata/sata_uli.c
@@ -117,6 +117,7 @@ static const struct ata_port_operations 
 
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.scr_read		= uli_scr_read,
drivers/ata/sata_via.c +3 -0
diff -Nrup 02_add_irq_off/drivers/ata/sata_via.c 03_add_irq_off_lldd/drivers/ata/sata_via.c
@@ -146,6 +146,7 @@ static const struct ata_port_operations 
 
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
@@ -180,6 +181,7 @@ static const struct ata_port_operations 
 
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.port_start		= ata_port_start,
@@ -211,6 +213,7 @@ static const struct ata_port_operations 
 
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 
 	.scr_read		= svia_scr_read,
drivers/ata/sata_vsc.c +1 -0
diff -Nrup 02_add_irq_off/drivers/ata/sata_vsc.c 03_add_irq_off_lldd/drivers/ata/sata_vsc.c
@@ -335,6 +335,7 @@ static const struct ata_port_operations 
 	.post_internal_cmd	= ata_bmdma_post_internal_cmd,
 	.irq_clear		= ata_bmdma_irq_clear,
 	.irq_on			= ata_irq_on,
+	.irq_off		= ata_irq_off,
 	.irq_ack		= ata_irq_ack,
 	.scr_read		= vsc_sata_scr_read,
 	.scr_write		= vsc_sata_scr_write,
author
#4 lore raw

PATCH 4/9 libata: call irq_off from bmdma_freeze()

In reply to Albert Lee

Patch 4/9:
Minor patch to call irq_off() from bmdma_freeze() to avoid duplicated code.

---

drivers/ata/libata-sff.c +1 -14
diff -Nrup 03_add_irq_off_lldd/drivers/ata/libata-sff.c 04_convert_freeze/drivers/ata/libata-sff.c
@@ -413,20 +413,7 @@ void ata_bmdma_stop(struct ata_queued_cm
  */
 void ata_bmdma_freeze(struct ata_port *ap)
 {
-	struct ata_ioports *ioaddr = &ap->ioaddr;
-
-	ap->ctl |= ATA_NIEN;
-	ap->last_ctl = ap->ctl;
-
-	iowrite8(ap->ctl, ioaddr->ctl_addr);
-
-	/* Under certain circumstances, some controllers raise IRQ on
-	 * ATA_NIEN manipulation.  Also, many controllers fail to mask
-	 * previously pending IRQ on ATA_NIEN assertion.  Clear it.
-	 */
-	ata_chk_status(ap);
-
-	ap->ops->irq_clear(ap);
+	ap->ops->irq_off(ap);
 }
 
 /**
drivers/ata/pata_scc.c +1 -14
diff -Nrup 03_add_irq_off_lldd/drivers/ata/pata_scc.c 04_convert_freeze/drivers/ata/pata_scc.c
@@ -875,20 +875,7 @@ static u8 scc_irq_ack (struct ata_port *
 
 static void scc_bmdma_freeze (struct ata_port *ap)
 {
-	struct ata_ioports *ioaddr = &ap->ioaddr;
-
-	ap->ctl |= ATA_NIEN;
-	ap->last_ctl = ap->ctl;
-
-	out_be32(ioaddr->ctl_addr, ap->ctl);
-
-	/* Under certain circumstances, some controllers raise IRQ on
-	 * ATA_NIEN manipulation.  Also, many controllers fail to mask
-	 * previously pending IRQ on ATA_NIEN assertion.  Clear it.
-	 */
-	ata_chk_status(ap);
-
-	ap->ops->irq_clear(ap);
+	scc_irq_off(ap);
 }
 
 /**
author
#5 lore raw

PATCH 5/9 libata: use freeze()/thaw() for polling

In reply to Albert Lee

Patch 5/9:

This patch changes polling codes to use freeze()/thaw() for irq off/on.
ata_qc_set_polling() is also removed since now unused.

The reason for freeze()/thaw(): some ATAPI devices raises INTRQ even if nIEN = 1.
Using the host adapter irq mask mechanism, if available, is more reliable than using the device nIEN bit.

Considerations:
1. the semantic of freeze()/thaw() maybe more than irq off/on?
2. HSM, the new user of freeze()/thaw(), will call freeze()/thaw() more frequently than EH. Can current implemention of freeze()/thaw() handle it?

---

drivers/ata/libata-core.c +5 -5
diff -Nrup 04_convert_freeze/drivers/ata/libata-core.c 05_convert_hsm_to_freeze/drivers/ata/libata-core.c
@@ -4753,7 +4753,7 @@ static void ata_hsm_qc_complete(struct a
 			qc = ata_qc_from_tag(ap, qc->tag);
 			if (qc) {
 				if (likely(!(qc->err_mask & AC_ERR_HSM))) {
-					ap->ops->irq_on(ap);
+					ap->ops->thaw(ap);
 					ata_qc_complete(qc);
 				} else
 					ata_port_freeze(ap);
@@ -4769,7 +4769,7 @@ static void ata_hsm_qc_complete(struct a
 	} else {
 		if (in_wq) {
 			spin_lock_irqsave(ap->lock, flags);
-			ap->ops->irq_on(ap);
+			ap->ops->thaw(ap);
 			ata_qc_complete(qc);
 			spin_unlock_irqrestore(ap->lock, flags);
 		} else
@@ -5421,7 +5421,7 @@ unsigned int ata_qc_issue_prot(struct at
 	switch (qc->tf.protocol) {
 	case ATA_PROT_NODATA:
 		if (qc->tf.flags & ATA_TFLAG_POLLING)
-			ata_qc_set_polling(qc);
+			ap->ops->freeze(ap);
 
 		ata_tf_to_host(ap, &qc->tf);
 		ap->hsm_task_state = HSM_ST_LAST;
@@ -5442,7 +5442,7 @@ unsigned int ata_qc_issue_prot(struct at
 
 	case ATA_PROT_PIO:
 		if (qc->tf.flags & ATA_TFLAG_POLLING)
-			ata_qc_set_polling(qc);
+			ap->ops->freeze(ap);
 
 		ata_tf_to_host(ap, &qc->tf);
 
@@ -5471,7 +5471,7 @@ unsigned int ata_qc_issue_prot(struct at
 	case ATA_PROT_ATAPI:
 	case ATA_PROT_ATAPI_NODATA:
 		if (qc->tf.flags & ATA_TFLAG_POLLING)
-			ata_qc_set_polling(qc);
+			ap->ops->freeze(ap);
 
 		ata_tf_to_host(ap, &qc->tf);
 
include/linux/libata.h +0 -5
diff -Nrup 04_convert_freeze/include/linux/libata.h 05_convert_hsm_to_freeze/include/linux/libata.h
@@ -1100,11 +1100,6 @@ static inline u8 ata_wait_idle(struct at
 	return status;
 }
 
-static inline void ata_qc_set_polling(struct ata_queued_cmd *qc)
-{
-	qc->tf.ctl |= ATA_NIEN;
-}
-
 static inline struct ata_queued_cmd *__ata_qc_from_tag(struct ata_port *ap,
 						       unsigned int tag)
 {
#6 lore raw

Re: [PATCH/RFC 5/9] libata: use freeze()/thaw() for polling

Hello,

Quoted 10 lines · Albert Lee

Patch 5/9:

This patch changes polling codes to use freeze()/thaw() for irq off/on.
ata_qc_set_polling() is also removed since now unused.

The reason for freeze()/thaw(): some ATAPI devices raises INTRQ even if nIEN = 1.
Using the host adapter irq mask mechanism, if available, is more reliable than using the device nIEN bit.

Considerations:
1. the semantic of freeze()/thaw() maybe more than irq off/on?

It usually is irq off/on.

Quoted 2 lines

2. HSM, the new user of freeze()/thaw(), will call freeze()/thaw() more frequently than EH. Can current implemention of freeze()/thaw() handle it?

Yeah, I don't see any reason why it can't be used that way but please audit each freeze/thaw implementation.

drivers/ata/libata-core.c unsigned int ata_qc_issue_prot(struct at · line 5447

Quoted 8 lines
drivers/ata/libata-core.c +1 -1
@@ -5442,7 +5442,7 @@ unsigned int ata_qc_issue_prot(struct at
 
 	case ATA_PROT_PIO:
 		if (qc->tf.flags & ATA_TFLAG_POLLING)
-			ata_qc_set_polling(qc);
+			ap->ops->freeze(ap);
 
 		ata_tf_to_host(ap, &qc->tf);

Wouldn't ata_tf_load() change the ctl value to qc->tf.ctl when issuing the command?

I'm not really sure about this change because most controller which have dedicated IRQ mask bit also have dedicated IRQ pending bit (and probably IRQ clear bit too). With those bits, IRQ during polling is not a big problem (sata_sil for example). So, the change doesn't really help the controllers which actually have problems dealing with devices which raise IRQ regardless of ATA_NIEN.

I don't see any easy way out other than manipulating host IRQ on/off as IDE does. If we choose to go that way, we can use them in ata_bmdma_freeze/thaw (they should be named ata_sff_freeze/thaw really) and use this patch on top of it. Maybe it's better to drop ->freeze() and ->thaw() altogether and use ->irq_on() and ->irq_off() instead. Their names are more intuitive IMHO but that's minor.

Jeff, Alan, what do you think about adopting IDE's irq off/on mechanism.
It's ugly and may cause some problems if the IRQ is shared but then
again it has been used for a long time without too much problem and occasional lost IRQ is much better than dead machine due to screaming IRQs followed by nobody cared.

Thanks.

Signature · 1 line
tejun
author
#7 lore raw

PATCH 6/9 libata: add freeze()/thaw() to old EH LLDDs

In reply to Albert Lee

Patch 6/9:
Since now the polling code path uses freeze()/thaw() regardless of old EH or new EH.
Add freeze()/thaw() to old EH LLDDs for use by the polling code.

---

drivers/ata/pata_ixp4xx_cf.c +3 -0
diff -Nrup 05_convert_hsm_to_freeze/drivers/ata/pata_ixp4xx_cf.c 06_add_freeze_thaw_to_lldd/drivers/ata/pata_ixp4xx_cf.c
@@ -131,6 +131,9 @@ static struct ata_port_operations ixp4xx
 	.data_xfer	= ixp4xx_mmio_data_xfer,
 	.cable_detect	= ata_cable_40wire,
 
+	.freeze		= ata_bmdma_freeze,
+	.thaw		= ata_bmdma_thaw,
+
 	.irq_clear	= ixp4xx_irq_clear,
 	.irq_on		= ata_irq_on,
 	.irq_off	= ata_irq_off,
drivers/ata/pata_scc.c +13 -0
diff -Nrup 05_convert_hsm_to_freeze/drivers/ata/pata_scc.c 06_add_freeze_thaw_to_lldd/drivers/ata/pata_scc.c
@@ -879,6 +879,18 @@ static void scc_bmdma_freeze (struct ata
 }
 
 /**
+ *	scc_bmdma_thaw - Thaw BMDMA controller port
+ *	@ap: port to thaw
+ *
+ *	Note: Original code is ata_bmdma_thaw().
+ */
+
+static void scc_bmdma_thaw (struct ata_port *ap)
+{
+	scc_irq_on(ap);
+}
+
+/**
  *	scc_pata_prereset - prepare for reset
  *	@ap: ATA port to be reset
  *	@deadline: deadline jiffies for the operation
@@ -1025,6 +1037,7 @@ static const struct ata_port_operations 
 	.qc_issue		= ata_qc_issue_prot,
 
 	.freeze			= scc_bmdma_freeze,
+	.thaw			= scc_bmdma_thaw,
 	.error_handler		= scc_error_handler,
 	.post_internal_cmd	= scc_bmdma_stop,
 
drivers/ata/pdc_adma.c +2 -0
diff -Nrup 05_convert_hsm_to_freeze/drivers/ata/pdc_adma.c 06_add_freeze_thaw_to_lldd/drivers/ata/pdc_adma.c
@@ -171,6 +171,8 @@ static const struct ata_port_operations 
 	.qc_issue		= adma_qc_issue,
 	.eng_timeout		= adma_eng_timeout,
 	.data_xfer		= ata_data_xfer,
+	.freeze			= ata_bmdma_freeze,
+	.thaw			= ata_bmdma_thaw,
 	.irq_clear		= adma_irq_clear,
 	.irq_on			= ata_irq_on,
 	.irq_off		= ata_irq_off,
drivers/ata/sata_mv.c +9 -0
diff -Nrup 05_convert_hsm_to_freeze/drivers/ata/sata_mv.c 06_add_freeze_thaw_to_lldd/drivers/ata/sata_mv.c
@@ -453,6 +453,9 @@ static const struct ata_port_operations 
 
 	.eng_timeout		= mv_eng_timeout,
 
+	.freeze			= ata_bmdma_freeze,
+	.thaw			= ata_bmdma_thaw,
+
 	.irq_clear		= mv_irq_clear,
 	.irq_on			= ata_irq_on,
 	.irq_off		= ata_irq_off,
@@ -483,6 +486,9 @@ static const struct ata_port_operations 
 
 	.eng_timeout		= mv_eng_timeout,
 
+	.freeze			= ata_bmdma_freeze,
+	.thaw			= ata_bmdma_thaw,
+
 	.irq_clear		= mv_irq_clear,
 	.irq_on			= ata_irq_on,
 	.irq_off		= ata_irq_off,
@@ -513,6 +519,9 @@ static const struct ata_port_operations 
 
 	.eng_timeout		= mv_eng_timeout,
 
+	.freeze			= ata_bmdma_freeze,
+	.thaw			= ata_bmdma_thaw,
+
 	.irq_clear		= mv_irq_clear,
 	.irq_on			= ata_irq_on,
 	.irq_off		= ata_irq_off,
drivers/ata/sata_qstor.c +2 -0
diff -Nrup 05_convert_hsm_to_freeze/drivers/ata/sata_qstor.c 06_add_freeze_thaw_to_lldd/drivers/ata/sata_qstor.c
@@ -157,6 +157,8 @@ static const struct ata_port_operations 
 	.qc_issue		= qs_qc_issue,
 	.data_xfer		= ata_data_xfer,
 	.eng_timeout		= qs_eng_timeout,
+	.freeze			= ata_bmdma_freeze,
+	.thaw			= ata_bmdma_thaw,
 	.irq_clear		= qs_irq_clear,
 	.irq_on			= ata_irq_on,
 	.irq_off		= ata_irq_off,
drivers/ata/sata_sx4.c +2 -0
diff -Nrup 05_convert_hsm_to_freeze/drivers/ata/sata_sx4.c 06_add_freeze_thaw_to_lldd/drivers/ata/sata_sx4.c
@@ -203,6 +203,8 @@ static const struct ata_port_operations 
 	.qc_issue		= pdc20621_qc_issue_prot,
 	.data_xfer		= ata_data_xfer,
 	.eng_timeout		= pdc_eng_timeout,
+	.freeze			= ata_bmdma_freeze,
+	.thaw			= ata_bmdma_thaw,
 	.irq_clear		= pdc20621_irq_clear,
 	.irq_on			= ata_irq_on,
 	.irq_off		= ata_irq_off,
author
#8 lore raw

PATCH 7/9 libata: pdc_freeze() semantic change

In reply to Albert Lee

Patch 7/9:

After checking the current implementations of freeze()/thaw(), it seems only pdc_freeze()
do more than simple irq masking. Remove the DMA disable code from pdc_freeze().

The question is the design/semantic of freeze()/thaw(). Maybe we should limit them to simple irq on/off?

---

drivers/ata/sata_promise.c +0 -1
diff -Nrup 06_add_freeze_thaw_to_lldd/drivers/ata/sata_promise.c 07_sata_promise_freeze/drivers/ata/sata_promise.c
@@ -581,7 +581,6 @@ static void pdc_freeze(struct ata_port *
 
 	tmp = readl(mmio + PDC_CTLSTAT);
 	tmp |= PDC_IRQ_DISABLE;
-	tmp &= ~PDC_DMA_ENABLE;
 	writel(tmp, mmio + PDC_CTLSTAT);
 	readl(mmio + PDC_CTLSTAT); /* flush */
 }
#9 lore raw

Re: [PATCH/RFC 7/9] libata: pdc_freeze() semantic change

Quoted 7 lines · Albert Lee

Patch 7/9:

After checking the current implementations of freeze()/thaw(), it seems only pdc_freeze()
do more than simple irq masking. Remove the DMA disable code from pdc_freeze().

The question is the design/semantic of freeze()/thaw(). Maybe we should limit them to simple irq on/off?

Yeap, we can do that but if we do so it would be better to use ->irq_off/->irq_on hooks and kill ->freeze/->thaw.

Signature · 1 line
tejun
author
#10 lore raw

PATCH 8/9 libata: remove writing of tf->ctl from ata_tf_load()

In reply to Albert Lee

Patch 8/9:

Currently ata_tf_load() writes to the Control register if it is changed.

The relevant bits in the ctl register are HOB, SRST and nIEN.
- HOB is only used by ata_tf_read().
- For SRST, soft reset is not the duty of tf_load.
- For nIEN, explicit irq_on()/irq_off and freeze()/thaw() are provided.

Since EH/HSM now call freeze()/thaw() for irq off/on explicitly.
The implicit nIEN handling is removed from ata_tf_load(). The nIEN snoop codes are also removed from sata_vsc.

---

drivers/ata/libata-sff.c +7 -5
diff -Nrup 07_sata_promise_freeze/drivers/ata/libata-sff.c 08_tfload_cleanup/drivers/ata/libata-sff.c
@@ -153,11 +153,13 @@ void ata_tf_load(struct ata_port *ap, co
 	struct ata_ioports *ioaddr = &ap->ioaddr;
 	unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
 
-	if (tf->ctl != ap->last_ctl) {
-		iowrite8(tf->ctl, ioaddr->ctl_addr);
-		ap->last_ctl = tf->ctl;
-		ata_wait_idle(ap);
-	}
+	/*
+	 * The relevant bits in the ctl register are HOB, SRST and nIEN.
+	 * HOB is only used by ata_tf_read().
+	 * For SRST, soft reset is not the duty of tf_load.
+	 * For nIEN, explicit ->irq_on() and ->irq_off are provided.
+	 * That's why tf->ctl is ignored here.
+	 */
 
 	if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) {
 		iowrite8(tf->hob_feature, ioaddr->feature_addr);
drivers/ata/pata_scc.c +0 -6
diff -Nrup 07_sata_promise_freeze/drivers/ata/pata_scc.c 08_tfload_cleanup/drivers/ata/pata_scc.c
@@ -271,12 +271,6 @@ static void scc_tf_load (struct ata_port
 	struct ata_ioports *ioaddr = &ap->ioaddr;
 	unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
 
-	if (tf->ctl != ap->last_ctl) {
-		out_be32(ioaddr->ctl_addr, tf->ctl);
-		ap->last_ctl = tf->ctl;
-		ata_wait_idle(ap);
-	}
-
 	if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) {
 		out_be32(ioaddr->feature_addr, tf->hob_feature);
 		out_be32(ioaddr->nsect_addr, tf->hob_nsect);
drivers/ata/sata_svw.c +0 -5
diff -Nrup 07_sata_promise_freeze/drivers/ata/sata_svw.c 08_tfload_cleanup/drivers/ata/sata_svw.c
@@ -125,11 +125,6 @@ static void k2_sata_tf_load(struct ata_p
 	struct ata_ioports *ioaddr = &ap->ioaddr;
 	unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
 
-	if (tf->ctl != ap->last_ctl) {
-		writeb(tf->ctl, ioaddr->ctl_addr);
-		ap->last_ctl = tf->ctl;
-		ata_wait_idle(ap);
-	}
 	if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) {
 		writew(tf->feature | (((u16)tf->hob_feature) << 8),
 		       ioaddr->feature_addr);
drivers/ata/sata_vsc.c +0 -25
diff -Nrup 07_sata_promise_freeze/drivers/ata/sata_vsc.c 08_tfload_cleanup/drivers/ata/sata_vsc.c
@@ -137,36 +137,11 @@ static void vsc_thaw(struct ata_port *ap
 }
 
 
-static void vsc_intr_mask_update(struct ata_port *ap, u8 ctl)
-{
-	void __iomem *mask_addr;
-	u8 mask;
-
-	mask_addr = ap->host->iomap[VSC_MMIO_BAR] +
-		VSC_SATA_INT_MASK_OFFSET + ap->port_no;
-	mask = readb(mask_addr);
-	if (ctl & ATA_NIEN)
-		mask |= 0x80;
-	else
-		mask &= 0x7F;
-	writeb(mask, mask_addr);
-}
-
-
 static void vsc_sata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
 {
 	struct ata_ioports *ioaddr = &ap->ioaddr;
 	unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
 
-	/*
-	 * The only thing the ctl register is used for is SRST.
-	 * That is not enabled or disabled via tf_load.
-	 * However, if ATA_NIEN is changed, then we need to change the interrupt register.
-	 */
-	if ((tf->ctl & ATA_NIEN) != (ap->last_ctl & ATA_NIEN)) {
-		ap->last_ctl = tf->ctl;
-		vsc_intr_mask_update(ap, tf->ctl & ATA_NIEN);
-	}
 	if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) {
 		writew(tf->feature | (((u16)tf->hob_feature) << 8),
 		       ioaddr->feature_addr);
author
#11 lore raw

PATCH 9/9 libata: remove irq_on/off and rename freeze()/thaw() to irq_on/off

In reply to Albert Lee

Patch 9/9:

It seems ->irq_on and ->irq_off are now only wrapped by freeze()/thaw() and unused elsewhere.
This patch
- Remove ->irq_on and ->irq_off.
- Rename ->freeze and ->thaw to irq_on() and irq_off() to be specific.

Hopefully the LLDDs need to implement only one irq on/off by either host adapter masking, nIEN manipulation, or both or something else.

No patch for this yet. Just some idea like below...

include/linux/libata.h +2 -4
diff -Nrup 09_freeze_thaw_pdc2027x/include/linux/libata.h 10_replace_irq_on_off/include/linux/libata.h
@@ -591,15 +591,13 @@ struct ata_port_operations {
 	 */
 	void (*eng_timeout) (struct ata_port *ap); /* obsolete */
 
-	void (*freeze) (struct ata_port *ap);
-	void (*thaw) (struct ata_port *ap);
+	u8 (*irq_on) (struct ata_port *);
+	u8 (*irq_off) (struct ata_port *);
 	void (*error_handler) (struct ata_port *ap);
 	void (*post_internal_cmd) (struct ata_queued_cmd *qc);
 
 	irq_handler_t irq_handler;
 	void (*irq_clear) (struct ata_port *);
-	u8 (*irq_on) (struct ata_port *);
-	u8 (*irq_off) (struct ata_port *);
 	u8 (*irq_ack) (struct ata_port *ap, unsigned int chk_drq);
 
 	u32 (*scr_read) (struct ata_port *ap, unsigned int sc_reg);