Commit 547e26c1 authored by James Bottomley's avatar James Bottomley

MPT Fusion driver 3.01.03 update

From: "Moore, Eric Dean" <Emoore@lsil.com>

Changelog for mpt version 3.01.03:

(1)  Fix fifo memory allocation under 64bit systems
by merging 3 seperate memory allocations into one call.
Before this fix, it was possible that these seperate 
pci_alloc_consistent() calls were crossing the 4GB 
hardware boundary.
Delete the MPTBASE_MEM_ALLOC_FIFO_FIX logic.
Backout recent ak@muc.de workaround.

(2) Replace wrappers for CHIPREG_XXX with defines;
per request from Jeff Garzik [jgarzik@pobox.com]

(3) Remove support for FC909.

(4) Remove PortIo modules parameter.

(5) Move procmpt_destroy function before pci_unregister_driver,
as the memory allocated for the proc was not being deallocated.

(6) Remove mptscshi_reset_timeouts function. The timer was
already expired when mod_timer is called.

(7) Fix small bug in slave_destroy, which could prevent domain
validation on hidden drive in a RAID volume.

----------------------------------------------------------------------

Changelog for mpt version 3.01.02:

(1) Andi Kleen[ak@suse.de]
put warning "Device (0:0:0) reported QUEUE_FULL!" into debug messages

(2) Alexander Stohr[Alexander.Stohr@gmx.de]
fix warnings from mptscsih_setup when driver isn't compiled as module

(3) Randy.Dunlap[rddunlap@osdl.org]
Remove unnecessary min/max macros and change calls to 
use kernel.h macros instead.
parent db2a43a6
......@@ -22,11 +22,6 @@ EXTRA_CFLAGS += ${MPT_CFLAGS}
#EXTRA_CFLAGS += -DMPT_DEBUG_MSG_FRAME
#EXTRA_CFLAGS += -DMPT_DEBUG_SG
# This is a temporary fix for the reply/request fifo
# for some 64bit archs. Uncommenting this line
# will place the fifo's in 32bit space
#EXTRA_CFLAGS += -DMPTBASE_MEM_ALLOC_FIFO_FIX
#
# driver/module specifics...
#
......
This diff is collapsed.
......@@ -81,8 +81,8 @@
#define COPYRIGHT "Copyright (c) 1999-2004 " MODULEAUTHOR
#endif
#define MPT_LINUX_VERSION_COMMON "3.01.01"
#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.01.01"
#define MPT_LINUX_VERSION_COMMON "3.01.03"
#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.01.03"
#define WHAT_MAGIC_STRING "@" "(" "#" ")"
#define show_mptmod_ver(s,ver) \
......@@ -156,6 +156,28 @@
#define C0_1030 0x08
#define XL_929 0x01
/*
* Try to keep these at 2^N-1
*/
#define MPT_FC_CAN_QUEUE 127
#define MPT_SCSI_CAN_QUEUE 127
/*
* 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
#endif
#ifdef __KERNEL__ /* { */
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
......@@ -581,6 +603,12 @@ typedef struct _MPT_ADAPTER
int alloc_total;
u32 last_state;
int active;
u8 *fifo_pool; /* dma pool for fifo's */
dma_addr_t fifo_pool_dma;
int fifo_pool_sz; /* allocated size */
u8 *chain_alloc; /* chain buffer alloc ptr */
dma_addr_t chain_alloc_dma;
int chain_alloc_sz;
u8 *reply_alloc; /* Reply frames alloc ptr */
dma_addr_t reply_alloc_dma;
MPT_FRAME_HDR *reply_frames; /* Reply msg frames - rounded up! */
......@@ -608,9 +636,6 @@ typedef struct _MPT_ADAPTER
u32 sense_buf_low_dma;
int mtrr_reg;
struct pci_dev *pcidev; /* struct pci_dev pointer */
#if defined(MPTBASE_MEM_ALLOC_FIFO_FIX)
struct pci_dev pcidev32; /* struct pci_dev pointer */
#endif
u8 *memmap; /* mmap address */
struct Scsi_Host *sh; /* Scsi Host pointer */
ScsiCfgData spi_data; /* Scsi config. data */
......@@ -1061,13 +1086,6 @@ extern int mpt_ASCQ_TableSz;
/*
* More (public) macros...
*/
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef MAX
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef offsetof
#define offsetof(t, m) ((size_t) (&((t *)0)->m))
#endif
......
......@@ -285,7 +285,7 @@ mptctl_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply)
dctlprintk((MYIOC_s_INFO_FMT ": Copying Reply Frame @%p to IOC!\n",
ioc->name, reply));
memcpy(ioc->ioctl->ReplyFrame, reply,
MIN(ioc->reply_sz, 4*reply->u.reply.MsgLength));
min(ioc->reply_sz, 4*reply->u.reply.MsgLength));
ioc->ioctl->status |= MPT_IOCTL_STATUS_RF_VALID;
/* Set the command status to GOOD if IOC Status is GOOD
......@@ -336,7 +336,7 @@ mptctl_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply)
// NOTE: Expects/requires non-Turbo reply!
dctlprintk((MYIOC_s_INFO_FMT ":Caching MPI_FUNCTION_FW_DOWNLOAD reply!\n",
ioc->name));
memcpy(fwReplyBuffer, reply, MIN(sizeof(fwReplyBuffer), 4*reply->u.reply.MsgLength));
memcpy(fwReplyBuffer, reply, min_t(int, sizeof(fwReplyBuffer), 4*reply->u.reply.MsgLength));
ReplyMsg = (pMPIDefaultReply_t) fwReplyBuffer;
}
}
......@@ -991,7 +991,7 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, int sge_offset, int *frags,
MptSge_t *sgl;
int numfrags = 0;
int fragcnt = 0;
int alloc_sz = MIN(bytes,MAX_KMALLOC_SZ); // avoid kernel warning msg!
int alloc_sz = min(bytes,MAX_KMALLOC_SZ); // avoid kernel warning msg!
int bytes_allocd = 0;
int this_alloc;
dma_addr_t pa; // phys addr
......@@ -1036,7 +1036,7 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, int sge_offset, int *frags,
sgl = sglbuf;
sg_spill = ((ioc->req_sz - sge_offset)/(sizeof(dma_addr_t) + sizeof(u32))) - 1;
while (bytes_allocd < bytes) {
this_alloc = MIN(alloc_sz, bytes-bytes_allocd);
this_alloc = min(alloc_sz, bytes-bytes_allocd);
buflist[buflist_ent].len = this_alloc;
buflist[buflist_ent].kptr = pci_alloc_consistent(ioc->pcidev,
this_alloc,
......@@ -2293,9 +2293,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local)
*/
if (ioc->ioctl->status & MPT_IOCTL_STATUS_RF_VALID) {
if (karg.maxReplyBytes < ioc->reply_sz) {
sz = MIN(karg.maxReplyBytes, 4*ioc->ioctl->ReplyFrame[2]);
sz = min(karg.maxReplyBytes, 4*ioc->ioctl->ReplyFrame[2]);
} else {
sz = MIN(ioc->reply_sz, 4*ioc->ioctl->ReplyFrame[2]);
sz = min(ioc->reply_sz, 4*ioc->ioctl->ReplyFrame[2]);
}
if (sz > 0) {
......@@ -2314,7 +2314,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, char *mfPtr, int local)
/* If valid sense data, copy to user.
*/
if (ioc->ioctl->status & MPT_IOCTL_STATUS_SENSE_VALID) {
sz = MIN(karg.maxSenseBytes, MPT_SENSE_BUFFER_SIZE);
sz = min(karg.maxSenseBytes, MPT_SENSE_BUFFER_SIZE);
if (sz > 0) {
if (copy_to_user((char *)karg.senseDataPtr, ioc->ioctl->sense, sz)) {
printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
......
......@@ -196,8 +196,9 @@ static int mptscsih_doDv(MPT_SCSI_HOST *hd, int channel, int target);
static void mptscsih_dv_parms(MPT_SCSI_HOST *hd, DVPARAMETERS *dv,void *pPage);
static void mptscsih_fillbuf(char *buffer, int size, int index, int width);
#endif
#ifdef MODULE
static int mptscsih_setup(char *str);
#endif
/* module entry point */
static int __init mptscsih_init (void);
static void __exit mptscsih_exit (void);
......@@ -1061,26 +1062,6 @@ search_doneQ_for_cmd(MPT_SCSI_HOST *hd, Scsi_Cmnd *SCpnt)
return;
}
static void
mptscsih_reset_timeouts (MPT_SCSI_HOST *hd)
{
Scsi_Cmnd *SCpnt;
int ii;
int max = hd->ioc->req_depth;
for (ii= 0; ii < max; ii++) {
if ((SCpnt = hd->ScsiLookup[ii]) != NULL) {
/* calling mod_timer() panics in 2.6 kernel...
* need to investigate
*/
// mod_timer(&SCpnt->eh_timeout, jiffies + (HZ * 60));
dtmprintk((MYIOC_s_WARN_FMT "resetting SCpnt=%p timeout + 60HZ",
(hd && hd->ioc) ? hd->ioc->name : "ioc?", SCpnt));
}
}
}
/*
* mptscsih_flush_running_cmds - For each command found, search
* Scsi_Host instance taskQ and reply to OS.
......@@ -1239,6 +1220,16 @@ mptscsih_initChainBuffers (MPT_SCSI_HOST *hd, int init)
int sz, ii, num_chain;
int scale, num_sge;
/* chain buffer allocation done from PrimeIocFifos */
if (hd->ioc->fifo_pool == NULL)
return -1;
hd->ChainBuffer = hd->ioc->chain_alloc;
hd->ChainBufferDMA = hd->ioc->chain_alloc_dma;
dprintk((KERN_INFO " ChainBuffer @ %p(%p), sz=%d\n",
hd->ChainBuffer, (void *)(ulong)hd->ChainBufferDMA, hd->ioc->chain_alloc_sz));
/* ReqToChain size must equal the req_depth
* index = req_idx
*/
......@@ -1294,26 +1285,7 @@ mptscsih_initChainBuffers (MPT_SCSI_HOST *hd, int init)
mem = (u8 *) hd->ChainToChain;
}
memset(mem, 0xFF, sz);
sz = num_chain * hd->ioc->req_sz;
if (hd->ChainBuffer == NULL) {
/* Allocate free chain buffer pool
*/
#if defined(MPTBASE_MEM_ALLOC_FIFO_FIX)
mem = pci_alloc_consistent(&hd->ioc->pcidev32, sz, &hd->ChainBufferDMA);
#else
mem = pci_alloc_consistent(hd->ioc->pcidev, sz, &hd->ChainBufferDMA);
#endif
if (mem == NULL)
return -1;
hd->ChainBuffer = (u8*)mem;
} else {
mem = (u8 *) hd->ChainBuffer;
}
memset(mem, 0, sz);
dprintk((KERN_INFO " ChainBuffer @ %p(%p), sz=%d\n",
hd->ChainBuffer, (void *)(ulong)hd->ChainBufferDMA, sz));
/* Initialize the free chain Q.
*/
......@@ -1366,8 +1338,8 @@ mptscsih_report_queue_full(Scsi_Cmnd *sc, SCSIIOReply_t *pScsiReply, SCSIIOReque
if (sc->device && sc->device->host != NULL && sc->device->host->hostdata != NULL)
ioc_str = ((MPT_SCSI_HOST *)sc->device->host->hostdata)->ioc->name;
printk(MYIOC_s_WARN_FMT "Device (%d:%d:%d) reported QUEUE_FULL!\n",
ioc_str, 0, sc->device->id, sc->device->lun);
dprintk((MYIOC_s_WARN_FMT "Device (%d:%d:%d) reported QUEUE_FULL!\n",
ioc_str, 0, sc->device->id, sc->device->lun));
last_queue_full = time;
}
}
......@@ -1761,7 +1733,6 @@ mptscsih_remove(struct pci_dev *pdev)
int sz1, sz2, sz3, sztarget=0;
int szr2chain = 0;
int szc2chain = 0;
int szchain = 0;
int szQ = 0;
mptscsih_shutdown(&pdev->dev);
......@@ -1786,15 +1757,6 @@ mptscsih_remove(struct pci_dev *pdev)
hd->ChainToChain = NULL;
}
if (hd->ChainBuffer != NULL) {
sz2 = hd->num_chain * hd->ioc->req_sz;
szchain = szr2chain + szc2chain + sz2;
pci_free_consistent(hd->ioc->pcidev, sz2,
hd->ChainBuffer, hd->ChainBufferDMA);
hd->ChainBuffer = NULL;
}
if (hd->memQ != NULL) {
szQ = host->can_queue * sizeof(MPT_DONE_Q);
kfree(hd->memQ);
......@@ -3375,7 +3337,7 @@ mptscsih_slave_destroy(Scsi_Device *device)
raid_volume==0;i++)
if(device->id ==
hd->ioc->spi_data.pIocPg3->PhysDisk[i].PhysDiskNum) {
hd->ioc->spi_data.pIocPg3->PhysDisk[i].PhysDiskID) {
raid_volume=1;
hd->ioc->spi_data.forceDv |=
MPT_SCSICFG_RELOAD_IOC_PG3;
......@@ -3706,8 +3668,6 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
*/
hd->resetPending = 1;
mptscsih_reset_timeouts (hd);
} else if (reset_phase == MPT_IOC_PRE_RESET) {
dtmprintk((MYIOC_s_WARN_FMT "Pre-Diag Reset\n", ioc->name));
......@@ -4519,7 +4479,7 @@ void mptscsih_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtDevice *target, char byt
if (nfactor < pspi_data->minSyncFactor )
nfactor = pspi_data->minSyncFactor;
factor = MAX (factor, nfactor);
factor = max(factor, nfactor);
if (factor == MPT_ASYNC)
offset = 0;
} else {
......@@ -4727,7 +4687,7 @@ mptscsih_writeSDP1(MPT_SCSI_HOST *hd, int portnum, int target_id, int flags)
maxid = ioc->sh->max_id - 1;
} else if (ioc->sh) {
id = target_id;
maxid = MIN(id, ioc->sh->max_id - 1);
maxid = min_t(int, id, ioc->sh->max_id - 1);
}
for (; id <= maxid; id++) {
......@@ -5134,7 +5094,7 @@ mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
sense_data = ((u8 *)hd->ioc->sense_buf_pool +
(req_idx * MPT_SENSE_BUFFER_ALLOC));
sz = MIN (pReq->SenseBufferLength,
sz = min_t(int, pReq->SenseBufferLength,
SCSI_STD_SENSE_BYTES);
memcpy(hd->pLocal->sense, sense_data, sz);
......@@ -5786,7 +5746,7 @@ mptscsih_domainValidation(void *arg)
ioc->spi_data.forceDv &= ~MPT_SCSICFG_RELOAD_IOC_PG3;
}
maxid = MIN (ioc->sh->max_id, MPT_MAX_SCSI_DEVICES);
maxid = min_t(int, ioc->sh->max_id, MPT_MAX_SCSI_DEVICES);
for (id = 0; id < maxid; id++) {
spin_lock_irqsave(&dvtaskQ_lock, flags);
......@@ -6509,7 +6469,7 @@ mptscsih_doDv(MPT_SCSI_HOST *hd, int bus_number, int id)
if (echoBufSize > 0) {
iocmd.flags |= MPT_ICFLAG_ECHO;
if (dataBufSize > 0)
bufsize = MIN(echoBufSize, dataBufSize);
bufsize = min(echoBufSize, dataBufSize);
else
bufsize = echoBufSize;
} else if (dataBufSize == 0)
......@@ -6520,7 +6480,7 @@ mptscsih_doDv(MPT_SCSI_HOST *hd, int bus_number, int id)
/* Data buffers for write-read-compare test max 1K.
*/
sz = MIN(bufsize, 1024);
sz = min(bufsize, 1024);
/* --- loop ----
* On first pass, always issue a reserve.
......@@ -6875,9 +6835,9 @@ mptscsih_dv_parms(MPT_SCSI_HOST *hd, DVPARAMETERS *dv,void *pPage)
}
/* limit by adapter capabilities */
width = MIN(width, hd->ioc->spi_data.maxBusWidth);
offset = MIN(offset, hd->ioc->spi_data.maxSyncOffset);
factor = MAX(factor, hd->ioc->spi_data.minSyncFactor);
width = min(width, hd->ioc->spi_data.maxBusWidth);
offset = min(offset, hd->ioc->spi_data.maxSyncOffset);
factor = max(factor, hd->ioc->spi_data.minSyncFactor);
/* Check Consistency */
if (offset && (factor < MPT_ULTRA2) && !width)
......@@ -7217,19 +7177,22 @@ mptscsih_fillbuf(char *buffer, int size, int index, int width)
#define ARG_SEP ','
#endif
#ifdef MODULE
static char setup_token[] __initdata =
"dv:"
"width:"
"factor:"
"saf-te:"
; /* DO NOT REMOVE THIS ';' */
#endif
#define OPT_DV 1
#define OPT_MAX_WIDTH 2
#define OPT_MIN_SYNC_FACTOR 3
#define OPT_SAF_TE 4
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
#ifdef MODULE
static int
get_setup_token(char *p)
{
......@@ -7298,7 +7261,7 @@ mptscsih_setup(char *str)
}
return 1;
}
#endif
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
......
......@@ -66,12 +66,6 @@
* SCSI Public stuff...
*/
/*
* Try to keep these at 2^N-1
*/
#define MPT_FC_CAN_QUEUE 127
#define MPT_SCSI_CAN_QUEUE 127
#define MPT_SCSI_CMD_PER_DEV_HIGH 31
#define MPT_SCSI_CMD_PER_DEV_LOW 7
......@@ -79,21 +73,6 @@
#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
#endif
/* To disable domain validation, uncomment the
* following line. No effect for FC devices.
* For SCSI devices, driver will negotiate to
......
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