aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/message')
-rw-r--r--drivers/message/fusion/mptbase.c241
-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.c33
-rw-r--r--drivers/message/i2o/i2o_config.c18
-rw-r--r--drivers/message/i2o/i2o_scsi.c3
6 files changed, 162 insertions, 166 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 667d13273072..c425681a1503 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>
@@ -109,8 +110,7 @@ MODULE_PARM_DESC(mpt_debug_level, " debug level - refer to mptdebug.h \
109 110
110int mpt_fwfault_debug; 111int mpt_fwfault_debug;
111EXPORT_SYMBOL(mpt_fwfault_debug); 112EXPORT_SYMBOL(mpt_fwfault_debug);
112module_param_call(mpt_fwfault_debug, param_set_int, param_get_int, 113module_param(mpt_fwfault_debug, int, 0600);
113 &mpt_fwfault_debug, 0600);
114MODULE_PARM_DESC(mpt_fwfault_debug, "Enable detection of Firmware fault" 114MODULE_PARM_DESC(mpt_fwfault_debug, "Enable detection of Firmware fault"
115 " and halt Firmware on fault - (default=0)"); 115 " and halt Firmware on fault - (default=0)");
116 116
@@ -200,12 +200,9 @@ static int mpt_host_page_access_control(MPT_ADAPTER *ioc, u8 access_control_valu
200static 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);
201 201
202#ifdef CONFIG_PROC_FS 202#ifdef CONFIG_PROC_FS
203static int procmpt_summary_read(char *buf, char **start, off_t offset, 203static const struct file_operations mpt_summary_proc_fops;
204 int request, int *eof, void *data); 204static const struct file_operations mpt_version_proc_fops;
205static int procmpt_version_read(char *buf, char **start, off_t offset, 205static const struct file_operations mpt_iocinfo_proc_fops;
206 int request, int *eof, void *data);
207static int procmpt_iocinfo_read(char *buf, char **start, off_t offset,
208 int request, int *eof, void *data);
209#endif 206#endif
210static void mpt_get_fw_exp_ver(char *buf, MPT_ADAPTER *ioc); 207static void mpt_get_fw_exp_ver(char *buf, MPT_ADAPTER *ioc);
211 208
@@ -1725,7 +1722,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1725 u8 pcixcmd; 1722 u8 pcixcmd;
1726 static int mpt_ids = 0; 1723 static int mpt_ids = 0;
1727#ifdef CONFIG_PROC_FS 1724#ifdef CONFIG_PROC_FS
1728 struct proc_dir_entry *dent, *ent; 1725 struct proc_dir_entry *dent;
1729#endif 1726#endif
1730 1727
1731 ioc = kzalloc(sizeof(MPT_ADAPTER), GFP_ATOMIC); 1728 ioc = kzalloc(sizeof(MPT_ADAPTER), GFP_ATOMIC);
@@ -1980,16 +1977,8 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1980 */ 1977 */
1981 dent = proc_mkdir(ioc->name, mpt_proc_root_dir); 1978 dent = proc_mkdir(ioc->name, mpt_proc_root_dir);
1982 if (dent) { 1979 if (dent) {
1983 ent = create_proc_entry("info", S_IFREG|S_IRUGO, dent); 1980 proc_create_data("info", S_IRUGO, dent, &mpt_iocinfo_proc_fops, ioc);
1984 if (ent) { 1981 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 } 1982 }
1994#endif 1983#endif
1995 1984
@@ -6546,20 +6535,12 @@ mpt_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
6546static int 6535static int
6547procmpt_create(void) 6536procmpt_create(void)
6548{ 6537{
6549 struct proc_dir_entry *ent;
6550
6551 mpt_proc_root_dir = proc_mkdir(MPT_PROCFS_MPTBASEDIR, NULL); 6538 mpt_proc_root_dir = proc_mkdir(MPT_PROCFS_MPTBASEDIR, NULL);
6552 if (mpt_proc_root_dir == NULL) 6539 if (mpt_proc_root_dir == NULL)
6553 return -ENOTDIR; 6540 return -ENOTDIR;
6554 6541
6555 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);
6556 if (ent) 6543 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; 6544 return 0;
6564} 6545}
6565 6546
@@ -6579,70 +6560,46 @@ procmpt_destroy(void)
6579 6560
6580/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 6561/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6581/** 6562/**
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. 6563 * Handles read request from /proc/mpt/summary or /proc/mpt/iocN/summary.
6591 * Returns number of characters written to process performing the read.
6592 */ 6564 */
6593static int 6565static void seq_mpt_print_ioc_summary(MPT_ADAPTER *ioc, struct seq_file *m, int showlan);
6594procmpt_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 6566
6600 if (data) { 6567static int mpt_summary_proc_show(struct seq_file *m, void *v)
6601 int more = 0; 6568{
6602 6569 MPT_ADAPTER *ioc = m->private;
6603 ioc = data;
6604 mpt_print_ioc_summary(ioc, out, &more, 0, 1);
6605 6570
6606 out += more; 6571 if (ioc) {
6572 seq_mpt_print_ioc_summary(ioc, m, 1);
6607 } else { 6573 } else {
6608 list_for_each_entry(ioc, &ioc_list, list) { 6574 list_for_each_entry(ioc, &ioc_list, list) {
6609 int more = 0; 6575 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 } 6576 }
6617 } 6577 }
6618 6578
6619 len = out - buf; 6579 return 0;
6580}
6620 6581
6621 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);
6622} 6585}
6623 6586
6624/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 6587static const struct file_operations mpt_summary_proc_fops = {
6625/** 6588 .owner = THIS_MODULE,
6626 * procmpt_version_read - Handle read request from /proc/mpt/version. 6589 .open = mpt_summary_proc_open,
6627 * @buf: Pointer to area to write information 6590 .read = seq_read,
6628 * @start: Pointer to start pointer 6591 .llseek = seq_lseek,
6629 * @offset: Offset to start writing 6592 .release = single_release,
6630 * @request: Amount of read data requested 6593};
6631 * @eof: Pointer to EOF integer 6594
6632 * @data: Pointer 6595static int mpt_version_proc_show(struct seq_file *m, void *v)
6633 *
6634 * Returns number of characters written to process performing the read.
6635 */
6636static int
6637procmpt_version_read(char *buf, char **start, off_t offset, int request, int *eof, void *data)
6638{ 6596{
6639 u8 cb_idx; 6597 u8 cb_idx;
6640 int scsi, fc, sas, lan, ctl, targ, dmp; 6598 int scsi, fc, sas, lan, ctl, targ, dmp;
6641 char *drvname; 6599 char *drvname;
6642 int len;
6643 6600
6644 len = sprintf(buf, "%s-%s\n", "mptlinux", MPT_LINUX_VERSION_COMMON); 6601 seq_printf(m, "%s-%s\n", "mptlinux", MPT_LINUX_VERSION_COMMON);
6645 len += sprintf(buf+len, " Fusion MPT base driver\n"); 6602 seq_printf(m, " Fusion MPT base driver\n");
6646 6603
6647 scsi = fc = sas = lan = ctl = targ = dmp = 0; 6604 scsi = fc = sas = lan = ctl = targ = dmp = 0;
6648 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--) {
@@ -6670,98 +6627,97 @@ procmpt_version_read(char *buf, char **start, off_t offset, int request, int *eo
6670 } 6627 }
6671 6628
6672 if (drvname) 6629 if (drvname)
6673 len += sprintf(buf+len, " Fusion MPT %s driver\n", drvname); 6630 seq_printf(m, " Fusion MPT %s driver\n", drvname);
6674 } 6631 }
6675 } 6632 }
6676 6633
6677 MPT_PROC_READ_RETURN(buf,start,offset,request,eof,len); 6634 return 0;
6678} 6635}
6679 6636
6680/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 6637static int mpt_version_proc_open(struct inode *inode, struct file *file)
6681/** 6638{
6682 * procmpt_iocinfo_read - Handle read request from /proc/mpt/iocN/info. 6639 return single_open(file, mpt_version_proc_show, NULL);
6683 * @buf: Pointer to area to write information 6640}
6684 * @start: Pointer to start pointer 6641
6685 * @offset: Offset to start writing 6642static const struct file_operations mpt_version_proc_fops = {
6686 * @request: Amount of read data requested 6643 .owner = THIS_MODULE,
6687 * @eof: Pointer to EOF integer 6644 .open = mpt_version_proc_open,
6688 * @data: Pointer 6645 .read = seq_read,
6689 * 6646 .llseek = seq_lseek,
6690 * Returns number of characters written to process performing the read. 6647 .release = single_release,
6691 */ 6648};
6692static int 6649
6693procmpt_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)
6694{ 6651{
6695 MPT_ADAPTER *ioc = data; 6652 MPT_ADAPTER *ioc = m->private;
6696 int len;
6697 char expVer[32]; 6653 char expVer[32];
6698 int sz; 6654 int sz;
6699 int p; 6655 int p;
6700 6656
6701 mpt_get_fw_exp_ver(expVer, ioc); 6657 mpt_get_fw_exp_ver(expVer, ioc);
6702 6658
6703 len = sprintf(buf, "%s:", ioc->name); 6659 seq_printf(m, "%s:", ioc->name);
6704 if (ioc->facts.Flags & MPI_IOCFACTS_FLAGS_FW_DOWNLOAD_BOOT) 6660 if (ioc->facts.Flags & MPI_IOCFACTS_FLAGS_FW_DOWNLOAD_BOOT)
6705 len += sprintf(buf+len, " (f/w download boot flag set)"); 6661 seq_printf(m, " (f/w download boot flag set)");
6706// if (ioc->facts.IOCExceptions & MPI_IOCFACTS_EXCEPT_CONFIG_CHECKSUM_FAIL) 6662// if (ioc->facts.IOCExceptions & MPI_IOCFACTS_EXCEPT_CONFIG_CHECKSUM_FAIL)
6707// len += sprintf(buf+len, " CONFIG_CHECKSUM_FAIL!"); 6663// seq_printf(m, " CONFIG_CHECKSUM_FAIL!");
6708 6664
6709 len += sprintf(buf+len, "\n ProductID = 0x%04x (%s)\n", 6665 seq_printf(m, "\n ProductID = 0x%04x (%s)\n",
6710 ioc->facts.ProductID, 6666 ioc->facts.ProductID,
6711 ioc->prod_name); 6667 ioc->prod_name);
6712 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);
6713 if (ioc->facts.FWImageSize) 6669 if (ioc->facts.FWImageSize)
6714 len += sprintf(buf+len, " (fw_size=%d)", ioc->facts.FWImageSize); 6670 seq_printf(m, " (fw_size=%d)", ioc->facts.FWImageSize);
6715 len += sprintf(buf+len, "\n MsgVersion = 0x%04x\n", ioc->facts.MsgVersion); 6671 seq_printf(m, "\n MsgVersion = 0x%04x\n", ioc->facts.MsgVersion);
6716 len += sprintf(buf+len, " FirstWhoInit = 0x%02x\n", ioc->FirstWhoInit); 6672 seq_printf(m, " FirstWhoInit = 0x%02x\n", ioc->FirstWhoInit);
6717 len += sprintf(buf+len, " EventState = 0x%02x\n", ioc->facts.EventState); 6673 seq_printf(m, " EventState = 0x%02x\n", ioc->facts.EventState);
6718 6674
6719 len += sprintf(buf+len, " CurrentHostMfaHighAddr = 0x%08x\n", 6675 seq_printf(m, " CurrentHostMfaHighAddr = 0x%08x\n",
6720 ioc->facts.CurrentHostMfaHighAddr); 6676 ioc->facts.CurrentHostMfaHighAddr);
6721 len += sprintf(buf+len, " CurrentSenseBufferHighAddr = 0x%08x\n", 6677 seq_printf(m, " CurrentSenseBufferHighAddr = 0x%08x\n",
6722 ioc->facts.CurrentSenseBufferHighAddr); 6678 ioc->facts.CurrentSenseBufferHighAddr);
6723 6679
6724 len += sprintf(buf+len, " MaxChainDepth = 0x%02x frames\n", ioc->facts.MaxChainDepth); 6680 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); 6681 seq_printf(m, " MinBlockSize = 0x%02x bytes\n", 4*ioc->facts.BlockSize);
6726 6682
6727 len += sprintf(buf+len, " RequestFrames @ 0x%p (Dma @ 0x%p)\n", 6683 seq_printf(m, " RequestFrames @ 0x%p (Dma @ 0x%p)\n",
6728 (void *)ioc->req_frames, (void *)(ulong)ioc->req_frames_dma); 6684 (void *)ioc->req_frames, (void *)(ulong)ioc->req_frames_dma);
6729 /* 6685 /*
6730 * Rounding UP to nearest 4-kB boundary here... 6686 * Rounding UP to nearest 4-kB boundary here...
6731 */ 6687 */
6732 sz = (ioc->req_sz * ioc->req_depth) + 128; 6688 sz = (ioc->req_sz * ioc->req_depth) + 128;
6733 sz = ((sz + 0x1000UL - 1UL) / 0x1000) * 0x1000; 6689 sz = ((sz + 0x1000UL - 1UL) / 0x1000) * 0x1000;
6734 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",
6735 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);
6736 len += sprintf(buf+len, " {MaxReqSz=%d} {MaxReqDepth=%d}\n", 6692 seq_printf(m, " {MaxReqSz=%d} {MaxReqDepth=%d}\n",
6737 4*ioc->facts.RequestFrameSize, 6693 4*ioc->facts.RequestFrameSize,
6738 ioc->facts.GlobalCredits); 6694 ioc->facts.GlobalCredits);
6739 6695
6740 len += sprintf(buf+len, " Frames @ 0x%p (Dma @ 0x%p)\n", 6696 seq_printf(m, " Frames @ 0x%p (Dma @ 0x%p)\n",
6741 (void *)ioc->alloc, (void *)(ulong)ioc->alloc_dma); 6697 (void *)ioc->alloc, (void *)(ulong)ioc->alloc_dma);
6742 sz = (ioc->reply_sz * ioc->reply_depth) + 128; 6698 sz = (ioc->reply_sz * ioc->reply_depth) + 128;
6743 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",
6744 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);
6745 len += sprintf(buf+len, " {MaxRepSz=%d} {MaxRepDepth=%d}\n", 6701 seq_printf(m, " {MaxRepSz=%d} {MaxRepDepth=%d}\n",
6746 ioc->facts.CurReplyFrameSize, 6702 ioc->facts.CurReplyFrameSize,
6747 ioc->facts.ReplyQueueDepth); 6703 ioc->facts.ReplyQueueDepth);
6748 6704
6749 len += sprintf(buf+len, " MaxDevices = %d\n", 6705 seq_printf(m, " MaxDevices = %d\n",
6750 (ioc->facts.MaxDevices==0) ? 255 : ioc->facts.MaxDevices); 6706 (ioc->facts.MaxDevices==0) ? 255 : ioc->facts.MaxDevices);
6751 len += sprintf(buf+len, " MaxBuses = %d\n", ioc->facts.MaxBuses); 6707 seq_printf(m, " MaxBuses = %d\n", ioc->facts.MaxBuses);
6752 6708
6753 /* per-port info */ 6709 /* per-port info */
6754 for (p=0; p < ioc->facts.NumberOfPorts; p++) { 6710 for (p=0; p < ioc->facts.NumberOfPorts; p++) {
6755 len += sprintf(buf+len, " PortNumber = %d (of %d)\n", 6711 seq_printf(m, " PortNumber = %d (of %d)\n",
6756 p+1, 6712 p+1,
6757 ioc->facts.NumberOfPorts); 6713 ioc->facts.NumberOfPorts);
6758 if (ioc->bus_type == FC) { 6714 if (ioc->bus_type == FC) {
6759 if (ioc->pfacts[p].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN) { 6715 if (ioc->pfacts[p].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN) {
6760 u8 *a = (u8*)&ioc->lan_cnfg_page1.HardwareAddressLow; 6716 u8 *a = (u8*)&ioc->lan_cnfg_page1.HardwareAddressLow;
6761 len += sprintf(buf+len, " LanAddr = %02X:%02X:%02X:%02X:%02X:%02X\n", 6717 seq_printf(m, " LanAddr = %02X:%02X:%02X:%02X:%02X:%02X\n",
6762 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]);
6763 } 6719 }
6764 len += sprintf(buf+len, " WWN = %08X%08X:%08X%08X\n", 6720 seq_printf(m, " WWN = %08X%08X:%08X%08X\n",
6765 ioc->fc_port_page0[p].WWNN.High, 6721 ioc->fc_port_page0[p].WWNN.High,
6766 ioc->fc_port_page0[p].WWNN.Low, 6722 ioc->fc_port_page0[p].WWNN.Low,
6767 ioc->fc_port_page0[p].WWPN.High, 6723 ioc->fc_port_page0[p].WWPN.High,
@@ -6769,9 +6725,21 @@ procmpt_iocinfo_read(char *buf, char **start, off_t offset, int request, int *eo
6769 } 6725 }
6770 } 6726 }
6771 6727
6772 MPT_PROC_READ_RETURN(buf,start,offset,request,eof,len); 6728 return 0;
6773} 6729}
6774 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};
6775#endif /* CONFIG_PROC_FS } */ 6743#endif /* CONFIG_PROC_FS } */
6776 6744
6777/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 6745/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -6837,6 +6805,39 @@ mpt_print_ioc_summary(MPT_ADAPTER *ioc, char *buffer, int *size, int len, int sh
6837 6805
6838 *size = y; 6806 *size = y;
6839} 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
6840/** 6841/**
6841 * 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
6842 * @ioc: Pointer to MPT_ADAPTER structure 6843 * @ioc: Pointer to MPT_ADAPTER structure
@@ -6922,7 +6923,6 @@ EXPORT_SYMBOL(mpt_halt_firmware);
6922 * mpt_SoftResetHandler - Issues a less expensive reset 6923 * mpt_SoftResetHandler - Issues a less expensive reset
6923 * @ioc: Pointer to MPT_ADAPTER structure 6924 * @ioc: Pointer to MPT_ADAPTER structure
6924 * @sleepFlag: Indicates if sleep or schedule must be called. 6925 * @sleepFlag: Indicates if sleep or schedule must be called.
6925
6926 * 6926 *
6927 * Returns 0 for SUCCESS or -1 if FAILED. 6927 * Returns 0 for SUCCESS or -1 if FAILED.
6928 * 6928 *
@@ -7067,7 +7067,6 @@ mpt_SoftResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
7067 * mpt_Soft_Hard_ResetHandler - Try less expensive reset 7067 * mpt_Soft_Hard_ResetHandler - Try less expensive reset
7068 * @ioc: Pointer to MPT_ADAPTER structure 7068 * @ioc: Pointer to MPT_ADAPTER structure
7069 * @sleepFlag: Indicates if sleep or schedule must be called. 7069 * @sleepFlag: Indicates if sleep or schedule must be called.
7070
7071 * 7070 *
7072 * Returns 0 for SUCCESS or -1 if FAILED. 7071 * Returns 0 for SUCCESS or -1 if FAILED.
7073 * 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 fc593fbab696..f0f1e667000f 100644
--- a/drivers/message/i2o/i2o_block.c
+++ b/drivers/message/i2o/i2o_block.c
@@ -53,6 +53,7 @@
53#include <linux/module.h> 53#include <linux/module.h>
54#include <linux/slab.h> 54#include <linux/slab.h>
55#include <linux/i2o.h> 55#include <linux/i2o.h>
56#include <linux/smp_lock.h>
56 57
57#include <linux/mempool.h> 58#include <linux/mempool.h>
58 59
@@ -577,6 +578,7 @@ static int i2o_block_open(struct block_device *bdev, fmode_t mode)
577 if (!dev->i2o_dev) 578 if (!dev->i2o_dev)
578 return -ENODEV; 579 return -ENODEV;
579 580
581 lock_kernel();
580 if (dev->power > 0x1f) 582 if (dev->power > 0x1f)
581 i2o_block_device_power(dev, 0x02); 583 i2o_block_device_power(dev, 0x02);
582 584
@@ -585,6 +587,7 @@ static int i2o_block_open(struct block_device *bdev, fmode_t mode)
585 i2o_block_device_lock(dev->i2o_dev, -1); 587 i2o_block_device_lock(dev->i2o_dev, -1);
586 588
587 osm_debug("Ready.\n"); 589 osm_debug("Ready.\n");
590 unlock_kernel();
588 591
589 return 0; 592 return 0;
590}; 593};
@@ -615,6 +618,7 @@ static int i2o_block_release(struct gendisk *disk, fmode_t mode)
615 if (!dev->i2o_dev) 618 if (!dev->i2o_dev)
616 return 0; 619 return 0;
617 620
621 lock_kernel();
618 i2o_block_device_flush(dev->i2o_dev); 622 i2o_block_device_flush(dev->i2o_dev);
619 623
620 i2o_block_device_unlock(dev->i2o_dev, -1); 624 i2o_block_device_unlock(dev->i2o_dev, -1);
@@ -625,6 +629,7 @@ static int i2o_block_release(struct gendisk *disk, fmode_t mode)
625 operation = 0x24; 629 operation = 0x24;
626 630
627 i2o_block_device_power(dev, operation); 631 i2o_block_device_power(dev, operation);
632 unlock_kernel();
628 633
629 return 0; 634 return 0;
630} 635}
@@ -652,30 +657,40 @@ static int i2o_block_ioctl(struct block_device *bdev, fmode_t mode,
652{ 657{
653 struct gendisk *disk = bdev->bd_disk; 658 struct gendisk *disk = bdev->bd_disk;
654 struct i2o_block_device *dev = disk->private_data; 659 struct i2o_block_device *dev = disk->private_data;
660 int ret = -ENOTTY;
655 661
656 /* Anyone capable of this syscall can do *real bad* things */ 662 /* Anyone capable of this syscall can do *real bad* things */
657 663
658 if (!capable(CAP_SYS_ADMIN)) 664 if (!capable(CAP_SYS_ADMIN))
659 return -EPERM; 665 return -EPERM;
660 666
667 lock_kernel();
661 switch (cmd) { 668 switch (cmd) {
662 case BLKI2OGRSTRAT: 669 case BLKI2OGRSTRAT:
663 return put_user(dev->rcache, (int __user *)arg); 670 ret = put_user(dev->rcache, (int __user *)arg);
671 break;
664 case BLKI2OGWSTRAT: 672 case BLKI2OGWSTRAT:
665 return put_user(dev->wcache, (int __user *)arg); 673 ret = put_user(dev->wcache, (int __user *)arg);
674 break;
666 case BLKI2OSRSTRAT: 675 case BLKI2OSRSTRAT:
676 ret = -EINVAL;
667 if (arg < 0 || arg > CACHE_SMARTFETCH) 677 if (arg < 0 || arg > CACHE_SMARTFETCH)
668 return -EINVAL; 678 break;
669 dev->rcache = arg; 679 dev->rcache = arg;
680 ret = 0;
670 break; 681 break;
671 case BLKI2OSWSTRAT: 682 case BLKI2OSWSTRAT:
683 ret = -EINVAL;
672 if (arg != 0 684 if (arg != 0
673 && (arg < CACHE_WRITETHROUGH || arg > CACHE_SMARTBACK)) 685 && (arg < CACHE_WRITETHROUGH || arg > CACHE_SMARTBACK))
674 return -EINVAL; 686 break;
675 dev->wcache = arg; 687 dev->wcache = arg;
688 ret = 0;
676 break; 689 break;
677 } 690 }
678 return -ENOTTY; 691 unlock_kernel();
692
693 return ret;
679}; 694};
680 695
681/** 696/**
@@ -712,7 +727,7 @@ static int i2o_block_transfer(struct request *req)
712{ 727{
713 struct i2o_block_device *dev = req->rq_disk->private_data; 728 struct i2o_block_device *dev = req->rq_disk->private_data;
714 struct i2o_controller *c; 729 struct i2o_controller *c;
715 u32 tid = dev->i2o_dev->lct_data.tid; 730 u32 tid;
716 struct i2o_message *msg; 731 struct i2o_message *msg;
717 u32 *mptr; 732 u32 *mptr;
718 struct i2o_block_request *ireq = req->special; 733 struct i2o_block_request *ireq = req->special;
@@ -728,6 +743,7 @@ static int i2o_block_transfer(struct request *req)
728 goto exit; 743 goto exit;
729 } 744 }
730 745
746 tid = dev->i2o_dev->lct_data.tid;
731 c = dev->i2o_dev->iop; 747 c = dev->i2o_dev->iop;
732 748
733 msg = i2o_msg_get(c); 749 msg = i2o_msg_get(c);
@@ -883,7 +899,7 @@ static void i2o_block_request_fn(struct request_queue *q)
883 if (!req) 899 if (!req)
884 break; 900 break;
885 901
886 if (blk_fs_request(req)) { 902 if (req->cmd_type == REQ_TYPE_FS) {
887 struct i2o_block_delayed_request *dreq; 903 struct i2o_block_delayed_request *dreq;
888 struct i2o_block_request *ireq = req->special; 904 struct i2o_block_request *ireq = req->special;
889 unsigned int queue_depth; 905 unsigned int queue_depth;
@@ -930,7 +946,8 @@ static const struct block_device_operations i2o_block_fops = {
930 .owner = THIS_MODULE, 946 .owner = THIS_MODULE,
931 .open = i2o_block_open, 947 .open = i2o_block_open,
932 .release = i2o_block_release, 948 .release = i2o_block_release,
933 .locked_ioctl = i2o_block_ioctl, 949 .ioctl = i2o_block_ioctl,
950 .compat_ioctl = i2o_block_ioctl,
934 .getgeo = i2o_block_getgeo, 951 .getgeo = i2o_block_getgeo,
935 .media_changed = i2o_block_media_changed 952 .media_changed = i2o_block_media_changed
936}; 953};
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);