Commit 4175a2c1 authored by Linus Torvalds's avatar Linus Torvalds

Merge

parents 839cc0e6 dbba62f3
......@@ -47,18 +47,13 @@ typedef signed short S16;
typedef unsigned short U16;
#if defined(unix) || defined(__arm) || defined(ALPHA)
typedef signed int S32;
typedef unsigned int U32;
#else
typedef signed long S32;
typedef unsigned long U32;
#endif
typedef int32_t S32;
typedef u_int32_t U32;
/*
* The only way crap below could work on big-endian boxen would be if it
* wasn't used at all.
*/
typedef struct _S64
{
......
......@@ -141,8 +141,8 @@ static int mptctl_hp_targetinfo(unsigned long arg);
/*
* Private function calls.
*/
static int mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local);
static int mptctl_do_fw_download(int ioc, char *ufwbuf, size_t fwlen);
static int mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr);
static int mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen);
static MptSge_t *kbuf_alloc_2_sgl( int bytes, u32 dir, int sge_offset, int *frags,
struct buflist **blp, dma_addr_t *sglbuf_dma, MPT_ADAPTER *ioc);
static void kfree_sgl( MptSge_t *sgl, dma_addr_t sgl_dma,
......@@ -551,7 +551,7 @@ mptctl_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
static int
mptctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
mpt_ioctl_header *uhdr = (mpt_ioctl_header *) arg;
mpt_ioctl_header __user *uhdr = (void __user *) arg;
mpt_ioctl_header khdr;
int iocnum;
unsigned iocnumX;
......@@ -564,7 +564,7 @@ mptctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned
if (copy_from_user(&khdr, uhdr, sizeof(khdr))) {
printk(KERN_ERR "%s::mptctl_ioctl() @%d - "
"Unable to copy mpt_ioctl_header data @ %p\n",
__FILE__, __LINE__, (void*)uhdr);
__FILE__, __LINE__, uhdr);
return -EFAULT;
}
ret = -ENXIO; /* (-6) No such device or address */
......@@ -636,7 +636,7 @@ mptctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned
static int mptctl_do_reset(unsigned long arg)
{
struct mpt_ioctl_diag_reset *urinfo = (struct mpt_ioctl_diag_reset *) arg;
struct mpt_ioctl_diag_reset __user *urinfo = (void __user *) arg;
struct mpt_ioctl_diag_reset krinfo;
MPT_ADAPTER *iocp;
......@@ -645,7 +645,7 @@ static int mptctl_do_reset(unsigned long arg)
if (copy_from_user(&krinfo, urinfo, sizeof(struct mpt_ioctl_diag_reset))) {
printk(KERN_ERR "%s@%d::mptctl_do_reset - "
"Unable to copy mpt_ioctl_diag_reset struct @ %p\n",
__FILE__, __LINE__, (void*)urinfo);
__FILE__, __LINE__, urinfo);
return -EFAULT;
}
......@@ -684,14 +684,14 @@ static int mptctl_do_reset(unsigned long arg)
static int
mptctl_fw_download(unsigned long arg)
{
struct mpt_fw_xfer *ufwdl = (struct mpt_fw_xfer *) arg;
struct mpt_fw_xfer __user *ufwdl = (void __user *) arg;
struct mpt_fw_xfer kfwdl;
dctlprintk((KERN_INFO "mptctl_fwdl called. mptctl_id = %xh\n", mptctl_id)); //tc
if (copy_from_user(&kfwdl, ufwdl, sizeof(struct mpt_fw_xfer))) {
printk(KERN_ERR "%s@%d::_ioctl_fwdl - "
"Unable to copy mpt_fw_xfer struct @ %p\n",
__FILE__, __LINE__, (void*)ufwdl);
__FILE__, __LINE__, ufwdl);
return -EFAULT;
}
......@@ -713,7 +713,7 @@ mptctl_fw_download(unsigned long arg)
* -ENOMSG if FW upload returned bad status
*/
static int
mptctl_do_fw_download(int ioc, char *ufwbuf, size_t fwlen)
mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
{
FWDownload_t *dlmsg;
MPT_FRAME_HDR *mf;
......@@ -842,7 +842,7 @@ mptctl_do_fw_download(int ioc, char *ufwbuf, size_t fwlen)
if (copy_from_user(bl->kptr, ufwbuf+fw_bytes_copied, bl->len)) {
printk(KERN_ERR "%s@%d::_ioctl_fwdl - "
"Unable to copy f/w buffer hunk#%d @ %p\n",
__FILE__, __LINE__, n, (void*)ufwbuf);
__FILE__, __LINE__, n, ufwbuf);
goto fwdl_out;
}
fw_bytes_copied += bl->len;
......@@ -1148,7 +1148,7 @@ kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, struct buflist *buflist, MPT_ADAPTE
static int
mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
{
struct mpt_ioctl_iocinfo *uarg = (struct mpt_ioctl_iocinfo *) arg;
struct mpt_ioctl_iocinfo __user *uarg = (void __user *) arg;
struct mpt_ioctl_iocinfo *karg;
MPT_ADAPTER *ioc;
struct pci_dev *pdev;
......@@ -1188,7 +1188,7 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
if (copy_from_user(karg, uarg, data_size)) {
printk(KERN_ERR "%s@%d::mptctl_getiocinfo - "
"Unable to read in mpt_ioctl_iocinfo struct @ %p\n",
__FILE__, __LINE__, (void*)uarg);
__FILE__, __LINE__, uarg);
kfree(karg);
return -EFAULT;
}
......@@ -1283,10 +1283,10 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
/* Copy the data from kernel memory to user memory
*/
if (copy_to_user((char *)arg, karg, data_size)) {
if (copy_to_user((char __user *)arg, karg, data_size)) {
printk(KERN_ERR "%s@%d::mptctl_getiocinfo - "
"Unable to write out mpt_ioctl_iocinfo struct @ %p\n",
__FILE__, __LINE__, (void*)uarg);
__FILE__, __LINE__, uarg);
kfree(karg);
return -EFAULT;
}
......@@ -1308,7 +1308,7 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
static int
mptctl_gettargetinfo (unsigned long arg)
{
struct mpt_ioctl_targetinfo *uarg = (struct mpt_ioctl_targetinfo *) arg;
struct mpt_ioctl_targetinfo __user *uarg = (void __user *) arg;
struct mpt_ioctl_targetinfo karg;
MPT_ADAPTER *ioc;
struct Scsi_Host *sh;
......@@ -1330,7 +1330,7 @@ mptctl_gettargetinfo (unsigned long arg)
if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_targetinfo))) {
printk(KERN_ERR "%s@%d::mptctl_gettargetinfo - "
"Unable to read in mpt_ioctl_targetinfo struct @ %p\n",
__FILE__, __LINE__, (void*)uarg);
__FILE__, __LINE__, uarg);
return -EFAULT;
}
......@@ -1448,21 +1448,21 @@ mptctl_gettargetinfo (unsigned long arg)
/* Copy part of the data from kernel memory to user memory
*/
if (copy_to_user((char *)arg, &karg,
if (copy_to_user((char __user *)arg, &karg,
sizeof(struct mpt_ioctl_targetinfo))) {
printk(KERN_ERR "%s@%d::mptctl_gettargetinfo - "
"Unable to write out mpt_ioctl_targetinfo struct @ %p\n",
__FILE__, __LINE__, (void*)uarg);
__FILE__, __LINE__, uarg);
kfree(pmem);
return -EFAULT;
}
/* Copy the remaining data from kernel memory to user memory
*/
if (copy_to_user((char *) uarg->targetInfo, pmem, numBytes)) {
if (copy_to_user(uarg->targetInfo, pmem, numBytes)) {
printk(KERN_ERR "%s@%d::mptctl_gettargetinfo - "
"Unable to write out mpt_ioctl_targetinfo struct @ %p\n",
__FILE__, __LINE__, (void*)pdata);
__FILE__, __LINE__, pdata);
kfree(pmem);
return -EFAULT;
}
......@@ -1483,7 +1483,7 @@ mptctl_gettargetinfo (unsigned long arg)
static int
mptctl_readtest (unsigned long arg)
{
struct mpt_ioctl_test *uarg = (struct mpt_ioctl_test *) arg;
struct mpt_ioctl_test __user *uarg = (void __user *) arg;
struct mpt_ioctl_test karg;
MPT_ADAPTER *ioc;
int iocnum;
......@@ -1492,7 +1492,7 @@ mptctl_readtest (unsigned long arg)
if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_test))) {
printk(KERN_ERR "%s@%d::mptctl_readtest - "
"Unable to read in mpt_ioctl_test struct @ %p\n",
__FILE__, __LINE__, (void*)uarg);
__FILE__, __LINE__, uarg);
return -EFAULT;
}
......@@ -1519,10 +1519,10 @@ mptctl_readtest (unsigned long arg)
/* Copy the data from kernel memory to user memory
*/
if (copy_to_user((char *)arg, &karg, sizeof(struct mpt_ioctl_test))) {
if (copy_to_user((char __user *)arg, &karg, sizeof(struct mpt_ioctl_test))) {
printk(KERN_ERR "%s@%d::mptctl_readtest - "
"Unable to write out mpt_ioctl_test struct @ %p\n",
__FILE__, __LINE__, (void*)uarg);
__FILE__, __LINE__, uarg);
return -EFAULT;
}
......@@ -1543,7 +1543,7 @@ mptctl_readtest (unsigned long arg)
static int
mptctl_eventquery (unsigned long arg)
{
struct mpt_ioctl_eventquery *uarg = (struct mpt_ioctl_eventquery *) arg;
struct mpt_ioctl_eventquery __user *uarg = (void __user *) arg;
struct mpt_ioctl_eventquery karg;
MPT_ADAPTER *ioc;
int iocnum;
......@@ -1552,7 +1552,7 @@ mptctl_eventquery (unsigned long arg)
if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventquery))) {
printk(KERN_ERR "%s@%d::mptctl_eventquery - "
"Unable to read in mpt_ioctl_eventquery struct @ %p\n",
__FILE__, __LINE__, (void*)uarg);
__FILE__, __LINE__, uarg);
return -EFAULT;
}
......@@ -1568,10 +1568,10 @@ mptctl_eventquery (unsigned long arg)
/* Copy the data from kernel memory to user memory
*/
if (copy_to_user((char *)arg, &karg, sizeof(struct mpt_ioctl_eventquery))) {
if (copy_to_user((char __user *)arg, &karg, sizeof(struct mpt_ioctl_eventquery))) {
printk(KERN_ERR "%s@%d::mptctl_eventquery - "
"Unable to write out mpt_ioctl_eventquery struct @ %p\n",
__FILE__, __LINE__, (void*)uarg);
__FILE__, __LINE__, uarg);
return -EFAULT;
}
return 0;
......@@ -1581,7 +1581,7 @@ mptctl_eventquery (unsigned long arg)
static int
mptctl_eventenable (unsigned long arg)
{
struct mpt_ioctl_eventenable *uarg = (struct mpt_ioctl_eventenable *) arg;
struct mpt_ioctl_eventenable __user *uarg = (void __user *) arg;
struct mpt_ioctl_eventenable karg;
MPT_ADAPTER *ioc;
int iocnum;
......@@ -1590,7 +1590,7 @@ mptctl_eventenable (unsigned long arg)
if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventenable))) {
printk(KERN_ERR "%s@%d::mptctl_eventenable - "
"Unable to read in mpt_ioctl_eventenable struct @ %p\n",
__FILE__, __LINE__, (void*)uarg);
__FILE__, __LINE__, uarg);
return -EFAULT;
}
......@@ -1628,7 +1628,7 @@ mptctl_eventenable (unsigned long arg)
static int
mptctl_eventreport (unsigned long arg)
{
struct mpt_ioctl_eventreport *uarg = (struct mpt_ioctl_eventreport *) arg;
struct mpt_ioctl_eventreport __user *uarg = (void __user *) arg;
struct mpt_ioctl_eventreport karg;
MPT_ADAPTER *ioc;
int iocnum;
......@@ -1638,7 +1638,7 @@ mptctl_eventreport (unsigned long arg)
if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventreport))) {
printk(KERN_ERR "%s@%d::mptctl_eventreport - "
"Unable to read in mpt_ioctl_eventreport struct @ %p\n",
__FILE__, __LINE__, (void*)uarg);
__FILE__, __LINE__, uarg);
return -EFAULT;
}
......@@ -1664,10 +1664,10 @@ mptctl_eventreport (unsigned long arg)
/* Copy the data from kernel memory to user memory
*/
numBytes = max * sizeof(MPT_IOCTL_EVENTS);
if (copy_to_user((char *) uarg->eventData, ioc->events, numBytes)) {
if (copy_to_user(uarg->eventData, ioc->events, numBytes)) {
printk(KERN_ERR "%s@%d::mptctl_eventreport - "
"Unable to write out mpt_ioctl_eventreport struct @ %p\n",
__FILE__, __LINE__, (void*)ioc->events);
__FILE__, __LINE__, ioc->events);
return -EFAULT;
}
......@@ -1678,7 +1678,7 @@ mptctl_eventreport (unsigned long arg)
static int
mptctl_replace_fw (unsigned long arg)
{
struct mpt_ioctl_replace_fw *uarg = (struct mpt_ioctl_replace_fw *) arg;
struct mpt_ioctl_replace_fw __user *uarg = (void __user *) arg;
struct mpt_ioctl_replace_fw karg;
MPT_ADAPTER *ioc;
fw_image_t **fwmem = NULL;
......@@ -1692,7 +1692,7 @@ mptctl_replace_fw (unsigned long arg)
if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_replace_fw))) {
printk(KERN_ERR "%s@%d::mptctl_replace_fw - "
"Unable to read in mpt_ioctl_replace_fw struct @ %p\n",
__FILE__, __LINE__, (void*)uarg);
__FILE__, __LINE__, uarg);
return -EFAULT;
}
......@@ -1722,7 +1722,7 @@ mptctl_replace_fw (unsigned long arg)
if (copy_from_user(fwmem[ii]->fw, uarg->newImage + offset, fwmem[ii]->size)) {
printk(KERN_ERR "%s@%d::mptctl_replace_fw - "
"Unable to read in mpt_ioctl_replace_fw image @ %p\n",
__FILE__, __LINE__, (void*)uarg);
__FILE__, __LINE__, uarg);
mpt_free_fw_memory(ioc, fwmem);
return -EFAULT;
......@@ -1767,7 +1767,7 @@ mptctl_replace_fw (unsigned long arg)
static int
mptctl_mpt_command (unsigned long arg)
{
struct mpt_ioctl_command *uarg = (struct mpt_ioctl_command *) arg;
struct mpt_ioctl_command __user *uarg = (void __user *) arg;
struct mpt_ioctl_command karg;
MPT_ADAPTER *ioc;
int iocnum;
......@@ -1778,7 +1778,7 @@ mptctl_mpt_command (unsigned long arg)
if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_command))) {
printk(KERN_ERR "%s@%d::mptctl_mpt_command - "
"Unable to read in mpt_ioctl_command struct @ %p\n",
__FILE__, __LINE__, (void*)uarg);
__FILE__, __LINE__, uarg);
return -EFAULT;
}
......@@ -1789,7 +1789,7 @@ mptctl_mpt_command (unsigned long arg)
return -ENODEV;
}
rc = mptctl_do_mpt_command (karg, (char *) &uarg->MF, 0);
rc = mptctl_do_mpt_command (karg, &uarg->MF);
return rc;
}
......@@ -1807,7 +1807,7 @@ mptctl_mpt_command (unsigned long arg)
* -EPERM if SCSI I/O and target is untagged
*/
static int
mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local)
mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
{
MPT_ADAPTER *ioc;
MPT_FRAME_HDR *mf = NULL;
......@@ -1871,23 +1871,15 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local)
/* Copy the request frame
* Reset the saved message context.
* Request frame in user space
*/
if (local) {
/* Request frame in kernel space
*/
memcpy((char *)mf, (char *) mfPtr, karg.dataSgeOffset * 4);
} else {
/* Request frame in user space
*/
if (copy_from_user((char *)mf, (char *) mfPtr,
karg.dataSgeOffset * 4)){
printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
"Unable to read MF from mpt_ioctl_command struct @ %p\n",
__FILE__, __LINE__, (void*)mfPtr);
rc = -EFAULT;
goto done_free_mem;
}
}
if (copy_from_user(mf, mfPtr, karg.dataSgeOffset * 4)) {
printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
"Unable to read MF from mpt_ioctl_command struct @ %p\n",
__FILE__, __LINE__, mfPtr);
rc = -EFAULT;
goto done_free_mem;
}
hdr->MsgContext = cpu_to_le32(msgContext);
......@@ -2168,7 +2160,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local)
"%s@%d::mptctl_do_mpt_command - Unable "
"to read user data "
"struct @ %p\n",
__FILE__, __LINE__,(void*)karg.dataOutBufPtr);
__FILE__, __LINE__,karg.dataOutBufPtr);
rc = -EFAULT;
goto done_free_mem;
}
......@@ -2269,12 +2261,12 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local)
}
if (sz > 0) {
if (copy_to_user((char *)karg.replyFrameBufPtr,
if (copy_to_user(karg.replyFrameBufPtr,
&ioc->ioctl->ReplyFrame, sz)){
printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
"Unable to write out reply frame %p\n",
__FILE__, __LINE__, (void*)karg.replyFrameBufPtr);
__FILE__, __LINE__, karg.replyFrameBufPtr);
rc = -ENODATA;
goto done_free_mem;
}
......@@ -2286,11 +2278,11 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local)
if (ioc->ioctl->status & MPT_IOCTL_STATUS_SENSE_VALID) {
sz = min(karg.maxSenseBytes, MPT_SENSE_BUFFER_SIZE);
if (sz > 0) {
if (copy_to_user((char *)karg.senseDataPtr, ioc->ioctl->sense, sz)) {
if (copy_to_user(karg.senseDataPtr, ioc->ioctl->sense, sz)) {
printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
"Unable to write sense data to user %p\n",
__FILE__, __LINE__,
(void*)karg.senseDataPtr);
karg.senseDataPtr);
rc = -ENODATA;
goto done_free_mem;
}
......@@ -2303,12 +2295,12 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local)
if ((ioc->ioctl->status & MPT_IOCTL_STATUS_COMMAND_GOOD) &&
(karg.dataInSize > 0) && (bufIn.kptr)) {
if (copy_to_user((char *)karg.dataInBufPtr,
if (copy_to_user(karg.dataInBufPtr,
bufIn.kptr, karg.dataInSize)) {
printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
"Unable to write data to user %p\n",
__FILE__, __LINE__,
(void*)karg.dataInBufPtr);
karg.dataInBufPtr);
rc = -ENODATA;
}
}
......@@ -2361,7 +2353,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local)
static int
mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
{
hp_host_info_t *uarg = (hp_host_info_t *) arg;
hp_host_info_t __user *uarg = (void __user *) arg;
MPT_ADAPTER *ioc;
struct pci_dev *pdev;
char *pbuf;
......@@ -2385,7 +2377,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
if (copy_from_user(&karg, uarg, sizeof(hp_host_info_t))) {
printk(KERN_ERR "%s@%d::mptctl_hp_host_info - "
"Unable to read in hp_host_info struct @ %p\n",
__FILE__, __LINE__, (void*)uarg);
__FILE__, __LINE__, uarg);
return -EFAULT;
}
......@@ -2522,11 +2514,10 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
/* Copy the data from kernel memory to user memory
*/
if (copy_to_user((char *)arg, &karg,
sizeof(hp_host_info_t))) {
if (copy_to_user((char __user *)arg, &karg, sizeof(hp_host_info_t))) {
printk(KERN_ERR "%s@%d::mptctl_hpgethostinfo - "
"Unable to write out hp_host_info @ %p\n",
__FILE__, __LINE__, (void*)uarg);
__FILE__, __LINE__, uarg);
return -EFAULT;
}
......@@ -2548,7 +2539,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
static int
mptctl_hp_targetinfo(unsigned long arg)
{
hp_target_info_t *uarg = (hp_target_info_t *) arg;
hp_target_info_t __user *uarg = (void __user *) arg;
SCSIDevicePage0_t *pg0_alloc;
SCSIDevicePage3_t *pg3_alloc;
MPT_ADAPTER *ioc;
......@@ -2565,7 +2556,7 @@ mptctl_hp_targetinfo(unsigned long arg)
if (copy_from_user(&karg, uarg, sizeof(hp_target_info_t))) {
printk(KERN_ERR "%s@%d::mptctl_hp_targetinfo - "
"Unable to read in hp_host_targetinfo struct @ %p\n",
__FILE__, __LINE__, (void*)uarg);
__FILE__, __LINE__, uarg);
return -EFAULT;
}
......@@ -2673,10 +2664,10 @@ mptctl_hp_targetinfo(unsigned long arg)
/* Copy the data from kernel memory to user memory
*/
if (copy_to_user((char *)arg, &karg, sizeof(hp_target_info_t))) {
if (copy_to_user((char __user *)arg, &karg, sizeof(hp_target_info_t))) {
printk(KERN_ERR "%s@%d::mptctl_hp_target_info - "
"Unable to write out mpt_ioctl_targetinfo struct @ %p\n",
__FILE__, __LINE__, (void*)uarg);
__FILE__, __LINE__, uarg);
return -EFAULT;
}
......@@ -2753,7 +2744,7 @@ compat_mptfwxfer_ioctl(unsigned int fd, unsigned int cmd,
kfw.iocnum = iocnum;
kfw.fwlen = kfw32.fwlen;
kfw.bufp = (void *)(unsigned long)kfw32.bufp;
kfw.bufp = compat_ptr(kfw32.bufp);
ret = mptctl_do_fw_download(kfw.iocnum, kfw.bufp, kfw.fwlen);
......@@ -2809,7 +2800,7 @@ compat_mpt_command(unsigned int fd, unsigned int cmd,
/* Pass new structure to do_mpt_command
*/
ret = mptctl_do_mpt_command (karg, (char *) &uarg->MF, 0);
ret = mptctl_do_mpt_command (karg, &uarg->MF);
up(&mptctl_syscall_sem_ioc[iocp->id]);
......
......@@ -115,7 +115,7 @@
struct mpt_fw_xfer {
unsigned int iocnum; /* IOC unit number */
unsigned int fwlen;
void *bufp; /* Pointer to firmware buffer */
void __user *bufp; /* Pointer to firmware buffer */
};
#if defined(__KERNEL__) && defined(CONFIG_COMPAT)
......@@ -332,10 +332,10 @@ typedef struct mpt_ioctl_replace_fw {
struct mpt_ioctl_command {
mpt_ioctl_header hdr;
int timeout; /* optional (seconds) */
char *replyFrameBufPtr;
char *dataInBufPtr;
char *dataOutBufPtr;
char *senseDataPtr;
char __user *replyFrameBufPtr;
char __user *dataInBufPtr;
char __user *dataOutBufPtr;
char __user *senseDataPtr;
int maxReplyBytes;
int dataInSize;
int dataOutSize;
......
......@@ -87,6 +87,7 @@
#include <linux/delay.h>
#include <linux/mca.h>
#include <linux/spinlock.h>
#include <scsi/scsicam.h>
#include <linux/mca-legacy.h>
#include <asm/io.h>
......@@ -1337,23 +1338,14 @@ static int fd_mcs_bus_reset(Scsi_Cmnd * SCpnt) {
static int fd_mcs_biosparam(struct scsi_device * disk, struct block_device *bdev,
sector_t capacity, int *info_array)
{
unsigned char buf[512 + sizeof(int) * 2];
unsigned char *p = scsi_bios_ptable(bdev);
int size = capacity;
int *sizes = (int *) buf;
unsigned char *data = (unsigned char *) (sizes + 2);
unsigned char do_read[] = { READ_6, 0, 0, 0, 1, 0 };
int retcode;
/* BIOS >= 3.4 for MCA cards */
/* This algorithm was provided by Future Domain (much thanks!). */
sizes[0] = 0; /* zero bytes out */
sizes[1] = 512; /* one sector in */
memcpy(data, do_read, sizeof(do_read));
retcode = kernel_scsi_ioctl(disk, SCSI_IOCTL_SEND_COMMAND, (void *) buf);
if (!retcode /* SCSI command ok */
&& data[511] == 0xaa && data[510] == 0x55 /* Partition table valid */
&& data[0x1c2]) { /* Partition type */
if (p && p[65] == 0xaa && p[64] == 0x55 /* Partition table valid */
&& p[4]) { /* Partition type */
/* The partition table layout is as follows:
Start: 0x1b3h
......@@ -1383,8 +1375,8 @@ static int fd_mcs_biosparam(struct scsi_device * disk, struct block_device *bdev
Future Domain algorithm, but it seemed to be a reasonable thing
to do, especially in the Linux and BSD worlds. */
info_array[0] = data[0x1c3] + 1; /* heads */
info_array[1] = data[0x1c4] & 0x3f; /* sectors */
info_array[0] = p[5] + 1; /* heads */
info_array[1] = p[6] & 0x3f; /* sectors */
} else {
/* Note that this new method guarantees that there will always be
less than 1024 cylinders on a platter. This is good for drives
......@@ -1403,6 +1395,7 @@ static int fd_mcs_biosparam(struct scsi_device * disk, struct block_device *bdev
}
/* For both methods, compute the cylinders */
info_array[2] = (unsigned int) size / (info_array[0] * info_array[1]);
kfree(p);
return 0;
}
......
......@@ -279,6 +279,7 @@
#include <linux/pci.h>
#include <linux/stat.h>
#include <linux/delay.h>
#include <scsi/scsicam.h>
#include <asm/io.h>
#include <asm/system.h>
......@@ -1564,12 +1565,7 @@ static int fdomain_16x0_biosparam(struct scsi_device *sdev,
sector_t capacity, int *info_array)
{
int drive;
unsigned char buf[512 + sizeof (Scsi_Ioctl_Command)];
Scsi_Ioctl_Command *sic = (Scsi_Ioctl_Command *) buf;
int size = capacity;
unsigned char *data = sic->data;
unsigned char do_read[] = { READ_6, 0, 0, 0, 1, 0 };
int retcode;
unsigned long offset;
struct drive_info {
unsigned short cylinders;
......@@ -1657,16 +1653,10 @@ static int fdomain_16x0_biosparam(struct scsi_device *sdev,
info_array[2] = i.cylinders;
} else { /* 3.4 BIOS (and up?) */
/* This algorithm was provided by Future Domain (much thanks!). */
unsigned char *p = scsi_bios_ptable(bdev);
sic->inlen = 0; /* zero bytes out */
sic->outlen = 512; /* one sector in */
memcpy( data, do_read, sizeof( do_read ) );
retcode = kernel_scsi_ioctl( sdev,
SCSI_IOCTL_SEND_COMMAND,
sic );
if (!retcode /* SCSI command ok */
&& data[511] == 0xaa && data[510] == 0x55 /* Partition table valid */
&& data[0x1c2]) { /* Partition type */
if (p && p[65] == 0xaa && p[64] == 0x55 /* Partition table valid */
&& p[4]) { /* Partition type */
/* The partition table layout is as follows:
......@@ -1697,8 +1687,8 @@ static int fdomain_16x0_biosparam(struct scsi_device *sdev,
Future Domain algorithm, but it seemed to be a reasonable thing
to do, especially in the Linux and BSD worlds. */
info_array[0] = data[0x1c3] + 1; /* heads */
info_array[1] = data[0x1c4] & 0x3f; /* sectors */
info_array[0] = p[5] + 1; /* heads */
info_array[1] = p[6] & 0x3f; /* sectors */
} else {
/* Note that this new method guarantees that there will always be
......@@ -1718,6 +1708,7 @@ static int fdomain_16x0_biosparam(struct scsi_device *sdev,
}
/* For both methods, compute the cylinders */
info_array[2] = (unsigned int)size / (info_array[0] * info_array[1] );
kfree(p);
}
return 0;
......
......@@ -1936,10 +1936,10 @@ static void nsp_cs_config(dev_link_t *link)
nsp_dbg(NSP_DEBUG_INIT, "host=0x%p", host);
for (dev = host->host_queue; dev != NULL; dev = dev->next) {
unsigned long arg[2], id;
kernel_scsi_ioctl(dev, SCSI_IOCTL_GET_IDLUN, arg);
id = (arg[0] & 0x0f) + ((arg[0] >> 4) & 0xf0) +
((arg[0] >> 8) & 0xf00) + ((arg[0] >> 12) & 0xf000);
unsigned long id;
id = (dev->id & 0x0f) + ((dev->lun & 0x0f) << 4) +
((dev->channel & 0x0f) << 8) +
((dev->host->host_no & 0x0f) << 12);
node = &info->node[info->ndev];
node->minor = 0;
switch (dev->type) {
......
......@@ -447,19 +447,3 @@ int scsi_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
}
return -EINVAL;
}
/*
* Just like scsi_ioctl, only callable from kernel space with no
* fs segment fiddling.
*/
int kernel_scsi_ioctl(struct scsi_device *sdev, int cmd, void *arg)
{
mm_segment_t oldfs;
int tmp;
oldfs = get_fs();
set_fs(get_ds());
tmp = scsi_ioctl(sdev, cmd, arg);
set_fs(oldfs);
return tmp;
}
......@@ -54,7 +54,6 @@ EXPORT_SYMBOL(scsi_print_msg);
EXPORT_SYMBOL(scsi_print_status);
EXPORT_SYMBOL(scsi_sense_key_string);
EXPORT_SYMBOL(scsi_extd_sense_format);
EXPORT_SYMBOL(kernel_scsi_ioctl);
EXPORT_SYMBOL(scsi_block_when_processing_errors);
EXPORT_SYMBOL(scsi_ioctl_send_command);
EXPORT_SYMBOL(scsi_set_medium_removal);
......
......@@ -41,7 +41,6 @@ typedef struct scsi_fctargaddress {
} Scsi_FCTargAddress;
extern int scsi_ioctl(struct scsi_device *, int, void __user *);
extern int kernel_scsi_ioctl(struct scsi_device *, int , void *);
extern int scsi_ioctl_send_command(struct scsi_device *,
struct scsi_ioctl_command __user *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment