linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Albert Lee <albertcc@tw.ibm.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, Tejun Heo <htejun@gmail.com>,
	Linux IDE <linux-ide@vger.kernel.org>,
	Doug Maxey <dwm@enoyolf.org>
Subject: [PATCH 2/10] libata: add irq_off
Date: Wed, 04 Jul 2007 16:46:25 +0800	[thread overview]
Message-ID: <468B5E61.6000601@tw.ibm.com> (raw)
In-Reply-To: <468B5C97.1000803@tw.ibm.com>

Patch 2/10:
  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.

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
---

diff -Nrup 01_remove_leftover_irqon/drivers/ata/libata-core.c 02_add_irq_off/drivers/ata/libata-core.c
--- 01_remove_leftover_irqon/drivers/ata/libata-core.c	2007-07-04 11:43:30.000000000 +0800
+++ 02_add_irq_off/drivers/ata/libata-core.c	2007-07-04 11:57:33.000000000 +0800
@@ -6901,6 +6901,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);
diff -Nrup 01_remove_leftover_irqon/drivers/ata/libata-sff.c 02_add_irq_off/drivers/ata/libata-sff.c
--- 01_remove_leftover_irqon/drivers/ata/libata-sff.c	2007-07-04 11:26:30.000000000 +0800
+++ 02_add_irq_off/drivers/ata/libata-sff.c	2007-07-04 11:57:33.000000000 +0800
@@ -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.
  *
diff -Nrup 01_remove_leftover_irqon/drivers/ata/libata.h 02_add_irq_off/drivers/ata/libata.h
--- 01_remove_leftover_irqon/drivers/ata/libata.h	2007-07-04 11:26:30.000000000 +0800
+++ 02_add_irq_off/drivers/ata/libata.h	2007-07-04 11:57:33.000000000 +0800
@@ -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__ */
diff -Nrup 01_remove_leftover_irqon/include/linux/libata.h 02_add_irq_off/include/linux/libata.h
--- 01_remove_leftover_irqon/include/linux/libata.h	2007-07-04 11:26:45.000000000 +0800
+++ 02_add_irq_off/include/linux/libata.h	2007-07-04 11:57:33.000000000 +0800
@@ -597,6 +597,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);
@@ -804,6 +805,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);
 



  parent reply	other threads:[~2007-07-04  8:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-04  8:38 [PATCH 0/10] libata: irq_on/off restructuring Albert Lee
2007-07-04  8:43 ` [PATCH 1/10] libata: remove irq_on from ata_bus_reset() and ata_std_postreset() Albert Lee
2007-07-05 10:18   ` Tejun Heo
2007-07-04  8:46 ` Albert Lee [this message]
2007-07-04  8:49 ` [PATCH 3/10] libata: implement ->irq_off in LLDDs Albert Lee
2007-07-04  8:52 ` [PATCH 4/10] libata: call irq_off from bmdma_freeze() Albert Lee
2007-07-04  8:57 ` [PATCH 5/10] libata: use freeze/thaw for polling Albert Lee
2007-07-04  8:59 ` [PATCH 6/10] libata: add freeze/thaw to old EH LLDDs Albert Lee
2007-07-04  9:01 ` [PATCH 7/10] libata: pdc_freeze() semantic change Albert Lee
2007-07-04  9:03 ` [PATCH 8/10] libata: remove writing of tf->ctl from ata_tf_load() Albert Lee
2007-07-04 19:09   ` Mark Lord
2007-07-05  2:43     ` Albert Lee
2007-07-05 10:40       ` Tejun Heo
2007-07-04  9:16 ` [PATCH 9/10] libata: Integrate freeze/thaw with irq_on/off Albert Lee
2007-07-04  9:29 ` [PATCH 10/10] libata: Integrate freeze/thaw with irq_on/off in LLDDs Albert Lee
2007-07-05 10:48 ` [PATCH 0/10] libata: irq_on/off restructuring Tejun Heo
2007-07-06  9:23   ` Albert Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=468B5E61.6000601@tw.ibm.com \
    --to=albertcc@tw.ibm.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=albertl@mail.com \
    --cc=dwm@enoyolf.org \
    --cc=htejun@gmail.com \
    --cc=jeff@garzik.org \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).