[libata] Introduce ata_id_has_unload()
authorElias Oltmanns <eo@nebensachen.de>
Fri, 19 Sep 2008 21:46:01 +0000 (23:46 +0200)
committerJeff Garzik <jgarzik@redhat.com>
Mon, 29 Sep 2008 04:25:50 +0000 (00:25 -0400)
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>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
include/linux/ata.h

index 8a12d718c16931892d7842a9e6e3c3e6020b2443..a26ebd25bac1aff43e076c6a1ab4fbd34a08cad9 100644 (file)
@@ -667,6 +667,15 @@ static inline int ata_id_has_dword_io(const u16 *id)
        return 0;
 }
 
+static inline int ata_id_has_unload(const u16 *id)
+{
+       if (ata_id_major_version(id) >= 7 &&
+           (id[ATA_ID_CFSSE] & 0xC000) == 0x4000 &&
+           id[ATA_ID_CFSSE] & (1 << 13))
+               return 1;
+       return 0;
+}
+
 static inline int ata_id_current_chs_valid(const u16 *id)
 {
        /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command