aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/libata.h52
1 files changed, 45 insertions, 7 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 9e5db2949c58..46ccea215892 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 */
@@ -71,6 +72,38 @@
71 } 72 }
72#endif 73#endif
73 74
75/* NEW: debug levels */
76#define HAVE_LIBATA_MSG 1
77
78enum {
79 ATA_MSG_DRV = 0x0001,
80 ATA_MSG_INFO = 0x0002,
81 ATA_MSG_PROBE = 0x0004,
82 ATA_MSG_WARN = 0x0008,
83 ATA_MSG_MALLOC = 0x0010,
84 ATA_MSG_CTL = 0x0020,
85 ATA_MSG_INTR = 0x0040,
86 ATA_MSG_ERR = 0x0080,
87};
88
89#define ata_msg_drv(p) ((p)->msg_enable & ATA_MSG_DRV)
90#define ata_msg_info(p) ((p)->msg_enable & ATA_MSG_INFO)
91#define ata_msg_probe(p) ((p)->msg_enable & ATA_MSG_PROBE)
92#define ata_msg_warn(p) ((p)->msg_enable & ATA_MSG_WARN)
93#define ata_msg_malloc(p) ((p)->msg_enable & ATA_MSG_MALLOC)
94#define ata_msg_ctl(p) ((p)->msg_enable & ATA_MSG_CTL)
95#define ata_msg_intr(p) ((p)->msg_enable & ATA_MSG_INTR)
96#define ata_msg_err(p) ((p)->msg_enable & ATA_MSG_ERR)
97
98static inline u32 ata_msg_init(int dval, int default_msg_enable_bits)
99{
100 if (dval < 0 || dval >= (sizeof(u32) * 8))
101 return default_msg_enable_bits; /* should be 0x1 - only driver info msgs */
102 if (!dval)
103 return 0;
104 return (1 << dval) - 1;
105}
106
74/* defines only for the constants which don't work well as enums */ 107/* defines only for the constants which don't work well as enums */
75#define ATA_TAG_POISON 0xfafbfcfdU 108#define ATA_TAG_POISON 0xfafbfcfdU
76 109
@@ -359,6 +392,8 @@ struct ata_port {
359 unsigned int hsm_task_state; 392 unsigned int hsm_task_state;
360 unsigned long pio_task_timeout; 393 unsigned long pio_task_timeout;
361 394
395 u32 msg_enable;
396
362 void *private_data; 397 void *private_data;
363}; 398};
364 399
@@ -645,9 +680,9 @@ static inline u8 ata_wait_idle(struct ata_port *ap)
645 680
646 if (status & (ATA_BUSY | ATA_DRQ)) { 681 if (status & (ATA_BUSY | ATA_DRQ)) {
647 unsigned long l = ap->ioaddr.status_addr; 682 unsigned long l = ap->ioaddr.status_addr;
648 printk(KERN_WARNING 683 if (ata_msg_warn(ap))
649 "ATA: abnormal status 0x%X on port 0x%lX\n", 684 printk(KERN_WARNING "ATA: abnormal status 0x%X on port 0x%lX\n",
650 status, l); 685 status, l);
651 } 686 }
652 687
653 return status; 688 return status;
@@ -739,7 +774,8 @@ static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq)
739 774
740 status = ata_busy_wait(ap, bits, 1000); 775 status = ata_busy_wait(ap, bits, 1000);
741 if (status & bits) 776 if (status & bits)
742 DPRINTK("abnormal status 0x%X\n", status); 777 if (ata_msg_err(ap))
778 printk(KERN_ERR "abnormal status 0x%X\n", status);
743 779
744 /* get controller status; clear intr, err bits */ 780 /* get controller status; clear intr, err bits */
745 if (ap->flags & ATA_FLAG_MMIO) { 781 if (ap->flags & ATA_FLAG_MMIO) {
@@ -757,8 +793,10 @@ static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq)
757 post_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); 793 post_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
758 } 794 }
759 795
760 VPRINTK("irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n", 796 if (ata_msg_intr(ap))
761 host_stat, post_stat, status); 797 printk(KERN_INFO "%s: irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n",
798 __FUNCTION__,
799 host_stat, post_stat, status);
762 800
763 return status; 801 return status;
764} 802}