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.h59
1 files changed, 19 insertions, 40 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h
index abd2debebca2..ab2754830322 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -140,6 +140,7 @@ enum {
140 ATA_DFLAG_LBA48 = (1 << 1), /* device supports LBA48 */ 140 ATA_DFLAG_LBA48 = (1 << 1), /* device supports LBA48 */
141 ATA_DFLAG_CDB_INTR = (1 << 2), /* device asserts INTRQ when ready for CDB */ 141 ATA_DFLAG_CDB_INTR = (1 << 2), /* device asserts INTRQ when ready for CDB */
142 ATA_DFLAG_NCQ = (1 << 3), /* device supports NCQ */ 142 ATA_DFLAG_NCQ = (1 << 3), /* device supports NCQ */
143 ATA_DFLAG_FLUSH_EXT = (1 << 4), /* do FLUSH_EXT instead of FLUSH */
143 ATA_DFLAG_CFG_MASK = (1 << 8) - 1, 144 ATA_DFLAG_CFG_MASK = (1 << 8) - 1,
144 145
145 ATA_DFLAG_PIO = (1 << 8), /* device limited to PIO mode */ 146 ATA_DFLAG_PIO = (1 << 8), /* device limited to PIO mode */
@@ -175,6 +176,7 @@ enum {
175 ATA_FLAG_SKIP_D2H_BSY = (1 << 12), /* can't wait for the first D2H 176 ATA_FLAG_SKIP_D2H_BSY = (1 << 12), /* can't wait for the first D2H
176 * Register FIS clearing BSY */ 177 * Register FIS clearing BSY */
177 ATA_FLAG_DEBUGMSG = (1 << 13), 178 ATA_FLAG_DEBUGMSG = (1 << 13),
179 ATA_FLAG_SETXFER_POLLING= (1 << 14), /* use polling for SETXFER */
178 180
179 /* The following flag belongs to ap->pflags but is kept in 181 /* The following flag belongs to ap->pflags but is kept in
180 * ap->flags because it's referenced in many LLDs and will be 182 * ap->flags because it's referenced in many LLDs and will be
@@ -283,6 +285,9 @@ enum {
283 ATA_EHI_QUIET = (1 << 3), /* be quiet */ 285 ATA_EHI_QUIET = (1 << 3), /* be quiet */
284 286
285 ATA_EHI_DID_RESET = (1 << 16), /* already reset this port */ 287 ATA_EHI_DID_RESET = (1 << 16), /* already reset this port */
288 ATA_EHI_PRINTINFO = (1 << 17), /* print configuration info */
289 ATA_EHI_SETMODE = (1 << 18), /* configure transfer mode */
290 ATA_EHI_POST_SETMODE = (1 << 19), /* revaildating after setmode */
286 291
287 ATA_EHI_RESET_MODIFIER_MASK = ATA_EHI_RESUME_LINK, 292 ATA_EHI_RESET_MODIFIER_MASK = ATA_EHI_RESUME_LINK,
288 293
@@ -307,10 +312,11 @@ enum {
307 (some horkage may be drive/controller pair dependant */ 312 (some horkage may be drive/controller pair dependant */
308 313
309 ATA_HORKAGE_DIAGNOSTIC = (1 << 0), /* Failed boot diag */ 314 ATA_HORKAGE_DIAGNOSTIC = (1 << 0), /* Failed boot diag */
315 ATA_HORKAGE_NODMA = (1 << 1), /* DMA problems */
316 ATA_HORKAGE_NONCQ = (1 << 2), /* Don't use NCQ */
310}; 317};
311 318
312enum hsm_task_states { 319enum hsm_task_states {
313 HSM_ST_UNKNOWN, /* state unknown */
314 HSM_ST_IDLE, /* no command on going */ 320 HSM_ST_IDLE, /* no command on going */
315 HSM_ST, /* (waiting the device to) transfer data */ 321 HSM_ST, /* (waiting the device to) transfer data */
316 HSM_ST_LAST, /* (waiting the device to) complete command */ 322 HSM_ST_LAST, /* (waiting the device to) complete command */
@@ -329,6 +335,7 @@ enum ata_completion_errors {
329 AC_ERR_SYSTEM = (1 << 6), /* system error */ 335 AC_ERR_SYSTEM = (1 << 6), /* system error */
330 AC_ERR_INVALID = (1 << 7), /* invalid argument */ 336 AC_ERR_INVALID = (1 << 7), /* invalid argument */
331 AC_ERR_OTHER = (1 << 8), /* unknown */ 337 AC_ERR_OTHER = (1 << 8), /* unknown */
338 AC_ERR_NODEV_HINT = (1 << 9), /* polling device detection hint */
332}; 339};
333 340
334/* forward declarations */ 341/* forward declarations */
@@ -568,8 +575,9 @@ struct ata_port {
568 struct ata_host *host; 575 struct ata_host *host;
569 struct device *dev; 576 struct device *dev;
570 577
571 struct work_struct port_task; 578 void *port_task_data;
572 struct work_struct hotplug_task; 579 struct delayed_work port_task;
580 struct delayed_work hotplug_task;
573 struct work_struct scsi_rescan_task; 581 struct work_struct scsi_rescan_task;
574 582
575 unsigned int hsm_task_state; 583 unsigned int hsm_task_state;
@@ -700,6 +708,8 @@ extern int sata_phy_debounce(struct ata_port *ap, const unsigned long *param);
700extern int sata_phy_resume(struct ata_port *ap, const unsigned long *param); 708extern int sata_phy_resume(struct ata_port *ap, const unsigned long *param);
701extern int ata_std_prereset(struct ata_port *ap); 709extern int ata_std_prereset(struct ata_port *ap);
702extern int ata_std_softreset(struct ata_port *ap, unsigned int *classes); 710extern int ata_std_softreset(struct ata_port *ap, unsigned int *classes);
711extern int sata_port_hardreset(struct ata_port *ap,
712 const unsigned long *timing);
703extern int sata_std_hardreset(struct ata_port *ap, unsigned int *class); 713extern int sata_std_hardreset(struct ata_port *ap, unsigned int *class);
704extern void ata_std_postreset(struct ata_port *ap, unsigned int *classes); 714extern void ata_std_postreset(struct ata_port *ap, unsigned int *classes);
705extern void ata_port_disable(struct ata_port *); 715extern void ata_port_disable(struct ata_port *);
@@ -744,10 +754,9 @@ extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t mesg);
744extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg); 754extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg);
745extern void ata_host_resume(struct ata_host *host); 755extern void ata_host_resume(struct ata_host *host);
746extern int ata_ratelimit(void); 756extern int ata_ratelimit(void);
747extern unsigned int ata_busy_sleep(struct ata_port *ap, 757extern int ata_busy_sleep(struct ata_port *ap,
748 unsigned long timeout_pat, 758 unsigned long timeout_pat, unsigned long timeout);
749 unsigned long timeout); 759extern void ata_port_queue_task(struct ata_port *ap, work_func_t fn,
750extern void ata_port_queue_task(struct ata_port *ap, void (*fn)(void *),
751 void *data, unsigned long delay); 760 void *data, unsigned long delay);
752extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, 761extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
753 unsigned long interval_msec, 762 unsigned long interval_msec,
@@ -787,6 +796,7 @@ extern void ata_id_string(const u16 *id, unsigned char *s,
787 unsigned int ofs, unsigned int len); 796 unsigned int ofs, unsigned int len);
788extern void ata_id_c_string(const u16 *id, unsigned char *s, 797extern void ata_id_c_string(const u16 *id, unsigned char *s,
789 unsigned int ofs, unsigned int len); 798 unsigned int ofs, unsigned int len);
799extern unsigned long ata_device_blacklisted(const struct ata_device *dev);
790extern void ata_bmdma_setup (struct ata_queued_cmd *qc); 800extern void ata_bmdma_setup (struct ata_queued_cmd *qc);
791extern void ata_bmdma_start (struct ata_queued_cmd *qc); 801extern void ata_bmdma_start (struct ata_queued_cmd *qc);
792extern void ata_bmdma_stop(struct ata_queued_cmd *qc); 802extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
@@ -1061,7 +1071,7 @@ static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits,
1061 udelay(10); 1071 udelay(10);
1062 status = ata_chk_status(ap); 1072 status = ata_chk_status(ap);
1063 max--; 1073 max--;
1064 } while ((status & bits) && (max > 0)); 1074 } while (status != 0xff && (status & bits) && (max > 0));
1065 1075
1066 return status; 1076 return status;
1067} 1077}
@@ -1082,7 +1092,7 @@ static inline u8 ata_wait_idle(struct ata_port *ap)
1082{ 1092{
1083 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); 1093 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
1084 1094
1085 if (status & (ATA_BUSY | ATA_DRQ)) { 1095 if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ))) {
1086 unsigned long l = ap->ioaddr.status_addr; 1096 unsigned long l = ap->ioaddr.status_addr;
1087 if (ata_msg_warn(ap)) 1097 if (ata_msg_warn(ap))
1088 printk(KERN_WARNING "ATA: abnormal status 0x%X on port 0x%lX\n", 1098 printk(KERN_WARNING "ATA: abnormal status 0x%X on port 0x%lX\n",
@@ -1148,37 +1158,6 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
1148} 1158}
1149 1159
1150/** 1160/**
1151 * ata_irq_on - Enable interrupts on a port.
1152 * @ap: Port on which interrupts are enabled.
1153 *
1154 * Enable interrupts on a legacy IDE device using MMIO or PIO,
1155 * wait for idle, clear any pending interrupts.
1156 *
1157 * LOCKING:
1158 * Inherited from caller.
1159 */
1160
1161static inline u8 ata_irq_on(struct ata_port *ap)
1162{
1163 struct ata_ioports *ioaddr = &ap->ioaddr;
1164 u8 tmp;
1165
1166 ap->ctl &= ~ATA_NIEN;
1167 ap->last_ctl = ap->ctl;
1168
1169 if (ap->flags & ATA_FLAG_MMIO)
1170 writeb(ap->ctl, (void __iomem *) ioaddr->ctl_addr);
1171 else
1172 outb(ap->ctl, ioaddr->ctl_addr);
1173 tmp = ata_wait_idle(ap);
1174
1175 ap->ops->irq_clear(ap);
1176
1177 return tmp;
1178}
1179
1180
1181/**
1182 * ata_irq_ack - Acknowledge a device interrupt. 1161 * ata_irq_ack - Acknowledge a device interrupt.
1183 * @ap: Port on which interrupts are enabled. 1162 * @ap: Port on which interrupts are enabled.
1184 * 1163 *