aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/libata.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/libata.h')
-rw-r--r--include/linux/libata.h56
1 files changed, 42 insertions, 14 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h
index b6b8a7f3ec66..3d501db36a26 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -187,6 +187,8 @@ enum {
187 ATA_FLAG_PIO_POLLING = (1 << 9), /* use polling PIO if LLD 187 ATA_FLAG_PIO_POLLING = (1 << 9), /* use polling PIO if LLD
188 * doesn't handle PIO interrupts */ 188 * doesn't handle PIO interrupts */
189 ATA_FLAG_NCQ = (1 << 10), /* host supports NCQ */ 189 ATA_FLAG_NCQ = (1 << 10), /* host supports NCQ */
190 ATA_FLAG_NO_POWEROFF_SPINDOWN = (1 << 11), /* don't spindown before poweroff */
191 ATA_FLAG_NO_HIBERNATE_SPINDOWN = (1 << 12), /* don't spindown before hibernation */
190 ATA_FLAG_DEBUGMSG = (1 << 13), 192 ATA_FLAG_DEBUGMSG = (1 << 13),
191 ATA_FLAG_IGN_SIMPLEX = (1 << 15), /* ignore SIMPLEX */ 193 ATA_FLAG_IGN_SIMPLEX = (1 << 15), /* ignore SIMPLEX */
192 ATA_FLAG_NO_IORDY = (1 << 16), /* controller lacks iordy */ 194 ATA_FLAG_NO_IORDY = (1 << 16), /* controller lacks iordy */
@@ -207,6 +209,7 @@ enum {
207 209
208 /* bits 24:31 of ap->flags are reserved for LLD specific flags */ 210 /* bits 24:31 of ap->flags are reserved for LLD specific flags */
209 211
212
210 /* struct ata_port pflags */ 213 /* struct ata_port pflags */
211 ATA_PFLAG_EH_PENDING = (1 << 0), /* EH pending */ 214 ATA_PFLAG_EH_PENDING = (1 << 0), /* EH pending */
212 ATA_PFLAG_EH_IN_PROGRESS = (1 << 1), /* EH in progress */ 215 ATA_PFLAG_EH_IN_PROGRESS = (1 << 1), /* EH in progress */
@@ -223,6 +226,9 @@ enum {
223 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */ 226 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */
224 ATA_PFLAG_INIT_GTM_VALID = (1 << 19), /* initial gtm data valid */ 227 ATA_PFLAG_INIT_GTM_VALID = (1 << 19), /* initial gtm data valid */
225 228
229 ATA_PFLAG_PIO32 = (1 << 20), /* 32bit PIO */
230 ATA_PFLAG_PIO32CHANGE = (1 << 21), /* 32bit PIO can be turned on/off */
231
226 /* struct ata_queued_cmd flags */ 232 /* struct ata_queued_cmd flags */
227 ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */ 233 ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */
228 ATA_QCFLAG_DMAMAP = (1 << 1), /* SG table is DMA mapped */ 234 ATA_QCFLAG_DMAMAP = (1 << 1), /* SG table is DMA mapped */
@@ -273,7 +279,7 @@ enum {
273 * advised to wait only for the following duration before 279 * advised to wait only for the following duration before
274 * doing SRST. 280 * doing SRST.
275 */ 281 */
276 ATA_TMOUT_PMP_SRST_WAIT = 1000, 282 ATA_TMOUT_PMP_SRST_WAIT = 5000,
277 283
278 /* ATA bus states */ 284 /* ATA bus states */
279 BUS_UNKNOWN = 0, 285 BUS_UNKNOWN = 0,
@@ -377,7 +383,8 @@ enum {
377 ATA_HORKAGE_BRIDGE_OK = (1 << 10), /* no bridge limits */ 383 ATA_HORKAGE_BRIDGE_OK = (1 << 10), /* no bridge limits */
378 ATA_HORKAGE_ATAPI_MOD16_DMA = (1 << 11), /* use ATAPI DMA for commands 384 ATA_HORKAGE_ATAPI_MOD16_DMA = (1 << 11), /* use ATAPI DMA for commands
379 not multiple of 16 bytes */ 385 not multiple of 16 bytes */
380 ATA_HORKAGE_FIRMWARE_WARN = (1 << 12), /* firwmare update warning */ 386 ATA_HORKAGE_FIRMWARE_WARN = (1 << 12), /* firmware update warning */
387 ATA_HORKAGE_1_5_GBPS = (1 << 13), /* force 1.5 Gbps */
381 388
382 /* DMA mask for user DMA control: User visible values; DO NOT 389 /* DMA mask for user DMA control: User visible values; DO NOT
383 renumber */ 390 renumber */
@@ -401,12 +408,14 @@ enum {
401 ATA_TIMING_CYC8B, 408 ATA_TIMING_CYC8B,
402 ATA_TIMING_ACTIVE = (1 << 4), 409 ATA_TIMING_ACTIVE = (1 << 4),
403 ATA_TIMING_RECOVER = (1 << 5), 410 ATA_TIMING_RECOVER = (1 << 5),
404 ATA_TIMING_CYCLE = (1 << 6), 411 ATA_TIMING_DMACK_HOLD = (1 << 6),
405 ATA_TIMING_UDMA = (1 << 7), 412 ATA_TIMING_CYCLE = (1 << 7),
413 ATA_TIMING_UDMA = (1 << 8),
406 ATA_TIMING_ALL = ATA_TIMING_SETUP | ATA_TIMING_ACT8B | 414 ATA_TIMING_ALL = ATA_TIMING_SETUP | ATA_TIMING_ACT8B |
407 ATA_TIMING_REC8B | ATA_TIMING_CYC8B | 415 ATA_TIMING_REC8B | ATA_TIMING_CYC8B |
408 ATA_TIMING_ACTIVE | ATA_TIMING_RECOVER | 416 ATA_TIMING_ACTIVE | ATA_TIMING_RECOVER |
409 ATA_TIMING_CYCLE | ATA_TIMING_UDMA, 417 ATA_TIMING_DMACK_HOLD | ATA_TIMING_CYCLE |
418 ATA_TIMING_UDMA,
410}; 419};
411 420
412enum ata_xfer_mask { 421enum ata_xfer_mask {
@@ -525,6 +534,7 @@ struct ata_queued_cmd {
525 unsigned long flags; /* ATA_QCFLAG_xxx */ 534 unsigned long flags; /* ATA_QCFLAG_xxx */
526 unsigned int tag; 535 unsigned int tag;
527 unsigned int n_elem; 536 unsigned int n_elem;
537 unsigned int orig_n_elem;
528 538
529 int dma_dir; 539 int dma_dir;
530 540
@@ -576,7 +586,7 @@ struct ata_device {
576 acpi_handle acpi_handle; 586 acpi_handle acpi_handle;
577 union acpi_object *gtf_cache; 587 union acpi_object *gtf_cache;
578#endif 588#endif
579 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */ 589 /* n_sector is CLEAR_BEGIN, read comment above CLEAR_BEGIN */
580 u64 n_sectors; /* size of device, if ATA */ 590 u64 n_sectors; /* size of device, if ATA */
581 unsigned int class; /* ATA_DEV_xxx */ 591 unsigned int class; /* ATA_DEV_xxx */
582 unsigned long unpark_deadline; 592 unsigned long unpark_deadline;
@@ -601,20 +611,22 @@ struct ata_device {
601 u16 heads; /* Number of heads */ 611 u16 heads; /* Number of heads */
602 u16 sectors; /* Number of sectors per track */ 612 u16 sectors; /* Number of sectors per track */
603 613
604 /* error history */
605 int spdn_cnt;
606 struct ata_ering ering;
607
608 union { 614 union {
609 u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */ 615 u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */
610 u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */ 616 u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */
611 }; 617 };
618
619 /* error history */
620 int spdn_cnt;
621 /* ering is CLEAR_END, read comment above CLEAR_END */
622 struct ata_ering ering;
612}; 623};
613 624
614/* Offset into struct ata_device. Fields above it are maintained 625/* Fields between ATA_DEVICE_CLEAR_BEGIN and ATA_DEVICE_CLEAR_END are
615 * acress device init. Fields below are zeroed. 626 * cleared to zero on ata_dev_init().
616 */ 627 */
617#define ATA_DEVICE_CLEAR_OFFSET offsetof(struct ata_device, n_sectors) 628#define ATA_DEVICE_CLEAR_BEGIN offsetof(struct ata_device, n_sectors)
629#define ATA_DEVICE_CLEAR_END offsetof(struct ata_device, ering)
618 630
619struct ata_eh_info { 631struct ata_eh_info {
620 struct ata_device *dev; /* offending device */ 632 struct ata_device *dev; /* offending device */
@@ -681,7 +693,10 @@ struct ata_port {
681 struct Scsi_Host *scsi_host; /* our co-allocated scsi host */ 693 struct Scsi_Host *scsi_host; /* our co-allocated scsi host */
682 struct ata_port_operations *ops; 694 struct ata_port_operations *ops;
683 spinlock_t *lock; 695 spinlock_t *lock;
696 /* Flags owned by the EH context. Only EH should touch these once the
697 port is active */
684 unsigned long flags; /* ATA_FLAG_xxx */ 698 unsigned long flags; /* ATA_FLAG_xxx */
699 /* Flags that change dynamically, protected by ap->lock */
685 unsigned int pflags; /* ATA_PFLAG_xxx */ 700 unsigned int pflags; /* ATA_PFLAG_xxx */
686 unsigned int print_id; /* user visible unique port ID */ 701 unsigned int print_id; /* user visible unique port ID */
687 unsigned int port_no; /* 0 based port no. inside the host */ 702 unsigned int port_no; /* 0 based port no. inside the host */
@@ -743,7 +758,8 @@ struct ata_port {
743 acpi_handle acpi_handle; 758 acpi_handle acpi_handle;
744 struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */ 759 struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */
745#endif 760#endif
746 u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */ 761 /* owned by EH */
762 u8 sector_buf[ATA_SECT_SIZE] ____cacheline_aligned;
747}; 763};
748 764
749/* The following initializer overrides a method to NULL whether one of 765/* The following initializer overrides a method to NULL whether one of
@@ -786,6 +802,7 @@ struct ata_port_operations {
786 ata_reset_fn_t pmp_hardreset; 802 ata_reset_fn_t pmp_hardreset;
787 ata_postreset_fn_t pmp_postreset; 803 ata_postreset_fn_t pmp_postreset;
788 void (*error_handler)(struct ata_port *ap); 804 void (*error_handler)(struct ata_port *ap);
805 void (*lost_interrupt)(struct ata_port *ap);
789 void (*post_internal_cmd)(struct ata_queued_cmd *qc); 806 void (*post_internal_cmd)(struct ata_queued_cmd *qc);
790 807
791 /* 808 /*
@@ -827,6 +844,8 @@ struct ata_port_operations {
827 void (*bmdma_start)(struct ata_queued_cmd *qc); 844 void (*bmdma_start)(struct ata_queued_cmd *qc);
828 void (*bmdma_stop)(struct ata_queued_cmd *qc); 845 void (*bmdma_stop)(struct ata_queued_cmd *qc);
829 u8 (*bmdma_status)(struct ata_port *ap); 846 u8 (*bmdma_status)(struct ata_port *ap);
847
848 void (*drain_fifo)(struct ata_queued_cmd *qc);
830#endif /* CONFIG_ATA_SFF */ 849#endif /* CONFIG_ATA_SFF */
831 850
832 ssize_t (*em_show)(struct ata_port *ap, char *buf); 851 ssize_t (*em_show)(struct ata_port *ap, char *buf);
@@ -866,6 +885,7 @@ struct ata_timing {
866 unsigned short cyc8b; /* t0 for 8-bit I/O */ 885 unsigned short cyc8b; /* t0 for 8-bit I/O */
867 unsigned short active; /* t2 or tD */ 886 unsigned short active; /* t2 or tD */
868 unsigned short recover; /* t2i or tK */ 887 unsigned short recover; /* t2i or tK */
888 unsigned short dmack_hold; /* tj */
869 unsigned short cycle; /* t0 */ 889 unsigned short cycle; /* t0 */
870 unsigned short udma; /* t2CYCTYP/2 */ 890 unsigned short udma; /* t2CYCTYP/2 */
871}; 891};
@@ -927,6 +947,8 @@ extern void ata_host_init(struct ata_host *, struct device *,
927extern int ata_scsi_detect(struct scsi_host_template *sht); 947extern int ata_scsi_detect(struct scsi_host_template *sht);
928extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); 948extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
929extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); 949extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *));
950extern int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *dev,
951 int cmd, void __user *arg);
930extern void ata_sas_port_destroy(struct ata_port *); 952extern void ata_sas_port_destroy(struct ata_port *);
931extern struct ata_port *ata_sas_port_alloc(struct ata_host *, 953extern struct ata_port *ata_sas_port_alloc(struct ata_host *,
932 struct ata_port_info *, struct Scsi_Host *); 954 struct ata_port_info *, struct Scsi_Host *);
@@ -996,6 +1018,9 @@ extern int ata_cable_sata(struct ata_port *ap);
996extern int ata_cable_ignore(struct ata_port *ap); 1018extern int ata_cable_ignore(struct ata_port *ap);
997extern int ata_cable_unknown(struct ata_port *ap); 1019extern int ata_cable_unknown(struct ata_port *ap);
998 1020
1021extern void ata_pio_queue_task(struct ata_port *ap, void *data,
1022 unsigned long delay);
1023
999/* Timing helpers */ 1024/* Timing helpers */
1000extern unsigned int ata_pio_need_iordy(const struct ata_device *); 1025extern unsigned int ata_pio_need_iordy(const struct ata_device *);
1001extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode); 1026extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode);
@@ -1560,6 +1585,7 @@ extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc);
1560extern unsigned int ata_sff_host_intr(struct ata_port *ap, 1585extern unsigned int ata_sff_host_intr(struct ata_port *ap,
1561 struct ata_queued_cmd *qc); 1586 struct ata_queued_cmd *qc);
1562extern irqreturn_t ata_sff_interrupt(int irq, void *dev_instance); 1587extern irqreturn_t ata_sff_interrupt(int irq, void *dev_instance);
1588extern void ata_sff_lost_interrupt(struct ata_port *ap);
1563extern void ata_sff_freeze(struct ata_port *ap); 1589extern void ata_sff_freeze(struct ata_port *ap);
1564extern void ata_sff_thaw(struct ata_port *ap); 1590extern void ata_sff_thaw(struct ata_port *ap);
1565extern int ata_sff_prereset(struct ata_link *link, unsigned long deadline); 1591extern int ata_sff_prereset(struct ata_link *link, unsigned long deadline);
@@ -1572,9 +1598,11 @@ extern int ata_sff_softreset(struct ata_link *link, unsigned int *classes,
1572extern int sata_sff_hardreset(struct ata_link *link, unsigned int *class, 1598extern int sata_sff_hardreset(struct ata_link *link, unsigned int *class,
1573 unsigned long deadline); 1599 unsigned long deadline);
1574extern void ata_sff_postreset(struct ata_link *link, unsigned int *classes); 1600extern void ata_sff_postreset(struct ata_link *link, unsigned int *classes);
1601extern void ata_sff_drain_fifo(struct ata_queued_cmd *qc);
1575extern void ata_sff_error_handler(struct ata_port *ap); 1602extern void ata_sff_error_handler(struct ata_port *ap);
1576extern void ata_sff_post_internal_cmd(struct ata_queued_cmd *qc); 1603extern void ata_sff_post_internal_cmd(struct ata_queued_cmd *qc);
1577extern int ata_sff_port_start(struct ata_port *ap); 1604extern int ata_sff_port_start(struct ata_port *ap);
1605extern int ata_sff_port_start32(struct ata_port *ap);
1578extern void ata_sff_std_ports(struct ata_ioports *ioaddr); 1606extern void ata_sff_std_ports(struct ata_ioports *ioaddr);
1579extern unsigned long ata_bmdma_mode_filter(struct ata_device *dev, 1607extern unsigned long ata_bmdma_mode_filter(struct ata_device *dev,
1580 unsigned long xfer_mask); 1608 unsigned long xfer_mask);