Commit bf6ca902 authored by Pamela Delaney's avatar Pamela Delaney Committed by Linus Torvalds

[PATCH] Fusion Driver 2.05.00.03 against 2.5.62bk3

Please accept this large patch against 2.5.62bk4 to update the
Fusion-MPT driver from 2.03.01.01 to 2.05.00.03.

This version contains full 2.5 kernel support (add, configuration &
removal of disks, new module hooks), performance enhancements, removal
of obsolete code that is 2.4 (or earlier) specific and removal of blank
spaces at end of lines.  Tested overnight on 2.5.62bk3 and ran some
tests against bk4 this morning on both machines.  Things appear to be
fine - have not tested the two failure conditions today.

The driver has been tested on two different platforms:

- P4 4-processor
   o boot controller
   o built into kernel
   o disk add, configure, remove
   o bus, target reset
   o device offline cases
   o cross channel I/O stress tests w/ Fibre and SCSI

 - Athlon uniprocessor, IDE boot
   o Ran a test that repeatedly loads the driver, mounts disks, runs a
     short I/O test (20mins) then unload the driver components in a
     different order

Failures:
   o Unable to boot if boot controller is built as a module - pivot_root
     fails (Happens if IDE or SCSI boot)

   o Problems when formatting large SCSI disks.  On P4 w/ 2.5.60, there
     were no difficulties formatting a 36GB disk.  On Athlon, mkfs.ext2
     would never send a write command to the driver (verified w/ SCSI
     trace and driver debug).  Reads completed successfully.  mkfs.ext2
     would not exit and is shown as a running process.

     Smaller partitions were formatted correctly.  W/ 2.5.62 failures on
     P4 and Athlon.

     Same error with other drivers. 100% reproducible.
parent 3d34f2f7
......@@ -91,6 +91,7 @@
MODULE_AUTHOR(MODULEAUTHOR);
MODULE_DESCRIPTION(my_NAME);
MODULE_LICENSE("GPL");
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
int __init isense_init(void)
......
......@@ -270,6 +270,13 @@ static __inline__ int __get_order(unsigned long size)
#define mptscsih_sync_irq(_irq) synchronize_irq()
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,58)
#define mpt_inc_use_count()
#define mpt_dec_use_count()
#else
#define mpt_inc_use_count() MOD_INC_USE_COUNT
#define mpt_dec_use_count() MOD_DEC_USE_COUNT
#endif
/*}-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
......
......@@ -184,7 +184,7 @@ typedef struct _MSG_SCSI_IO_RAID_PT_REPLY
/****************************************************************************/
/* Mailbox request structure */
/* Mailbox reqeust structure */
/****************************************************************************/
typedef struct _MSG_MAILBOX_REQUEST
......
......@@ -49,7 +49,7 @@
* (mailto:sjralston1@netscape.net)
* (mailto:Pam.Delaney@lsil.com)
*
* $Id: mptbase.c,v 1.125 2002/12/03 21:26:32 pdelaney Exp $
* $Id: mptbase.c,v 1.126 2002/12/16 15:28:45 pdelaney Exp $
*/
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/*
......@@ -123,8 +123,10 @@ MODULE_LICENSE("GPL");
/*
* cmd line parameters
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,59)
MODULE_PARM(PortIo, "0-1i");
MODULE_PARM_DESC(PortIo, "[0]=Use mmap, 1=Use port io");
#endif
static int PortIo = 0;
#ifdef MFCNT
......@@ -580,8 +582,6 @@ mpt_base_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *reply)
dcprintk((MYIOC_s_INFO_FMT "config_complete (mf=%p,mr=%p)\n",
ioc->name, mf, reply));
DBG_DUMP_REPLY_FRAME(reply)
pCfg = * ((CONFIGPARMS **)((u8 *) mf + ioc->req_sz - sizeof(void *)));
if (pCfg) {
......@@ -686,7 +686,7 @@ mpt_register(MPT_CALLBACK cbfunc, MPT_DRIVER_CLASS dclass)
MptEvHandlers[i] = NULL;
last_drv_idx = i;
if (cbfunc != mpt_base_reply) {
MOD_INC_USE_COUNT;
mpt_inc_use_count();
}
break;
}
......@@ -706,7 +706,7 @@ mpt_register(MPT_CALLBACK cbfunc, MPT_DRIVER_CLASS dclass)
void
mpt_deregister(int cb_idx)
{
if (cb_idx && (cb_idx < MPT_MAX_PROTOCOL_DRIVERS)) {
if ((cb_idx >= 0) && (cb_idx < MPT_MAX_PROTOCOL_DRIVERS)) {
MptCallbacks[cb_idx] = NULL;
MptDriverClass[cb_idx] = MPTUNKNOWN_DRIVER;
MptEvHandlers[cb_idx] = NULL;
......@@ -716,7 +716,7 @@ mpt_deregister(int cb_idx)
isense_idx++;
if (cb_idx != mpt_base_index) {
MOD_DEC_USE_COUNT;
mpt_dec_use_count();
}
}
}
......@@ -2107,9 +2107,7 @@ MakeIocReady(MPT_ADAPTER *ioc, int force, int sleepFlag)
* Loop here waiting for IOC to come READY.
*/
ii = 0;
cntdn = HZ * 15;
if (sleepFlag != CAN_SLEEP)
cntdn *= 10; /* 1500 iterations @ 1msec per */
cntdn = ((sleepFlag == CAN_SLEEP) ? HZ : 1000) * 15; /* 15 seconds */
while ((ioc_state = mpt_GetIocState(ioc, 1)) != MPI_IOC_STATE_READY) {
if (ioc_state == MPI_IOC_STATE_OPERATIONAL) {
......@@ -2483,9 +2481,7 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepFlag)
* LoopInit and TargetDiscovery!
*/
count = 0;
cntdn = HZ * 60; /* chg'd from 30 to 60 seconds */
if (sleepFlag != CAN_SLEEP)
cntdn *= 10; /* scale for 1msec delays */
cntdn = ((sleepFlag == CAN_SLEEP) ? HZ : 1000) * 60; /* 60 seconds */
state = mpt_GetIocState(ioc, 1);
while (state != MPI_IOC_STATE_OPERATIONAL && --cntdn) {
if (sleepFlag == CAN_SLEEP) {
......@@ -3478,10 +3474,8 @@ SendIocReset(MPT_ADAPTER *ioc, u8 reset_type, int sleepFlag)
/* FW ACK'd request, wait for READY state
*/
cntdn = HZ * 15;
count = 0;
if (sleepFlag != CAN_SLEEP)
cntdn *= 10; /* 1500 iterations @ 1msec per */
cntdn = ((sleepFlag == CAN_SLEEP) ? HZ : 1000) * 15; /* 15 seconds */
while ((state = mpt_GetIocState(ioc, 1)) != MPI_IOC_STATE_READY) {
cntdn--;
......@@ -3640,9 +3634,6 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
}
spin_unlock_irqrestore(&ioc->FreeQlock, flags);
#ifdef MFCNT
ioc->mfcnt = 0;
#endif
if (ioc->sense_buf_pool == NULL) {
sz = (ioc->req_depth * MPT_SENSE_BUFFER_ALLOC);
......@@ -3822,10 +3813,12 @@ mpt_handshake_req_reply_wait(MPT_ADAPTER *ioc, int reqBytes, u32 *req,
static int
WaitForDoorbellAck(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
{
int cntdn = HZ * howlong;
int cntdn;
int count = 0;
u32 intstat;
cntdn = ((sleepFlag == CAN_SLEEP) ? HZ : 1000) * howlong;
if (sleepFlag == CAN_SLEEP) {
while (--cntdn) {
intstat = CHIPREG_READ32(&ioc->chip->IntStatus);
......@@ -3836,7 +3829,6 @@ WaitForDoorbellAck(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
count++;
}
} else {
cntdn *= 10; /* convert to msec */
while (--cntdn) {
intstat = CHIPREG_READ32(&ioc->chip->IntStatus);
if (! (intstat & MPI_HIS_IOP_DOORBELL_STATUS))
......@@ -3844,7 +3836,6 @@ WaitForDoorbellAck(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
mdelay (1);
count++;
}
count /= 10;
}
if (cntdn) {
......@@ -3873,10 +3864,11 @@ WaitForDoorbellAck(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
static int
WaitForDoorbellInt(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
{
int cntdn = HZ * howlong;
int cntdn;
int count = 0;
u32 intstat;
cntdn = ((sleepFlag == CAN_SLEEP) ? HZ : 1000) * howlong;
if (sleepFlag == CAN_SLEEP) {
while (--cntdn) {
intstat = CHIPREG_READ32(&ioc->chip->IntStatus);
......@@ -3887,7 +3879,6 @@ WaitForDoorbellInt(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
count++;
}
} else {
cntdn *= 10; /* convert to msec */
while (--cntdn) {
intstat = CHIPREG_READ32(&ioc->chip->IntStatus);
if (intstat & MPI_HIS_DOORBELL_INTERRUPT)
......@@ -3895,7 +3886,6 @@ WaitForDoorbellInt(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
mdelay(1);
count++;
}
count /= 10;
}
if (cntdn) {
......@@ -4953,7 +4943,6 @@ mpt_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
/* Search the configQ for internal commands.
* Flush the Q, and wake up all suspended threads.
*/
#if 1
spin_lock_irqsave(&ioc->FreeQlock, flags);
if (! Q_IS_EMPTY(&ioc->configQ)){
pCfg = (CONFIGPARMS *)ioc->configQ.head;
......@@ -4970,23 +4959,6 @@ mpt_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
} while (pCfg != (CONFIGPARMS *)&ioc->configQ);
}
spin_unlock_irqrestore(&ioc->FreeQlock, flags);
#else
while (1) {
spin_lock_irqsave(&ioc->FreeQlock, flags);
if (! Q_IS_EMPTY(&ioc->configQ)){
spin_unlock_irqrestore(&ioc->FreeQlock, flags);
break;
}
pCfg = (CONFIGPARMS *)ioc->configQ.head;
Q_DEL_ITEM(&pCfg->linkage);
spin_unlock_irqrestore(&ioc->FreeQlock, flags);
pCfg->status = MPT_CONFIG_ERROR;
pCfg->wait_done = 1;
wake_up(&mpt_waitq);
}
#endif
}
return 1; /* currently means nothing really */
......@@ -5845,7 +5817,7 @@ mpt_register_ascqops_strings(void *ascqTable, int ascqtbl_sz, const char **opsTa
isense_idx = last_drv_idx;
r = 1;
}
MOD_INC_USE_COUNT;
mpt_inc_use_count();
return r;
}
......@@ -5864,7 +5836,7 @@ mpt_deregister_ascqops_strings(void)
mpt_ScsiOpcodesPtr = NULL;
printk(KERN_INFO MYNAM ": English readable SCSI-3 strings disabled)-:\n");
isense_idx = -1;
MOD_DEC_USE_COUNT;
mpt_dec_use_count();
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
......
......@@ -13,7 +13,7 @@
* (mailto:sjralston1@netscape.net)
* (mailto:Pam.Delaney@lsil.com)
*
* $Id: mptbase.h,v 1.141 2002/12/03 21:26:32 pdelaney Exp $
* $Id: mptbase.h,v 1.144 2003/01/28 21:31:56 pdelaney Exp $
*/
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/*
......@@ -80,8 +80,8 @@
#define COPYRIGHT "Copyright (c) 1999-2002 " MODULEAUTHOR
#endif
#define MPT_LINUX_VERSION_COMMON "2.03.01.01"
#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-2.03.01.01"
#define MPT_LINUX_VERSION_COMMON "2.05.00.03"
#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-2.05.00.03"
#define WHAT_MAGIC_STRING "@" "(" "#" ")"
#define show_mptmod_ver(s,ver) \
......@@ -383,12 +383,9 @@ typedef struct _VirtDevice {
u8 maxWidth; /* 0 if narrow, 1 if wide*/
u8 negoFlags; /* bit field, 0 if WDTR/SDTR/QAS allowed */
u8 raidVolume; /* set, if RAID Volume */
#ifdef ABORT_FIX
u8 numAborts;
#else
u8 rsvd;
#endif
u16 rsvd1raid;
u8 type; /* byte 0 of Inquiry data */
u8 cflags; /* controller flags */
u8 rsvd1raid;
int npaths;
u16 fc_phys_lun;
u16 fc_xlat_lun;
......@@ -400,11 +397,8 @@ typedef struct _VirtDevice {
ScsiCmndTracker WaitQ;
ScsiCmndTracker SentQ;
ScsiCmndTracker DoneQ;
u32 num_luns;
//--- LUN split here?
#ifdef MPT_SAVE_AUTOSENSE
u8 sense[SCSI_STD_SENSE_BYTES]; /* 18 */
u8 rsvd2[2]; /* alignment */
#endif
u32 luns; /* Max LUNs is 32 */
u8 inq_data[SCSI_STD_INQUIRY_BYTES]; /* 36 */
u8 pad0[4];
......@@ -428,13 +422,15 @@ typedef struct _VirtDevice {
* Fibre Channel (SCSI) target device and associated defines...
*/
#define MPT_TARGET_DEFAULT_DV_STATUS 0
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,55)
#define MPT_TARGET_FLAGS_CONFIGURED 0x02
#define MPT_TARGET_FLAGS_Q_YES 0x08
#else
#define MPT_TARGET_FLAGS_VALID_NEGO 0x01
#define MPT_TARGET_FLAGS_VALID_INQUIRY 0x02
#ifdef MPT_SAVE_AUTOSENSE
#define MPT_TARGET_FLAGS_VALID_SENSE 0x04
#endif
#define MPT_TARGET_FLAGS_Q_YES 0x08
#define MPT_TARGET_FLAGS_VALID_56 0x10
#endif
#define MPT_TARGET_NO_NEGO_WIDE 0x01
#define MPT_TARGET_NO_NEGO_SYNC 0x02
......@@ -603,7 +599,7 @@ typedef struct _MPT_ADAPTER
dma_addr_t sense_buf_pool_dma;
u32 sense_buf_low_dma;
int mtrr_reg;
struct pci_dev *pcidev;
struct pci_dev *pcidev; /* struct pci_dev pointer */
u8 *memmap; /* mmap address */
struct Scsi_Host *sh; /* Scsi Host pointer */
ScsiCfgData spi_data; /* Scsi config. data */
......@@ -764,6 +760,13 @@ typedef struct _mpt_sge {
#define dcprintk(x)
#endif
#if defined(MPT_DEBUG_SCSI) || defined(MPT_DEBUG) || defined(MPT_DEBUG_MSG_FRAME)
#define dsprintk(x) printk x
#else
#define dsprintk(x)
#endif
#define MPT_INDEX_2_MFPTR(ioc,idx) \
(MPT_FRAME_HDR*)( (u8*)(ioc)->req_frames + (ioc)->req_sz * (idx) )
......@@ -1050,7 +1053,7 @@ extern int mpt_ASCQ_TableSz;
#define offsetof(t, m) ((size_t) (&((t *)0)->m))
#endif
#if defined(__alpha__) || defined(__sparc_v9__) || defined(__ia64__)
#if defined(__alpha__) || defined(__sparc_v9__) || defined(__ia64__) || defined(__x86_64__)
#define CAST_U32_TO_PTR(x) ((void *)(u64)x)
#define CAST_PTR_TO_U32(x) ((u32)(u64)x)
#else
......
......@@ -102,6 +102,9 @@
#define my_VERSION MPT_LINUX_VERSION_COMMON
#define MYNAM "mptctl"
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,62)
EXPORT_NO_SYMBOLS;
#endif
MODULE_AUTHOR(MODULEAUTHOR);
MODULE_DESCRIPTION(my_NAME);
MODULE_LICENSE("GPL");
......@@ -135,7 +138,7 @@ static int mptctl_eventreport (unsigned long arg);
static int mptctl_replace_fw (unsigned long arg);
static int mptctl_do_reset(unsigned long arg);
static int mptctl_hp_hostinfo(unsigned long arg);
static int mptctl_hp_hostinfo(unsigned long arg, unsigned int cmd);
static int mptctl_hp_targetinfo(unsigned long arg);
/*
......@@ -658,25 +661,19 @@ mptctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned
dctlprintk((MYIOC_s_INFO_FMT ": mptctl_ioctl()\n", iocp->name));
switch(cmd) {
case MPTFWDOWNLOAD:
if (cmd == MPTFWDOWNLOAD)
ret = mptctl_fw_download(arg);
break;
case MPTCOMMAND:
else if (cmd == MPTCOMMAND)
ret = mptctl_mpt_command(arg);
break;
case MPTHARDRESET:
else if (cmd == MPTHARDRESET)
ret = mptctl_do_reset(arg);
break;
case HP_GETHOSTINFO:
ret = mptctl_hp_hostinfo(arg);
break;
case HP_GETTARGETINFO:
else if ((cmd & ~IOCSIZE_MASK) == (HP_GETHOSTINFO & ~IOCSIZE_MASK))
ret = mptctl_hp_hostinfo(arg, _IOC_SIZE(cmd));
else if (cmd == HP_GETTARGETINFO)
ret = mptctl_hp_targetinfo(arg);
break;
default:
else
ret = -EINVAL;
}
up(&mptctl_syscall_sem_ioc[iocp->id]);
......@@ -873,7 +870,7 @@ mptctl_do_fw_download(int ioc, char *ufwbuf, size_t fwlen)
* 96 8
* 64 4
*/
maxfrags = (iocp->req_sz - sizeof(MPIHeader_t) - sizeof(FWDownloadTCSGE_t))
maxfrags = (iocp->req_sz - sizeof(MPIHeader_t) - sizeof(FWDownloadTCSGE_t))
/ (sizeof(dma_addr_t) + sizeof(u32));
if (numfrags > maxfrags) {
ret = -EMLINK;
......@@ -1227,10 +1224,16 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
u8 revision;
dctlprintk((": mptctl_getiocinfo called.\n"));
if (data_size == sizeof(struct mpt_ioctl_iocinfo))
cim_rev = 1;
else if (data_size == (sizeof(struct mpt_ioctl_iocinfo) - sizeof(struct mpt_ioctl_pci_info)))
/* Add of PCI INFO results in unaligned access for
* IA64 and Sparc. Reset long to int. Return no PCI
* data for obsolete format.
*/
if (data_size == sizeof(struct mpt_ioctl_iocinfo_rev0))
cim_rev = 0;
else if (data_size == sizeof(struct mpt_ioctl_iocinfo))
cim_rev = 1;
else if (data_size == (sizeof(struct mpt_ioctl_iocinfo_rev0)+12))
cim_rev = 0; /* obsolete */
else
return -EFAULT;
......@@ -1414,7 +1417,7 @@ mptctl_gettargetinfo (unsigned long arg)
/* Get number of devices
*/
if ( (sh = ioc->sh) != NULL) {
if ((sh = ioc->sh) != NULL) {
max_id = sh->max_id - 1;
hd = (MPT_SCSI_HOST *) sh->hostdata;
......@@ -1437,9 +1440,8 @@ mptctl_gettargetinfo (unsigned long arg)
pdata++;
if (maxWordsLeft <= 0) {
if (maxWordsLeft <= 0)
break;
}
}
}
}
......@@ -1712,7 +1714,7 @@ mptctl_replace_fw (unsigned long arg)
/* Allocate memory for the new FW image
*/
newFwSize = karg.newImageSize;
fwmem = mpt_alloc_fw_memory(ioc, newFwSize, &num_frags, &alloc_sz);
fwmem = mpt_alloc_fw_memory(ioc, newFwSize, &num_frags, &alloc_sz);
if (fwmem == NULL)
return -ENOMEM;
......@@ -1732,7 +1734,7 @@ mptctl_replace_fw (unsigned long arg)
}
/* Free the old FW image
/* Free the old FW image
*/
if (ioc->cached_fw) {
mpt_free_fw_memory(ioc, 0);
......@@ -1905,6 +1907,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local)
case MPI_FUNCTION_FW_UPLOAD:
case MPI_FUNCTION_SCSI_ENCLOSURE_PROCESSOR:
case MPI_FUNCTION_FW_DOWNLOAD:
case MPI_FUNCTION_FC_PRIMITIVE_SEND:
break;
case MPI_FUNCTION_SCSI_IO_REQUEST:
......@@ -2032,7 +2035,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local)
break;
case MPI_FUNCTION_SCSI_TASK_MGMT:
{
{
MPT_SCSI_HOST *hd = NULL;
if ((ioc->sh == NULL) || ((hd = (MPT_SCSI_HOST *)ioc->sh->hostdata) == NULL)) {
printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
......@@ -2065,7 +2068,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local)
}
if ((pInit->Flags != 0) || (pInit->MaxDevices != ioc->facts.MaxDevices) ||
(pInit->MaxBuses != ioc->facts.MaxBuses) ||
(pInit->MaxBuses != ioc->facts.MaxBuses) ||
(pInit->ReplyFrameSize != cpu_to_le16(ioc->reply_sz)) ||
(pInit->HostMfaHighAddr != high_addr) ||
(pInit->SenseBufferHighAddr != sense_high)) {
......@@ -2097,7 +2100,6 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local)
MPI_FUNCTION_FC_LINK_SRVC_BUF_POST
MPI_FUNCTION_FC_LINK_SRVC_RSP
MPI_FUNCTION_FC_ABORT
MPI_FUNCTION_FC_PRIMITIVE_SEND
MPI_FUNCTION_LAN_SEND
MPI_FUNCTION_LAN_RECEIVE
MPI_FUNCTION_LAN_RESET
......@@ -2395,7 +2397,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local)
* -ENOMEM if memory allocation error
*/
static int
mptctl_hp_hostinfo(unsigned long arg)
mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
{
hp_host_info_t *uarg = (hp_host_info_t *) arg;
MPT_ADAPTER *ioc;
......@@ -2406,9 +2408,18 @@ mptctl_hp_hostinfo(unsigned long arg)
CONFIGPARMS cfg;
ConfigPageHeader_t hdr;
int iocnum;
int rc;
int rc, cim_rev;
dctlprintk((": mptctl_hp_hostinfo called.\n"));
/* Reset long to int. Should affect IA64 and SPARC only
*/
if (data_size == sizeof(hp_host_info_t))
cim_rev = 1;
else if (data_size == (sizeof(hp_host_info_t) + 12))
cim_rev = 0; /* obsolete */
else
return -EFAULT;
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",
......@@ -2438,7 +2449,7 @@ mptctl_hp_hostinfo(unsigned long arg)
karg.bus = pdev->bus->number;
/* Save the SCSI host no. if
* SCSI driver loaded
* SCSI driver loaded
*/
if (ioc->sh != NULL)
karg.host_no = ioc->sh->host_no;
......@@ -2526,7 +2537,7 @@ mptctl_hp_hostinfo(unsigned long arg)
if (ioc->sh != NULL) {
MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)ioc->sh->hostdata;
if (hd) {
if (hd && (cim_rev == 1)) {
karg.hard_resets = hd->hard_resets;
karg.soft_resets = hd->soft_resets;
karg.timeouts = hd->timeouts;
......@@ -2620,7 +2631,7 @@ mptctl_hp_targetinfo(unsigned long arg)
if ((rc = mpt_config(ioc, &cfg)) == 0) {
np = le32_to_cpu(pg0_alloc->NegotiatedParameters);
karg.negotiated_width = np & MPI_SCSIDEVPAGE0_NP_WIDE ?
karg.negotiated_width = np & MPI_SCSIDEVPAGE0_NP_WIDE ?
HP_BUS_WIDTH_16 : HP_BUS_WIDTH_8;
if (np & MPI_SCSIDEVPAGE0_NP_NEG_SYNC_OFFSET_MASK) {
......@@ -2699,7 +2710,7 @@ mptctl_hp_targetinfo(unsigned long arg)
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,51)
#define owner_THIS_MODULE owner: THIS_MODULE,
#define owner_THIS_MODULE .owner = THIS_MODULE,
#else
#define owner_THIS_MODULE
#endif
......@@ -2885,6 +2896,8 @@ int __init mptctl_init(void)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) /*{*/
err = register_ioctl32_conversion(MPTIOCINFO, NULL);
if (++where && err) goto out_fail;
err = register_ioctl32_conversion(MPTIOCINFO1, NULL);
if (++where && err) goto out_fail;
err = register_ioctl32_conversion(MPTTARGETINFO, NULL);
if (++where && err) goto out_fail;
err = register_ioctl32_conversion(MPTTEST, NULL);
......@@ -2945,6 +2958,7 @@ int __init mptctl_init(void)
printk(KERN_ERR MYNAM ": ERROR: Failed to register ioctl32_conversion!"
" (%d:err=%d)\n", where, err);
unregister_ioctl32_conversion(MPTIOCINFO);
unregister_ioctl32_conversion(MPTIOCINFO1);
unregister_ioctl32_conversion(MPTTARGETINFO);
unregister_ioctl32_conversion(MPTTEST);
unregister_ioctl32_conversion(MPTEVENTQUERY);
......
......@@ -90,6 +90,7 @@
#endif /*}*/
#define MPTIOCINFO _IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo)
#define MPTIOCINFO1 _IOWR(MPT_MAGIC_NUMBER,17,struct mpt_ioctl_iocinfo_rev0)
#define MPTTARGETINFO _IOWR(MPT_MAGIC_NUMBER,18,struct mpt_ioctl_targetinfo)
#define MPTTEST _IOWR(MPT_MAGIC_NUMBER,19,struct mpt_ioctl_test)
#define MPTEVENTQUERY _IOWR(MPT_MAGIC_NUMBER,21,struct mpt_ioctl_eventquery)
......@@ -99,7 +100,7 @@
#define MPTFWREPLACE _IOWR(MPT_MAGIC_NUMBER,25,struct mpt_ioctl_replace_fw)
/*
* SPARC PLATFORM REMARK:
* SPARC PLATFORM REMARKS:
* IOCTL data structures that contain pointers
* will have different sizes in the driver and applications
* (as the app. will not use 8-byte pointers).
......@@ -107,6 +108,8 @@
* The driver will convert data from
* mpt_fw_xfer32 (mpt_ioctl_command32) to mpt_fw_xfer (mpt_ioctl_command)
* internally.
*
* If data structures change size, must handle as in IOCGETINFO.
*/
struct mpt_fw_xfer {
unsigned int iocnum; /* IOC unit number */
......@@ -154,11 +157,11 @@ struct mpt_ioctl_diag_reset {
struct mpt_ioctl_pci_info {
union {
struct {
unsigned long deviceNumber : 5;
unsigned long functionNumber : 3;
unsigned long busNumber : 24;
unsigned int deviceNumber : 5;
unsigned int functionNumber : 3;
unsigned int busNumber : 24;
} bits;
unsigned long asUlong;
unsigned int asUlong;
} u;
};
......@@ -189,6 +192,27 @@ struct mpt_ioctl_iocinfo {
struct mpt_ioctl_pci_info pciInfo; /* Added Rev 1 */
};
/* Original structure, must always accept these
* IOCTLs. 4 byte pads can occur based on arch with
* above structure. Wish to re-align, but cannot.
*/
struct mpt_ioctl_iocinfo_rev0 {
mpt_ioctl_header hdr;
int adapterType; /* SCSI or FCP */
int port; /* port number */
int pciId; /* PCI Id. */
int hwRev; /* hardware revision */
int subSystemDevice; /* PCI subsystem Device ID */
int subSystemVendor; /* PCI subsystem Vendor ID */
int numDevices; /* number of devices */
int FWVersion; /* FW Version (integer) */
int BIOSVersion; /* BIOS Version (integer) */
char driverVersion[MPT_IOCTL_VERSION_LENGTH]; /* Driver Version (string) */
char busChangeEvent;
char hostId;
char rsvd[2];
};
/*
* Device Information Page
* Report the number of, and ids of, all targets
......@@ -330,7 +354,7 @@ typedef struct _hp_header {
unsigned int lun;
} hp_header_t;
/*
/*
* Header:
* iocnum required (input)
* host ignored
......@@ -353,12 +377,12 @@ typedef struct _hp_host_info {
u32 bus_phys_width;
u32 base_io_addr;
u32 rsvd;
unsigned long hard_resets; /* driver initiated resets */
unsigned long soft_resets; /* ioc, external resets */
unsigned long timeouts; /* num timeouts */
unsigned int hard_resets; /* driver initiated resets */
unsigned int soft_resets; /* ioc, external resets */
unsigned int timeouts; /* num timeouts */
} hp_host_info_t;
/*
/*
* Header:
* iocnum required (input)
* host required
......
......@@ -154,7 +154,7 @@ static int mpt_lan_open(struct net_device *dev);
static int mpt_lan_reset(struct net_device *dev);
static int mpt_lan_close(struct net_device *dev);
static void mpt_lan_post_receive_buckets(void *dev_id);
static void mpt_lan_wake_post_buckets_task(struct net_device *dev,
static void mpt_lan_wake_post_buckets_task(struct net_device *dev,
int priority);
static int mpt_lan_receive_post_turbo(struct net_device *dev, u32 tmsg);
static int mpt_lan_receive_post_reply(struct net_device *dev,
......@@ -868,7 +868,7 @@ mpt_lan_sdu_send (struct sk_buff *skb, struct net_device *dev)
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
static inline void
mpt_lan_wake_post_buckets_task(struct net_device *dev, int priority)
/*
/*
* @priority: 0 = put it on the timer queue, 1 = put it on the immediate queue
*/
{
......@@ -878,8 +878,6 @@ mpt_lan_wake_post_buckets_task(struct net_device *dev, int priority)
if (priority) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,41)
schedule_work(&priv->post_buckets_task);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,40)
schedule_task(&priv->post_buckets_task);
#else
queue_task(&priv->post_buckets_task, &tq_immediate);
mark_bh(IMMEDIATE_BH);
......@@ -887,8 +885,6 @@ mpt_lan_wake_post_buckets_task(struct net_device *dev, int priority)
} else {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,41)
schedule_delayed_work(&priv->post_buckets_task, 1);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,40)
schedule_task(&priv->post_buckets_task);
#else
queue_task(&priv->post_buckets_task, &tq_timer);
#endif
......@@ -1191,7 +1187,7 @@ mpt_lan_receive_post_reply(struct net_device *dev,
remaining, atomic_read(&priv->buckets_out));
if ((remaining < priv->bucketthresh) &&
((atomic_read(&priv->buckets_out) - remaining) >
((atomic_read(&priv->buckets_out) - remaining) >
MPT_LAN_BUCKETS_REMAIN_MISMATCH_THRESH)) {
printk (KERN_WARNING MYNAM " Mismatch between driver's "
......@@ -1525,7 +1521,7 @@ mpt_lan_init (void)
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
void __init mpt_lan_exit(void)
static void mpt_lan_exit(void)
{
int i;
......@@ -1534,10 +1530,11 @@ void __init mpt_lan_exit(void)
for (i = 0; mpt_landev[i] != NULL; i++) {
struct net_device *dev = mpt_landev[i];
printk (KERN_INFO MYNAM ": %s/%s: Fusion MPT LAN device unregistered\n",
printk (KERN_INFO ": %s/%s: Fusion MPT LAN device unregistered\n",
IOC_AND_NETDEV_NAMES_s_s(dev));
unregister_fcdev(dev);
mpt_landev[i] = (struct net_device *) 0xdeadbeef; /* Debug */
//mpt_landev[i] = (struct net_device *) 0xdeadbeef; /* Debug */
mpt_landev[i] = NULL;
}
if (LanCtx >= 0) {
......@@ -1550,9 +1547,10 @@ void __init mpt_lan_exit(void)
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,59)
MODULE_PARM(tx_max_out_p, "i");
MODULE_PARM(max_buckets_out, "i"); // Debug stuff. FIXME!
#endif
module_init(mpt_lan_init);
module_exit(mpt_lan_exit);
......
......@@ -21,11 +21,7 @@
#include <linux/miscdevice.h>
#include <linux/spinlock.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,41)
#include <linux/tqueue.h>
#else
#include <linux/workqueue.h>
#endif
#include <linux/delay.h>
// #include <linux/trdevice.h>
......
This diff is collapsed.
......@@ -72,7 +72,7 @@
/*
* Try to keep these at 2^N-1
*/
#define MPT_FC_CAN_QUEUE 63
#define MPT_FC_CAN_QUEUE 127
#if defined MPT_SCSI_USE_NEW_EH
#define MPT_SCSI_CAN_QUEUE 127
#else
......@@ -148,59 +148,18 @@ struct mptscsih_driver_setup
* Issue discovered 20001213 by: sshirron
*/
#define MPT_SCSIHOST_NEED_ENTRY_EXIT_HOOKUPS 1
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,0)
# if LINUX_VERSION_CODE == KERNEL_VERSION(2,4,0)
/*
* Super HACK! -by sralston:-(
* (good grief; heaven help me!)
*/
# include <linux/capability.h>
# if !defined(CAP_LEASE) && !defined(MODULE)
# undef MPT_SCSIHOST_NEED_ENTRY_EXIT_HOOKUPS
# endif
# else
# ifndef MODULE
# undef MPT_SCSIHOST_NEED_ENTRY_EXIT_HOOKUPS
# endif
# endif
#endif
/*
* tq_scheduler disappeared @ lk-2.4.0-test12
* (right when <linux/sched.h> newly defined TQ_ACTIVE)
* tq_struct reworked in 2.5.41. Include workqueue.h.
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,41)
# include <linux/sched.h>
# include <linux/workqueue.h>
#define SCHEDULE_TASK(x) \
if (schedule_work(x) == 0) { \
/*MOD_DEC_USE_COUNT*/; \
}
#else
#define HAVE_TQ_SCHED 1
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
# include <linux/sched.h>
# ifdef TQ_ACTIVE
# undef HAVE_TQ_SCHED
# endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,40)
# undef HAVE_TQ_SCHED
#endif
#endif
#ifdef HAVE_TQ_SCHED
#define SCHEDULE_TASK(x) \
/*MOD_INC_USE_COUNT*/; \
(x)->next = NULL; \
queue_task(x, &tq_scheduler)
#else
#define SCHEDULE_TASK(x) \
/*MOD_INC_USE_COUNT*/; \
if (schedule_task(x) == 0) { \
/*MOD_DEC_USE_COUNT*/; \
}
#endif
#endif
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
......@@ -217,11 +176,9 @@ struct mptscsih_driver_setup
#define x_scsi_taskmgmt_bh mptscsih_taskmgmt_bh
#define x_scsi_old_abort mptscsih_old_abort
#define x_scsi_old_reset mptscsih_old_reset
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,52)
#define x_scsi_slave_alloc mptscsih_slave_alloc
#define x_scsi_slave_configure mptscsih_slave_configure
#else
#define x_scsi_select_queue_depths mptscsih_select_queue_depths
#endif
#define x_scsi_slave_destroy mptscsih_slave_destroy
#define x_scsi_proc_info mptscsih_proc_info
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
......@@ -232,41 +189,19 @@ extern int x_scsi_detect(Scsi_Host_Template *);
extern int x_scsi_release(struct Scsi_Host *host);
extern const char *x_scsi_info(struct Scsi_Host *);
extern int x_scsi_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
#ifdef MPT_SCSI_USE_NEW_EH
extern int x_scsi_abort(Scsi_Cmnd *);
extern int x_scsi_bus_reset(Scsi_Cmnd *);
extern int x_scsi_dev_reset(Scsi_Cmnd *);
extern int x_scsi_host_reset(Scsi_Cmnd *);
#else
extern int x_scsi_old_abort(Scsi_Cmnd *);
extern int x_scsi_old_reset(Scsi_Cmnd *, unsigned int);
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45)
extern int x_scsi_bios_param(struct scsi_device * sdev, struct block_device *bdev,
sector_t capacity, int *ip);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,28)
extern int x_scsi_bios_param(Disk *, struct block_device *, int *);
#else
extern int x_scsi_bios_param(Disk *, kdev_t, int *);
#endif
extern void x_scsi_taskmgmt_bh(void *);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,52)
extern int x_scsi_slave_alloc(Scsi_Device *);
extern int x_scsi_slave_configure(Scsi_Device *);
#else
extern void x_scsi_select_queue_depths(struct Scsi_Host *, Scsi_Device *);
#endif
extern void x_scsi_slave_destroy(Scsi_Device *);
extern int x_scsi_proc_info(char *, char **, off_t, int, int, int);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
#define PROC_SCSI_DECL
#else
#define PROC_SCSI_DECL proc_name: "mptscsih",
#endif
#ifdef MPT_SCSI_USE_NEW_EH
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,52)
#define PROC_SCSI_DECL .proc_name = "mptscsih",
#define MPT_SCSIHOST { \
PROC_SCSI_DECL \
......@@ -277,7 +212,9 @@ extern int x_scsi_proc_info(char *, char **, off_t, int, int, int);
.info = x_scsi_info, \
.command = NULL, \
.queuecommand = x_scsi_queuecommand, \
.slave_alloc = x_scsi_slave_alloc, \
.slave_configure = x_scsi_slave_configure, \
.slave_destroy = x_scsi_slave_destroy, \
.eh_strategy_handler = NULL, \
.eh_abort_handler = x_scsi_abort, \
.eh_device_reset_handler = x_scsi_dev_reset, \
......@@ -293,58 +230,6 @@ extern int x_scsi_proc_info(char *, char **, off_t, int, int, int);
.use_clustering = ENABLE_CLUSTERING, \
}
#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,1) */
#define MPT_SCSIHOST { \
.next = NULL, \
PROC_SCSI_DECL \
.proc_info = x_scsi_proc_info, \
.name = "MPT SCSI Host", \
.detect = x_scsi_detect, \
.release = x_scsi_release, \
.info = x_scsi_info, \
.command = NULL, \
.queuecommand = x_scsi_queuecommand, \
.eh_strategy_handler = NULL, \
.eh_abort_handler = x_scsi_abort, \
.eh_device_reset_handler = x_scsi_dev_reset, \
.eh_bus_reset_handler = x_scsi_bus_reset, \
.eh_host_reset_handler = NULL, \
.bios_param = x_scsi_bios_param, \
.can_queue = MPT_SCSI_CAN_QUEUE, \
.this_id = -1, \
.sg_tablesize = MPT_SCSI_SG_DEPTH, \
.cmd_per_lun = MPT_SCSI_CMD_PER_LUN, \
.unchecked_isa_dma = 0, \
.use_clustering = ENABLE_CLUSTERING, \
.use_new_eh_code = 1 \
}
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,1) */
#else /* MPT_SCSI_USE_NEW_EH */
#define MPT_SCSIHOST { \
.next = NULL, \
PROC_SCSI_DECL \
.name = "MPT SCSI Host", \
.detect = x_scsi_detect, \
.release = x_scsi_release, \
.info = x_scsi_info, \
.command = NULL, \
.queuecommand = x_scsi_queuecommand, \
.abort = x_scsi_old_abort, \
.reset = x_scsi_old_reset, \
.bios_param = x_scsi_bios_param, \
.can_queue = MPT_SCSI_CAN_QUEUE, \
.this_id = -1, \
.sg_tablesize = MPT_SCSI_SG_DEPTH, \
.cmd_per_lun = MPT_SCSI_CMD_PER_LUN, \
.unchecked_isa_dma = 0, \
.use_clustering = ENABLE_CLUSTERING \
}
#endif /* MPT_SCSI_USE_NEW_EH */
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
......
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