Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
[linux-block.git] / include / linux / libata.h
index dd5797fb6305cb29b3edff708215b0459a7516b2..820f7a3a2749bedf8f46cc2684cda1d336b7cfa4 100644 (file)
@@ -94,17 +94,19 @@ enum {
        ATA_DFLAG_DMADIR        = (1 << 10), /* device requires DMADIR */
        ATA_DFLAG_NCQ_SEND_RECV = (1 << 11), /* device supports NCQ SEND and RECV */
        ATA_DFLAG_NCQ_PRIO      = (1 << 12), /* device supports NCQ priority */
-       ATA_DFLAG_CFG_MASK      = (1 << 13) - 1,
-
-       ATA_DFLAG_PIO           = (1 << 13), /* device limited to PIO mode */
-       ATA_DFLAG_NCQ_OFF       = (1 << 14), /* device limited to non-NCQ mode */
-       ATA_DFLAG_SLEEPING      = (1 << 15), /* device is sleeping */
-       ATA_DFLAG_DUBIOUS_XFER  = (1 << 16), /* data transfer not verified */
-       ATA_DFLAG_NO_UNLOAD     = (1 << 17), /* device doesn't support unload */
-       ATA_DFLAG_UNLOCK_HPA    = (1 << 18), /* unlock HPA */
-       ATA_DFLAG_INIT_MASK     = (1 << 19) - 1,
-
-       ATA_DFLAG_NCQ_PRIO_ENABLED = (1 << 19), /* Priority cmds sent to dev */
+       ATA_DFLAG_CDL           = (1 << 13), /* supports cmd duration limits */
+       ATA_DFLAG_CFG_MASK      = (1 << 14) - 1,
+
+       ATA_DFLAG_PIO           = (1 << 14), /* device limited to PIO mode */
+       ATA_DFLAG_NCQ_OFF       = (1 << 15), /* device limited to non-NCQ mode */
+       ATA_DFLAG_SLEEPING      = (1 << 16), /* device is sleeping */
+       ATA_DFLAG_DUBIOUS_XFER  = (1 << 17), /* data transfer not verified */
+       ATA_DFLAG_NO_UNLOAD     = (1 << 18), /* device doesn't support unload */
+       ATA_DFLAG_UNLOCK_HPA    = (1 << 19), /* unlock HPA */
+       ATA_DFLAG_INIT_MASK     = (1 << 20) - 1,
+
+       ATA_DFLAG_NCQ_PRIO_ENABLED = (1 << 20), /* Priority cmds sent to dev */
+       ATA_DFLAG_CDL_ENABLED   = (1 << 21), /* cmd duration limits is enabled */
        ATA_DFLAG_DETACH        = (1 << 24),
        ATA_DFLAG_DETACHED      = (1 << 25),
        ATA_DFLAG_DA            = (1 << 26), /* device supports Device Attention */
@@ -115,7 +117,8 @@ enum {
 
        ATA_DFLAG_FEATURES_MASK = (ATA_DFLAG_TRUSTED | ATA_DFLAG_DA |   \
                                   ATA_DFLAG_DEVSLP | ATA_DFLAG_NCQ_SEND_RECV | \
-                                  ATA_DFLAG_NCQ_PRIO | ATA_DFLAG_FUA),
+                                  ATA_DFLAG_NCQ_PRIO | ATA_DFLAG_FUA | \
+                                  ATA_DFLAG_CDL),
 
        ATA_DEV_UNKNOWN         = 0,    /* unknown device */
        ATA_DEV_ATA             = 1,    /* ATA device */
@@ -206,10 +209,12 @@ enum {
        ATA_QCFLAG_CLEAR_EXCL   = (1 << 5), /* clear excl_link on completion */
        ATA_QCFLAG_QUIET        = (1 << 6), /* don't report device error */
        ATA_QCFLAG_RETRY        = (1 << 7), /* retry after failure */
+       ATA_QCFLAG_HAS_CDL      = (1 << 8), /* qc has CDL a descriptor set */
 
        ATA_QCFLAG_EH           = (1 << 16), /* cmd aborted and owned by EH */
        ATA_QCFLAG_SENSE_VALID  = (1 << 17), /* sense data valid */
        ATA_QCFLAG_EH_SCHEDULED = (1 << 18), /* EH scheduled (obsolete) */
+       ATA_QCFLAG_EH_SUCCESS_CMD = (1 << 19), /* EH should fetch sense for this successful cmd */
 
        /* host set flags */
        ATA_HOST_SIMPLEX        = (1 << 0),     /* Host is simplex, one DMA channel per host only */
@@ -308,8 +313,10 @@ enum {
        ATA_EH_RESET            = ATA_EH_SOFTRESET | ATA_EH_HARDRESET,
        ATA_EH_ENABLE_LINK      = (1 << 3),
        ATA_EH_PARK             = (1 << 5), /* unload heads and stop I/O */
+       ATA_EH_GET_SUCCESS_SENSE = (1 << 6), /* Get sense data for successful cmd */
 
-       ATA_EH_PERDEV_MASK      = ATA_EH_REVALIDATE | ATA_EH_PARK,
+       ATA_EH_PERDEV_MASK      = ATA_EH_REVALIDATE | ATA_EH_PARK |
+                                 ATA_EH_GET_SUCCESS_SENSE,
        ATA_EH_ALL_ACTIONS      = ATA_EH_REVALIDATE | ATA_EH_RESET |
                                  ATA_EH_ENABLE_LINK,
 
@@ -709,6 +716,9 @@ struct ata_device {
        /* Concurrent positioning ranges */
        struct ata_cpr_log      *cpr_log;
 
+       /* Command Duration Limits log support */
+       u8                      cdl[ATA_LOG_CDL_SIZE];
+
        /* error history */
        int                     spdn_cnt;
        /* ering is CLEAR_END, read comment above CLEAR_END */
@@ -860,6 +870,7 @@ struct ata_port {
        struct ata_acpi_gtm     __acpi_init_gtm; /* use ata_acpi_init_gtm() */
 #endif
        /* owned by EH */
+       u8                      *ncq_sense_buf;
        u8                      sector_buf[ATA_SECT_SIZE] ____cacheline_aligned;
 };
 
@@ -1144,8 +1155,8 @@ extern int ata_scsi_slave_config(struct scsi_device *sdev);
 extern void ata_scsi_slave_destroy(struct scsi_device *sdev);
 extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
                                       int queue_depth);
-extern int ata_change_queue_depth(struct ata_port *ap, struct ata_device *dev,
-                                 struct scsi_device *sdev, int queue_depth);
+extern int ata_change_queue_depth(struct ata_port *ap, struct scsi_device *sdev,
+                                 int queue_depth);
 extern struct ata_device *ata_dev_pair(struct ata_device *adev);
 extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev);
 extern void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap);
@@ -1178,6 +1189,7 @@ extern int sata_link_hardreset(struct ata_link *link,
                        bool *online, int (*check_ready)(struct ata_link *));
 extern int sata_link_resume(struct ata_link *link, const unsigned long *params,
                            unsigned long deadline);
+extern int ata_eh_read_sense_success_ncq_log(struct ata_link *link);
 extern void ata_eh_analyze_ncq_error(struct ata_link *link);
 #else
 static inline const unsigned long *
@@ -1215,6 +1227,10 @@ static inline int sata_link_resume(struct ata_link *link,
 {
        return -EOPNOTSUPP;
 }
+static inline int ata_eh_read_sense_success_ncq_log(struct ata_link *link)
+{
+       return -EOPNOTSUPP;
+}
 static inline void ata_eh_analyze_ncq_error(struct ata_link *link) { }
 #endif
 extern int sata_link_debounce(struct ata_link *link,
@@ -1276,7 +1292,7 @@ extern int ata_pci_device_resume(struct pci_dev *pdev);
 
 struct platform_device;
 
-extern int ata_platform_remove_one(struct platform_device *pdev);
+extern void ata_platform_remove_one(struct platform_device *pdev);
 
 /*
  * ACPI - drivers/ata/libata-acpi.c