Commit 53affa1a authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

[PATCH] mpt fusion update from vendor

parent 75a97cd1
...@@ -42,6 +42,16 @@ CONFIG_FUSION ...@@ -42,6 +42,16 @@ CONFIG_FUSION
architecture is based on LSI Logic's Message Passing Interface (MPI) architecture is based on LSI Logic's Message Passing Interface (MPI)
specification. specification.
Maximum number of scatter gather entries
CONFIG_FUSION_MAX_SGE
This option allows you to specify the maximum number of scatter-
gather entries per I/O. The driver defaults to 40, a reasonable number
for most systems. However, the user may increase this up to 128.
Increasing this parameter will require significantly more memory
on a per controller instance. Increasing the parameter is not
necessary (or recommended) unless the user will be running
large I/O's via the raw interface.
CONFIG_FUSION_ISENSE CONFIG_FUSION_ISENSE
The isense module (roughly stands for Interpret SENSE data) is The isense module (roughly stands for Interpret SENSE data) is
completely optional. It simply provides extra English readable completely optional. It simply provides extra English readable
......
...@@ -10,6 +10,7 @@ if [ "$CONFIG_FUSION" = "y" -o "$CONFIG_FUSION" = "m" ]; then ...@@ -10,6 +10,7 @@ if [ "$CONFIG_FUSION" = "y" -o "$CONFIG_FUSION" = "m" ]; then
else else
define_bool CONFIG_FUSION_BOOT n define_bool CONFIG_FUSION_BOOT n
fi fi
int " Maximum number of scatter gather entries" CONFIG_FUSION_MAX_SGE 40
if [ "$CONFIG_MODULES" = "y" ]; then if [ "$CONFIG_MODULES" = "y" ]; then
# How can we force these options to module or nothing? # How can we force these options to module or nothing?
......
...@@ -253,25 +253,36 @@ static __inline__ int __get_order(unsigned long size) ...@@ -253,25 +253,36 @@ static __inline__ int __get_order(unsigned long size)
#endif #endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,28) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,28)
#define mptscsih_save_flags(flags) \ #define mptscsih_lock(iocp, flags) \
({ local_irq_save(flags); \ spin_lock_irqsave(&iocp->FreeQlock, flags)
})
#else #else
#define mptscsih_save_flags(flags) \ #define mptscsih_lock(iocp, flags) \
({ save_flags(flags); \ ({ save_flags(flags); \
cli(); \ cli(); \
}) })
#endif #endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,28) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,28)
#define mptscsih_restore_flags(flags) \ #define mptscsih_unlock(iocp, flags) \
({ local_irq_enable(); \ spin_unlock_irqrestore(&iocp->FreeQlock, flags)
local_irq_restore(flags); \ #else
}) #define mptscsih_unlock(iocp, flags) restore_flags(flags);
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,41)
#define mpt_work_struct work_struct
#define MPT_INIT_WORK(_task, _func, _data) INIT_WORK(_task, _func, _data)
#else #else
#define mptscsih_restore_flags(flags) restore_flags(flags); #define mpt_work_struct tq_struct
#define MPT_INIT_WORK(_task, _func, _data) \
({ (_task)->sync = 0; \
(_task)->routine = (_func); \
(_task)->data = (void *) (_data); \
})
#endif #endif
/*}-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*}-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
#endif /* _LINUX_COMPAT_H */ #endif /* _LINUX_COMPAT_H */
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Title: MPI Message independent structures and definitions * Title: MPI Message independent structures and definitions
* Creation Date: July 27, 2000 * Creation Date: July 27, 2000
* *
* MPI.H Version: 01.02.06 * MPI.H Version: 01.02.07
* *
* Version History * Version History
* --------------- * ---------------
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
* 03-14-02 01.02.04 Added MPI_HEADER_VERSION_ defines. * 03-14-02 01.02.04 Added MPI_HEADER_VERSION_ defines.
* 05-31-02 01.02.05 Bumped MPI_HEADER_VERSION_UNIT. * 05-31-02 01.02.05 Bumped MPI_HEADER_VERSION_UNIT.
* 07-12-02 01.02.06 Added define for MPI_FUNCTION_MAILBOX. * 07-12-02 01.02.06 Added define for MPI_FUNCTION_MAILBOX.
* 09-16-02 01.02.07 Bumped value for MPI_HEADER_VERSION_UNIT.
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
...@@ -75,7 +76,7 @@ ...@@ -75,7 +76,7 @@
/* Note: The major versions of 0xe0 through 0xff are reserved */ /* Note: The major versions of 0xe0 through 0xff are reserved */
/* versioning for this MPI header set */ /* versioning for this MPI header set */
#define MPI_HEADER_VERSION_UNIT (0x07) #define MPI_HEADER_VERSION_UNIT (0x09)
#define MPI_HEADER_VERSION_DEV (0x00) #define MPI_HEADER_VERSION_DEV (0x00)
#define MPI_HEADER_VERSION_UNIT_MASK (0xFF00) #define MPI_HEADER_VERSION_UNIT_MASK (0xFF00)
#define MPI_HEADER_VERSION_UNIT_SHIFT (8) #define MPI_HEADER_VERSION_UNIT_SHIFT (8)
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Title: MPI Config message, structures, and Pages * Title: MPI Config message, structures, and Pages
* Creation Date: July 27, 2000 * Creation Date: July 27, 2000
* *
* MPI_CNFG.H Version: 01.02.08 * MPI_CNFG.H Version: 01.02.09
* *
* Version History * Version History
* --------------- * ---------------
...@@ -127,6 +127,7 @@ ...@@ -127,6 +127,7 @@
* MPI_SCSIDEVPAGE1_CONF_EXTENDED_PARAMS_ENABLE. * MPI_SCSIDEVPAGE1_CONF_EXTENDED_PARAMS_ENABLE.
* Added new config page: CONFIG_PAGE_SCSI_DEVICE_3. * Added new config page: CONFIG_PAGE_SCSI_DEVICE_3.
* Modified MPI_FCPORTPAGE5_FLAGS_ defines. * Modified MPI_FCPORTPAGE5_FLAGS_ defines.
* 09-16-02 01.02.09 Added more MPI_SCSIDEVPAGE1_CONF_FORCE_PPR_MSG define.
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
...@@ -814,6 +815,7 @@ typedef struct _CONFIG_PAGE_SCSI_DEVICE_1 ...@@ -814,6 +815,7 @@ typedef struct _CONFIG_PAGE_SCSI_DEVICE_1
#define MPI_SCSIDEVPAGE1_CONF_WDTR_DISALLOWED (0x00000002) #define MPI_SCSIDEVPAGE1_CONF_WDTR_DISALLOWED (0x00000002)
#define MPI_SCSIDEVPAGE1_CONF_SDTR_DISALLOWED (0x00000004) #define MPI_SCSIDEVPAGE1_CONF_SDTR_DISALLOWED (0x00000004)
#define MPI_SCSIDEVPAGE1_CONF_EXTENDED_PARAMS_ENABLE (0x00000008) #define MPI_SCSIDEVPAGE1_CONF_EXTENDED_PARAMS_ENABLE (0x00000008)
#define MPI_SCSIDEVPAGE1_CONF_FORCE_PPR_MSG (0x00000010)
typedef struct _CONFIG_PAGE_SCSI_DEVICE_2 typedef struct _CONFIG_PAGE_SCSI_DEVICE_2
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Title: MPI Target mode messages and structures * Title: MPI Target mode messages and structures
* Creation Date: June 22, 2000 * Creation Date: June 22, 2000
* *
* MPI_TARG.H Version: 01.02.06 * MPI_TARG.H Version: 01.02.07
* *
* Version History * Version History
* --------------- * ---------------
...@@ -39,6 +39,8 @@ ...@@ -39,6 +39,8 @@
* 05-31-02 01.02.06 Modified TARGET_MODE_REPLY_ALIAS_MASK to only include * 05-31-02 01.02.06 Modified TARGET_MODE_REPLY_ALIAS_MASK to only include
* one bit. * one bit.
* Added AliasIndex field to MPI_TARGET_FCP_CMD_BUFFER. * Added AliasIndex field to MPI_TARGET_FCP_CMD_BUFFER.
* 09-16-02 01.02.07 Added flags for confirmed completion.
* Added PRIORITY_REASON_TARGET_BUSY.
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
...@@ -138,6 +140,7 @@ typedef struct _MSG_PRIORITY_CMD_RECEIVED_REPLY ...@@ -138,6 +140,7 @@ typedef struct _MSG_PRIORITY_CMD_RECEIVED_REPLY
#define PRIORITY_REASON_PROTOCOL_ERR (0x06) #define PRIORITY_REASON_PROTOCOL_ERR (0x06)
#define PRIORITY_REASON_DATA_OUT_PARITY_ERR (0x07) #define PRIORITY_REASON_DATA_OUT_PARITY_ERR (0x07)
#define PRIORITY_REASON_DATA_OUT_CRC_ERR (0x08) #define PRIORITY_REASON_DATA_OUT_CRC_ERR (0x08)
#define PRIORITY_REASON_TARGET_BUSY (0x09)
#define PRIORITY_REASON_UNKNOWN (0xFF) #define PRIORITY_REASON_UNKNOWN (0xFF)
...@@ -217,6 +220,7 @@ typedef struct _MSG_TARGET_ASSIST_REQUEST ...@@ -217,6 +220,7 @@ typedef struct _MSG_TARGET_ASSIST_REQUEST
#define TARGET_ASSIST_FLAGS_DATA_DIRECTION (0x01) #define TARGET_ASSIST_FLAGS_DATA_DIRECTION (0x01)
#define TARGET_ASSIST_FLAGS_AUTO_STATUS (0x02) #define TARGET_ASSIST_FLAGS_AUTO_STATUS (0x02)
#define TARGET_ASSIST_FLAGS_HIGH_PRIORITY (0x04) #define TARGET_ASSIST_FLAGS_HIGH_PRIORITY (0x04)
#define TARGET_ASSIST_FLAGS_CONFIRMED (0x08)
#define TARGET_ASSIST_FLAGS_REPOST_CMD_BUFFER (0x80) #define TARGET_ASSIST_FLAGS_REPOST_CMD_BUFFER (0x80)
...@@ -261,6 +265,7 @@ typedef struct _MSG_TARGET_STATUS_SEND_REQUEST ...@@ -261,6 +265,7 @@ typedef struct _MSG_TARGET_STATUS_SEND_REQUEST
#define TARGET_STATUS_SEND_FLAGS_AUTO_GOOD_STATUS (0x01) #define TARGET_STATUS_SEND_FLAGS_AUTO_GOOD_STATUS (0x01)
#define TARGET_STATUS_SEND_FLAGS_HIGH_PRIORITY (0x04) #define TARGET_STATUS_SEND_FLAGS_HIGH_PRIORITY (0x04)
#define TARGET_STATUS_SEND_FLAGS_CONFIRMED (0x08)
#define TARGET_STATUS_SEND_FLAGS_REPOST_CMD_BUFFER (0x80) #define TARGET_STATUS_SEND_FLAGS_REPOST_CMD_BUFFER (0x80)
/* /*
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
* (mailto:sjralston1@netscape.net) * (mailto:sjralston1@netscape.net)
* (mailto:Pam.Delaney@lsil.com) * (mailto:Pam.Delaney@lsil.com)
* *
* $Id: mptbase.c,v 1.121 2002/07/23 18:56:59 pdelaney Exp $ * $Id: mptbase.c,v 1.122 2002/10/03 13:10:11 pdelaney Exp $
*/ */
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/* /*
...@@ -1416,10 +1416,30 @@ mpt_adapter_install(struct pci_dev *pdev) ...@@ -1416,10 +1416,30 @@ mpt_adapter_install(struct pci_dev *pdev)
else if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC929X) { else if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC929X) {
ioc->chip_type = FC929X; ioc->chip_type = FC929X;
ioc->prod_name = "LSIFC929X"; ioc->prod_name = "LSIFC929X";
{
/* 929X Chip Fix. Set Split transactions level
* for PCIX. Set bits 5 - 6 to zero, turn on bit 4.
*/
u16 pcixcmd = 0;
pci_read_config_word(pdev, 0x6a, &pcixcmd);
pcixcmd &= 0xFF9F;
pcixcmd |= 0x0010;
pci_write_config_word(pdev, 0x6a, pcixcmd);
}
} }
else if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC919X) { else if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC919X) {
ioc->chip_type = FC919X; ioc->chip_type = FC919X;
ioc->prod_name = "LSIFC919X"; ioc->prod_name = "LSIFC919X";
{
/* 919X Chip Fix. Set Split transactions level
* for PCIX. Set bits 5 - 6 to zero, turn on bit 4.
*/
u16 pcixcmd = 0;
pci_read_config_word(pdev, 0x6a, &pcixcmd);
pcixcmd &= 0xFF9F;
pcixcmd |= 0x0010;
pci_write_config_word(pdev, 0x6a, pcixcmd);
}
} }
else if (pdev->device == MPI_MANUFACTPAGE_DEVID_53C1030) { else if (pdev->device == MPI_MANUFACTPAGE_DEVID_53C1030) {
ioc->chip_type = C1030; ioc->chip_type = C1030;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* (mailto:sjralston1@netscape.net) * (mailto:sjralston1@netscape.net)
* (mailto:Pam.Delaney@lsil.com) * (mailto:Pam.Delaney@lsil.com)
* *
* $Id: mptbase.h,v 1.133 2002/09/05 22:30:09 pdelaney Exp $ * $Id: mptbase.h,v 1.134 2002/10/03 13:10:12 pdelaney Exp $
*/ */
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/* /*
...@@ -80,8 +80,8 @@ ...@@ -80,8 +80,8 @@
#define COPYRIGHT "Copyright (c) 1999-2002 " MODULEAUTHOR #define COPYRIGHT "Copyright (c) 1999-2002 " MODULEAUTHOR
#endif #endif
#define MPT_LINUX_VERSION_COMMON "2.02.01.01" #define MPT_LINUX_VERSION_COMMON "2.02.01.07"
#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-2.02.01.01" #define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-2.02.01.07"
#define WHAT_MAGIC_STRING "@" "(" "#" ")" #define WHAT_MAGIC_STRING "@" "(" "#" ")"
#define show_mptmod_ver(s,ver) \ #define show_mptmod_ver(s,ver) \
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
/* /*
* Fusion MPT(linux) driver configurable stuff... * Fusion MPT(linux) driver configurable stuff...
*/ */
#define MPT_MAX_ADAPTERS 16 #define MPT_MAX_ADAPTERS 18
#define MPT_MAX_PROTOCOL_DRIVERS 16 #define MPT_MAX_PROTOCOL_DRIVERS 16
#define MPT_MAX_BUS 1 #define MPT_MAX_BUS 1
#define MPT_MAX_FC_DEVICES 255 #define MPT_MAX_FC_DEVICES 255
...@@ -397,8 +397,10 @@ typedef struct _VirtDevice { ...@@ -397,8 +397,10 @@ typedef struct _VirtDevice {
ScsiCmndTracker SentQ; ScsiCmndTracker SentQ;
ScsiCmndTracker DoneQ; ScsiCmndTracker DoneQ;
//--- LUN split here? //--- LUN split here?
#ifdef MPT_SAVE_AUTOSENSE
u8 sense[SCSI_STD_SENSE_BYTES]; /* 18 */ u8 sense[SCSI_STD_SENSE_BYTES]; /* 18 */
u8 rsvd2[2]; /* alignment */ u8 rsvd2[2]; /* alignment */
#endif
u32 luns; /* Max LUNs is 32 */ u32 luns; /* Max LUNs is 32 */
u8 inq_data[SCSI_STD_INQUIRY_BYTES]; /* 36 */ u8 inq_data[SCSI_STD_INQUIRY_BYTES]; /* 36 */
u8 pad0[4]; u8 pad0[4];
...@@ -424,7 +426,9 @@ typedef struct _VirtDevice { ...@@ -424,7 +426,9 @@ typedef struct _VirtDevice {
#define MPT_TARGET_DEFAULT_DV_STATUS 0 #define MPT_TARGET_DEFAULT_DV_STATUS 0
#define MPT_TARGET_FLAGS_VALID_NEGO 0x01 #define MPT_TARGET_FLAGS_VALID_NEGO 0x01
#define MPT_TARGET_FLAGS_VALID_INQUIRY 0x02 #define MPT_TARGET_FLAGS_VALID_INQUIRY 0x02
#ifdef MPT_SAVE_AUTOSENSE
#define MPT_TARGET_FLAGS_VALID_SENSE 0x04 #define MPT_TARGET_FLAGS_VALID_SENSE 0x04
#endif
#define MPT_TARGET_FLAGS_Q_YES 0x08 #define MPT_TARGET_FLAGS_Q_YES 0x08
#define MPT_TARGET_FLAGS_VALID_56 0x10 #define MPT_TARGET_FLAGS_VALID_56 0x10
...@@ -890,6 +894,8 @@ typedef struct _MPT_SCSI_HOST { ...@@ -890,6 +894,8 @@ typedef struct _MPT_SCSI_HOST {
MPT_Q_TRACKER taskQ; /* TM request Q */ MPT_Q_TRACKER taskQ; /* TM request Q */
spinlock_t freedoneQlock; spinlock_t freedoneQlock;
int taskQcnt; int taskQcnt;
int num_chain; /* Number of chain buffers */
int max_sge; /* Max No of SGE*/
u8 numTMrequests; u8 numTMrequests;
u8 tmPending; u8 tmPending;
u8 resetPending; u8 resetPending;
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
* (mailto:sjralston1@netscape.net) * (mailto:sjralston1@netscape.net)
* (mailto:Pam.Delaney@lsil.com) * (mailto:Pam.Delaney@lsil.com)
* *
* $Id: mptctl.c,v 1.59 2002/09/05 22:30:10 pdelaney Exp $ * $Id: mptctl.c,v 1.60 2002/10/03 13:10:13 pdelaney Exp $
*/ */
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/* /*
...@@ -627,7 +627,7 @@ mptctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned ...@@ -627,7 +627,7 @@ mptctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned
/* Test for Compaq-specific IOCTL's. /* Test for Compaq-specific IOCTL's.
*/ */
if ((cmd == CPQFCTS_GETPCIINFO) || (cmd == CPQFCTS_CTLR_STATUS) || if ((cmd == CPQFCTS_GETPCIINFO) || (cmd == CPQFCTS_CTLR_STATUS) ||
(cmd == CPQFCTS_GETDRIVER) || (cmd == CPQFCTS_SCSI_PASSTHRU) || (cmd == CPQFCTS_GETDRIVVER) || (cmd == CPQFCTS_SCSI_PASSTHRU) ||
(cmd == CPQFCTS_SCSI_IOCTL_FC_TARGET_ADDRESS)) (cmd == CPQFCTS_SCSI_IOCTL_FC_TARGET_ADDRESS))
return mptctl_compaq_ioctl(file, cmd, arg); return mptctl_compaq_ioctl(file, cmd, arg);
...@@ -2406,7 +2406,7 @@ mptctl_compaq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -2406,7 +2406,7 @@ mptctl_compaq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case CPQFCTS_GETPCIINFO: case CPQFCTS_GETPCIINFO:
ret = mptctl_cpq_getpciinfo(arg); ret = mptctl_cpq_getpciinfo(arg);
break; break;
case CPQFCTS_GETDRIVER: case CPQFCTS_GETDRIVVER:
ret = mptctl_cpq_getdriver(arg); ret = mptctl_cpq_getdriver(arg);
break; break;
case CPQFCTS_CTLR_STATUS: case CPQFCTS_CTLR_STATUS:
...@@ -3180,7 +3180,7 @@ int __init mptctl_init(void) ...@@ -3180,7 +3180,7 @@ int __init mptctl_init(void)
if (++where && err) goto out_fail; if (++where && err) goto out_fail;
err = register_ioctl32_conversion(CPQFCTS_CTLR_STATUS, NULL); err = register_ioctl32_conversion(CPQFCTS_CTLR_STATUS, NULL);
if (++where && err) goto out_fail; if (++where && err) goto out_fail;
err = register_ioctl32_conversion(CPQFCTS_GETDRIVER, NULL); err = register_ioctl32_conversion(CPQFCTS_GETDRIVVER, NULL);
if (++where && err) goto out_fail; if (++where && err) goto out_fail;
err = register_ioctl32_conversion(CPQFCTS_SCSI_IOCTL_FC_TARGET_ADDRESS, NULL); err = register_ioctl32_conversion(CPQFCTS_SCSI_IOCTL_FC_TARGET_ADDRESS, NULL);
if (++where && err) goto out_fail; if (++where && err) goto out_fail;
...@@ -3234,7 +3234,7 @@ int __init mptctl_init(void) ...@@ -3234,7 +3234,7 @@ int __init mptctl_init(void)
unregister_ioctl32_conversion(MPTCOMMAND32); unregister_ioctl32_conversion(MPTCOMMAND32);
unregister_ioctl32_conversion(MPTFWDOWNLOAD32); unregister_ioctl32_conversion(MPTFWDOWNLOAD32);
unregister_ioctl32_conversion(CPQFCTS_GETPCIINFO); unregister_ioctl32_conversion(CPQFCTS_GETPCIINFO);
unregister_ioctl32_conversion(CPQFCTS_GETDRIVER); unregister_ioctl32_conversion(CPQFCTS_GETDRIVVER);
unregister_ioctl32_conversion(CPQFCTS_CTLR_STATUS); unregister_ioctl32_conversion(CPQFCTS_CTLR_STATUS);
unregister_ioctl32_conversion(CPQFCTS_SCSI_IOCTL_FC_TARGET_ADDRESS); unregister_ioctl32_conversion(CPQFCTS_SCSI_IOCTL_FC_TARGET_ADDRESS);
unregister_ioctl32_conversion(CPQFCTS_SCSI_PASSTHRU32); unregister_ioctl32_conversion(CPQFCTS_SCSI_PASSTHRU32);
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
* (mailto:sjralston1@netscape.net) * (mailto:sjralston1@netscape.net)
* (mailto:Pam.Delaney@lsil.com) * (mailto:Pam.Delaney@lsil.com)
* *
* $Id: mptctl.h,v 1.10 2002/05/28 15:57:16 pdelaney Exp $ * $Id: mptctl.h,v 1.11 2002/10/03 13:10:13 pdelaney Exp $
*/ */
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/* /*
...@@ -319,12 +319,12 @@ struct mpt_ioctl_command32 { ...@@ -319,12 +319,12 @@ struct mpt_ioctl_command32 {
#define CPQFCTS_IOC_MAGIC 'Z' #define CPQFCTS_IOC_MAGIC 'Z'
#define CPQFCTS_GETPCIINFO _IOR(CPQFCTS_IOC_MAGIC, 1, cpqfc_pci_info_struct) #define CPQFCTS_GETPCIINFO _IOR(CPQFCTS_IOC_MAGIC, 1, cpqfc_pci_info_struct)
#define CPQFCTS_GETDRIVER _IOR(CPQFCTS_IOC_MAGIC, 2, int) #define CPQFCTS_GETDRIVVER _IOR(CPQFCTS_IOC_MAGIC, 9, int)
#define CPQFCTS_CTLR_STATUS _IOR(CPQFCTS_IOC_MAGIC, 3, struct _cpqfc_ctlr_status) #define CPQFCTS_CTLR_STATUS _IOR(CPQFCTS_IOC_MAGIC, 3, struct _cpqfc_ctlr_status)
#define CPQFCTS_SCSI_IOCTL_FC_TARGET_ADDRESS _IOR(CPQFCTS_IOC_MAGIC, 4, struct scsi_fctargaddress) #define CPQFCTS_SCSI_IOCTL_FC_TARGET_ADDRESS _IOR(CPQFCTS_IOC_MAGIC, 13, struct scsi_fctargaddress)
#define CPQFCTS_SCSI_PASSTHRU _IOWR(CPQFCTS_IOC_MAGIC, 5, VENDOR_IOCTL_REQ) #define CPQFCTS_SCSI_PASSTHRU _IOWR(CPQFCTS_IOC_MAGIC, 11, VENDOR_IOCTL_REQ)
#if defined(__sparc__) && defined(__sparc_v9__) #if defined(__sparc__) && defined(__sparc_v9__)
#define CPQFCTS_SCSI_PASSTHRU32 _IOWR(CPQFCTS_IOC_MAGIC, 5, VENDOR_IOCTL_REQ32) #define CPQFCTS_SCSI_PASSTHRU32 _IOWR(CPQFCTS_IOC_MAGIC, 11, VENDOR_IOCTL_REQ32)
#endif #endif
typedef struct { typedef struct {
......
...@@ -132,7 +132,7 @@ struct mpt_lan_priv { ...@@ -132,7 +132,7 @@ struct mpt_lan_priv {
u32 total_received; u32 total_received;
struct net_device_stats stats; /* Per device statistics */ struct net_device_stats stats; /* Per device statistics */
struct work_struct post_buckets_task; struct mpt_work_struct post_buckets_task;
unsigned long post_buckets_active; unsigned long post_buckets_active;
}; };
...@@ -876,9 +876,22 @@ mpt_lan_wake_post_buckets_task(struct net_device *dev, int priority) ...@@ -876,9 +876,22 @@ mpt_lan_wake_post_buckets_task(struct net_device *dev, int priority)
if (test_and_set_bit(0, &priv->post_buckets_active) == 0) { if (test_and_set_bit(0, &priv->post_buckets_active) == 0) {
if (priority) { if (priority) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,41)
schedule_work(&priv->post_buckets_task); 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);
#endif
} else { } else {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,41)
schedule_delayed_work(&priv->post_buckets_task, 1); 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
dioprintk((KERN_INFO MYNAM ": post_buckets queued on " dioprintk((KERN_INFO MYNAM ": post_buckets queued on "
"timer.\n")); "timer.\n"));
} }
...@@ -1364,8 +1377,8 @@ mpt_register_lan_device (MPT_ADAPTER *mpt_dev, int pnum) ...@@ -1364,8 +1377,8 @@ mpt_register_lan_device (MPT_ADAPTER *mpt_dev, int pnum)
priv->mpt_dev = mpt_dev; priv->mpt_dev = mpt_dev;
priv->pnum = pnum; priv->pnum = pnum;
memset(&priv->post_buckets_task, 0, sizeof(struct work_struct)); memset(&priv->post_buckets_task, 0, sizeof(struct mpt_work_struct));
INIT_WORK(&priv->post_buckets_task, mpt_lan_post_receive_buckets, dev); MPT_INIT_WORK(&priv->post_buckets_task, mpt_lan_post_receive_buckets, dev);
priv->post_buckets_active = 0; priv->post_buckets_active = 0;
dlprintk((KERN_INFO MYNAM "@%d: bucketlen = %d\n", dlprintk((KERN_INFO MYNAM "@%d: bucketlen = %d\n",
......
...@@ -20,7 +20,11 @@ ...@@ -20,7 +20,11 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,41)
#include <linux/tqueue.h>
#else
#include <linux/workqueue.h> #include <linux/workqueue.h>
#endif
#include <linux/delay.h> #include <linux/delay.h>
// #include <linux/trdevice.h> // #include <linux/trdevice.h>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* (mailto:sjralston1@netscape.net) * (mailto:sjralston1@netscape.net)
* (mailto:Pam.Delaney@lsil.com) * (mailto:Pam.Delaney@lsil.com)
* *
* $Id: mptscsih.c,v 1.101 2002/09/05 22:30:11 pdelaney Exp $ * $Id: mptscsih.c,v 1.102 2002/10/03 13:10:14 pdelaney Exp $
*/ */
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/* /*
...@@ -76,7 +76,6 @@ ...@@ -76,7 +76,6 @@
#include <linux/delay.h> /* for mdelay */ #include <linux/delay.h> /* for mdelay */
#include <linux/interrupt.h> /* needed for in_interrupt() proto */ #include <linux/interrupt.h> /* needed for in_interrupt() proto */
#include <linux/reboot.h> /* notifier code */ #include <linux/reboot.h> /* notifier code */
#include <linux/workqueue.h>
#include "../../scsi/scsi.h" #include "../../scsi/scsi.h"
#include "../../scsi/hosts.h" #include "../../scsi/hosts.h"
#include "../../scsi/sd.h" #include "../../scsi/sd.h"
...@@ -165,7 +164,6 @@ static int mptscsih_AddSGE(MPT_SCSI_HOST *hd, Scsi_Cmnd *SCpnt, ...@@ -165,7 +164,6 @@ static int mptscsih_AddSGE(MPT_SCSI_HOST *hd, Scsi_Cmnd *SCpnt,
static int mptscsih_getFreeChainBuffer(MPT_SCSI_HOST *hd, int *retIndex); static int mptscsih_getFreeChainBuffer(MPT_SCSI_HOST *hd, int *retIndex);
static void mptscsih_freeChainBuffers(MPT_SCSI_HOST *hd, int req_idx); static void mptscsih_freeChainBuffers(MPT_SCSI_HOST *hd, int req_idx);
static int mptscsih_initChainBuffers (MPT_SCSI_HOST *hd, int init); static int mptscsih_initChainBuffers (MPT_SCSI_HOST *hd, int init);
static void copy_sense_data(Scsi_Cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR *mf, SCSIIOReply_t *pScsiReply); static void copy_sense_data(Scsi_Cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR *mf, SCSIIOReply_t *pScsiReply);
#ifndef MPT_SCSI_USE_NEW_EH #ifndef MPT_SCSI_USE_NEW_EH
static void search_taskQ_for_cmd(Scsi_Cmnd *sc, MPT_SCSI_HOST *hd); static void search_taskQ_for_cmd(Scsi_Cmnd *sc, MPT_SCSI_HOST *hd);
...@@ -184,7 +182,9 @@ static int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pE ...@@ -184,7 +182,9 @@ static int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pE
static VirtDevice *mptscsih_initTarget(MPT_SCSI_HOST *hd, int bus_id, int target_id, u8 lun, char *data, int dlen); static VirtDevice *mptscsih_initTarget(MPT_SCSI_HOST *hd, int bus_id, int target_id, u8 lun, char *data, int dlen);
void mptscsih_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtDevice *target, char byte56); void mptscsih_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtDevice *target, char byte56);
#ifdef MPT_SAVE_AUTOSENSE
static void clear_sense_flag(MPT_SCSI_HOST *hd, SCSIIORequest_t *pReq); static void clear_sense_flag(MPT_SCSI_HOST *hd, SCSIIORequest_t *pReq);
#endif
static void mptscsih_set_dvflags(MPT_SCSI_HOST *hd, SCSIIORequest_t *pReq); static void mptscsih_set_dvflags(MPT_SCSI_HOST *hd, SCSIIORequest_t *pReq);
static void mptscsih_setDevicePage1Flags (u8 width, u8 factor, u8 offset, int *requestedPtr, int *configurationPtr, u8 flags); static void mptscsih_setDevicePage1Flags (u8 width, u8 factor, u8 offset, int *requestedPtr, int *configurationPtr, u8 flags);
static void mptscsih_no_negotiate(MPT_SCSI_HOST *hd, int target_id); static void mptscsih_no_negotiate(MPT_SCSI_HOST *hd, int target_id);
...@@ -245,7 +245,7 @@ static struct proc_dir_entry proc_mpt_scsihost = ...@@ -245,7 +245,7 @@ static struct proc_dir_entry proc_mpt_scsihost =
*/ */
static spinlock_t mytaskQ_lock = SPIN_LOCK_UNLOCKED; static spinlock_t mytaskQ_lock = SPIN_LOCK_UNLOCKED;
static int mytaskQ_bh_active = 0; static int mytaskQ_bh_active = 0;
static struct work_struct mptscsih_ptaskfoo; static struct mpt_work_struct mptscsih_ptaskfoo;
static atomic_t mpt_taskQdepth; static atomic_t mpt_taskQdepth;
#endif #endif
...@@ -256,7 +256,7 @@ static atomic_t mpt_taskQdepth; ...@@ -256,7 +256,7 @@ static atomic_t mpt_taskQdepth;
static spinlock_t dvtaskQ_lock = SPIN_LOCK_UNLOCKED; static spinlock_t dvtaskQ_lock = SPIN_LOCK_UNLOCKED;
static int dvtaskQ_active = 0; static int dvtaskQ_active = 0;
static int dvtaskQ_release = 0; static int dvtaskQ_release = 0;
static struct work_struct mptscsih_dvTask; static struct mpt_work_struct mptscsih_dvTask;
#endif #endif
/* /*
...@@ -352,7 +352,9 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr) ...@@ -352,7 +352,9 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
dlen); dlen);
} }
} }
#ifdef MPT_SAVE_AUTOSENSE
clear_sense_flag(hd, pScsiReq); clear_sense_flag(hd, pScsiReq);
#endif
} else { } else {
u32 xfer_cnt; u32 xfer_cnt;
u16 status; u16 status;
...@@ -437,17 +439,21 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr) ...@@ -437,17 +439,21 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
* precedence! * precedence!
*/ */
sc->result = (DID_OK << 16) | pScsiReply->SCSIStatus; sc->result = (DID_OK << 16) | pScsiReply->SCSIStatus;
#ifdef MPT_SAVE_AUTOSENSE
clear_sense_flag(hd, pScsiReq); clear_sense_flag(hd, pScsiReq);
if (pScsiReply->SCSIState & MPI_SCSI_STATE_AUTOSENSE_VALID) { #endif
if (scsi_state == 0) {
;
} else if (scsi_state & MPI_SCSI_STATE_AUTOSENSE_VALID) {
/* Have already saved the status and sense data /* Have already saved the status and sense data
*/ */
; ;
} else if (pScsiReply->SCSIState & (MPI_SCSI_STATE_AUTOSENSE_FAILED | MPI_SCSI_STATE_NO_SCSI_STATUS)) { } else if (scsi_state & (MPI_SCSI_STATE_AUTOSENSE_FAILED | MPI_SCSI_STATE_NO_SCSI_STATUS)) {
/* What to do? /* What to do?
*/ */
sc->result = DID_SOFT_ERROR << 16; sc->result = DID_SOFT_ERROR << 16;
} }
else if (pScsiReply->SCSIState & MPI_SCSI_STATE_TERMINATED) { else if (scsi_state & MPI_SCSI_STATE_TERMINATED) {
/* Not real sure here either... */ /* Not real sure here either... */
sc->result = DID_RESET << 16; sc->result = DID_RESET << 16;
} }
...@@ -488,9 +494,12 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr) ...@@ -488,9 +494,12 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
case MPI_IOCSTATUS_SCSI_RECOVERED_ERROR: /* 0x0040 */ case MPI_IOCSTATUS_SCSI_RECOVERED_ERROR: /* 0x0040 */
case MPI_IOCSTATUS_SUCCESS: /* 0x0000 */ case MPI_IOCSTATUS_SUCCESS: /* 0x0000 */
sc->result = (DID_OK << 16) | pScsiReply->SCSIStatus; sc->result = (DID_OK << 16) | pScsiReply->SCSIStatus;
#ifdef MPT_SAVE_AUTOSENSE
clear_sense_flag(hd, pScsiReq); clear_sense_flag(hd, pScsiReq);
#endif
if (pScsiReply->SCSIState & MPI_SCSI_STATE_AUTOSENSE_VALID) { if (scsi_state == 0) {
;
} else if (scsi_state & MPI_SCSI_STATE_AUTOSENSE_VALID) {
/* /*
* If running agains circa 200003dd 909 MPT f/w, * If running agains circa 200003dd 909 MPT f/w,
* may get this (AUTOSENSE_VALID) for actual TASK_SET_FULL * may get this (AUTOSENSE_VALID) for actual TASK_SET_FULL
...@@ -521,7 +530,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr) ...@@ -521,7 +530,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
#endif #endif
} }
else if (pScsiReply->SCSIState & else if (scsi_state &
(MPI_SCSI_STATE_AUTOSENSE_FAILED | MPI_SCSI_STATE_NO_SCSI_STATUS) (MPI_SCSI_STATE_AUTOSENSE_FAILED | MPI_SCSI_STATE_NO_SCSI_STATUS)
) { ) {
/* /*
...@@ -529,11 +538,11 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr) ...@@ -529,11 +538,11 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
*/ */
sc->result = DID_SOFT_ERROR << 16; sc->result = DID_SOFT_ERROR << 16;
} }
else if (pScsiReply->SCSIState & MPI_SCSI_STATE_TERMINATED) { else if (scsi_state & MPI_SCSI_STATE_TERMINATED) {
/* Not real sure here either... */ /* Not real sure here either... */
sc->result = DID_RESET << 16; sc->result = DID_RESET << 16;
} }
else if (pScsiReply->SCSIState & MPI_SCSI_STATE_QUEUE_TAG_REJECTED) { else if (scsi_state & MPI_SCSI_STATE_QUEUE_TAG_REJECTED) {
/* Device Inq. data indicates that it supports /* Device Inq. data indicates that it supports
* QTags, but rejects QTag messages. * QTags, but rejects QTag messages.
* This command completed OK. * This command completed OK.
...@@ -1024,21 +1033,13 @@ mptscsih_initChainBuffers (MPT_SCSI_HOST *hd, int init) ...@@ -1024,21 +1033,13 @@ mptscsih_initChainBuffers (MPT_SCSI_HOST *hd, int init)
MPT_FRAME_HDR *chain; MPT_FRAME_HDR *chain;
u8 *mem; u8 *mem;
unsigned long flags; unsigned long flags;
int sz, ii, numChain; int sz, ii, num_chain;
int scale, num_sge;
/* ReqToChain size must equal the req_depth
/* Chain buffer allocations * index = req_idx
* Allocate and initialize tracker structures
*/ */
if (hd->ioc->req_sz <= 64) sz = hd->ioc->req_depth * sizeof(int);
numChain = MPT_SG_REQ_64_SCALE * hd->ioc->req_depth;
else if (hd->ioc->req_sz <= 96)
numChain = MPT_SG_REQ_96_SCALE * hd->ioc->req_depth;
else
numChain = MPT_SG_REQ_128_SCALE * hd->ioc->req_depth;
sz = numChain * sizeof(int);
if (hd->ReqToChain == NULL) { if (hd->ReqToChain == NULL) {
mem = kmalloc(sz, GFP_ATOMIC); mem = kmalloc(sz, GFP_ATOMIC);
if (mem == NULL) if (mem == NULL)
...@@ -1050,6 +1051,38 @@ mptscsih_initChainBuffers (MPT_SCSI_HOST *hd, int init) ...@@ -1050,6 +1051,38 @@ mptscsih_initChainBuffers (MPT_SCSI_HOST *hd, int init)
} }
memset(mem, 0xFF, sz); memset(mem, 0xFF, sz);
/* ChainToChain size must equal the total number
* of chain buffers to be allocated.
* index = chain_idx
*
* Calculate the number of chain buffers needed(plus 1) per I/O
* then multiply the the maximum number of simultaneous cmds
*
* num_sge = num sge in request frame + last chain buffer
* scale = num sge per chain buffer if no chain element
*/
scale = hd->ioc->req_sz/(sizeof(dma_addr_t) + sizeof(u32));
if (sizeof(dma_addr_t) == sizeof(u64))
num_sge = scale + (hd->ioc->req_sz - 60) / (sizeof(dma_addr_t) + sizeof(u32));
else
num_sge = 1+ scale + (hd->ioc->req_sz - 64) / (sizeof(dma_addr_t) + sizeof(u32));
num_chain = 1;
while (hd->max_sge - num_sge > 0) {
num_chain++;
num_sge += (scale - 1);
}
num_chain++;
if ((int) hd->ioc->chip_type > (int) FC929)
num_chain *= MPT_SCSI_CAN_QUEUE;
else
num_chain *= MPT_FC_CAN_QUEUE;
hd->num_chain = num_chain;
sz = num_chain * sizeof(int);
if (hd->ChainToChain == NULL) { if (hd->ChainToChain == NULL) {
mem = kmalloc(sz, GFP_ATOMIC); mem = kmalloc(sz, GFP_ATOMIC);
if (mem == NULL) if (mem == NULL)
...@@ -1061,10 +1094,10 @@ mptscsih_initChainBuffers (MPT_SCSI_HOST *hd, int init) ...@@ -1061,10 +1094,10 @@ mptscsih_initChainBuffers (MPT_SCSI_HOST *hd, int init)
} }
memset(mem, 0xFF, sz); memset(mem, 0xFF, sz);
sz = num_chain * hd->ioc->req_sz;
if (hd->ChainBuffer == NULL) { if (hd->ChainBuffer == NULL) {
/* Allocate free chain buffer pool /* Allocate free chain buffer pool
*/ */
sz = numChain * hd->ioc->req_sz;
mem = pci_alloc_consistent(hd->ioc->pcidev, sz, &hd->ChainBufferDMA); mem = pci_alloc_consistent(hd->ioc->pcidev, sz, &hd->ChainBufferDMA);
if (mem == NULL) if (mem == NULL)
return -1; return -1;
...@@ -1090,7 +1123,7 @@ mptscsih_initChainBuffers (MPT_SCSI_HOST *hd, int init) ...@@ -1090,7 +1123,7 @@ mptscsih_initChainBuffers (MPT_SCSI_HOST *hd, int init)
/* Post the chain buffers to the FreeChainQ. /* Post the chain buffers to the FreeChainQ.
*/ */
mem = (u8 *)hd->ChainBuffer; mem = (u8 *)hd->ChainBuffer;
for (ii=0; ii < numChain; ii++) { for (ii=0; ii < num_chain; ii++) {
chain = (MPT_FRAME_HDR *) mem; chain = (MPT_FRAME_HDR *) mem;
Q_ADD_TAIL(&hd->FreeChainQ.head, &chain->u.frame.linkage, MPT_FRAME_HDR); Q_ADD_TAIL(&hd->FreeChainQ.head, &chain->u.frame.linkage, MPT_FRAME_HDR);
mem += hd->ioc->req_sz; mem += hd->ioc->req_sz;
...@@ -1227,7 +1260,7 @@ mptscsih_detect(Scsi_Host_Template *tpnt) ...@@ -1227,7 +1260,7 @@ mptscsih_detect(Scsi_Host_Template *tpnt)
#endif #endif
sh = scsi_register(tpnt, sizeof(MPT_SCSI_HOST)); sh = scsi_register(tpnt, sizeof(MPT_SCSI_HOST));
if (sh != NULL) { if (sh != NULL) {
mptscsih_save_flags(flags); mptscsih_lock(this, flags);
sh->io_port = 0; sh->io_port = 0;
sh->n_io_port = 0; sh->n_io_port = 0;
sh->irq = 0; sh->irq = 0;
...@@ -1254,12 +1287,21 @@ mptscsih_detect(Scsi_Host_Template *tpnt) ...@@ -1254,12 +1287,21 @@ mptscsih_detect(Scsi_Host_Template *tpnt)
} }
sh->max_lun = MPT_LAST_LUN + 1; sh->max_lun = MPT_LAST_LUN + 1;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,7)
sh->max_sectors = MPT_SCSI_MAX_SECTORS;
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,1)
sh->highmem_io = 1;
#endif
sh->this_id = this->pfacts[portnum].PortSCSIID; sh->this_id = this->pfacts[portnum].PortSCSIID;
/* OS entry to allow host drivers to force /* OS entry to allow host drivers to force
* a queue depth on a per device basis. * a queue depth on a per device basis.
*/ */
sh->select_queue_depths = mptscsih_select_queue_depths; sh->select_queue_depths = mptscsih_select_queue_depths;
/* Required entry.
*/
sh->unique_id = this->id;
/* Verify that we won't exceed the maximum /* Verify that we won't exceed the maximum
* number of chain buffers * number of chain buffers
...@@ -1291,10 +1333,11 @@ mptscsih_detect(Scsi_Host_Template *tpnt) ...@@ -1291,10 +1333,11 @@ mptscsih_detect(Scsi_Host_Template *tpnt)
*/ */
scsi_set_pci_device(sh, this->pcidev); scsi_set_pci_device(sh, this->pcidev);
mptscsih_restore_flags(flags); mptscsih_unlock(this, flags);
hd = (MPT_SCSI_HOST *) sh->hostdata; hd = (MPT_SCSI_HOST *) sh->hostdata;
hd->ioc = this; hd->ioc = this;
hd->max_sge = sh->sg_tablesize;
if ((int)this->chip_type > (int)FC929) if ((int)this->chip_type > (int)FC929)
hd->is_spi = 1; hd->is_spi = 1;
...@@ -1534,7 +1577,6 @@ mptscsih_release(struct Scsi_Host *host) ...@@ -1534,7 +1577,6 @@ mptscsih_release(struct Scsi_Host *host)
int szc2chain = 0; int szc2chain = 0;
int szchain = 0; int szchain = 0;
int szQ = 0; int szQ = 0;
int scale;
/* Synchronize disk caches /* Synchronize disk caches
*/ */
...@@ -1542,13 +1584,6 @@ mptscsih_release(struct Scsi_Host *host) ...@@ -1542,13 +1584,6 @@ mptscsih_release(struct Scsi_Host *host)
sz1 = sz2 = sz3 = 0; sz1 = sz2 = sz3 = 0;
if (hd->ioc->req_sz <= 64)
scale = MPT_SG_REQ_64_SCALE;
else if (hd->ioc->req_sz <= 96)
scale = MPT_SG_REQ_96_SCALE;
else
scale = MPT_SG_REQ_128_SCALE;
if (hd->ScsiLookup != NULL) { if (hd->ScsiLookup != NULL) {
sz1 = hd->ioc->req_depth * sizeof(void *); sz1 = hd->ioc->req_depth * sizeof(void *);
kfree(hd->ScsiLookup); kfree(hd->ScsiLookup);
...@@ -1556,19 +1591,19 @@ mptscsih_release(struct Scsi_Host *host) ...@@ -1556,19 +1591,19 @@ mptscsih_release(struct Scsi_Host *host)
} }
if (hd->ReqToChain != NULL) { if (hd->ReqToChain != NULL) {
szr2chain = scale * hd->ioc->req_depth * sizeof(int); szr2chain = hd->ioc->req_depth * sizeof(int);
kfree(hd->ReqToChain); kfree(hd->ReqToChain);
hd->ReqToChain = NULL; hd->ReqToChain = NULL;
} }
if (hd->ChainToChain != NULL) { if (hd->ChainToChain != NULL) {
szc2chain = scale * hd->ioc->req_depth * sizeof(int); szc2chain = hd->num_chain * sizeof(int);
kfree(hd->ChainToChain); kfree(hd->ChainToChain);
hd->ChainToChain = NULL; hd->ChainToChain = NULL;
} }
if (hd->ChainBuffer != NULL) { if (hd->ChainBuffer != NULL) {
sz2 = scale * hd->ioc->req_depth * hd->ioc->req_sz; sz2 = hd->num_chain * hd->ioc->req_sz;
szchain = szr2chain + szc2chain + sz2; szchain = szr2chain + szc2chain + sz2;
pci_free_consistent(hd->ioc->pcidev, sz2, pci_free_consistent(hd->ioc->pcidev, sz2,
...@@ -1591,7 +1626,7 @@ mptscsih_release(struct Scsi_Host *host) ...@@ -1591,7 +1626,7 @@ mptscsih_release(struct Scsi_Host *host)
if (hd->is_spi) { if (hd->is_spi) {
max = MPT_MAX_SCSI_DEVICES; max = MPT_MAX_SCSI_DEVICES;
} else { } else {
max = MPT_MAX_FC_DEVICES; max = MPT_MAX_FC_DEVICES<256 ? MPT_MAX_FC_DEVICES : 255;
} }
for (ii=0; ii < max; ii++) { for (ii=0; ii < max; ii++) {
if (hd->Targets[ii]) { if (hd->Targets[ii]) {
...@@ -1805,6 +1840,7 @@ mptscsih_qcmd(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) ...@@ -1805,6 +1840,7 @@ mptscsih_qcmd(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
dmfprintk((MYIOC_s_INFO_FMT "qcmd: SCpnt=%p, done()=%p\n", dmfprintk((MYIOC_s_INFO_FMT "qcmd: SCpnt=%p, done()=%p\n",
(hd && hd->ioc) ? hd->ioc->name : "ioc?", SCpnt, done)); (hd && hd->ioc) ? hd->ioc->name : "ioc?", SCpnt, done));
#ifdef MPT_SAVE_AUTOSENSE
/* 20000617 -sralston /* 20000617 -sralston
* GRRRRR... Shouldn't have to do this but... * GRRRRR... Shouldn't have to do this but...
* Do explicit check for REQUEST_SENSE and cached SenseData. * Do explicit check for REQUEST_SENSE and cached SenseData.
...@@ -1840,6 +1876,7 @@ mptscsih_qcmd(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) ...@@ -1840,6 +1876,7 @@ mptscsih_qcmd(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
} }
} }
} }
#endif
if (hd->resetPending) { if (hd->resetPending) {
/* Prevent new commands from being issued /* Prevent new commands from being issued
...@@ -2020,7 +2057,8 @@ mptscsih_qcmd(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) ...@@ -2020,7 +2057,8 @@ mptscsih_qcmd(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
if (!dvtaskQ_active) { if (!dvtaskQ_active) {
dvtaskQ_active = 1; dvtaskQ_active = 1;
spin_unlock_irqrestore(&dvtaskQ_lock, lflags); spin_unlock_irqrestore(&dvtaskQ_lock, lflags);
INIT_WORK(&mptscsih_dvTask, mptscsih_domainValidation, (void *) hd); MPT_INIT_WORK(&mptscsih_dvTask, mptscsih_domainValidation, (void *) hd);
SCHEDULE_TASK(&mptscsih_dvTask); SCHEDULE_TASK(&mptscsih_dvTask);
} else { } else {
spin_unlock_irqrestore(&dvtaskQ_lock, lflags); spin_unlock_irqrestore(&dvtaskQ_lock, lflags);
...@@ -3046,7 +3084,7 @@ mptscsih_old_abort(Scsi_Cmnd *SCpnt) ...@@ -3046,7 +3084,7 @@ mptscsih_old_abort(Scsi_Cmnd *SCpnt)
{ {
MPT_SCSI_HOST *hd; MPT_SCSI_HOST *hd;
MPT_FRAME_HDR *mf; MPT_FRAME_HDR *mf;
struct work_struct *ptaskfoo; struct mpt_work_struct *ptaskfoo;
unsigned long flags; unsigned long flags;
int scpnt_idx; int scpnt_idx;
...@@ -3154,10 +3192,8 @@ mptscsih_old_abort(Scsi_Cmnd *SCpnt) ...@@ -3154,10 +3192,8 @@ mptscsih_old_abort(Scsi_Cmnd *SCpnt)
* Oh how cute, no alloc/free/mgmt needed if we use * Oh how cute, no alloc/free/mgmt needed if we use
* (bottom/unused portion of) MPT request frame. * (bottom/unused portion of) MPT request frame.
*/ */
ptaskfoo = (struct work_struct *) &mptscsih_ptaskfoo; ptaskfoo = (struct mpt_work_struct *) &mptscsih_ptaskfoo;
ptaskfoo->sync = 0; MPT_INIT_WORK(&mptscsih_ptaskfoo, mptscsih_taskmgmt_bh, (void *) SCpnt);
ptaskfoo->routine = mptscsih_taskmgmt_bh;
ptaskfoo->data = SCpnt;
SCHEDULE_TASK(ptaskfoo); SCHEDULE_TASK(ptaskfoo);
} else { } else {
...@@ -3182,7 +3218,7 @@ mptscsih_old_reset(Scsi_Cmnd *SCpnt, unsigned int reset_flags) ...@@ -3182,7 +3218,7 @@ mptscsih_old_reset(Scsi_Cmnd *SCpnt, unsigned int reset_flags)
{ {
MPT_SCSI_HOST *hd; MPT_SCSI_HOST *hd;
MPT_FRAME_HDR *mf; MPT_FRAME_HDR *mf;
struct work_struct *ptaskfoo; struct mpt_work_struct *ptaskfoo;
unsigned long flags; unsigned long flags;
int scpnt_idx; int scpnt_idx;
...@@ -3284,10 +3320,8 @@ mptscsih_old_reset(Scsi_Cmnd *SCpnt, unsigned int reset_flags) ...@@ -3284,10 +3320,8 @@ mptscsih_old_reset(Scsi_Cmnd *SCpnt, unsigned int reset_flags)
* Oh how cute, no alloc/free/mgmt needed if we use * Oh how cute, no alloc/free/mgmt needed if we use
* (bottom/unused portion of) MPT request frame. * (bottom/unused portion of) MPT request frame.
*/ */
ptaskfoo = (struct work_struct *) &mptscsih_ptaskfoo; ptaskfoo = (struct mpt_work_struct *) &mptscsih_ptaskfoo;
ptaskfoo->sync = 0; MPT_INIT_WORK(&mptscsih_ptaskfoo, mptscsih_taskmgmt_bh, (void *) SCpnt);
ptaskfoo->routine = mptscsih_taskmgmt_bh;
ptaskfoo->data = SCpnt;
SCHEDULE_TASK(ptaskfoo); SCHEDULE_TASK(ptaskfoo);
} else { } else {
...@@ -3655,7 +3689,7 @@ mptscsih_select_queue_depths(struct Scsi_Host *sh, Scsi_Device *sdList) ...@@ -3655,7 +3689,7 @@ mptscsih_select_queue_depths(struct Scsi_Host *sh, Scsi_Device *sdList)
if (hd->is_spi) if (hd->is_spi)
max = MPT_MAX_SCSI_DEVICES; max = MPT_MAX_SCSI_DEVICES;
else else
max = MPT_MAX_FC_DEVICES; max = MPT_MAX_FC_DEVICES<256 ? MPT_MAX_FC_DEVICES : 255;
for (ii=0; ii < max; ii++) { for (ii=0; ii < max; ii++) {
pTarget = hd->Targets[ii]; pTarget = hd->Targets[ii];
...@@ -3801,6 +3835,7 @@ copy_sense_data(Scsi_Cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR *mf, SCSIIOReply ...@@ -3801,6 +3835,7 @@ copy_sense_data(Scsi_Cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR *mf, SCSIIOReply
/* save sense data to the target device /* save sense data to the target device
*/ */
if (target) { if (target) {
#ifdef MPT_SAVE_AUTOSENSE
int sz; int sz;
sz = MIN(pReq->SenseBufferLength, sense_count); sz = MIN(pReq->SenseBufferLength, sense_count);
...@@ -3808,6 +3843,7 @@ copy_sense_data(Scsi_Cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR *mf, SCSIIOReply ...@@ -3808,6 +3843,7 @@ copy_sense_data(Scsi_Cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR *mf, SCSIIOReply
sz = SCSI_STD_SENSE_BYTES; sz = SCSI_STD_SENSE_BYTES;
memcpy(target->sense, sense_data, sz); memcpy(target->sense, sense_data, sz);
target->tflags |= MPT_TARGET_FLAGS_VALID_SENSE; target->tflags |= MPT_TARGET_FLAGS_VALID_SENSE;
#endif
#ifdef ABORT_FIX #ifdef ABORT_FIX
if (sz >= SCSI_STD_SENSE_BYTES) { if (sz >= SCSI_STD_SENSE_BYTES) {
...@@ -4491,6 +4527,7 @@ static int dump_cdb(char *foo, unsigned char *cdb) ...@@ -4491,6 +4527,7 @@ static int dump_cdb(char *foo, unsigned char *cdb)
} }
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
#if 0
static int dump_sd(char *foo, unsigned char *sd) static int dump_sd(char *foo, unsigned char *sd)
{ {
int snsLen = 8 + SD_Additional_Sense_Length(sd); int snsLen = 8 + SD_Additional_Sense_Length(sd);
...@@ -4503,6 +4540,7 @@ static int dump_sd(char *foo, unsigned char *sd) ...@@ -4503,6 +4540,7 @@ static int dump_sd(char *foo, unsigned char *sd)
return l; return l;
} }
#endif
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/* Do ASC/ASCQ lookup/grindage to English readable string(s) */ /* Do ASC/ASCQ lookup/grindage to English readable string(s) */
...@@ -4593,6 +4631,15 @@ static const char * ascq_set_strings_4max( ...@@ -4593,6 +4631,15 @@ static const char * ascq_set_strings_4max(
} }
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/*
* SCSI Information Report; desired output format...
*---
SCSI Error: (iocnum:target_id:LUN) Status=02h (CHECK CONDITION)
Key=6h (UNIT ATTENTION); FRU=03h
ASC/ASCQ=29h/00h, "POWER ON, RESET, OR BUS DEVICE RESET OCCURRED"
CDB: 00 00 00 00 00 00 - TestUnitReady
*---
*/
/* /*
* SCSI Error Report; desired output format... * SCSI Error Report; desired output format...
*--- *---
...@@ -4617,6 +4664,22 @@ int mpt_ScsiHost_ErrorReport(IO_Info_t *ioop) ...@@ -4617,6 +4664,22 @@ int mpt_ScsiHost_ErrorReport(IO_Info_t *ioop)
unsigned char ascq = SD_ASCQ(ioop->sensePtr); unsigned char ascq = SD_ASCQ(ioop->sensePtr);
int l; int l;
/* Change the error logging to only report errors on
* read and write commands. Ignore errors on other commands.
* Should this be configurable via proc?
*/
switch (ioop->cdbPtr[0]) {
case READ_6:
case WRITE_6:
case READ_10:
case WRITE_10:
case READ_12:
case WRITE_12:
break;
default:
return 0;
}
/* /*
* More quiet mode. * More quiet mode.
* Filter out common, repetitive, warning-type errors... like: * Filter out common, repetitive, warning-type errors... like:
...@@ -4627,6 +4690,7 @@ int mpt_ScsiHost_ErrorReport(IO_Info_t *ioop) ...@@ -4627,6 +4690,7 @@ int mpt_ScsiHost_ErrorReport(IO_Info_t *ioop)
if (sk == SK_NO_SENSE) { if (sk == SK_NO_SENSE) {
return 0; return 0;
} }
if ( (sk==SK_UNIT_ATTENTION && asc==0x29 && (ascq==0x00 || ascq==0x01)) if ( (sk==SK_UNIT_ATTENTION && asc==0x29 && (ascq==0x00 || ascq==0x01))
|| (sk==SK_NOT_READY && asc==0x04 && (ascq==0x01 || ascq==0x02)) || (sk==SK_NOT_READY && asc==0x04 && (ascq==0x01 || ascq==0x02))
|| (sk==SK_ILLEGAL_REQUEST && asc==0x25 && ascq==0x00) || (sk==SK_ILLEGAL_REQUEST && asc==0x25 && ascq==0x00)
...@@ -4681,20 +4745,12 @@ int mpt_ScsiHost_ErrorReport(IO_Info_t *ioop) ...@@ -4681,20 +4745,12 @@ int mpt_ScsiHost_ErrorReport(IO_Info_t *ioop)
else if (mpt_ScsiOpcodesPtr) else if (mpt_ScsiOpcodesPtr)
opstr = mpt_ScsiOpcodesPtr[ioop->cdbPtr[0]]; opstr = mpt_ScsiOpcodesPtr[ioop->cdbPtr[0]];
l = sprintf(foo, "SCSI Error Report =-=-= (%s)\n" l = sprintf(foo, "SCSI Error: (%s) Status=%02Xh (%s)\n",
" SCSI_Status=%02Xh (%s)\n"
" Original_CDB[]:",
ioop->DevIDStr, ioop->DevIDStr,
ioop->SCSIStatus, ioop->SCSIStatus,
statstr); statstr);
l += dump_cdb(foo+l, ioop->cdbPtr); l += sprintf(foo+l, " Key=%Xh (%s); FRU=%02Xh\n ASC/ASCQ=%02Xh/%02Xh",
if (opstr)
l += sprintf(foo+l, " - \"%s\"", opstr);
l += sprintf(foo+l, "\n SenseData[%02Xh]:", 8+SD_Additional_Sense_Length(ioop->sensePtr));
l += dump_sd(foo+l, ioop->sensePtr);
l += sprintf(foo+l, "\n SenseKey=%Xh (%s); FRU=%02Xh\n ASC/ASCQ=%02Xh/%02Xh",
sk, skstr, SD_FRU(ioop->sensePtr), asc, ascq ); sk, skstr, SD_FRU(ioop->sensePtr), asc, ascq );
{ {
const char *x1, *x2, *x3, *x4; const char *x1, *x2, *x3, *x4;
x1 = x2 = x3 = x4 = ""; x1 = x2 = x3 = x4 = "";
...@@ -4706,11 +4762,11 @@ int mpt_ScsiHost_ErrorReport(IO_Info_t *ioop) ...@@ -4706,11 +4762,11 @@ int mpt_ScsiHost_ErrorReport(IO_Info_t *ioop)
l += sprintf(foo+l, " %s%s%s%s", x1,x2,x3,x4); l += sprintf(foo+l, " %s%s%s%s", x1,x2,x3,x4);
} }
} }
l += sprintf(foo+l, "\n CDB:");
#if 0 l += dump_cdb(foo+l, ioop->cdbPtr);
if (SPECIAL_ASCQ(asc,ascq)) if (opstr)
l += sprintf(foo+l, " (%02Xh)", ascq); l += sprintf(foo+l, " - \"%s\"", opstr);
#endif l += sprintf(foo+l, "\n");
PrintF(("%s\n", foo)); PrintF(("%s\n", foo));
...@@ -4953,6 +5009,7 @@ void mptscsih_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtDevice *target, char byt ...@@ -4953,6 +5009,7 @@ void mptscsih_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtDevice *target, char byt
return; return;
} }
#ifdef MPT_SAVE_AUTOSENSE
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/* /*
* Clear sense valid flag. * Clear sense valid flag.
...@@ -4968,6 +5025,7 @@ static void clear_sense_flag(MPT_SCSI_HOST *hd, SCSIIORequest_t *pReq) ...@@ -4968,6 +5025,7 @@ static void clear_sense_flag(MPT_SCSI_HOST *hd, SCSIIORequest_t *pReq)
return; return;
} }
#endif
/* If DV disabled (negoNvram set to USE_NVARM) or if not LUN 0, return. /* If DV disabled (negoNvram set to USE_NVARM) or if not LUN 0, return.
* Else set the NEED_DV flag after Read Capacity Issued (disks) * Else set the NEED_DV flag after Read Capacity Issued (disks)
...@@ -5366,7 +5424,9 @@ mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr) ...@@ -5366,7 +5424,9 @@ mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
/* If target struct exists, clear sense valid flag. /* If target struct exists, clear sense valid flag.
*/ */
#ifdef MPT_SAVE_AUTOSENSE
clear_sense_flag(hd, pReq); clear_sense_flag(hd, pReq);
#endif
if (mr == NULL) { if (mr == NULL) {
completionCode = MPT_SCANDV_GOOD; completionCode = MPT_SCANDV_GOOD;
...@@ -5418,7 +5478,9 @@ mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr) ...@@ -5418,7 +5478,9 @@ mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
completionCode = MPT_SCANDV_SOME_ERROR; completionCode = MPT_SCANDV_SOME_ERROR;
} else if (pReply->SCSIState & MPI_SCSI_STATE_AUTOSENSE_VALID) { } else if (pReply->SCSIState & MPI_SCSI_STATE_AUTOSENSE_VALID) {
#ifdef MPT_SAVE_AUTOSENSE
VirtDevice *target; VirtDevice *target;
#endif
u8 *sense_data; u8 *sense_data;
int sz; int sz;
...@@ -5433,12 +5495,14 @@ mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr) ...@@ -5433,12 +5495,14 @@ mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
SCSI_STD_SENSE_BYTES); SCSI_STD_SENSE_BYTES);
memcpy(hd->pLocal->sense, sense_data, sz); memcpy(hd->pLocal->sense, sense_data, sz);
#ifdef MPT_SAVE_AUTOSENSE
target = hd->Targets[pReq->TargetID]; target = hd->Targets[pReq->TargetID];
if (target) { if (target) {
memcpy(target->sense, sense_data, sz); memcpy(target->sense, sense_data, sz);
target->tflags target->tflags
|= MPT_TARGET_FLAGS_VALID_SENSE; |= MPT_TARGET_FLAGS_VALID_SENSE;
} }
#endif
ddvprintk((KERN_NOTICE " Check Condition, sense ptr %p\n", ddvprintk((KERN_NOTICE " Check Condition, sense ptr %p\n",
sense_data)); sense_data));
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
* (mailto:netscape.net) * (mailto:netscape.net)
* (mailto:Pam.Delaney@lsil.com) * (mailto:Pam.Delaney@lsil.com)
* *
* $Id: mptscsih.h,v 1.18 2002/06/06 15:32:52 pdelaney Exp $ * $Id: mptscsih.h,v 1.19 2002/10/03 13:10:15 pdelaney Exp $
*/ */
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/* /*
...@@ -77,7 +77,22 @@ ...@@ -77,7 +77,22 @@
#define MPT_SCSI_CAN_QUEUE MPT_FC_CAN_QUEUE #define MPT_SCSI_CAN_QUEUE MPT_FC_CAN_QUEUE
#define MPT_SCSI_CMD_PER_LUN 7 #define MPT_SCSI_CMD_PER_LUN 7
#define MPT_SCSI_MAX_SECTORS 8192
/*
* Set the MAX_SGE value based on user input.
*/
#ifdef CONFIG_FUSION_MAX_SGE
#if CONFIG_FUSION_MAX_SGE < 16
#define MPT_SCSI_SG_DEPTH 16
#elif CONFIG_FUSION_MAX_SGE > 128
#define MPT_SCSI_SG_DEPTH 128
#else
#define MPT_SCSI_SG_DEPTH CONFIG_FUSION_MAX_SGE
#endif
#else
#define MPT_SCSI_SG_DEPTH 40 #define MPT_SCSI_SG_DEPTH 40
#endif
/* To disable domain validation, uncomment the /* To disable domain validation, uncomment the
* following line. No effect for FC devices. * following line. No effect for FC devices.
...@@ -146,25 +161,39 @@ struct mptscsih_driver_setup ...@@ -146,25 +161,39 @@ struct mptscsih_driver_setup
/* /*
* tq_scheduler disappeared @ lk-2.4.0-test12 * tq_scheduler disappeared @ lk-2.4.0-test12
* (right when <linux/sched.h> newly defined TQ_ACTIVE) * (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 #define HAVE_TQ_SCHED 1
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
# include <linux/sched.h> # include <linux/sched.h>
# ifdef TQ_ACTIVE # ifdef TQ_ACTIVE
# undef HAVE_TQ_SCHED # undef HAVE_TQ_SCHED
# endif # endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,40)
# undef HAVE_TQ_SCHED
#endif
#endif #endif
#ifdef HAVE_TQ_SCHED #ifdef HAVE_TQ_SCHED
#define SCHEDULE_TASK(x) \ #define SCHEDULE_TASK(x) \
/*MOD_INC_USE_COUNT*/; \ /*MOD_INC_USE_COUNT*/; \
schedule_work(x) (x)->next = NULL; \
queue_task(x, &tq_scheduler)
#else #else
#define SCHEDULE_TASK(x) \ #define SCHEDULE_TASK(x) \
/*MOD_INC_USE_COUNT*/; \ /*MOD_INC_USE_COUNT*/; \
if (schedule_work(x) == 0) { \ if (schedule_task(x) == 0) { \
/*MOD_DEC_USE_COUNT*/; \ /*MOD_DEC_USE_COUNT*/; \
} }
#endif #endif
#endif
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
...@@ -236,6 +265,7 @@ extern void x_scsi_taskmgmt_bh(void *); ...@@ -236,6 +265,7 @@ extern void x_scsi_taskmgmt_bh(void *);
can_queue: MPT_SCSI_CAN_QUEUE, \ can_queue: MPT_SCSI_CAN_QUEUE, \
this_id: -1, \ this_id: -1, \
sg_tablesize: MPT_SCSI_SG_DEPTH, \ sg_tablesize: MPT_SCSI_SG_DEPTH, \
max_sectors: MPT_SCSI_MAX_SECTORS, \
cmd_per_lun: MPT_SCSI_CMD_PER_LUN, \ cmd_per_lun: MPT_SCSI_CMD_PER_LUN, \
unchecked_isa_dma: 0, \ unchecked_isa_dma: 0, \
use_clustering: ENABLE_CLUSTERING, \ use_clustering: ENABLE_CLUSTERING, \
......
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