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 abd2debebca2..202283b5df96 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 */
@@ -700,6 +707,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); 707extern int sata_phy_resume(struct ata_port *ap, const unsigned long *param);
701extern int ata_std_prereset(struct ata_port *ap); 708extern int ata_std_prereset(struct ata_port *ap);
702extern int ata_std_softreset(struct ata_port *ap, unsigned int *classes); 709extern int ata_std_softreset(struct ata_port *ap, unsigned int *classes);
710extern int sata_port_hardreset(struct ata_port *ap,
711 const unsigned long *timing);
703extern int sata_std_hardreset(struct ata_port *ap, unsigned int *class); 712extern int sata_std_hardreset(struct ata_port *ap, unsigned int *class);
704extern void ata_std_postreset(struct ata_port *ap, unsigned int *classes); 713extern void ata_std_postreset(struct ata_port *ap, unsigned int *classes);
705extern void ata_port_disable(struct ata_port *); 714extern void ata_port_disable(struct ata_port *);
@@ -744,9 +753,8 @@ 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); 753extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg);
745extern void ata_host_resume(struct ata_host *host); 754extern void ata_host_resume(struct ata_host *host);
746extern int ata_ratelimit(void); 755extern int ata_ratelimit(void);
747extern unsigned int ata_busy_sleep(struct ata_port *ap, 756extern int ata_busy_sleep(struct ata_port *ap,
748 unsigned long timeout_pat, 757 unsigned long timeout_pat, unsigned long timeout);
749 unsigned long timeout);
750extern void ata_port_queue_task(struct ata_port *ap, void (*fn)(void *), 758extern void ata_port_queue_task(struct ata_port *ap, void (*fn)(void *),
751 void *data, unsigned long delay); 759 void *data, unsigned long delay);
752extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, 760extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
@@ -787,6 +795,7 @@ extern void ata_id_string(const u16 *id, unsigned char *s,
787 unsigned int ofs, unsigned int len); 795 unsigned int ofs, unsigned int len);
788extern void ata_id_c_string(const u16 *id, unsigned char *s, 796extern void ata_id_c_string(const u16 *id, unsigned char *s,
789 unsigned int ofs, unsigned int len); 797 unsigned int ofs, unsigned int len);
798extern unsigned long ata_device_blacklisted(const struct ata_device *dev);
790extern void ata_bmdma_setup (struct ata_queued_cmd *qc); 799extern void ata_bmdma_setup (struct ata_queued_cmd *qc);
791extern void ata_bmdma_start (struct ata_queued_cmd *qc); 800extern void ata_bmdma_start (struct ata_queued_cmd *qc);
792extern void ata_bmdma_stop(struct ata_queued_cmd *qc); 801extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
@@ -1061,7 +1070,7 @@ static inline u8 ata_busy_wait(struct ata_port *ap, unsigned int bits,
1061 udelay(10); 1070 udelay(10);
1062 status = ata_chk_status(ap); 1071 status = ata_chk_status(ap);
1063 max--; 1072 max--;
1064 } while ((status & bits) && (max > 0)); 1073 } while (status != 0xff && (status & bits) && (max > 0));
1065 1074
1066 return status; 1075 return status;
1067} 1076}
@@ -1082,7 +1091,7 @@ static inline u8 ata_wait_idle(struct ata_port *ap)
1082{ 1091{
1083 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); 1092 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
1084 1093
1085 if (status & (ATA_BUSY | ATA_DRQ)) { 1094 if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ))) {
1086 unsigned long l = ap->ioaddr.status_addr; 1095 unsigned long l = ap->ioaddr.status_addr;
1087 if (ata_msg_warn(ap)) 1096 if (ata_msg_warn(ap))
1088 printk(KERN_WARNING "ATA: abnormal status 0x%X on port 0x%lX\n", 1097 printk(KERN_WARNING "ATA: abnormal status 0x%X on port 0x%lX\n",
@@ -1148,37 +1157,6 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
1148} 1157}
1149 1158
1150/** 1159/**
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. 1160 * ata_irq_ack - Acknowledge a device interrupt.
1183 * @ap: Port on which interrupts are enabled. 1161 * @ap: Port on which interrupts are enabled.
1184 * 1162 *