All of lore.kernel.org
 help / color / mirror / Atom feed
From: Elias Oltmanns <eo@nebensachen.de>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Jeff Garzik <jeff@garzik.org>,
	Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
	James Bottomley <James.Bottomley@hansenpartnership.com>
Cc: Pavel Machek <pavel@ucw.cz>,
	linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/5] Introduce ata_id_has_unload()
Date: Sat, 26 Jul 2008 08:24:35 +0200	[thread overview]
Message-ID: <20080726062142.29070.87751.stgit@denkblock.local> (raw)
In-Reply-To: <87prp1kvyy.fsf@denkblock.local>

Add a function to check an ATA device's id for head unload support as
specified in ATA-7.

Signed-off-by: Elias Oltmanns <eo@nebensachen.de>
---

 include/linux/ata.h |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/include/linux/ata.h b/include/linux/ata.h
index cf4ef6d..c92ac10 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -530,6 +530,21 @@ static inline bool ata_id_has_dipm(const u16 *id)
 }
 
 
+static inline int ata_id_has_unload(const u16 *id)
+{
+	/*
+	 * ATA-7 specifies two places to indicate unload feature support.
+	 * Since I don't really understand the difference, I'll just check
+	 * both and only return zero if none of them indicates otherwise.
+	 */
+	if ((id[ATA_ID_CFSSE] & 0xC000) == 0x4000
+	    && id[ATA_ID_CFSSE] & (1 << 13))
+		return id[ATA_ID_CFSSE] & (1 << 13);
+	if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) == 0x4000)
+		return id[ATA_ID_CSF_DEFAULT] & (1 << 13);
+	return 0;
+}
+
 static inline int ata_id_has_fua(const u16 *id)
 {
 	if ((id[ATA_ID_CFSSE] & 0xC000) != 0x4000)



  parent reply	other threads:[~2008-07-26  6:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-26  6:20 [RFC] Disk shock protection in GNU/Linux Elias Oltmanns
2008-07-26  6:23 ` [PATCH 1/5] Make sure that ata_force_tbl is freed in case of an error Elias Oltmanns
2008-07-26  6:24 ` Elias Oltmanns [this message]
2008-07-26 16:01   ` [PATCH 2/5] Introduce ata_id_has_unload() Alan Cox
2008-07-26  6:25 ` [PATCH 3/5] libata: Implement disk shock protection support Elias Oltmanns
2008-08-01  7:19   ` Tejun Heo
2008-08-01 22:34     ` Alan Cox
2008-08-03  3:19       ` Tejun Heo
2008-08-03 13:05         ` Alan Cox
2008-08-03 13:58           ` Tejun Heo
2008-08-04 13:43       ` Elias Oltmanns
2008-08-04 13:26     ` Elias Oltmanns
2008-08-04 14:12       ` Tejun Heo
2008-08-04 16:54         ` Elias Oltmanns
2008-08-04 23:26           ` Tejun Heo
2008-08-04 14:28     ` Gabor Gombas
2008-08-04 14:13       ` Alan Cox
2008-08-04 14:35       ` Tejun Heo
2008-07-26  6:27 ` [PATCH 4/5] ide: " Elias Oltmanns
2008-08-04  6:39   ` Pavel Machek
2008-08-04 14:15     ` Elias Oltmanns
2008-07-26  6:29 ` [PATCH 5/5] Add documentation for hard disk shock protection interface Elias Oltmanns
2008-07-26  9:18   ` Sergei Shtylyov

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=20080726062142.29070.87751.stgit@denkblock.local \
    --to=eo@nebensachen.de \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=bzolnier@gmail.com \
    --cc=jeff@garzik.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.