diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-25 20:19:08 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-25 20:19:08 -0500 |
commit | 9b73e76f3cf63379dcf45fcd4f112f5812418d0a (patch) | |
tree | 4e6bef87cd0cd6d848fc39a5ae25b981dbbe035b /drivers/scsi/lpfc/lpfc_debugfs.c | |
parent | 50d9a126240f9961cfdd063336bbeb91f77a7dce (diff) | |
parent | 23c3e290fb9ce38cabc2822b47583fc8702411bf (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (200 commits)
[SCSI] usbstorage: use last_sector_bug flag universally
[SCSI] libsas: abstract STP task status into a function
[SCSI] ultrastor: clean up inline asm warnings
[SCSI] aic7xxx: fix firmware build
[SCSI] aacraid: fib context lock for management ioctls
[SCSI] ch: remove forward declarations
[SCSI] ch: fix device minor number management bug
[SCSI] ch: handle class_device_create failure properly
[SCSI] NCR5380: fix section mismatch
[SCSI] sg: fix /proc/scsi/sg/devices when no SCSI devices
[SCSI] IB/iSER: add logical unit reset support
[SCSI] don't use __GFP_DMA for sense buffers if not required
[SCSI] use dynamically allocated sense buffer
[SCSI] scsi.h: add macro for enclosure bit of inquiry data
[SCSI] sd: add fix for devices with last sector access problems
[SCSI] fix pcmcia compile problem
[SCSI] aacraid: add Voodoo Lite class of cards.
[SCSI] aacraid: add new driver features flags
[SCSI] qla2xxx: Update version number to 8.02.00-k7.
[SCSI] qla2xxx: Issue correct MBC_INITIALIZE_FIRMWARE command.
...
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_debugfs.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_debugfs.c | 157 |
1 files changed, 127 insertions, 30 deletions
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index d6a98bc970ff..783d1eea13ef 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include "lpfc_crtn.h" | 43 | #include "lpfc_crtn.h" |
44 | #include "lpfc_vport.h" | 44 | #include "lpfc_vport.h" |
45 | #include "lpfc_version.h" | 45 | #include "lpfc_version.h" |
46 | #include "lpfc_compat.h" | ||
46 | #include "lpfc_debugfs.h" | 47 | #include "lpfc_debugfs.h" |
47 | 48 | ||
48 | #ifdef CONFIG_LPFC_DEBUG_FS | 49 | #ifdef CONFIG_LPFC_DEBUG_FS |
@@ -75,18 +76,18 @@ module_param(lpfc_debugfs_enable, int, 0); | |||
75 | MODULE_PARM_DESC(lpfc_debugfs_enable, "Enable debugfs services"); | 76 | MODULE_PARM_DESC(lpfc_debugfs_enable, "Enable debugfs services"); |
76 | 77 | ||
77 | /* This MUST be a power of 2 */ | 78 | /* This MUST be a power of 2 */ |
78 | static int lpfc_debugfs_max_disc_trc = 0; | 79 | static int lpfc_debugfs_max_disc_trc; |
79 | module_param(lpfc_debugfs_max_disc_trc, int, 0); | 80 | module_param(lpfc_debugfs_max_disc_trc, int, 0); |
80 | MODULE_PARM_DESC(lpfc_debugfs_max_disc_trc, | 81 | MODULE_PARM_DESC(lpfc_debugfs_max_disc_trc, |
81 | "Set debugfs discovery trace depth"); | 82 | "Set debugfs discovery trace depth"); |
82 | 83 | ||
83 | /* This MUST be a power of 2 */ | 84 | /* This MUST be a power of 2 */ |
84 | static int lpfc_debugfs_max_slow_ring_trc = 0; | 85 | static int lpfc_debugfs_max_slow_ring_trc; |
85 | module_param(lpfc_debugfs_max_slow_ring_trc, int, 0); | 86 | module_param(lpfc_debugfs_max_slow_ring_trc, int, 0); |
86 | MODULE_PARM_DESC(lpfc_debugfs_max_slow_ring_trc, | 87 | MODULE_PARM_DESC(lpfc_debugfs_max_slow_ring_trc, |
87 | "Set debugfs slow ring trace depth"); | 88 | "Set debugfs slow ring trace depth"); |
88 | 89 | ||
89 | static int lpfc_debugfs_mask_disc_trc = 0; | 90 | int lpfc_debugfs_mask_disc_trc; |
90 | module_param(lpfc_debugfs_mask_disc_trc, int, 0); | 91 | module_param(lpfc_debugfs_mask_disc_trc, int, 0); |
91 | MODULE_PARM_DESC(lpfc_debugfs_mask_disc_trc, | 92 | MODULE_PARM_DESC(lpfc_debugfs_mask_disc_trc, |
92 | "Set debugfs discovery trace mask"); | 93 | "Set debugfs discovery trace mask"); |
@@ -100,8 +101,11 @@ MODULE_PARM_DESC(lpfc_debugfs_mask_disc_trc, | |||
100 | #define LPFC_NODELIST_SIZE 8192 | 101 | #define LPFC_NODELIST_SIZE 8192 |
101 | #define LPFC_NODELIST_ENTRY_SIZE 120 | 102 | #define LPFC_NODELIST_ENTRY_SIZE 120 |
102 | 103 | ||
103 | /* dumpslim output buffer size */ | 104 | /* dumpHBASlim output buffer size */ |
104 | #define LPFC_DUMPSLIM_SIZE 4096 | 105 | #define LPFC_DUMPHBASLIM_SIZE 4096 |
106 | |||
107 | /* dumpHostSlim output buffer size */ | ||
108 | #define LPFC_DUMPHOSTSLIM_SIZE 4096 | ||
105 | 109 | ||
106 | /* hbqinfo output buffer size */ | 110 | /* hbqinfo output buffer size */ |
107 | #define LPFC_HBQINFO_SIZE 8192 | 111 | #define LPFC_HBQINFO_SIZE 8192 |
@@ -243,16 +247,17 @@ lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, int size) | |||
243 | raw_index = phba->hbq_get[i]; | 247 | raw_index = phba->hbq_get[i]; |
244 | getidx = le32_to_cpu(raw_index); | 248 | getidx = le32_to_cpu(raw_index); |
245 | len += snprintf(buf+len, size-len, | 249 | len += snprintf(buf+len, size-len, |
246 | "entrys:%d Put:%d nPut:%d localGet:%d hbaGet:%d\n", | 250 | "entrys:%d bufcnt:%d Put:%d nPut:%d localGet:%d hbaGet:%d\n", |
247 | hbqs->entry_count, hbqs->hbqPutIdx, hbqs->next_hbqPutIdx, | 251 | hbqs->entry_count, hbqs->buffer_count, hbqs->hbqPutIdx, |
248 | hbqs->local_hbqGetIdx, getidx); | 252 | hbqs->next_hbqPutIdx, hbqs->local_hbqGetIdx, getidx); |
249 | 253 | ||
250 | hbqe = (struct lpfc_hbq_entry *) phba->hbqs[i].hbq_virt; | 254 | hbqe = (struct lpfc_hbq_entry *) phba->hbqs[i].hbq_virt; |
251 | for (j=0; j<hbqs->entry_count; j++) { | 255 | for (j=0; j<hbqs->entry_count; j++) { |
252 | len += snprintf(buf+len, size-len, | 256 | len += snprintf(buf+len, size-len, |
253 | "%03d: %08x %04x %05x ", j, | 257 | "%03d: %08x %04x %05x ", j, |
254 | hbqe->bde.addrLow, hbqe->bde.tus.w, hbqe->buffer_tag); | 258 | le32_to_cpu(hbqe->bde.addrLow), |
255 | 259 | le32_to_cpu(hbqe->bde.tus.w), | |
260 | le32_to_cpu(hbqe->buffer_tag)); | ||
256 | i = 0; | 261 | i = 0; |
257 | found = 0; | 262 | found = 0; |
258 | 263 | ||
@@ -276,7 +281,7 @@ lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, int size) | |||
276 | list_for_each_entry(d_buf, &hbqs->hbq_buffer_list, list) { | 281 | list_for_each_entry(d_buf, &hbqs->hbq_buffer_list, list) { |
277 | hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf); | 282 | hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf); |
278 | phys = ((uint64_t)hbq_buf->dbuf.phys & 0xffffffff); | 283 | phys = ((uint64_t)hbq_buf->dbuf.phys & 0xffffffff); |
279 | if (phys == hbqe->bde.addrLow) { | 284 | if (phys == le32_to_cpu(hbqe->bde.addrLow)) { |
280 | len += snprintf(buf+len, size-len, | 285 | len += snprintf(buf+len, size-len, |
281 | "Buf%d: %p %06x\n", i, | 286 | "Buf%d: %p %06x\n", i, |
282 | hbq_buf->dbuf.virt, hbq_buf->tag); | 287 | hbq_buf->dbuf.virt, hbq_buf->tag); |
@@ -297,18 +302,58 @@ skipit: | |||
297 | return len; | 302 | return len; |
298 | } | 303 | } |
299 | 304 | ||
305 | static int lpfc_debugfs_last_hba_slim_off; | ||
306 | |||
307 | static int | ||
308 | lpfc_debugfs_dumpHBASlim_data(struct lpfc_hba *phba, char *buf, int size) | ||
309 | { | ||
310 | int len = 0; | ||
311 | int i, off; | ||
312 | uint32_t *ptr; | ||
313 | char buffer[1024]; | ||
314 | |||
315 | off = 0; | ||
316 | spin_lock_irq(&phba->hbalock); | ||
317 | |||
318 | len += snprintf(buf+len, size-len, "HBA SLIM\n"); | ||
319 | lpfc_memcpy_from_slim(buffer, | ||
320 | ((uint8_t *)phba->MBslimaddr) + lpfc_debugfs_last_hba_slim_off, | ||
321 | 1024); | ||
322 | |||
323 | ptr = (uint32_t *)&buffer[0]; | ||
324 | off = lpfc_debugfs_last_hba_slim_off; | ||
325 | |||
326 | /* Set it up for the next time */ | ||
327 | lpfc_debugfs_last_hba_slim_off += 1024; | ||
328 | if (lpfc_debugfs_last_hba_slim_off >= 4096) | ||
329 | lpfc_debugfs_last_hba_slim_off = 0; | ||
330 | |||
331 | i = 1024; | ||
332 | while (i > 0) { | ||
333 | len += snprintf(buf+len, size-len, | ||
334 | "%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n", | ||
335 | off, *ptr, *(ptr+1), *(ptr+2), *(ptr+3), *(ptr+4), | ||
336 | *(ptr+5), *(ptr+6), *(ptr+7)); | ||
337 | ptr += 8; | ||
338 | i -= (8 * sizeof(uint32_t)); | ||
339 | off += (8 * sizeof(uint32_t)); | ||
340 | } | ||
341 | |||
342 | spin_unlock_irq(&phba->hbalock); | ||
343 | return len; | ||
344 | } | ||
345 | |||
300 | static int | 346 | static int |
301 | lpfc_debugfs_dumpslim_data(struct lpfc_hba *phba, char *buf, int size) | 347 | lpfc_debugfs_dumpHostSlim_data(struct lpfc_hba *phba, char *buf, int size) |
302 | { | 348 | { |
303 | int len = 0; | 349 | int len = 0; |
304 | int cnt, i, off; | 350 | int i, off; |
305 | uint32_t word0, word1, word2, word3; | 351 | uint32_t word0, word1, word2, word3; |
306 | uint32_t *ptr; | 352 | uint32_t *ptr; |
307 | struct lpfc_pgp *pgpp; | 353 | struct lpfc_pgp *pgpp; |
308 | struct lpfc_sli *psli = &phba->sli; | 354 | struct lpfc_sli *psli = &phba->sli; |
309 | struct lpfc_sli_ring *pring; | 355 | struct lpfc_sli_ring *pring; |
310 | 356 | ||
311 | cnt = LPFC_DUMPSLIM_SIZE; | ||
312 | off = 0; | 357 | off = 0; |
313 | spin_lock_irq(&phba->hbalock); | 358 | spin_lock_irq(&phba->hbalock); |
314 | 359 | ||
@@ -620,7 +665,34 @@ out: | |||
620 | } | 665 | } |
621 | 666 | ||
622 | static int | 667 | static int |
623 | lpfc_debugfs_dumpslim_open(struct inode *inode, struct file *file) | 668 | lpfc_debugfs_dumpHBASlim_open(struct inode *inode, struct file *file) |
669 | { | ||
670 | struct lpfc_hba *phba = inode->i_private; | ||
671 | struct lpfc_debug *debug; | ||
672 | int rc = -ENOMEM; | ||
673 | |||
674 | debug = kmalloc(sizeof(*debug), GFP_KERNEL); | ||
675 | if (!debug) | ||
676 | goto out; | ||
677 | |||
678 | /* Round to page boundry */ | ||
679 | debug->buffer = kmalloc(LPFC_DUMPHBASLIM_SIZE, GFP_KERNEL); | ||
680 | if (!debug->buffer) { | ||
681 | kfree(debug); | ||
682 | goto out; | ||
683 | } | ||
684 | |||
685 | debug->len = lpfc_debugfs_dumpHBASlim_data(phba, debug->buffer, | ||
686 | LPFC_DUMPHBASLIM_SIZE); | ||
687 | file->private_data = debug; | ||
688 | |||
689 | rc = 0; | ||
690 | out: | ||
691 | return rc; | ||
692 | } | ||
693 | |||
694 | static int | ||
695 | lpfc_debugfs_dumpHostSlim_open(struct inode *inode, struct file *file) | ||
624 | { | 696 | { |
625 | struct lpfc_hba *phba = inode->i_private; | 697 | struct lpfc_hba *phba = inode->i_private; |
626 | struct lpfc_debug *debug; | 698 | struct lpfc_debug *debug; |
@@ -631,14 +703,14 @@ lpfc_debugfs_dumpslim_open(struct inode *inode, struct file *file) | |||
631 | goto out; | 703 | goto out; |
632 | 704 | ||
633 | /* Round to page boundry */ | 705 | /* Round to page boundry */ |
634 | debug->buffer = kmalloc(LPFC_DUMPSLIM_SIZE, GFP_KERNEL); | 706 | debug->buffer = kmalloc(LPFC_DUMPHOSTSLIM_SIZE, GFP_KERNEL); |
635 | if (!debug->buffer) { | 707 | if (!debug->buffer) { |
636 | kfree(debug); | 708 | kfree(debug); |
637 | goto out; | 709 | goto out; |
638 | } | 710 | } |
639 | 711 | ||
640 | debug->len = lpfc_debugfs_dumpslim_data(phba, debug->buffer, | 712 | debug->len = lpfc_debugfs_dumpHostSlim_data(phba, debug->buffer, |
641 | LPFC_DUMPSLIM_SIZE); | 713 | LPFC_DUMPHOSTSLIM_SIZE); |
642 | file->private_data = debug; | 714 | file->private_data = debug; |
643 | 715 | ||
644 | rc = 0; | 716 | rc = 0; |
@@ -741,10 +813,19 @@ static struct file_operations lpfc_debugfs_op_hbqinfo = { | |||
741 | .release = lpfc_debugfs_release, | 813 | .release = lpfc_debugfs_release, |
742 | }; | 814 | }; |
743 | 815 | ||
744 | #undef lpfc_debugfs_op_dumpslim | 816 | #undef lpfc_debugfs_op_dumpHBASlim |
745 | static struct file_operations lpfc_debugfs_op_dumpslim = { | 817 | static struct file_operations lpfc_debugfs_op_dumpHBASlim = { |
818 | .owner = THIS_MODULE, | ||
819 | .open = lpfc_debugfs_dumpHBASlim_open, | ||
820 | .llseek = lpfc_debugfs_lseek, | ||
821 | .read = lpfc_debugfs_read, | ||
822 | .release = lpfc_debugfs_release, | ||
823 | }; | ||
824 | |||
825 | #undef lpfc_debugfs_op_dumpHostSlim | ||
826 | static struct file_operations lpfc_debugfs_op_dumpHostSlim = { | ||
746 | .owner = THIS_MODULE, | 827 | .owner = THIS_MODULE, |
747 | .open = lpfc_debugfs_dumpslim_open, | 828 | .open = lpfc_debugfs_dumpHostSlim_open, |
748 | .llseek = lpfc_debugfs_lseek, | 829 | .llseek = lpfc_debugfs_lseek, |
749 | .read = lpfc_debugfs_read, | 830 | .read = lpfc_debugfs_read, |
750 | .release = lpfc_debugfs_release, | 831 | .release = lpfc_debugfs_release, |
@@ -812,15 +893,27 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) | |||
812 | goto debug_failed; | 893 | goto debug_failed; |
813 | } | 894 | } |
814 | 895 | ||
815 | /* Setup dumpslim */ | 896 | /* Setup dumpHBASlim */ |
816 | snprintf(name, sizeof(name), "dumpslim"); | 897 | snprintf(name, sizeof(name), "dumpHBASlim"); |
817 | phba->debug_dumpslim = | 898 | phba->debug_dumpHBASlim = |
899 | debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR, | ||
900 | phba->hba_debugfs_root, | ||
901 | phba, &lpfc_debugfs_op_dumpHBASlim); | ||
902 | if (!phba->debug_dumpHBASlim) { | ||
903 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | ||
904 | "0409 Cannot create debugfs dumpHBASlim\n"); | ||
905 | goto debug_failed; | ||
906 | } | ||
907 | |||
908 | /* Setup dumpHostSlim */ | ||
909 | snprintf(name, sizeof(name), "dumpHostSlim"); | ||
910 | phba->debug_dumpHostSlim = | ||
818 | debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR, | 911 | debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR, |
819 | phba->hba_debugfs_root, | 912 | phba->hba_debugfs_root, |
820 | phba, &lpfc_debugfs_op_dumpslim); | 913 | phba, &lpfc_debugfs_op_dumpHostSlim); |
821 | if (!phba->debug_dumpslim) { | 914 | if (!phba->debug_dumpHostSlim) { |
822 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | 915 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, |
823 | "0409 Cannot create debugfs dumpslim\n"); | 916 | "0409 Cannot create debugfs dumpHostSlim\n"); |
824 | goto debug_failed; | 917 | goto debug_failed; |
825 | } | 918 | } |
826 | 919 | ||
@@ -970,9 +1063,13 @@ lpfc_debugfs_terminate(struct lpfc_vport *vport) | |||
970 | debugfs_remove(phba->debug_hbqinfo); /* hbqinfo */ | 1063 | debugfs_remove(phba->debug_hbqinfo); /* hbqinfo */ |
971 | phba->debug_hbqinfo = NULL; | 1064 | phba->debug_hbqinfo = NULL; |
972 | } | 1065 | } |
973 | if (phba->debug_dumpslim) { | 1066 | if (phba->debug_dumpHBASlim) { |
974 | debugfs_remove(phba->debug_dumpslim); /* dumpslim */ | 1067 | debugfs_remove(phba->debug_dumpHBASlim); /* HBASlim */ |
975 | phba->debug_dumpslim = NULL; | 1068 | phba->debug_dumpHBASlim = NULL; |
1069 | } | ||
1070 | if (phba->debug_dumpHostSlim) { | ||
1071 | debugfs_remove(phba->debug_dumpHostSlim); /* HostSlim */ | ||
1072 | phba->debug_dumpHostSlim = NULL; | ||
976 | } | 1073 | } |
977 | if (phba->slow_ring_trc) { | 1074 | if (phba->slow_ring_trc) { |
978 | kfree(phba->slow_ring_trc); | 1075 | kfree(phba->slow_ring_trc); |