diff options
| author | Alexey Dobriyan <adobriyan@gmail.com> | 2010-08-10 21:01:15 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-11 11:59:00 -0400 |
| commit | eb6edad3ec23265e6bf48035531a035e7eeba5f5 (patch) | |
| tree | 6354869037095df54a065ebf642d6e80c210be93 /drivers/message/fusion | |
| parent | d23670069ad60c82234e51a945e8b472e8c7bde2 (diff) | |
mpt fusion: convert to seq_file
Convert everything except ->proc_info() stuff, it is done within separate
->proc_info path series.
Problem with ->read_proc et al is described here commit
786d7e1612f0b0adb6046f19b906609e4fe8b1ba "Fix rmmod/read/write races in
/proc entries"
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Eric Moore <Eric.Moore@lsi.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/message/fusion')
| -rw-r--r-- | drivers/message/fusion/mptbase.c | 236 | ||||
| -rw-r--r-- | drivers/message/fusion/mptbase.h | 25 |
2 files changed, 119 insertions, 142 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index b88a244a1edd..d18965b55b57 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c | |||
| @@ -50,6 +50,7 @@ | |||
| 50 | #include <linux/module.h> | 50 | #include <linux/module.h> |
| 51 | #include <linux/errno.h> | 51 | #include <linux/errno.h> |
| 52 | #include <linux/init.h> | 52 | #include <linux/init.h> |
| 53 | #include <linux/seq_file.h> | ||
| 53 | #include <linux/slab.h> | 54 | #include <linux/slab.h> |
| 54 | #include <linux/types.h> | 55 | #include <linux/types.h> |
| 55 | #include <linux/pci.h> | 56 | #include <linux/pci.h> |
| @@ -200,12 +201,9 @@ static int mpt_host_page_access_control(MPT_ADAPTER *ioc, u8 access_control_valu | |||
| 200 | static int mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init); | 201 | static int mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init); |
| 201 | 202 | ||
| 202 | #ifdef CONFIG_PROC_FS | 203 | #ifdef CONFIG_PROC_FS |
| 203 | static int procmpt_summary_read(char *buf, char **start, off_t offset, | 204 | static const struct file_operations mpt_summary_proc_fops; |
| 204 | int request, int *eof, void *data); | 205 | static const struct file_operations mpt_version_proc_fops; |
| 205 | static int procmpt_version_read(char *buf, char **start, off_t offset, | 206 | static const struct file_operations mpt_iocinfo_proc_fops; |
| 206 | int request, int *eof, void *data); | ||
| 207 | static int procmpt_iocinfo_read(char *buf, char **start, off_t offset, | ||
| 208 | int request, int *eof, void *data); | ||
| 209 | #endif | 207 | #endif |
| 210 | static void mpt_get_fw_exp_ver(char *buf, MPT_ADAPTER *ioc); | 208 | static void mpt_get_fw_exp_ver(char *buf, MPT_ADAPTER *ioc); |
| 211 | 209 | ||
| @@ -1725,7 +1723,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 1725 | u8 pcixcmd; | 1723 | u8 pcixcmd; |
| 1726 | static int mpt_ids = 0; | 1724 | static int mpt_ids = 0; |
| 1727 | #ifdef CONFIG_PROC_FS | 1725 | #ifdef CONFIG_PROC_FS |
| 1728 | struct proc_dir_entry *dent, *ent; | 1726 | struct proc_dir_entry *dent; |
| 1729 | #endif | 1727 | #endif |
| 1730 | 1728 | ||
| 1731 | ioc = kzalloc(sizeof(MPT_ADAPTER), GFP_ATOMIC); | 1729 | ioc = kzalloc(sizeof(MPT_ADAPTER), GFP_ATOMIC); |
| @@ -1980,16 +1978,8 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 1980 | */ | 1978 | */ |
| 1981 | dent = proc_mkdir(ioc->name, mpt_proc_root_dir); | 1979 | dent = proc_mkdir(ioc->name, mpt_proc_root_dir); |
| 1982 | if (dent) { | 1980 | if (dent) { |
| 1983 | ent = create_proc_entry("info", S_IFREG|S_IRUGO, dent); | 1981 | proc_create_data("info", S_IRUGO, dent, &mpt_iocinfo_proc_fops, ioc); |
| 1984 | if (ent) { | 1982 | proc_create_data("summary", S_IRUGO, dent, &mpt_summary_proc_fops, ioc); |
| 1985 | ent->read_proc = procmpt_iocinfo_read; | ||
| 1986 | ent->data = ioc; | ||
| 1987 | } | ||
| 1988 | ent = create_proc_entry("summary", S_IFREG|S_IRUGO, dent); | ||
| 1989 | if (ent) { | ||
| 1990 | ent->read_proc = procmpt_summary_read; | ||
| 1991 | ent->data = ioc; | ||
| 1992 | } | ||
| 1993 | } | 1983 | } |
| 1994 | #endif | 1984 | #endif |
| 1995 | 1985 | ||
| @@ -6546,20 +6536,12 @@ mpt_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) | |||
| 6546 | static int | 6536 | static int |
| 6547 | procmpt_create(void) | 6537 | procmpt_create(void) |
| 6548 | { | 6538 | { |
| 6549 | struct proc_dir_entry *ent; | ||
| 6550 | |||
| 6551 | mpt_proc_root_dir = proc_mkdir(MPT_PROCFS_MPTBASEDIR, NULL); | 6539 | mpt_proc_root_dir = proc_mkdir(MPT_PROCFS_MPTBASEDIR, NULL); |
| 6552 | if (mpt_proc_root_dir == NULL) | 6540 | if (mpt_proc_root_dir == NULL) |
| 6553 | return -ENOTDIR; | 6541 | return -ENOTDIR; |
| 6554 | 6542 | ||
| 6555 | ent = create_proc_entry("summary", S_IFREG|S_IRUGO, mpt_proc_root_dir); | 6543 | proc_create("summary", S_IRUGO, mpt_proc_root_dir, &mpt_summary_proc_fops); |
| 6556 | if (ent) | 6544 | proc_create("version", S_IRUGO, mpt_proc_root_dir, &mpt_version_proc_fops); |
| 6557 | ent->read_proc = procmpt_summary_read; | ||
| 6558 | |||
| 6559 | ent = create_proc_entry("version", S_IFREG|S_IRUGO, mpt_proc_root_dir); | ||
| 6560 | if (ent) | ||
| 6561 | ent->read_proc = procmpt_version_read; | ||
| 6562 | |||
| 6563 | return 0; | 6545 | return 0; |
| 6564 | } | 6546 | } |
| 6565 | 6547 | ||
| @@ -6579,70 +6561,46 @@ procmpt_destroy(void) | |||
| 6579 | 6561 | ||
| 6580 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 6562 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
| 6581 | /** | 6563 | /** |
| 6582 | * procmpt_summary_read - Handle read request of a summary file | ||
| 6583 | * @buf: Pointer to area to write information | ||
| 6584 | * @start: Pointer to start pointer | ||
| 6585 | * @offset: Offset to start writing | ||
| 6586 | * @request: Amount of read data requested | ||
| 6587 | * @eof: Pointer to EOF integer | ||
| 6588 | * @data: Pointer | ||
| 6589 | * | ||
| 6590 | * Handles read request from /proc/mpt/summary or /proc/mpt/iocN/summary. | 6564 | * Handles read request from /proc/mpt/summary or /proc/mpt/iocN/summary. |
| 6591 | * Returns number of characters written to process performing the read. | ||
| 6592 | */ | 6565 | */ |
| 6593 | static int | 6566 | static void seq_mpt_print_ioc_summary(MPT_ADAPTER *ioc, struct seq_file *m, int showlan); |
| 6594 | procmpt_summary_read(char *buf, char **start, off_t offset, int request, int *eof, void *data) | ||
| 6595 | { | ||
| 6596 | MPT_ADAPTER *ioc; | ||
| 6597 | char *out = buf; | ||
| 6598 | int len; | ||
| 6599 | 6567 | ||
| 6600 | if (data) { | 6568 | static int mpt_summary_proc_show(struct seq_file *m, void *v) |
| 6601 | int more = 0; | 6569 | { |
| 6602 | 6570 | MPT_ADAPTER *ioc = m->private; | |
| 6603 | ioc = data; | ||
| 6604 | mpt_print_ioc_summary(ioc, out, &more, 0, 1); | ||
| 6605 | 6571 | ||
| 6606 | out += more; | 6572 | if (ioc) { |
| 6573 | seq_mpt_print_ioc_summary(ioc, m, 1); | ||
| 6607 | } else { | 6574 | } else { |
| 6608 | list_for_each_entry(ioc, &ioc_list, list) { | 6575 | list_for_each_entry(ioc, &ioc_list, list) { |
| 6609 | int more = 0; | 6576 | seq_mpt_print_ioc_summary(ioc, m, 1); |
| 6610 | |||
| 6611 | mpt_print_ioc_summary(ioc, out, &more, 0, 1); | ||
| 6612 | |||
| 6613 | out += more; | ||
| 6614 | if ((out-buf) >= request) | ||
| 6615 | break; | ||
| 6616 | } | 6577 | } |
| 6617 | } | 6578 | } |
| 6618 | 6579 | ||
| 6619 | len = out - buf; | 6580 | return 0; |
| 6581 | } | ||
| 6620 | 6582 | ||
| 6621 | MPT_PROC_READ_RETURN(buf,start,offset,request,eof,len); | 6583 | static int mpt_summary_proc_open(struct inode *inode, struct file *file) |
| 6584 | { | ||
| 6585 | return single_open(file, mpt_summary_proc_show, PDE(inode)->data); | ||
| 6622 | } | 6586 | } |
| 6623 | 6587 | ||
| 6624 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 6588 | static const struct file_operations mpt_summary_proc_fops = { |
| 6625 | /** | 6589 | .owner = THIS_MODULE, |
| 6626 | * procmpt_version_read - Handle read request from /proc/mpt/version. | 6590 | .open = mpt_summary_proc_open, |
| 6627 | * @buf: Pointer to area to write information | 6591 | .read = seq_read, |
| 6628 | * @start: Pointer to start pointer | 6592 | .llseek = seq_lseek, |
| 6629 | * @offset: Offset to start writing | 6593 | .release = single_release, |
| 6630 | * @request: Amount of read data requested | 6594 | }; |
| 6631 | * @eof: Pointer to EOF integer | 6595 | |
| 6632 | * @data: Pointer | 6596 | static int mpt_version_proc_show(struct seq_file *m, void *v) |
| 6633 | * | ||
| 6634 | * Returns number of characters written to process performing the read. | ||
| 6635 | */ | ||
| 6636 | static int | ||
| 6637 | procmpt_version_read(char *buf, char **start, off_t offset, int request, int *eof, void *data) | ||
| 6638 | { | 6597 | { |
| 6639 | u8 cb_idx; | 6598 | u8 cb_idx; |
| 6640 | int scsi, fc, sas, lan, ctl, targ, dmp; | 6599 | int scsi, fc, sas, lan, ctl, targ, dmp; |
| 6641 | char *drvname; | 6600 | char *drvname; |
| 6642 | int len; | ||
| 6643 | 6601 | ||
| 6644 | len = sprintf(buf, "%s-%s\n", "mptlinux", MPT_LINUX_VERSION_COMMON); | 6602 | seq_printf(m, "%s-%s\n", "mptlinux", MPT_LINUX_VERSION_COMMON); |
| 6645 | len += sprintf(buf+len, " Fusion MPT base driver\n"); | 6603 | seq_printf(m, " Fusion MPT base driver\n"); |
| 6646 | 6604 | ||
| 6647 | scsi = fc = sas = lan = ctl = targ = dmp = 0; | 6605 | scsi = fc = sas = lan = ctl = targ = dmp = 0; |
| 6648 | for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) { | 6606 | for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) { |
| @@ -6670,98 +6628,97 @@ procmpt_version_read(char *buf, char **start, off_t offset, int request, int *eo | |||
| 6670 | } | 6628 | } |
| 6671 | 6629 | ||
| 6672 | if (drvname) | 6630 | if (drvname) |
| 6673 | len += sprintf(buf+len, " Fusion MPT %s driver\n", drvname); | 6631 | seq_printf(m, " Fusion MPT %s driver\n", drvname); |
| 6674 | } | 6632 | } |
| 6675 | } | 6633 | } |
| 6676 | 6634 | ||
| 6677 | MPT_PROC_READ_RETURN(buf,start,offset,request,eof,len); | 6635 | return 0; |
| 6678 | } | 6636 | } |
| 6679 | 6637 | ||
| 6680 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 6638 | static int mpt_version_proc_open(struct inode *inode, struct file *file) |
| 6681 | /** | ||
| 6682 | * procmpt_iocinfo_read - Handle read request from /proc/mpt/iocN/info. | ||
| 6683 | * @buf: Pointer to area to write information | ||
| 6684 | * @start: Pointer to start pointer | ||
| 6685 | * @offset: Offset to start writing | ||
| 6686 | * @request: Amount of read data requested | ||
| 6687 | * @eof: Pointer to EOF integer | ||
| 6688 | * @data: Pointer | ||
| 6689 | * | ||
| 6690 | * Returns number of characters written to process performing the read. | ||
| 6691 | */ | ||
| 6692 | static int | ||
| 6693 | procmpt_iocinfo_read(char *buf, char **start, off_t offset, int request, int *eof, void *data) | ||
| 6694 | { | 6639 | { |
| 6695 | MPT_ADAPTER *ioc = data; | 6640 | return single_open(file, mpt_version_proc_show, NULL); |
| 6696 | int len; | 6641 | } |
| 6642 | |||
| 6643 | static const struct file_operations mpt_version_proc_fops = { | ||
| 6644 | .owner = THIS_MODULE, | ||
| 6645 | .open = mpt_version_proc_open, | ||
| 6646 | .read = seq_read, | ||
| 6647 | .llseek = seq_lseek, | ||
| 6648 | .release = single_release, | ||
| 6649 | }; | ||
| 6650 | |||
| 6651 | static int mpt_iocinfo_proc_show(struct seq_file *m, void *v) | ||
| 6652 | { | ||
| 6653 | MPT_ADAPTER *ioc = m->private; | ||
| 6697 | char expVer[32]; | 6654 | char expVer[32]; |
| 6698 | int sz; | 6655 | int sz; |
| 6699 | int p; | 6656 | int p; |
| 6700 | 6657 | ||
| 6701 | mpt_get_fw_exp_ver(expVer, ioc); | 6658 | mpt_get_fw_exp_ver(expVer, ioc); |
| 6702 | 6659 | ||
| 6703 | len = sprintf(buf, "%s:", ioc->name); | 6660 | seq_printf(m, "%s:", ioc->name); |
| 6704 | if (ioc->facts.Flags & MPI_IOCFACTS_FLAGS_FW_DOWNLOAD_BOOT) | 6661 | if (ioc->facts.Flags & MPI_IOCFACTS_FLAGS_FW_DOWNLOAD_BOOT) |
| 6705 | len += sprintf(buf+len, " (f/w download boot flag set)"); | 6662 | seq_printf(m, " (f/w download boot flag set)"); |
| 6706 | // if (ioc->facts.IOCExceptions & MPI_IOCFACTS_EXCEPT_CONFIG_CHECKSUM_FAIL) | 6663 | // if (ioc->facts.IOCExceptions & MPI_IOCFACTS_EXCEPT_CONFIG_CHECKSUM_FAIL) |
| 6707 | // len += sprintf(buf+len, " CONFIG_CHECKSUM_FAIL!"); | 6664 | // seq_printf(m, " CONFIG_CHECKSUM_FAIL!"); |
| 6708 | 6665 | ||
| 6709 | len += sprintf(buf+len, "\n ProductID = 0x%04x (%s)\n", | 6666 | seq_printf(m, "\n ProductID = 0x%04x (%s)\n", |
| 6710 | ioc->facts.ProductID, | 6667 | ioc->facts.ProductID, |
| 6711 | ioc->prod_name); | 6668 | ioc->prod_name); |
| 6712 | len += sprintf(buf+len, " FWVersion = 0x%08x%s", ioc->facts.FWVersion.Word, expVer); | 6669 | seq_printf(m, " FWVersion = 0x%08x%s", ioc->facts.FWVersion.Word, expVer); |
| 6713 | if (ioc->facts.FWImageSize) | 6670 | if (ioc->facts.FWImageSize) |
| 6714 | len += sprintf(buf+len, " (fw_size=%d)", ioc->facts.FWImageSize); | 6671 | seq_printf(m, " (fw_size=%d)", ioc->facts.FWImageSize); |
| 6715 | len += sprintf(buf+len, "\n MsgVersion = 0x%04x\n", ioc->facts.MsgVersion); | 6672 | seq_printf(m, "\n MsgVersion = 0x%04x\n", ioc->facts.MsgVersion); |
| 6716 | len += sprintf(buf+len, " FirstWhoInit = 0x%02x\n", ioc->FirstWhoInit); | 6673 | seq_printf(m, " FirstWhoInit = 0x%02x\n", ioc->FirstWhoInit); |
| 6717 | len += sprintf(buf+len, " EventState = 0x%02x\n", ioc->facts.EventState); | 6674 | seq_printf(m, " EventState = 0x%02x\n", ioc->facts.EventState); |
| 6718 | 6675 | ||
| 6719 | len += sprintf(buf+len, " CurrentHostMfaHighAddr = 0x%08x\n", | 6676 | seq_printf(m, " CurrentHostMfaHighAddr = 0x%08x\n", |
| 6720 | ioc->facts.CurrentHostMfaHighAddr); | 6677 | ioc->facts.CurrentHostMfaHighAddr); |
| 6721 | len += sprintf(buf+len, " CurrentSenseBufferHighAddr = 0x%08x\n", | 6678 | seq_printf(m, " CurrentSenseBufferHighAddr = 0x%08x\n", |
| 6722 | ioc->facts.CurrentSenseBufferHighAddr); | 6679 | ioc->facts.CurrentSenseBufferHighAddr); |
| 6723 | 6680 | ||
| 6724 | len += sprintf(buf+len, " MaxChainDepth = 0x%02x frames\n", ioc->facts.MaxChainDepth); | 6681 | seq_printf(m, " MaxChainDepth = 0x%02x frames\n", ioc->facts.MaxChainDepth); |
| 6725 | len += sprintf(buf+len, " MinBlockSize = 0x%02x bytes\n", 4*ioc->facts.BlockSize); | 6682 | seq_printf(m, " MinBlockSize = 0x%02x bytes\n", 4*ioc->facts.BlockSize); |
| 6726 | 6683 | ||
| 6727 | len += sprintf(buf+len, " RequestFrames @ 0x%p (Dma @ 0x%p)\n", | 6684 | seq_printf(m, " RequestFrames @ 0x%p (Dma @ 0x%p)\n", |
| 6728 | (void *)ioc->req_frames, (void *)(ulong)ioc->req_frames_dma); | 6685 | (void *)ioc->req_frames, (void *)(ulong)ioc->req_frames_dma); |
| 6729 | /* | 6686 | /* |
| 6730 | * Rounding UP to nearest 4-kB boundary here... | 6687 | * Rounding UP to nearest 4-kB boundary here... |
| 6731 | */ | 6688 | */ |
| 6732 | sz = (ioc->req_sz * ioc->req_depth) + 128; | 6689 | sz = (ioc->req_sz * ioc->req_depth) + 128; |
| 6733 | sz = ((sz + 0x1000UL - 1UL) / 0x1000) * 0x1000; | 6690 | sz = ((sz + 0x1000UL - 1UL) / 0x1000) * 0x1000; |
| 6734 | len += sprintf(buf+len, " {CurReqSz=%d} x {CurReqDepth=%d} = %d bytes ^= 0x%x\n", | 6691 | seq_printf(m, " {CurReqSz=%d} x {CurReqDepth=%d} = %d bytes ^= 0x%x\n", |
| 6735 | ioc->req_sz, ioc->req_depth, ioc->req_sz*ioc->req_depth, sz); | 6692 | ioc->req_sz, ioc->req_depth, ioc->req_sz*ioc->req_depth, sz); |
| 6736 | len += sprintf(buf+len, " {MaxReqSz=%d} {MaxReqDepth=%d}\n", | 6693 | seq_printf(m, " {MaxReqSz=%d} {MaxReqDepth=%d}\n", |
| 6737 | 4*ioc->facts.RequestFrameSize, | 6694 | 4*ioc->facts.RequestFrameSize, |
| 6738 | ioc->facts.GlobalCredits); | 6695 | ioc->facts.GlobalCredits); |
| 6739 | 6696 | ||
| 6740 | len += sprintf(buf+len, " Frames @ 0x%p (Dma @ 0x%p)\n", | 6697 | seq_printf(m, " Frames @ 0x%p (Dma @ 0x%p)\n", |
| 6741 | (void *)ioc->alloc, (void *)(ulong)ioc->alloc_dma); | 6698 | (void *)ioc->alloc, (void *)(ulong)ioc->alloc_dma); |
| 6742 | sz = (ioc->reply_sz * ioc->reply_depth) + 128; | 6699 | sz = (ioc->reply_sz * ioc->reply_depth) + 128; |
| 6743 | len += sprintf(buf+len, " {CurRepSz=%d} x {CurRepDepth=%d} = %d bytes ^= 0x%x\n", | 6700 | seq_printf(m, " {CurRepSz=%d} x {CurRepDepth=%d} = %d bytes ^= 0x%x\n", |
| 6744 | ioc->reply_sz, ioc->reply_depth, ioc->reply_sz*ioc->reply_depth, sz); | 6701 | ioc->reply_sz, ioc->reply_depth, ioc->reply_sz*ioc->reply_depth, sz); |
| 6745 | len += sprintf(buf+len, " {MaxRepSz=%d} {MaxRepDepth=%d}\n", | 6702 | seq_printf(m, " {MaxRepSz=%d} {MaxRepDepth=%d}\n", |
| 6746 | ioc->facts.CurReplyFrameSize, | 6703 | ioc->facts.CurReplyFrameSize, |
| 6747 | ioc->facts.ReplyQueueDepth); | 6704 | ioc->facts.ReplyQueueDepth); |
| 6748 | 6705 | ||
| 6749 | len += sprintf(buf+len, " MaxDevices = %d\n", | 6706 | seq_printf(m, " MaxDevices = %d\n", |
| 6750 | (ioc->facts.MaxDevices==0) ? 255 : ioc->facts.MaxDevices); | 6707 | (ioc->facts.MaxDevices==0) ? 255 : ioc->facts.MaxDevices); |
| 6751 | len += sprintf(buf+len, " MaxBuses = %d\n", ioc->facts.MaxBuses); | 6708 | seq_printf(m, " MaxBuses = %d\n", ioc->facts.MaxBuses); |
| 6752 | 6709 | ||
| 6753 | /* per-port info */ | 6710 | /* per-port info */ |
| 6754 | for (p=0; p < ioc->facts.NumberOfPorts; p++) { | 6711 | for (p=0; p < ioc->facts.NumberOfPorts; p++) { |
| 6755 | len += sprintf(buf+len, " PortNumber = %d (of %d)\n", | 6712 | seq_printf(m, " PortNumber = %d (of %d)\n", |
| 6756 | p+1, | 6713 | p+1, |
| 6757 | ioc->facts.NumberOfPorts); | 6714 | ioc->facts.NumberOfPorts); |
| 6758 | if (ioc->bus_type == FC) { | 6715 | if (ioc->bus_type == FC) { |
| 6759 | if (ioc->pfacts[p].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN) { | 6716 | if (ioc->pfacts[p].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN) { |
| 6760 | u8 *a = (u8*)&ioc->lan_cnfg_page1.HardwareAddressLow; | 6717 | u8 *a = (u8*)&ioc->lan_cnfg_page1.HardwareAddressLow; |
| 6761 | len += sprintf(buf+len, " LanAddr = %02X:%02X:%02X:%02X:%02X:%02X\n", | 6718 | seq_printf(m, " LanAddr = %02X:%02X:%02X:%02X:%02X:%02X\n", |
| 6762 | a[5], a[4], a[3], a[2], a[1], a[0]); | 6719 | a[5], a[4], a[3], a[2], a[1], a[0]); |
| 6763 | } | 6720 | } |
| 6764 | len += sprintf(buf+len, " WWN = %08X%08X:%08X%08X\n", | 6721 | seq_printf(m, " WWN = %08X%08X:%08X%08X\n", |
| 6765 | ioc->fc_port_page0[p].WWNN.High, | 6722 | ioc->fc_port_page0[p].WWNN.High, |
| 6766 | ioc->fc_port_page0[p].WWNN.Low, | 6723 | ioc->fc_port_page0[p].WWNN.Low, |
| 6767 | ioc->fc_port_page0[p].WWPN.High, | 6724 | ioc->fc_port_page0[p].WWPN.High, |
| @@ -6769,9 +6726,21 @@ procmpt_iocinfo_read(char *buf, char **start, off_t offset, int request, int *eo | |||
| 6769 | } | 6726 | } |
| 6770 | } | 6727 | } |
| 6771 | 6728 | ||
| 6772 | MPT_PROC_READ_RETURN(buf,start,offset,request,eof,len); | 6729 | return 0; |
| 6730 | } | ||
| 6731 | |||
| 6732 | static int mpt_iocinfo_proc_open(struct inode *inode, struct file *file) | ||
| 6733 | { | ||
| 6734 | return single_open(file, mpt_iocinfo_proc_show, PDE(inode)->data); | ||
| 6773 | } | 6735 | } |
| 6774 | 6736 | ||
| 6737 | static const struct file_operations mpt_iocinfo_proc_fops = { | ||
| 6738 | .owner = THIS_MODULE, | ||
| 6739 | .open = mpt_iocinfo_proc_open, | ||
| 6740 | .read = seq_read, | ||
| 6741 | .llseek = seq_lseek, | ||
| 6742 | .release = single_release, | ||
| 6743 | }; | ||
| 6775 | #endif /* CONFIG_PROC_FS } */ | 6744 | #endif /* CONFIG_PROC_FS } */ |
| 6776 | 6745 | ||
| 6777 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 6746 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
| @@ -6837,6 +6806,39 @@ mpt_print_ioc_summary(MPT_ADAPTER *ioc, char *buffer, int *size, int len, int sh | |||
| 6837 | 6806 | ||
| 6838 | *size = y; | 6807 | *size = y; |
| 6839 | } | 6808 | } |
| 6809 | |||
| 6810 | static void seq_mpt_print_ioc_summary(MPT_ADAPTER *ioc, struct seq_file *m, int showlan) | ||
| 6811 | { | ||
| 6812 | char expVer[32]; | ||
| 6813 | |||
| 6814 | mpt_get_fw_exp_ver(expVer, ioc); | ||
| 6815 | |||
| 6816 | /* | ||
| 6817 | * Shorter summary of attached ioc's... | ||
| 6818 | */ | ||
| 6819 | seq_printf(m, "%s: %s, %s%08xh%s, Ports=%d, MaxQ=%d", | ||
| 6820 | ioc->name, | ||
| 6821 | ioc->prod_name, | ||
| 6822 | MPT_FW_REV_MAGIC_ID_STRING, /* "FwRev=" or somesuch */ | ||
| 6823 | ioc->facts.FWVersion.Word, | ||
| 6824 | expVer, | ||
| 6825 | ioc->facts.NumberOfPorts, | ||
| 6826 | ioc->req_depth); | ||
| 6827 | |||
| 6828 | if (showlan && (ioc->pfacts[0].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN)) { | ||
| 6829 | u8 *a = (u8*)&ioc->lan_cnfg_page1.HardwareAddressLow; | ||
| 6830 | seq_printf(m, ", LanAddr=%02X:%02X:%02X:%02X:%02X:%02X", | ||
| 6831 | a[5], a[4], a[3], a[2], a[1], a[0]); | ||
| 6832 | } | ||
| 6833 | |||
| 6834 | seq_printf(m, ", IRQ=%d", ioc->pci_irq); | ||
| 6835 | |||
| 6836 | if (!ioc->active) | ||
| 6837 | seq_printf(m, " (disabled)"); | ||
| 6838 | |||
| 6839 | seq_putc(m, '\n'); | ||
| 6840 | } | ||
| 6841 | |||
| 6840 | /** | 6842 | /** |
| 6841 | * mpt_set_taskmgmt_in_progress_flag - set flags associated with task management | 6843 | * mpt_set_taskmgmt_in_progress_flag - set flags associated with task management |
| 6842 | * @ioc: Pointer to MPT_ADAPTER structure | 6844 | * @ioc: Pointer to MPT_ADAPTER structure |
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h index 23ed3dec72a5..f71f22948477 100644 --- a/drivers/message/fusion/mptbase.h +++ b/drivers/message/fusion/mptbase.h | |||
| @@ -420,31 +420,6 @@ typedef struct _VirtDevice { | |||
| 420 | #define MPT_TARGET_FLAGS_LED_ON 0x80 | 420 | #define MPT_TARGET_FLAGS_LED_ON 0x80 |
| 421 | 421 | ||
| 422 | /* | 422 | /* |
| 423 | * /proc/mpt interface | ||
| 424 | */ | ||
| 425 | typedef struct { | ||
| 426 | const char *name; | ||
| 427 | mode_t mode; | ||
| 428 | int pad; | ||
| 429 | read_proc_t *read_proc; | ||
| 430 | write_proc_t *write_proc; | ||
| 431 | } mpt_proc_entry_t; | ||
| 432 | |||
| 433 | #define MPT_PROC_READ_RETURN(buf,start,offset,request,eof,len) \ | ||
| 434 | do { \ | ||
| 435 | len -= offset; \ | ||
| 436 | if (len < request) { \ | ||
| 437 | *eof = 1; \ | ||
| 438 | if (len <= 0) \ | ||
| 439 | return 0; \ | ||
| 440 | } else \ | ||
| 441 | len = request; \ | ||
| 442 | *start = buf + offset; \ | ||
| 443 | return len; \ | ||
| 444 | } while (0) | ||
| 445 | |||
| 446 | |||
| 447 | /* | ||
| 448 | * IOCTL structure and associated defines | 423 | * IOCTL structure and associated defines |
| 449 | */ | 424 | */ |
| 450 | 425 | ||
