aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/libata.h
diff options
context:
space:
mode:
authorRandy Dunlap <randy_d_dunlap@linux.intel.com>2006-01-17 19:34:42 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-01-17 19:34:42 -0500
commitbfd6057959ecd3ff779a373a4d07cda2c2d0eec1 (patch)
treef3d6e2a5f408251b59ea17457bde5cf161164fe0 /include/linux/libata.h
parent2664b25051f7ab96b22b199aa2f5ef6a949a4296 (diff)
From: Borislav Petkov <petkov@uni-muenster.de>
libata new debugging macro definitions Signed-off-by: Borislav Petkov <petkov@uni-muenster.de> Signed-off-by: Randy Dunlap <randy_d_dunlap@linux.intel.com>
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 a43c95f8f968..339f7e75cb60 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
@@ -356,6 +389,8 @@ struct ata_port {
356 unsigned int hsm_task_state; 389 unsigned int hsm_task_state;
357 unsigned long pio_task_timeout; 390 unsigned long pio_task_timeout;
358 391
392 u32 msg_enable;
393
359 void *private_data; 394 void *private_data;
360}; 395};
361 396
@@ -640,9 +675,9 @@ static inline u8 ata_wait_idle(struct ata_port *ap)
640 675
641 if (status & (ATA_BUSY | ATA_DRQ)) { 676 if (status & (ATA_BUSY | ATA_DRQ)) {
642 unsigned long l = ap->ioaddr.status_addr; 677 unsigned long l = ap->ioaddr.status_addr;
643 printk(KERN_WARNING 678 if (ata_msg_warn(ap))
644 "ATA: abnormal status 0x%X on port 0x%lX\n", 679 printk(KERN_WARNING "ATA: abnormal status 0x%X on port 0x%lX\n",
645 status, l); 680 status, l);
646 } 681 }
647 682
648 return status; 683 return status;
@@ -734,7 +769,8 @@ static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq)
734 769
735 status = ata_busy_wait(ap, bits, 1000); 770 status = ata_busy_wait(ap, bits, 1000);
736 if (status & bits) 771 if (status & bits)
737 DPRINTK("abnormal status 0x%X\n", status); 772 if (ata_msg_err(ap))
773 printk(KERN_ERR "abnormal status 0x%X\n", status);
738 774
739 /* get controller status; clear intr, err bits */ 775 /* get controller status; clear intr, err bits */
740 if (ap->flags & ATA_FLAG_MMIO) { 776 if (ap->flags & ATA_FLAG_MMIO) {
@@ -752,8 +788,10 @@ static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq)
752 post_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); 788 post_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
753 } 789 }
754 790
755 VPRINTK("irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n", 791 if (ata_msg_intr(ap))
756 host_stat, post_stat, status); 792 printk(KERN_INFO "%s: irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n",
793 __FUNCTION__,
794 host_stat, post_stat, status);
757 795
758 return status; 796 return status;
759} 797}