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.h52
1 files changed, 15 insertions, 37 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h
index b3f32eadbef5..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 */
@@ -701,6 +708,8 @@ extern int sata_phy_debounce(struct ata_port *ap, const unsigned long *param);
701extern 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);
702extern int ata_std_prereset(struct ata_port *ap); 709extern int ata_std_prereset(struct ata_port *ap);
703extern 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);
704extern int sata_std_hardreset(struct ata_port *ap, unsigned int *class); 713extern int sata_std_hardreset(struct ata_port *ap, unsigned int *class);
705extern void ata_std_postreset(struct ata_port *ap, unsigned int *classes); 714extern void ata_std_postreset(struct ata_port *ap, unsigned int *classes);
706extern void ata_port_disable(struct ata_port *); 715extern void ata_port_disable(struct ata_port *);
@@ -745,9 +754,8 @@ extern int ata_scsi_device_suspend(struct scsi_device *, pm_message_t mesg);
745extern 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);
746extern void ata_host_resume(struct ata_host *host); 755extern void ata_host_resume(struct ata_host *host);
747extern int ata_ratelimit(void); 756extern int ata_ratelimit(void);
748extern unsigned int ata_busy_sleep(struct ata_port *ap, 757extern int ata_busy_sleep(struct ata_port *ap,
749 unsigned long timeout_pat, 758 unsigned long timeout_pat, unsigned long timeout);
750 unsigned long timeout);
751extern void ata_port_queue_task(struct ata_port *ap, work_func_t fn, 759extern void ata_port_queue_task(struct ata_port *ap, work_func_t fn,
752 void *data, unsigned long delay); 760 void *data, unsigned long delay);
753extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, 761extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
@@ -788,6 +796,7 @@ extern void ata_id_string(const u16 *id, unsigned char *s,
788 unsigned int ofs, unsigned int len); 796 unsigned int ofs, unsigned int len);
789extern void ata_id_c_string(const u16 *id, unsigned char *s, 797extern void ata_id_c_string(const u16 *id, unsigned char *s,
790 unsigned int ofs, unsigned int len); 798 unsigned int ofs, unsigned int len);
799extern unsigned long ata_device_blacklisted(const struct ata_device *dev);
791extern void ata_bmdma_setup (struct ata_queued_cmd *qc); 800extern void ata_bmdma_setup (struct ata_queued_cmd *qc);
792extern void ata_bmdma_start (struct ata_queued_cmd *qc); 801extern void ata_bmdma_start (struct ata_queued_cmd *qc);
793extern void ata_bmdma_stop(struct ata_queued_cmd *qc); 802extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
@@ -1062,7 +1071,7 @@ static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits,
1062 udelay(10); 1071 udelay(10);
1063 status = ata_chk_status(ap); 1072 status = ata_chk_status(ap);
1064 max--; 1073 max--;
1065 } while ((status & bits) && (max > 0)); 1074 } while (status != 0xff && (status & bits) && (max > 0));
1066 1075
1067 return status; 1076 return status;
1068} 1077}
@@ -1083,7 +1092,7 @@ static inline u8 ata_wait_idle(struct ata_port *ap)
1083{ 1092{
1084 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); 1093 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
1085 1094
1086 if (status & (ATA_BUSY | ATA_DRQ)) { 1095 if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ))) {
1087 unsigned long l = ap->ioaddr.status_addr; 1096 unsigned long l = ap->ioaddr.status_addr;
1088 if (ata_msg_warn(ap)) 1097 if (ata_msg_warn(ap))
1089 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",
@@ -1149,37 +1158,6 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
1149} 1158}
1150 1159
1151/** 1160/**
1152 * ata_irq_on - Enable interrupts on a port.
1153 * @ap: Port on which interrupts are enabled.
1154 *
1155 * Enable interrupts on a legacy IDE device using MMIO or PIO,
1156 * wait for idle, clear any pending interrupts.
1157 *
1158 * LOCKING:
1159 * Inherited from caller.
1160 */
1161
1162static inline u8 ata_irq_on(struct ata_port *ap)
1163{
1164 struct ata_ioports *ioaddr = &ap->ioaddr;
1165 u8 tmp;
1166
1167 ap->ctl &= ~ATA_NIEN;
1168 ap->last_ctl = ap->ctl;
1169
1170 if (ap->flags & ATA_FLAG_MMIO)
1171 writeb(ap->ctl, (void __iomem *) ioaddr->ctl_addr);
1172 else
1173 outb(ap->ctl, ioaddr->ctl_addr);
1174 tmp = ata_wait_idle(ap);
1175
1176 ap->ops->irq_clear(ap);
1177
1178 return tmp;
1179}
1180
1181
1182/**
1183 * ata_irq_ack - Acknowledge a device interrupt. 1161 * ata_irq_ack - Acknowledge a device interrupt.
1184 * @ap: Port on which interrupts are enabled. 1162 * @ap: Port on which interrupts are enabled.
1185 * 1163 *