aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/libata.h
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2006-01-27 02:26:46 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-01-27 02:26:46 -0500
commit8dd2e3bd57c3b389febba1de6b10372ef507f985 (patch)
tree1fdb120ec9c0c81f8f2a9452ae6c225d68aed5e3 /include/linux/libata.h
parent2af5920b81a4cd0a22d40b6b2c38356d3df03e13 (diff)
parent71e834f563799e09c6bd7d6638993b464fac26f5 (diff)
Merge branch 'tmp'
Diffstat (limited to 'include/linux/libata.h')
-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 6282bd553c45..cf59ecfff865 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
@@ -362,6 +395,8 @@ struct ata_port {
362 unsigned int hsm_task_state; 395 unsigned int hsm_task_state;
363 unsigned long pio_task_timeout; 396 unsigned long pio_task_timeout;
364 397
398 u32 msg_enable;
399
365 void *private_data; 400 void *private_data;
366}; 401};
367 402
@@ -648,9 +683,9 @@ static inline u8 ata_wait_idle(struct ata_port *ap)
648 683
649 if (status & (ATA_BUSY | ATA_DRQ)) { 684 if (status & (ATA_BUSY | ATA_DRQ)) {
650 unsigned long l = ap->ioaddr.status_addr; 685 unsigned long l = ap->ioaddr.status_addr;
651 printk(KERN_WARNING 686 if (ata_msg_warn(ap))
652 "ATA: abnormal status 0x%X on port 0x%lX\n", 687 printk(KERN_WARNING "ATA: abnormal status 0x%X on port 0x%lX\n",
653 status, l); 688 status, l);
654 } 689 }
655 690
656 return status; 691 return status;
@@ -742,7 +777,8 @@ static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq)
742 777
743 status = ata_busy_wait(ap, bits, 1000); 778 status = ata_busy_wait(ap, bits, 1000);
744 if (status & bits) 779 if (status & bits)
745 DPRINTK("abnormal status 0x%X\n", status); 780 if (ata_msg_err(ap))
781 printk(KERN_ERR "abnormal status 0x%X\n", status);
746 782
747 /* get controller status; clear intr, err bits */ 783 /* get controller status; clear intr, err bits */
748 if (ap->flags & ATA_FLAG_MMIO) { 784 if (ap->flags & ATA_FLAG_MMIO) {
@@ -760,8 +796,10 @@ static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq)
760 post_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); 796 post_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
761 } 797 }
762 798
763 VPRINTK("irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n", 799 if (ata_msg_intr(ap))
764 host_stat, post_stat, status); 800 printk(KERN_INFO "%s: irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n",
801 __FUNCTION__,
802 host_stat, post_stat, status);
765 803
766 return status; 804 return status;
767} 805}