aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/message')
-rw-r--r--drivers/message/fusion/mptbase.c238
-rw-r--r--drivers/message/fusion/mptbase.h25
-rw-r--r--drivers/message/i2o/exec-osm.c8
-rw-r--r--drivers/message/i2o/i2o_block.c3
-rw-r--r--drivers/message/i2o/i2o_config.c18
-rw-r--r--drivers/message/i2o/i2o_scsi.c3
6 files changed, 138 insertions, 157 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index d8c668d64418..b8f1719d7c02 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>
@@ -199,12 +200,9 @@ static int mpt_host_page_access_control(MPT_ADAPTER *ioc, u8 access_control_valu
199static int mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init); 200static int mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init);
200 201
201#ifdef CONFIG_PROC_FS 202#ifdef CONFIG_PROC_FS
202static int procmpt_summary_read(char *buf, char **start, off_t offset, 203static const struct file_operations mpt_summary_proc_fops;
203 int request, int *eof, void *data); 204static const struct file_operations mpt_version_proc_fops;
204static int procmpt_version_read(char *buf, char **start, off_t offset, 205static const struct file_operations mpt_iocinfo_proc_fops;
205 int request, int *eof, void *data);
206static int procmpt_iocinfo_read(char *buf, char **start, off_t offset,
207 int request, int *eof, void *data);
208#endif 206#endif
209static void mpt_get_fw_exp_ver(char *buf, MPT_ADAPTER *ioc); 207static void mpt_get_fw_exp_ver(char *buf, MPT_ADAPTER *ioc);
210 208
@@ -1724,7 +1722,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1724 u8 pcixcmd; 1722 u8 pcixcmd;
1725 static int mpt_ids = 0; 1723 static int mpt_ids = 0;
1726#ifdef CONFIG_PROC_FS 1724#ifdef CONFIG_PROC_FS
1727 struct proc_dir_entry *dent, *ent; 1725 struct proc_dir_entry *dent;
1728#endif 1726#endif
1729 1727
1730 ioc = kzalloc(sizeof(MPT_ADAPTER), GFP_ATOMIC); 1728 ioc = kzalloc(sizeof(MPT_ADAPTER), GFP_ATOMIC);
@@ -1979,16 +1977,8 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1979 */ 1977 */
1980 dent = proc_mkdir(ioc->name, mpt_proc_root_dir); 1978 dent = proc_mkdir(ioc->name, mpt_proc_root_dir);
1981 if (dent) { 1979 if (dent) {
1982 ent = create_proc_entry("info", S_IFREG|S_IRUGO, dent); 1980 proc_create_data("info", S_IRUGO, dent, &mpt_iocinfo_proc_fops, ioc);
1983 if (ent) { 1981 proc_create_data("summary", S_IRUGO, dent, &mpt_summary_proc_fops, ioc);
1984 ent->read_proc = procmpt_iocinfo_read;
1985 ent->data = ioc;
1986 }
1987 ent = create_proc_entry("summary", S_IFREG|S_IRUGO, dent);
1988 if (ent) {
1989 ent->read_proc = procmpt_summary_read;
1990 ent->data = ioc;
1991 }
1992 } 1982 }
1993#endif 1983#endif
1994 1984
@@ -6545,20 +6535,12 @@ mpt_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
6545static int 6535static int
6546procmpt_create(void) 6536procmpt_create(void)
6547{ 6537{
6548 struct proc_dir_entry *ent;
6549
6550 mpt_proc_root_dir = proc_mkdir(MPT_PROCFS_MPTBASEDIR, NULL); 6538 mpt_proc_root_dir = proc_mkdir(MPT_PROCFS_MPTBASEDIR, NULL);
6551 if (mpt_proc_root_dir == NULL) 6539 if (mpt_proc_root_dir == NULL)
6552 return -ENOTDIR; 6540 return -ENOTDIR;
6553 6541
6554 ent = create_proc_entry("summary", S_IFREG|S_IRUGO, mpt_proc_root_dir); 6542 proc_create("summary", S_IRUGO, mpt_proc_root_dir, &mpt_summary_proc_fops);
6555 if (ent) 6543 proc_create("version", S_IRUGO, mpt_proc_root_dir, &mpt_version_proc_fops);
6556 ent->read_proc = procmpt_summary_read;
6557
6558 ent = create_proc_entry("version", S_IFREG|S_IRUGO, mpt_proc_root_dir);
6559 if (ent)
6560 ent->read_proc = procmpt_version_read;
6561
6562 return 0; 6544 return 0;
6563} 6545}
6564 6546
@@ -6578,70 +6560,46 @@ procmpt_destroy(void)
6578 6560
6579/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 6561/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6580/** 6562/**
6581 * procmpt_summary_read - Handle read request of a summary file
6582 * @buf: Pointer to area to write information
6583 * @start: Pointer to start pointer
6584 * @offset: Offset to start writing
6585 * @request: Amount of read data requested
6586 * @eof: Pointer to EOF integer
6587 * @data: Pointer
6588 *
6589 * Handles read request from /proc/mpt/summary or /proc/mpt/iocN/summary. 6563 * Handles read request from /proc/mpt/summary or /proc/mpt/iocN/summary.
6590 * Returns number of characters written to process performing the read.
6591 */ 6564 */
6592static int 6565static void seq_mpt_print_ioc_summary(MPT_ADAPTER *ioc, struct seq_file *m, int showlan);
6593procmpt_summary_read(char *buf, char **start, off_t offset, int request, int *eof, void *data)
6594{
6595 MPT_ADAPTER *ioc;
6596 char *out = buf;
6597 int len;
6598 6566
6599 if (data) { 6567static int mpt_summary_proc_show(struct seq_file *m, void *v)
6600 int more = 0; 6568{
6601 6569 MPT_ADAPTER *ioc = m->private;
6602 ioc = data;
6603 mpt_print_ioc_summary(ioc, out, &more, 0, 1);
6604 6570
6605 out += more; 6571 if (ioc) {
6572 seq_mpt_print_ioc_summary(ioc, m, 1);
6606 } else { 6573 } else {
6607 list_for_each_entry(ioc, &ioc_list, list) { 6574 list_for_each_entry(ioc, &ioc_list, list) {
6608 int more = 0; 6575 seq_mpt_print_ioc_summary(ioc, m, 1);
6609
6610 mpt_print_ioc_summary(ioc, out, &more, 0, 1);
6611
6612 out += more;
6613 if ((out-buf) >= request)
6614 break;
6615 } 6576 }
6616 } 6577 }
6617 6578
6618 len = out - buf; 6579 return 0;
6580}
6619 6581
6620 MPT_PROC_READ_RETURN(buf,start,offset,request,eof,len); 6582static int mpt_summary_proc_open(struct inode *inode, struct file *file)
6583{
6584 return single_open(file, mpt_summary_proc_show, PDE(inode)->data);
6621} 6585}
6622 6586
6623/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 6587static const struct file_operations mpt_summary_proc_fops = {
6624/** 6588 .owner = THIS_MODULE,
6625 * procmpt_version_read - Handle read request from /proc/mpt/version. 6589 .open = mpt_summary_proc_open,
6626 * @buf: Pointer to area to write information 6590 .read = seq_read,
6627 * @start: Pointer to start pointer 6591 .llseek = seq_lseek,
6628 * @offset: Offset to start writing 6592 .release = single_release,
6629 * @request: Amount of read data requested 6593};
6630 * @eof: Pointer to EOF integer 6594
6631 * @data: Pointer 6595static int mpt_version_proc_show(struct seq_file *m, void *v)
6632 *
6633 * Returns number of characters written to process performing the read.
6634 */
6635static int
6636procmpt_version_read(char *buf, char **start, off_t offset, int request, int *eof, void *data)
6637{ 6596{
6638 u8 cb_idx; 6597 u8 cb_idx;
6639 int scsi, fc, sas, lan, ctl, targ, dmp; 6598 int scsi, fc, sas, lan, ctl, targ, dmp;
6640 char *drvname; 6599 char *drvname;
6641 int len;
6642 6600
6643 len = sprintf(buf, "%s-%s\n", "mptlinux", MPT_LINUX_VERSION_COMMON); 6601 seq_printf(m, "%s-%s\n", "mptlinux", MPT_LINUX_VERSION_COMMON);
6644 len += sprintf(buf+len, " Fusion MPT base driver\n"); 6602 seq_printf(m, " Fusion MPT base driver\n");
6645 6603
6646 scsi = fc = sas = lan = ctl = targ = dmp = 0; 6604 scsi = fc = sas = lan = ctl = targ = dmp = 0;
6647 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) { 6605 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) {
@@ -6669,98 +6627,97 @@ procmpt_version_read(char *buf, char **start, off_t offset, int request, int *eo
6669 } 6627 }
6670 6628
6671 if (drvname) 6629 if (drvname)
6672 len += sprintf(buf+len, " Fusion MPT %s driver\n", drvname); 6630 seq_printf(m, " Fusion MPT %s driver\n", drvname);
6673 } 6631 }
6674 } 6632 }
6675 6633
6676 MPT_PROC_READ_RETURN(buf,start,offset,request,eof,len); 6634 return 0;
6677} 6635}
6678 6636
6679/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 6637static int mpt_version_proc_open(struct inode *inode, struct file *file)
6680/** 6638{
6681 * procmpt_iocinfo_read - Handle read request from /proc/mpt/iocN/info. 6639 return single_open(file, mpt_version_proc_show, NULL);
6682 * @buf: Pointer to area to write information 6640}
6683 * @start: Pointer to start pointer 6641
6684 * @offset: Offset to start writing 6642static const struct file_operations mpt_version_proc_fops = {
6685 * @request: Amount of read data requested 6643 .owner = THIS_MODULE,
6686 * @eof: Pointer to EOF integer 6644 .open = mpt_version_proc_open,
6687 * @data: Pointer 6645 .read = seq_read,
6688 * 6646 .llseek = seq_lseek,
6689 * Returns number of characters written to process performing the read. 6647 .release = single_release,
6690 */ 6648};
6691static int 6649
6692procmpt_iocinfo_read(char *buf, char **start, off_t offset, int request, int *eof, void *data) 6650static int mpt_iocinfo_proc_show(struct seq_file *m, void *v)
6693{ 6651{
6694 MPT_ADAPTER *ioc = data; 6652 MPT_ADAPTER *ioc = m->private;
6695 int len;
6696 char expVer[32]; 6653 char expVer[32];
6697 int sz; 6654 int sz;
6698 int p; 6655 int p;
6699 6656
6700 mpt_get_fw_exp_ver(expVer, ioc); 6657 mpt_get_fw_exp_ver(expVer, ioc);
6701 6658
6702 len = sprintf(buf, "%s:", ioc->name); 6659 seq_printf(m, "%s:", ioc->name);
6703 if (ioc->facts.Flags & MPI_IOCFACTS_FLAGS_FW_DOWNLOAD_BOOT) 6660 if (ioc->facts.Flags & MPI_IOCFACTS_FLAGS_FW_DOWNLOAD_BOOT)
6704 len += sprintf(buf+len, " (f/w download boot flag set)"); 6661 seq_printf(m, " (f/w download boot flag set)");
6705// if (ioc->facts.IOCExceptions & MPI_IOCFACTS_EXCEPT_CONFIG_CHECKSUM_FAIL) 6662// if (ioc->facts.IOCExceptions & MPI_IOCFACTS_EXCEPT_CONFIG_CHECKSUM_FAIL)
6706// len += sprintf(buf+len, " CONFIG_CHECKSUM_FAIL!"); 6663// seq_printf(m, " CONFIG_CHECKSUM_FAIL!");
6707 6664
6708 len += sprintf(buf+len, "\n ProductID = 0x%04x (%s)\n", 6665 seq_printf(m, "\n ProductID = 0x%04x (%s)\n",
6709 ioc->facts.ProductID, 6666 ioc->facts.ProductID,
6710 ioc->prod_name); 6667 ioc->prod_name);
6711 len += sprintf(buf+len, " FWVersion = 0x%08x%s", ioc->facts.FWVersion.Word, expVer); 6668 seq_printf(m, " FWVersion = 0x%08x%s", ioc->facts.FWVersion.Word, expVer);
6712 if (ioc->facts.FWImageSize) 6669 if (ioc->facts.FWImageSize)
6713 len += sprintf(buf+len, " (fw_size=%d)", ioc->facts.FWImageSize); 6670 seq_printf(m, " (fw_size=%d)", ioc->facts.FWImageSize);
6714 len += sprintf(buf+len, "\n MsgVersion = 0x%04x\n", ioc->facts.MsgVersion); 6671 seq_printf(m, "\n MsgVersion = 0x%04x\n", ioc->facts.MsgVersion);
6715 len += sprintf(buf+len, " FirstWhoInit = 0x%02x\n", ioc->FirstWhoInit); 6672 seq_printf(m, " FirstWhoInit = 0x%02x\n", ioc->FirstWhoInit);
6716 len += sprintf(buf+len, " EventState = 0x%02x\n", ioc->facts.EventState); 6673 seq_printf(m, " EventState = 0x%02x\n", ioc->facts.EventState);
6717 6674
6718 len += sprintf(buf+len, " CurrentHostMfaHighAddr = 0x%08x\n", 6675 seq_printf(m, " CurrentHostMfaHighAddr = 0x%08x\n",
6719 ioc->facts.CurrentHostMfaHighAddr); 6676 ioc->facts.CurrentHostMfaHighAddr);
6720 len += sprintf(buf+len, " CurrentSenseBufferHighAddr = 0x%08x\n", 6677 seq_printf(m, " CurrentSenseBufferHighAddr = 0x%08x\n",
6721 ioc->facts.CurrentSenseBufferHighAddr); 6678 ioc->facts.CurrentSenseBufferHighAddr);
6722 6679
6723 len += sprintf(buf+len, " MaxChainDepth = 0x%02x frames\n", ioc->facts.MaxChainDepth); 6680 seq_printf(m, " MaxChainDepth = 0x%02x frames\n", ioc->facts.MaxChainDepth);
6724 len += sprintf(buf+len, " MinBlockSize = 0x%02x bytes\n", 4*ioc->facts.BlockSize); 6681 seq_printf(m, " MinBlockSize = 0x%02x bytes\n", 4*ioc->facts.BlockSize);
6725 6682
6726 len += sprintf(buf+len, " RequestFrames @ 0x%p (Dma @ 0x%p)\n", 6683 seq_printf(m, " RequestFrames @ 0x%p (Dma @ 0x%p)\n",
6727 (void *)ioc->req_frames, (void *)(ulong)ioc->req_frames_dma); 6684 (void *)ioc->req_frames, (void *)(ulong)ioc->req_frames_dma);
6728 /* 6685 /*
6729 * Rounding UP to nearest 4-kB boundary here... 6686 * Rounding UP to nearest 4-kB boundary here...
6730 */ 6687 */
6731 sz = (ioc->req_sz * ioc->req_depth) + 128; 6688 sz = (ioc->req_sz * ioc->req_depth) + 128;
6732 sz = ((sz + 0x1000UL - 1UL) / 0x1000) * 0x1000; 6689 sz = ((sz + 0x1000UL - 1UL) / 0x1000) * 0x1000;
6733 len += sprintf(buf+len, " {CurReqSz=%d} x {CurReqDepth=%d} = %d bytes ^= 0x%x\n", 6690 seq_printf(m, " {CurReqSz=%d} x {CurReqDepth=%d} = %d bytes ^= 0x%x\n",
6734 ioc->req_sz, ioc->req_depth, ioc->req_sz*ioc->req_depth, sz); 6691 ioc->req_sz, ioc->req_depth, ioc->req_sz*ioc->req_depth, sz);
6735 len += sprintf(buf+len, " {MaxReqSz=%d} {MaxReqDepth=%d}\n", 6692 seq_printf(m, " {MaxReqSz=%d} {MaxReqDepth=%d}\n",
6736 4*ioc->facts.RequestFrameSize, 6693 4*ioc->facts.RequestFrameSize,
6737 ioc->facts.GlobalCredits); 6694 ioc->facts.GlobalCredits);
6738 6695
6739 len += sprintf(buf+len, " Frames @ 0x%p (Dma @ 0x%p)\n", 6696 seq_printf(m, " Frames @ 0x%p (Dma @ 0x%p)\n",
6740 (void *)ioc->alloc, (void *)(ulong)ioc->alloc_dma); 6697 (void *)ioc->alloc, (void *)(ulong)ioc->alloc_dma);
6741 sz = (ioc->reply_sz * ioc->reply_depth) + 128; 6698 sz = (ioc->reply_sz * ioc->reply_depth) + 128;
6742 len += sprintf(buf+len, " {CurRepSz=%d} x {CurRepDepth=%d} = %d bytes ^= 0x%x\n", 6699 seq_printf(m, " {CurRepSz=%d} x {CurRepDepth=%d} = %d bytes ^= 0x%x\n",
6743 ioc->reply_sz, ioc->reply_depth, ioc->reply_sz*ioc->reply_depth, sz); 6700 ioc->reply_sz, ioc->reply_depth, ioc->reply_sz*ioc->reply_depth, sz);
6744 len += sprintf(buf+len, " {MaxRepSz=%d} {MaxRepDepth=%d}\n", 6701 seq_printf(m, " {MaxRepSz=%d} {MaxRepDepth=%d}\n",
6745 ioc->facts.CurReplyFrameSize, 6702 ioc->facts.CurReplyFrameSize,
6746 ioc->facts.ReplyQueueDepth); 6703 ioc->facts.ReplyQueueDepth);
6747 6704
6748 len += sprintf(buf+len, " MaxDevices = %d\n", 6705 seq_printf(m, " MaxDevices = %d\n",
6749 (ioc->facts.MaxDevices==0) ? 255 : ioc->facts.MaxDevices); 6706 (ioc->facts.MaxDevices==0) ? 255 : ioc->facts.MaxDevices);
6750 len += sprintf(buf+len, " MaxBuses = %d\n", ioc->facts.MaxBuses); 6707 seq_printf(m, " MaxBuses = %d\n", ioc->facts.MaxBuses);
6751 6708
6752 /* per-port info */ 6709 /* per-port info */
6753 for (p=0; p < ioc->facts.NumberOfPorts; p++) { 6710 for (p=0; p < ioc->facts.NumberOfPorts; p++) {
6754 len += sprintf(buf+len, " PortNumber = %d (of %d)\n", 6711 seq_printf(m, " PortNumber = %d (of %d)\n",
6755 p+1, 6712 p+1,
6756 ioc->facts.NumberOfPorts); 6713 ioc->facts.NumberOfPorts);
6757 if (ioc->bus_type == FC) { 6714 if (ioc->bus_type == FC) {
6758 if (ioc->pfacts[p].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN) { 6715 if (ioc->pfacts[p].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN) {
6759 u8 *a = (u8*)&ioc->lan_cnfg_page1.HardwareAddressLow; 6716 u8 *a = (u8*)&ioc->lan_cnfg_page1.HardwareAddressLow;
6760 len += sprintf(buf+len, " LanAddr = %02X:%02X:%02X:%02X:%02X:%02X\n", 6717 seq_printf(m, " LanAddr = %02X:%02X:%02X:%02X:%02X:%02X\n",
6761 a[5], a[4], a[3], a[2], a[1], a[0]); 6718 a[5], a[4], a[3], a[2], a[1], a[0]);
6762 } 6719 }
6763 len += sprintf(buf+len, " WWN = %08X%08X:%08X%08X\n", 6720 seq_printf(m, " WWN = %08X%08X:%08X%08X\n",
6764 ioc->fc_port_page0[p].WWNN.High, 6721 ioc->fc_port_page0[p].WWNN.High,
6765 ioc->fc_port_page0[p].WWNN.Low, 6722 ioc->fc_port_page0[p].WWNN.Low,
6766 ioc->fc_port_page0[p].WWPN.High, 6723 ioc->fc_port_page0[p].WWPN.High,
@@ -6768,9 +6725,21 @@ procmpt_iocinfo_read(char *buf, char **start, off_t offset, int request, int *eo
6768 } 6725 }
6769 } 6726 }
6770 6727
6771 MPT_PROC_READ_RETURN(buf,start,offset,request,eof,len); 6728 return 0;
6772} 6729}
6773 6730
6731static int mpt_iocinfo_proc_open(struct inode *inode, struct file *file)
6732{
6733 return single_open(file, mpt_iocinfo_proc_show, PDE(inode)->data);
6734}
6735
6736static const struct file_operations mpt_iocinfo_proc_fops = {
6737 .owner = THIS_MODULE,
6738 .open = mpt_iocinfo_proc_open,
6739 .read = seq_read,
6740 .llseek = seq_lseek,
6741 .release = single_release,
6742};
6774#endif /* CONFIG_PROC_FS } */ 6743#endif /* CONFIG_PROC_FS } */
6775 6744
6776/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 6745/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -6836,6 +6805,39 @@ mpt_print_ioc_summary(MPT_ADAPTER *ioc, char *buffer, int *size, int len, int sh
6836 6805
6837 *size = y; 6806 *size = y;
6838} 6807}
6808
6809static void seq_mpt_print_ioc_summary(MPT_ADAPTER *ioc, struct seq_file *m, int showlan)
6810{
6811 char expVer[32];
6812
6813 mpt_get_fw_exp_ver(expVer, ioc);
6814
6815 /*
6816 * Shorter summary of attached ioc's...
6817 */
6818 seq_printf(m, "%s: %s, %s%08xh%s, Ports=%d, MaxQ=%d",
6819 ioc->name,
6820 ioc->prod_name,
6821 MPT_FW_REV_MAGIC_ID_STRING, /* "FwRev=" or somesuch */
6822 ioc->facts.FWVersion.Word,
6823 expVer,
6824 ioc->facts.NumberOfPorts,
6825 ioc->req_depth);
6826
6827 if (showlan && (ioc->pfacts[0].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN)) {
6828 u8 *a = (u8*)&ioc->lan_cnfg_page1.HardwareAddressLow;
6829 seq_printf(m, ", LanAddr=%02X:%02X:%02X:%02X:%02X:%02X",
6830 a[5], a[4], a[3], a[2], a[1], a[0]);
6831 }
6832
6833 seq_printf(m, ", IRQ=%d", ioc->pci_irq);
6834
6835 if (!ioc->active)
6836 seq_printf(m, " (disabled)");
6837
6838 seq_putc(m, '\n');
6839}
6840
6839/** 6841/**
6840 * mpt_set_taskmgmt_in_progress_flag - set flags associated with task management 6842 * mpt_set_taskmgmt_in_progress_flag - set flags associated with task management
6841 * @ioc: Pointer to MPT_ADAPTER structure 6843 * @ioc: Pointer to MPT_ADAPTER structure
@@ -6921,7 +6923,6 @@ EXPORT_SYMBOL(mpt_halt_firmware);
6921 * mpt_SoftResetHandler - Issues a less expensive reset 6923 * mpt_SoftResetHandler - Issues a less expensive reset
6922 * @ioc: Pointer to MPT_ADAPTER structure 6924 * @ioc: Pointer to MPT_ADAPTER structure
6923 * @sleepFlag: Indicates if sleep or schedule must be called. 6925 * @sleepFlag: Indicates if sleep or schedule must be called.
6924
6925 * 6926 *
6926 * Returns 0 for SUCCESS or -1 if FAILED. 6927 * Returns 0 for SUCCESS or -1 if FAILED.
6927 * 6928 *
@@ -7066,7 +7067,6 @@ mpt_SoftResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
7066 * mpt_Soft_Hard_ResetHandler - Try less expensive reset 7067 * mpt_Soft_Hard_ResetHandler - Try less expensive reset
7067 * @ioc: Pointer to MPT_ADAPTER structure 7068 * @ioc: Pointer to MPT_ADAPTER structure
7068 * @sleepFlag: Indicates if sleep or schedule must be called. 7069 * @sleepFlag: Indicates if sleep or schedule must be called.
7069
7070 * 7070 *
7071 * Returns 0 for SUCCESS or -1 if FAILED. 7071 * Returns 0 for SUCCESS or -1 if FAILED.
7072 * Try for softreset first, only if it fails go for expensive 7072 * Try for softreset first, only if it fails go for expensive
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 */
425typedef 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) \
434do { \
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
diff --git a/drivers/message/i2o/exec-osm.c b/drivers/message/i2o/exec-osm.c
index 06c655c55587..a3970e56ae53 100644
--- a/drivers/message/i2o/exec-osm.c
+++ b/drivers/message/i2o/exec-osm.c
@@ -389,12 +389,16 @@ static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind)
389 dev = &c->pdev->dev; 389 dev = &c->pdev->dev;
390 390
391 if (i2o_dma_realloc(dev, &c->dlct, 391 if (i2o_dma_realloc(dev, &c->dlct,
392 le32_to_cpu(sb->expected_lct_size))) 392 le32_to_cpu(sb->expected_lct_size))) {
393 mutex_unlock(&c->lct_lock);
393 return -ENOMEM; 394 return -ENOMEM;
395 }
394 396
395 msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET); 397 msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET);
396 if (IS_ERR(msg)) 398 if (IS_ERR(msg)) {
399 mutex_unlock(&c->lct_lock);
397 return PTR_ERR(msg); 400 return PTR_ERR(msg);
401 }
398 402
399 msg->u.head[0] = cpu_to_le32(EIGHT_WORD_MSG_SIZE | SGL_OFFSET_6); 403 msg->u.head[0] = cpu_to_le32(EIGHT_WORD_MSG_SIZE | SGL_OFFSET_6);
400 msg->u.head[1] = cpu_to_le32(I2O_CMD_LCT_NOTIFY << 24 | HOST_TID << 12 | 404 msg->u.head[1] = cpu_to_le32(I2O_CMD_LCT_NOTIFY << 24 | HOST_TID << 12 |
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c
index e6733bc99724..f0f1e667000f 100644
--- a/drivers/message/i2o/i2o_block.c
+++ b/drivers/message/i2o/i2o_block.c
@@ -727,7 +727,7 @@ static int i2o_block_transfer(struct request *req)
727{ 727{
728 struct i2o_block_device *dev = req->rq_disk->private_data; 728 struct i2o_block_device *dev = req->rq_disk->private_data;
729 struct i2o_controller *c; 729 struct i2o_controller *c;
730 u32 tid = dev->i2o_dev->lct_data.tid; 730 u32 tid;
731 struct i2o_message *msg; 731 struct i2o_message *msg;
732 u32 *mptr; 732 u32 *mptr;
733 struct i2o_block_request *ireq = req->special; 733 struct i2o_block_request *ireq = req->special;
@@ -743,6 +743,7 @@ static int i2o_block_transfer(struct request *req)
743 goto exit; 743 goto exit;
744 } 744 }
745 745
746 tid = dev->i2o_dev->lct_data.tid;
746 c = dev->i2o_dev->iop; 747 c = dev->i2o_dev->iop;
747 748
748 msg = i2o_msg_get(c); 749 msg = i2o_msg_get(c);
diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c
index c4b117f5fb70..068ba0785bb4 100644
--- a/drivers/message/i2o/i2o_config.c
+++ b/drivers/message/i2o/i2o_config.c
@@ -111,11 +111,11 @@ static int i2o_cfg_gethrt(unsigned long arg)
111 111
112 len = 8 + ((hrt->entry_len * hrt->num_entries) << 2); 112 len = 8 + ((hrt->entry_len * hrt->num_entries) << 2);
113 113
114 /* We did a get user...so assuming mem is ok...is this bad? */ 114 if (put_user(len, kcmd.reslen))
115 put_user(len, kcmd.reslen); 115 ret = -EFAULT;
116 if (len > reslen) 116 else if (len > reslen)
117 ret = -ENOBUFS; 117 ret = -ENOBUFS;
118 if (copy_to_user(kcmd.resbuf, (void *)hrt, len)) 118 else if (copy_to_user(kcmd.resbuf, (void *)hrt, len))
119 ret = -EFAULT; 119 ret = -EFAULT;
120 120
121 return ret; 121 return ret;
@@ -147,8 +147,9 @@ static int i2o_cfg_getlct(unsigned long arg)
147 lct = (i2o_lct *) c->lct; 147 lct = (i2o_lct *) c->lct;
148 148
149 len = (unsigned int)lct->table_size << 2; 149 len = (unsigned int)lct->table_size << 2;
150 put_user(len, kcmd.reslen); 150 if (put_user(len, kcmd.reslen))
151 if (len > reslen) 151 ret = -EFAULT;
152 else if (len > reslen)
152 ret = -ENOBUFS; 153 ret = -ENOBUFS;
153 else if (copy_to_user(kcmd.resbuf, lct, len)) 154 else if (copy_to_user(kcmd.resbuf, lct, len))
154 ret = -EFAULT; 155 ret = -EFAULT;
@@ -208,8 +209,9 @@ static int i2o_cfg_parms(unsigned long arg, unsigned int type)
208 return -EAGAIN; 209 return -EAGAIN;
209 } 210 }
210 211
211 put_user(len, kcmd.reslen); 212 if (put_user(len, kcmd.reslen))
212 if (len > reslen) 213 ret = -EFAULT;
214 else if (len > reslen)
213 ret = -ENOBUFS; 215 ret = -ENOBUFS;
214 else if (copy_to_user(kcmd.resbuf, res, len)) 216 else if (copy_to_user(kcmd.resbuf, res, len))
215 ret = -EFAULT; 217 ret = -EFAULT;
diff --git a/drivers/message/i2o/i2o_scsi.c b/drivers/message/i2o/i2o_scsi.c
index 3d45817e6dcd..ea6b2197da8a 100644
--- a/drivers/message/i2o/i2o_scsi.c
+++ b/drivers/message/i2o/i2o_scsi.c
@@ -528,7 +528,6 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,
528 * Do the incoming paperwork 528 * Do the incoming paperwork
529 */ 529 */
530 i2o_dev = SCpnt->device->hostdata; 530 i2o_dev = SCpnt->device->hostdata;
531 c = i2o_dev->iop;
532 531
533 SCpnt->scsi_done = done; 532 SCpnt->scsi_done = done;
534 533
@@ -538,7 +537,7 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,
538 done(SCpnt); 537 done(SCpnt);
539 goto exit; 538 goto exit;
540 } 539 }
541 540 c = i2o_dev->iop;
542 tid = i2o_dev->lct_data.tid; 541 tid = i2o_dev->lct_data.tid;
543 542
544 osm_debug("qcmd: Tid = %03x\n", tid); 543 osm_debug("qcmd: Tid = %03x\n", tid);