diff options
Diffstat (limited to 'drivers/message/fusion/mptctl.c')
| -rw-r--r-- | drivers/message/fusion/mptctl.c | 68 |
1 files changed, 20 insertions, 48 deletions
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index 70b0cfb5ac5c..05ea5944c487 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c | |||
| @@ -1,40 +1,12 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * linux/drivers/message/fusion/mptctl.c | 2 | * linux/drivers/message/fusion/mptctl.c |
| 3 | * Fusion MPT misc device (ioctl) driver. | 3 | * mpt Ioctl driver. |
| 4 | * For use with PCI chip/adapter(s): | 4 | * For use with LSI Logic PCI chip/adapters |
| 5 | * LSIFC9xx/LSI409xx Fibre Channel | ||
| 6 | * running LSI Logic Fusion MPT (Message Passing Technology) firmware. | 5 | * running LSI Logic Fusion MPT (Message Passing Technology) firmware. |
| 7 | * | 6 | * |
| 8 | * Credits: | 7 | * Copyright (c) 1999-2005 LSI Logic Corporation |
| 9 | * This driver would not exist if not for Alan Cox's development | ||
| 10 | * of the linux i2o driver. | ||
| 11 | * | ||
| 12 | * A special thanks to Pamela Delaney (LSI Logic) for tons of work | ||
| 13 | * and countless enhancements while adding support for the 1030 | ||
| 14 | * chip family. Pam has been instrumental in the development of | ||
| 15 | * of the 2.xx.xx series fusion drivers, and her contributions are | ||
| 16 | * far too numerous to hope to list in one place. | ||
| 17 | * | ||
| 18 | * A huge debt of gratitude is owed to David S. Miller (DaveM) | ||
| 19 | * for fixing much of the stupid and broken stuff in the early | ||
| 20 | * driver while porting to sparc64 platform. THANK YOU! | ||
| 21 | * | ||
| 22 | * A big THANKS to Eddie C. Dost for fixing the ioctl path | ||
| 23 | * and most importantly f/w download on sparc64 platform! | ||
| 24 | * (plus Eddie's other helpful hints and insights) | ||
| 25 | * | ||
| 26 | * Thanks to Arnaldo Carvalho de Melo for finding and patching | ||
| 27 | * a potential memory leak in mptctl_do_fw_download(), | ||
| 28 | * and for some kmalloc insight:-) | ||
| 29 | * | ||
| 30 | * (see also mptbase.c) | ||
| 31 | * | ||
| 32 | * Copyright (c) 1999-2004 LSI Logic Corporation | ||
| 33 | * Originally By: Steven J. Ralston, Noah Romer | ||
| 34 | * (mailto:sjralston1@netscape.net) | ||
| 35 | * (mailto:mpt_linux_developer@lsil.com) | 8 | * (mailto:mpt_linux_developer@lsil.com) |
| 36 | * | 9 | * |
| 37 | * $Id: mptctl.c,v 1.63 2002/12/03 21:26:33 pdelaney Exp $ | ||
| 38 | */ | 10 | */ |
| 39 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 11 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
| 40 | /* | 12 | /* |
| @@ -95,8 +67,8 @@ | |||
| 95 | #include <scsi/scsi_host.h> | 67 | #include <scsi/scsi_host.h> |
| 96 | #include <scsi/scsi_tcq.h> | 68 | #include <scsi/scsi_tcq.h> |
| 97 | 69 | ||
| 98 | #define COPYRIGHT "Copyright (c) 1999-2004 LSI Logic Corporation" | 70 | #define COPYRIGHT "Copyright (c) 1999-2005 LSI Logic Corporation" |
| 99 | #define MODULEAUTHOR "Steven J. Ralston, Noah Romer, Pamela Delaney" | 71 | #define MODULEAUTHOR "LSI Logic Corporation" |
| 100 | #include "mptbase.h" | 72 | #include "mptbase.h" |
| 101 | #include "mptctl.h" | 73 | #include "mptctl.h" |
| 102 | 74 | ||
| @@ -127,14 +99,14 @@ struct buflist { | |||
| 127 | * arg contents specific to function. | 99 | * arg contents specific to function. |
| 128 | */ | 100 | */ |
| 129 | static int mptctl_fw_download(unsigned long arg); | 101 | static int mptctl_fw_download(unsigned long arg); |
| 130 | static int mptctl_getiocinfo (unsigned long arg, unsigned int cmd); | 102 | static int mptctl_getiocinfo(unsigned long arg, unsigned int cmd); |
| 131 | static int mptctl_gettargetinfo (unsigned long arg); | 103 | static int mptctl_gettargetinfo(unsigned long arg); |
| 132 | static int mptctl_readtest (unsigned long arg); | 104 | static int mptctl_readtest(unsigned long arg); |
| 133 | static int mptctl_mpt_command (unsigned long arg); | 105 | static int mptctl_mpt_command(unsigned long arg); |
| 134 | static int mptctl_eventquery (unsigned long arg); | 106 | static int mptctl_eventquery(unsigned long arg); |
| 135 | static int mptctl_eventenable (unsigned long arg); | 107 | static int mptctl_eventenable(unsigned long arg); |
| 136 | static int mptctl_eventreport (unsigned long arg); | 108 | static int mptctl_eventreport(unsigned long arg); |
| 137 | static int mptctl_replace_fw (unsigned long arg); | 109 | static int mptctl_replace_fw(unsigned long arg); |
| 138 | 110 | ||
| 139 | static int mptctl_do_reset(unsigned long arg); | 111 | static int mptctl_do_reset(unsigned long arg); |
| 140 | static int mptctl_hp_hostinfo(unsigned long arg, unsigned int cmd); | 112 | static int mptctl_hp_hostinfo(unsigned long arg, unsigned int cmd); |
| @@ -149,11 +121,11 @@ static long compat_mpctl_ioctl(struct file *f, unsigned cmd, unsigned long arg); | |||
| 149 | /* | 121 | /* |
| 150 | * Private function calls. | 122 | * Private function calls. |
| 151 | */ | 123 | */ |
| 152 | static int mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr); | 124 | static int mptctl_do_mpt_command(struct mpt_ioctl_command karg, void __user *mfPtr); |
| 153 | static int mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen); | 125 | static int mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen); |
| 154 | static MptSge_t *kbuf_alloc_2_sgl( int bytes, u32 dir, int sge_offset, int *frags, | 126 | static MptSge_t *kbuf_alloc_2_sgl(int bytes, u32 dir, int sge_offset, int *frags, |
| 155 | struct buflist **blp, dma_addr_t *sglbuf_dma, MPT_ADAPTER *ioc); | 127 | struct buflist **blp, dma_addr_t *sglbuf_dma, MPT_ADAPTER *ioc); |
| 156 | static void kfree_sgl( MptSge_t *sgl, dma_addr_t sgl_dma, | 128 | static void kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, |
| 157 | struct buflist *buflist, MPT_ADAPTER *ioc); | 129 | struct buflist *buflist, MPT_ADAPTER *ioc); |
| 158 | static void mptctl_timeout_expired (MPT_IOCTL *ioctl); | 130 | static void mptctl_timeout_expired (MPT_IOCTL *ioctl); |
| 159 | static int mptctl_bus_reset(MPT_IOCTL *ioctl); | 131 | static int mptctl_bus_reset(MPT_IOCTL *ioctl); |
| @@ -1119,7 +1091,7 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size) | |||
| 1119 | int numDevices = 0; | 1091 | int numDevices = 0; |
| 1120 | unsigned int max_id; | 1092 | unsigned int max_id; |
| 1121 | int ii; | 1093 | int ii; |
| 1122 | int port; | 1094 | unsigned int port; |
| 1123 | int cim_rev; | 1095 | int cim_rev; |
| 1124 | u8 revision; | 1096 | u8 revision; |
| 1125 | 1097 | ||
| @@ -1162,9 +1134,7 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size) | |||
| 1162 | return -ENODEV; | 1134 | return -ENODEV; |
| 1163 | } | 1135 | } |
| 1164 | 1136 | ||
| 1165 | /* Verify the data transfer size is correct. | 1137 | /* Verify the data transfer size is correct. */ |
| 1166 | * Ignore the port setting. | ||
| 1167 | */ | ||
| 1168 | if (karg->hdr.maxDataSize != data_size) { | 1138 | if (karg->hdr.maxDataSize != data_size) { |
| 1169 | printk(KERN_ERR "%s@%d::mptctl_getiocinfo - " | 1139 | printk(KERN_ERR "%s@%d::mptctl_getiocinfo - " |
| 1170 | "Structure size mismatch. Command not completed.\n", | 1140 | "Structure size mismatch. Command not completed.\n", |
| @@ -1181,6 +1151,8 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size) | |||
| 1181 | else | 1151 | else |
| 1182 | karg->adapterType = MPT_IOCTL_INTERFACE_SCSI; | 1152 | karg->adapterType = MPT_IOCTL_INTERFACE_SCSI; |
| 1183 | 1153 | ||
| 1154 | if (karg->hdr.port > 1) | ||
| 1155 | return -EINVAL; | ||
| 1184 | port = karg->hdr.port; | 1156 | port = karg->hdr.port; |
| 1185 | 1157 | ||
| 1186 | karg->port = port; | 1158 | karg->port = port; |
