diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/ata.h | 22 | ||||
-rw-r--r-- | include/linux/libata.h | 146 | ||||
-rw-r--r-- | include/scsi/scsi_eh.h | 3 |
3 files changed, 138 insertions, 33 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h index 94f77cce27fa..b02a16c435e7 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -267,6 +267,16 @@ struct ata_taskfile { | |||
267 | ((u64) (id)[(n) + 1] << 16) | \ | 267 | ((u64) (id)[(n) + 1] << 16) | \ |
268 | ((u64) (id)[(n) + 0]) ) | 268 | ((u64) (id)[(n) + 0]) ) |
269 | 269 | ||
270 | static inline unsigned int ata_id_major_version(const u16 *id) | ||
271 | { | ||
272 | unsigned int mver; | ||
273 | |||
274 | for (mver = 14; mver >= 1; mver--) | ||
275 | if (id[ATA_ID_MAJOR_VER] & (1 << mver)) | ||
276 | break; | ||
277 | return mver; | ||
278 | } | ||
279 | |||
270 | static inline int ata_id_current_chs_valid(const u16 *id) | 280 | static inline int ata_id_current_chs_valid(const u16 *id) |
271 | { | 281 | { |
272 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command | 282 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command |
@@ -302,4 +312,16 @@ static inline int ata_ok(u8 status) | |||
302 | == ATA_DRDY); | 312 | == ATA_DRDY); |
303 | } | 313 | } |
304 | 314 | ||
315 | static inline int lba_28_ok(u64 block, u32 n_block) | ||
316 | { | ||
317 | /* check the ending block number */ | ||
318 | return ((block + n_block - 1) < ((u64)1 << 28)) && (n_block <= 256); | ||
319 | } | ||
320 | |||
321 | static inline int lba_48_ok(u64 block, u32 n_block) | ||
322 | { | ||
323 | /* check the ending block number */ | ||
324 | return ((block + n_block - 1) < ((u64)1 << 48)) && (n_block <= 65536); | ||
325 | } | ||
326 | |||
305 | #endif /* __LINUX_ATA_H__ */ | 327 | #endif /* __LINUX_ATA_H__ */ |
diff --git a/include/linux/libata.h b/include/linux/libata.h index c91be5e64ede..66b6847225df 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -35,7 +35,8 @@ | |||
35 | #include <linux/workqueue.h> | 35 | #include <linux/workqueue.h> |
36 | 36 | ||
37 | /* | 37 | /* |
38 | * compile-time options | 38 | * compile-time options: to be removed as soon as all the drivers are |
39 | * converted to the new debugging mechanism | ||
39 | */ | 40 | */ |
40 | #undef ATA_DEBUG /* debugging output */ | 41 | #undef ATA_DEBUG /* debugging output */ |
41 | #undef ATA_VERBOSE_DEBUG /* yet more debugging output */ | 42 | #undef ATA_VERBOSE_DEBUG /* yet more debugging output */ |
@@ -61,15 +62,37 @@ | |||
61 | 62 | ||
62 | #define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args) | 63 | #define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args) |
63 | 64 | ||
64 | #ifdef ATA_NDEBUG | 65 | /* NEW: debug levels */ |
65 | #define assert(expr) | 66 | #define HAVE_LIBATA_MSG 1 |
66 | #else | 67 | |
67 | #define assert(expr) \ | 68 | enum { |
68 | if(unlikely(!(expr))) { \ | 69 | ATA_MSG_DRV = 0x0001, |
69 | printk(KERN_ERR "Assertion failed! %s,%s,%s,line=%d\n", \ | 70 | ATA_MSG_INFO = 0x0002, |
70 | #expr,__FILE__,__FUNCTION__,__LINE__); \ | 71 | ATA_MSG_PROBE = 0x0004, |
71 | } | 72 | ATA_MSG_WARN = 0x0008, |
72 | #endif | 73 | ATA_MSG_MALLOC = 0x0010, |
74 | ATA_MSG_CTL = 0x0020, | ||
75 | ATA_MSG_INTR = 0x0040, | ||
76 | ATA_MSG_ERR = 0x0080, | ||
77 | }; | ||
78 | |||
79 | #define ata_msg_drv(p) ((p)->msg_enable & ATA_MSG_DRV) | ||
80 | #define ata_msg_info(p) ((p)->msg_enable & ATA_MSG_INFO) | ||
81 | #define ata_msg_probe(p) ((p)->msg_enable & ATA_MSG_PROBE) | ||
82 | #define ata_msg_warn(p) ((p)->msg_enable & ATA_MSG_WARN) | ||
83 | #define ata_msg_malloc(p) ((p)->msg_enable & ATA_MSG_MALLOC) | ||
84 | #define ata_msg_ctl(p) ((p)->msg_enable & ATA_MSG_CTL) | ||
85 | #define ata_msg_intr(p) ((p)->msg_enable & ATA_MSG_INTR) | ||
86 | #define ata_msg_err(p) ((p)->msg_enable & ATA_MSG_ERR) | ||
87 | |||
88 | static inline u32 ata_msg_init(int dval, int default_msg_enable_bits) | ||
89 | { | ||
90 | if (dval < 0 || dval >= (sizeof(u32) * 8)) | ||
91 | return default_msg_enable_bits; /* should be 0x1 - only driver info msgs */ | ||
92 | if (!dval) | ||
93 | return 0; | ||
94 | return (1 << dval) - 1; | ||
95 | } | ||
73 | 96 | ||
74 | /* defines only for the constants which don't work well as enums */ | 97 | /* defines only for the constants which don't work well as enums */ |
75 | #define ATA_TAG_POISON 0xfafbfcfdU | 98 | #define ATA_TAG_POISON 0xfafbfcfdU |
@@ -99,8 +122,7 @@ enum { | |||
99 | /* struct ata_device stuff */ | 122 | /* struct ata_device stuff */ |
100 | ATA_DFLAG_LBA48 = (1 << 0), /* device supports LBA48 */ | 123 | ATA_DFLAG_LBA48 = (1 << 0), /* device supports LBA48 */ |
101 | ATA_DFLAG_PIO = (1 << 1), /* device currently in PIO mode */ | 124 | ATA_DFLAG_PIO = (1 << 1), /* device currently in PIO mode */ |
102 | ATA_DFLAG_LOCK_SECTORS = (1 << 2), /* don't adjust max_sectors */ | 125 | ATA_DFLAG_LBA = (1 << 2), /* device supports LBA */ |
103 | ATA_DFLAG_LBA = (1 << 3), /* device supports LBA */ | ||
104 | 126 | ||
105 | ATA_DEV_UNKNOWN = 0, /* unknown device */ | 127 | ATA_DEV_UNKNOWN = 0, /* unknown device */ |
106 | ATA_DEV_ATA = 1, /* ATA device */ | 128 | ATA_DEV_ATA = 1, /* ATA device */ |
@@ -115,9 +137,9 @@ enum { | |||
115 | ATA_FLAG_PORT_DISABLED = (1 << 2), /* port is disabled, ignore it */ | 137 | ATA_FLAG_PORT_DISABLED = (1 << 2), /* port is disabled, ignore it */ |
116 | ATA_FLAG_SATA = (1 << 3), | 138 | ATA_FLAG_SATA = (1 << 3), |
117 | ATA_FLAG_NO_LEGACY = (1 << 4), /* no legacy mode check */ | 139 | ATA_FLAG_NO_LEGACY = (1 << 4), /* no legacy mode check */ |
118 | ATA_FLAG_SRST = (1 << 5), /* use ATA SRST, not E.D.D. */ | 140 | ATA_FLAG_SRST = (1 << 5), /* (obsolete) use ATA SRST, not E.D.D. */ |
119 | ATA_FLAG_MMIO = (1 << 6), /* use MMIO, not PIO */ | 141 | ATA_FLAG_MMIO = (1 << 6), /* use MMIO, not PIO */ |
120 | ATA_FLAG_SATA_RESET = (1 << 7), /* use COMRESET */ | 142 | ATA_FLAG_SATA_RESET = (1 << 7), /* (obsolete) use COMRESET */ |
121 | ATA_FLAG_PIO_DMA = (1 << 8), /* PIO cmds via DMA */ | 143 | ATA_FLAG_PIO_DMA = (1 << 8), /* PIO cmds via DMA */ |
122 | ATA_FLAG_NOINTR = (1 << 9), /* FIXME: Remove this once | 144 | ATA_FLAG_NOINTR = (1 << 9), /* FIXME: Remove this once |
123 | * proper HSM is in place. */ | 145 | * proper HSM is in place. */ |
@@ -129,10 +151,14 @@ enum { | |||
129 | ATA_FLAG_PIO_LBA48 = (1 << 13), /* Host DMA engine is LBA28 only */ | 151 | ATA_FLAG_PIO_LBA48 = (1 << 13), /* Host DMA engine is LBA28 only */ |
130 | ATA_FLAG_IRQ_MASK = (1 << 14), /* Mask IRQ in PIO xfers */ | 152 | ATA_FLAG_IRQ_MASK = (1 << 14), /* Mask IRQ in PIO xfers */ |
131 | 153 | ||
154 | ATA_FLAG_FLUSH_PIO_TASK = (1 << 15), /* Flush PIO task */ | ||
155 | ATA_FLAG_IN_EH = (1 << 16), /* EH in progress */ | ||
156 | |||
132 | ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */ | 157 | ATA_QCFLAG_ACTIVE = (1 << 1), /* cmd not yet ack'd to scsi lyer */ |
133 | ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */ | 158 | ATA_QCFLAG_SG = (1 << 3), /* have s/g table? */ |
134 | ATA_QCFLAG_SINGLE = (1 << 4), /* no s/g, just a single buffer */ | 159 | ATA_QCFLAG_SINGLE = (1 << 4), /* no s/g, just a single buffer */ |
135 | ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE, | 160 | ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE, |
161 | ATA_QCFLAG_EH_SCHEDULED = (1 << 5), /* EH scheduled */ | ||
136 | 162 | ||
137 | /* various lengths of time */ | 163 | /* various lengths of time */ |
138 | ATA_TMOUT_EDD = 5 * HZ, /* heuristic */ | 164 | ATA_TMOUT_EDD = 5 * HZ, /* heuristic */ |
@@ -189,10 +215,15 @@ enum hsm_task_states { | |||
189 | }; | 215 | }; |
190 | 216 | ||
191 | enum ata_completion_errors { | 217 | enum ata_completion_errors { |
192 | AC_ERR_OTHER = (1 << 0), | 218 | AC_ERR_DEV = (1 << 0), /* device reported error */ |
193 | AC_ERR_DEV = (1 << 1), | 219 | AC_ERR_HSM = (1 << 1), /* host state machine violation */ |
194 | AC_ERR_ATA_BUS = (1 << 2), | 220 | AC_ERR_TIMEOUT = (1 << 2), /* timeout */ |
195 | AC_ERR_HOST_BUS = (1 << 3), | 221 | AC_ERR_MEDIA = (1 << 3), /* media error */ |
222 | AC_ERR_ATA_BUS = (1 << 4), /* ATA bus error */ | ||
223 | AC_ERR_HOST_BUS = (1 << 5), /* host bus error */ | ||
224 | AC_ERR_SYSTEM = (1 << 6), /* system error */ | ||
225 | AC_ERR_INVALID = (1 << 7), /* invalid argument */ | ||
226 | AC_ERR_OTHER = (1 << 8), /* unknown */ | ||
196 | }; | 227 | }; |
197 | 228 | ||
198 | /* forward declarations */ | 229 | /* forward declarations */ |
@@ -202,7 +233,10 @@ struct ata_port; | |||
202 | struct ata_queued_cmd; | 233 | struct ata_queued_cmd; |
203 | 234 | ||
204 | /* typedefs */ | 235 | /* typedefs */ |
205 | typedef int (*ata_qc_cb_t) (struct ata_queued_cmd *qc); | 236 | typedef void (*ata_qc_cb_t) (struct ata_queued_cmd *qc); |
237 | typedef void (*ata_probeinit_fn_t)(struct ata_port *); | ||
238 | typedef int (*ata_reset_fn_t)(struct ata_port *, int, unsigned int *); | ||
239 | typedef void (*ata_postreset_fn_t)(struct ata_port *ap, unsigned int *); | ||
206 | 240 | ||
207 | struct ata_ioports { | 241 | struct ata_ioports { |
208 | unsigned long cmd_addr; | 242 | unsigned long cmd_addr; |
@@ -313,6 +347,8 @@ struct ata_device { | |||
313 | 347 | ||
314 | unsigned int multi_count; /* sectors count for | 348 | unsigned int multi_count; /* sectors count for |
315 | READ/WRITE MULTIPLE */ | 349 | READ/WRITE MULTIPLE */ |
350 | unsigned int max_sectors; /* per-device max sectors */ | ||
351 | unsigned int cdb_len; | ||
316 | 352 | ||
317 | /* for CHS addressing */ | 353 | /* for CHS addressing */ |
318 | u16 cylinders; /* Number of cylinders */ | 354 | u16 cylinders; /* Number of cylinders */ |
@@ -342,7 +378,6 @@ struct ata_port { | |||
342 | unsigned int mwdma_mask; | 378 | unsigned int mwdma_mask; |
343 | unsigned int udma_mask; | 379 | unsigned int udma_mask; |
344 | unsigned int cbl; /* cable type; ATA_CBL_xxx */ | 380 | unsigned int cbl; /* cable type; ATA_CBL_xxx */ |
345 | unsigned int cdb_len; | ||
346 | 381 | ||
347 | struct ata_device device[ATA_MAX_DEVICES]; | 382 | struct ata_device device[ATA_MAX_DEVICES]; |
348 | 383 | ||
@@ -359,6 +394,9 @@ struct ata_port { | |||
359 | unsigned int hsm_task_state; | 394 | unsigned int hsm_task_state; |
360 | unsigned long pio_task_timeout; | 395 | unsigned long pio_task_timeout; |
361 | 396 | ||
397 | u32 msg_enable; | ||
398 | struct list_head eh_done_q; | ||
399 | |||
362 | void *private_data; | 400 | void *private_data; |
363 | }; | 401 | }; |
364 | 402 | ||
@@ -378,7 +416,9 @@ struct ata_port_operations { | |||
378 | u8 (*check_altstatus)(struct ata_port *ap); | 416 | u8 (*check_altstatus)(struct ata_port *ap); |
379 | void (*dev_select)(struct ata_port *ap, unsigned int device); | 417 | void (*dev_select)(struct ata_port *ap, unsigned int device); |
380 | 418 | ||
381 | void (*phy_reset) (struct ata_port *ap); | 419 | void (*phy_reset) (struct ata_port *ap); /* obsolete */ |
420 | int (*probe_reset) (struct ata_port *ap, unsigned int *classes); | ||
421 | |||
382 | void (*post_set_mode) (struct ata_port *ap); | 422 | void (*post_set_mode) (struct ata_port *ap); |
383 | 423 | ||
384 | int (*check_atapi_dma) (struct ata_queued_cmd *qc); | 424 | int (*check_atapi_dma) (struct ata_queued_cmd *qc); |
@@ -387,7 +427,7 @@ struct ata_port_operations { | |||
387 | void (*bmdma_start) (struct ata_queued_cmd *qc); | 427 | void (*bmdma_start) (struct ata_queued_cmd *qc); |
388 | 428 | ||
389 | void (*qc_prep) (struct ata_queued_cmd *qc); | 429 | void (*qc_prep) (struct ata_queued_cmd *qc); |
390 | int (*qc_issue) (struct ata_queued_cmd *qc); | 430 | unsigned int (*qc_issue) (struct ata_queued_cmd *qc); |
391 | 431 | ||
392 | void (*eng_timeout) (struct ata_port *ap); | 432 | void (*eng_timeout) (struct ata_port *ap); |
393 | 433 | ||
@@ -435,6 +475,16 @@ extern void ata_port_probe(struct ata_port *); | |||
435 | extern void __sata_phy_reset(struct ata_port *ap); | 475 | extern void __sata_phy_reset(struct ata_port *ap); |
436 | extern void sata_phy_reset(struct ata_port *ap); | 476 | extern void sata_phy_reset(struct ata_port *ap); |
437 | extern void ata_bus_reset(struct ata_port *ap); | 477 | extern void ata_bus_reset(struct ata_port *ap); |
478 | extern int ata_drive_probe_reset(struct ata_port *ap, | ||
479 | ata_probeinit_fn_t probeinit, | ||
480 | ata_reset_fn_t softreset, ata_reset_fn_t hardreset, | ||
481 | ata_postreset_fn_t postreset, unsigned int *classes); | ||
482 | extern void ata_std_probeinit(struct ata_port *ap); | ||
483 | extern int ata_std_softreset(struct ata_port *ap, int verbose, | ||
484 | unsigned int *classes); | ||
485 | extern int sata_std_hardreset(struct ata_port *ap, int verbose, | ||
486 | unsigned int *class); | ||
487 | extern void ata_std_postreset(struct ata_port *ap, unsigned int *classes); | ||
438 | extern void ata_port_disable(struct ata_port *); | 488 | extern void ata_port_disable(struct ata_port *); |
439 | extern void ata_std_ports(struct ata_ioports *ioaddr); | 489 | extern void ata_std_ports(struct ata_ioports *ioaddr); |
440 | #ifdef CONFIG_PCI | 490 | #ifdef CONFIG_PCI |
@@ -449,7 +499,10 @@ extern void ata_host_set_remove(struct ata_host_set *host_set); | |||
449 | extern int ata_scsi_detect(struct scsi_host_template *sht); | 499 | extern int ata_scsi_detect(struct scsi_host_template *sht); |
450 | extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); | 500 | extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); |
451 | extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); | 501 | extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); |
502 | extern enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd); | ||
452 | extern int ata_scsi_error(struct Scsi_Host *host); | 503 | extern int ata_scsi_error(struct Scsi_Host *host); |
504 | extern void ata_eh_qc_complete(struct ata_queued_cmd *qc); | ||
505 | extern void ata_eh_qc_retry(struct ata_queued_cmd *qc); | ||
453 | extern int ata_scsi_release(struct Scsi_Host *host); | 506 | extern int ata_scsi_release(struct Scsi_Host *host); |
454 | extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); | 507 | extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); |
455 | extern int ata_scsi_device_resume(struct scsi_device *); | 508 | extern int ata_scsi_device_resume(struct scsi_device *); |
@@ -457,6 +510,9 @@ extern int ata_scsi_device_suspend(struct scsi_device *); | |||
457 | extern int ata_device_resume(struct ata_port *, struct ata_device *); | 510 | extern int ata_device_resume(struct ata_port *, struct ata_device *); |
458 | extern int ata_device_suspend(struct ata_port *, struct ata_device *); | 511 | extern int ata_device_suspend(struct ata_port *, struct ata_device *); |
459 | extern int ata_ratelimit(void); | 512 | extern int ata_ratelimit(void); |
513 | extern unsigned int ata_busy_sleep(struct ata_port *ap, | ||
514 | unsigned long timeout_pat, | ||
515 | unsigned long timeout); | ||
460 | 516 | ||
461 | /* | 517 | /* |
462 | * Default driver ops implementations | 518 | * Default driver ops implementations |
@@ -470,26 +526,29 @@ extern void ata_std_dev_select (struct ata_port *ap, unsigned int device); | |||
470 | extern u8 ata_check_status(struct ata_port *ap); | 526 | extern u8 ata_check_status(struct ata_port *ap); |
471 | extern u8 ata_altstatus(struct ata_port *ap); | 527 | extern u8 ata_altstatus(struct ata_port *ap); |
472 | extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); | 528 | extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); |
529 | extern int ata_std_probe_reset(struct ata_port *ap, unsigned int *classes); | ||
473 | extern int ata_port_start (struct ata_port *ap); | 530 | extern int ata_port_start (struct ata_port *ap); |
474 | extern void ata_port_stop (struct ata_port *ap); | 531 | extern void ata_port_stop (struct ata_port *ap); |
475 | extern void ata_host_stop (struct ata_host_set *host_set); | 532 | extern void ata_host_stop (struct ata_host_set *host_set); |
476 | extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); | 533 | extern irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs); |
477 | extern void ata_qc_prep(struct ata_queued_cmd *qc); | 534 | extern void ata_qc_prep(struct ata_queued_cmd *qc); |
478 | extern int ata_qc_issue_prot(struct ata_queued_cmd *qc); | 535 | extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc); |
479 | extern void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, | 536 | extern void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, |
480 | unsigned int buflen); | 537 | unsigned int buflen); |
481 | extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, | 538 | extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, |
482 | unsigned int n_elem); | 539 | unsigned int n_elem); |
483 | extern unsigned int ata_dev_classify(const struct ata_taskfile *tf); | 540 | extern unsigned int ata_dev_classify(const struct ata_taskfile *tf); |
484 | extern void ata_dev_id_string(const u16 *id, unsigned char *s, | 541 | extern void ata_id_string(const u16 *id, unsigned char *s, |
485 | unsigned int ofs, unsigned int len); | 542 | unsigned int ofs, unsigned int len); |
543 | extern void ata_id_c_string(const u16 *id, unsigned char *s, | ||
544 | unsigned int ofs, unsigned int len); | ||
486 | extern void ata_dev_config(struct ata_port *ap, unsigned int i); | 545 | extern void ata_dev_config(struct ata_port *ap, unsigned int i); |
487 | extern void ata_bmdma_setup (struct ata_queued_cmd *qc); | 546 | extern void ata_bmdma_setup (struct ata_queued_cmd *qc); |
488 | extern void ata_bmdma_start (struct ata_queued_cmd *qc); | 547 | extern void ata_bmdma_start (struct ata_queued_cmd *qc); |
489 | extern void ata_bmdma_stop(struct ata_queued_cmd *qc); | 548 | extern void ata_bmdma_stop(struct ata_queued_cmd *qc); |
490 | extern u8 ata_bmdma_status(struct ata_port *ap); | 549 | extern u8 ata_bmdma_status(struct ata_port *ap); |
491 | extern void ata_bmdma_irq_clear(struct ata_port *ap); | 550 | extern void ata_bmdma_irq_clear(struct ata_port *ap); |
492 | extern void ata_qc_complete(struct ata_queued_cmd *qc); | 551 | extern void __ata_qc_complete(struct ata_queued_cmd *qc); |
493 | extern void ata_eng_timeout(struct ata_port *ap); | 552 | extern void ata_eng_timeout(struct ata_port *ap); |
494 | extern void ata_scsi_simulate(struct ata_port *ap, struct ata_device *dev, | 553 | extern void ata_scsi_simulate(struct ata_port *ap, struct ata_device *dev, |
495 | struct scsi_cmnd *cmd, | 554 | struct scsi_cmnd *cmd, |
@@ -657,9 +716,9 @@ static inline u8 ata_wait_idle(struct ata_port *ap) | |||
657 | 716 | ||
658 | if (status & (ATA_BUSY | ATA_DRQ)) { | 717 | if (status & (ATA_BUSY | ATA_DRQ)) { |
659 | unsigned long l = ap->ioaddr.status_addr; | 718 | unsigned long l = ap->ioaddr.status_addr; |
660 | printk(KERN_WARNING | 719 | if (ata_msg_warn(ap)) |
661 | "ATA: abnormal status 0x%X on port 0x%lX\n", | 720 | printk(KERN_WARNING "ATA: abnormal status 0x%X on port 0x%lX\n", |
662 | status, l); | 721 | status, l); |
663 | } | 722 | } |
664 | 723 | ||
665 | return status; | 724 | return status; |
@@ -701,6 +760,24 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc) | |||
701 | ata_tf_init(qc->ap, &qc->tf, qc->dev->devno); | 760 | ata_tf_init(qc->ap, &qc->tf, qc->dev->devno); |
702 | } | 761 | } |
703 | 762 | ||
763 | /** | ||
764 | * ata_qc_complete - Complete an active ATA command | ||
765 | * @qc: Command to complete | ||
766 | * @err_mask: ATA Status register contents | ||
767 | * | ||
768 | * Indicate to the mid and upper layers that an ATA | ||
769 | * command has completed, with either an ok or not-ok status. | ||
770 | * | ||
771 | * LOCKING: | ||
772 | * spin_lock_irqsave(host_set lock) | ||
773 | */ | ||
774 | static inline void ata_qc_complete(struct ata_queued_cmd *qc) | ||
775 | { | ||
776 | if (unlikely(qc->flags & ATA_QCFLAG_EH_SCHEDULED)) | ||
777 | return; | ||
778 | |||
779 | __ata_qc_complete(qc); | ||
780 | } | ||
704 | 781 | ||
705 | /** | 782 | /** |
706 | * ata_irq_on - Enable interrupts on a port. | 783 | * ata_irq_on - Enable interrupts on a port. |
@@ -751,7 +828,8 @@ static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq) | |||
751 | 828 | ||
752 | status = ata_busy_wait(ap, bits, 1000); | 829 | status = ata_busy_wait(ap, bits, 1000); |
753 | if (status & bits) | 830 | if (status & bits) |
754 | DPRINTK("abnormal status 0x%X\n", status); | 831 | if (ata_msg_err(ap)) |
832 | printk(KERN_ERR "abnormal status 0x%X\n", status); | ||
755 | 833 | ||
756 | /* get controller status; clear intr, err bits */ | 834 | /* get controller status; clear intr, err bits */ |
757 | if (ap->flags & ATA_FLAG_MMIO) { | 835 | if (ap->flags & ATA_FLAG_MMIO) { |
@@ -769,8 +847,10 @@ static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq) | |||
769 | post_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); | 847 | post_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); |
770 | } | 848 | } |
771 | 849 | ||
772 | VPRINTK("irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n", | 850 | if (ata_msg_intr(ap)) |
773 | host_stat, post_stat, status); | 851 | printk(KERN_INFO "%s: irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n", |
852 | __FUNCTION__, | ||
853 | host_stat, post_stat, status); | ||
774 | 854 | ||
775 | return status; | 855 | return status; |
776 | } | 856 | } |
@@ -807,7 +887,7 @@ static inline int ata_try_flush_cache(const struct ata_device *dev) | |||
807 | static inline unsigned int ac_err_mask(u8 status) | 887 | static inline unsigned int ac_err_mask(u8 status) |
808 | { | 888 | { |
809 | if (status & ATA_BUSY) | 889 | if (status & ATA_BUSY) |
810 | return AC_ERR_ATA_BUS; | 890 | return AC_ERR_HSM; |
811 | if (status & (ATA_ERR | ATA_DF)) | 891 | if (status & (ATA_ERR | ATA_DF)) |
812 | return AC_ERR_DEV; | 892 | return AC_ERR_DEV; |
813 | return 0; | 893 | return 0; |
diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h index fabd879c2f2e..d160880b2a87 100644 --- a/include/scsi/scsi_eh.h +++ b/include/scsi/scsi_eh.h | |||
@@ -35,6 +35,9 @@ static inline int scsi_sense_valid(struct scsi_sense_hdr *sshdr) | |||
35 | } | 35 | } |
36 | 36 | ||
37 | 37 | ||
38 | extern void scsi_eh_finish_cmd(struct scsi_cmnd *scmd, | ||
39 | struct list_head *done_q); | ||
40 | extern void scsi_eh_flush_done_q(struct list_head *done_q); | ||
38 | extern void scsi_report_bus_reset(struct Scsi_Host *, int); | 41 | extern void scsi_report_bus_reset(struct Scsi_Host *, int); |
39 | extern void scsi_report_device_reset(struct Scsi_Host *, int, int); | 42 | extern void scsi_report_device_reset(struct Scsi_Host *, int, int); |
40 | extern int scsi_block_when_processing_errors(struct scsi_device *); | 43 | extern int scsi_block_when_processing_errors(struct scsi_device *); |