libata: detect Device Attention support
authorLin Ming <ming.m.lin@intel.com>
Mon, 25 Jun 2012 08:13:08 +0000 (16:13 +0800)
committerJeff Garzik <jgarzik@redhat.com>
Fri, 29 Jun 2012 15:38:17 +0000 (11:38 -0400)
Add a new flag ATA_DFLAG_DA to indicate that device supports "Device
Attention".

Acked-by: Aaron Lu <aaron.lu@amd.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/ata/libata-core.c
include/linux/ata.h
include/linux/libata.h

index 7705191b5a81bcf1c19c02694ad50742523143e9..c14f88c1f1da910b3227dfa2e4658d99d68fe588 100644 (file)
@@ -2374,6 +2374,9 @@ int ata_dev_configure(struct ata_device *dev)
                        dma_dir_string = ", DMADIR";
                }
 
+               if (ata_id_has_da(dev->id))
+                       dev->flags |= ATA_DFLAG_DA;
+
                /* print device info to dmesg */
                if (ata_msg_drv(ap) && print_info)
                        ata_dev_info(dev,
index 32df2b6ef0e09e5ba918988adb8bc7d9e7f246f1..5713d3ac381ad4f72a8ccc8193a1421286d30f6c 100644 (file)
@@ -578,6 +578,7 @@ static inline int ata_is_data(u8 prot)
          ((u64) (id)[(n) + 0]) )
 
 #define ata_id_cdb_intr(id)    (((id)[ATA_ID_CONFIG] & 0x60) == 0x20)
+#define ata_id_has_da(id)      ((id)[77] & (1 << 4))
 
 static inline bool ata_id_has_hipm(const u16 *id)
 {
index 888feef3cda460ff49899b6f5dbb7787d2ab9743..cc22b943db83cd1c6235f84a575f82f0b982717f 100644 (file)
@@ -161,6 +161,8 @@ enum {
        ATA_DFLAG_DETACH        = (1 << 24),
        ATA_DFLAG_DETACHED      = (1 << 25),
 
+       ATA_DFLAG_DA            = (1 << 26), /* device supports Device Attention */
+
        ATA_DEV_UNKNOWN         = 0,    /* unknown device */
        ATA_DEV_ATA             = 1,    /* ATA device */
        ATA_DEV_ATA_UNSUP       = 2,    /* ATA device (unsupported) */