Commit 4c244d1a authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://linux-scsi.bkbits.net/scsi-for-linus-2.6

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents 821bc517 77340725
......@@ -155,7 +155,6 @@ static MPT_EVHANDLER MptEvHandlers[MPT_MAX_PROTOCOL_DRIVERS];
static MPT_RESETHANDLER MptResetHandlers[MPT_MAX_PROTOCOL_DRIVERS];
static struct mpt_pci_driver *MptDeviceDriverHandlers[MPT_MAX_PROTOCOL_DRIVERS];
static int FusionInitCalled = 0;
static int mpt_base_index = -1;
static int last_drv_idx = -1;
......@@ -337,15 +336,13 @@ mpt_interrupt(int irq, void *bus_id, struct pt_regs *r)
ioc_stat = le16_to_cpu(mr->u.reply.IOCStatus);
if (ioc_stat & MPI_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE) {
u32 log_info = le32_to_cpu(mr->u.reply.IOCLogInfo);
if ((int)ioc->chip_type <= (int)FC929)
if (ioc->bus_type == FC)
mpt_fc_log_info(ioc, log_info);
else
else if (ioc->bus_type == SCSI)
mpt_sp_log_info(ioc, log_info);
}
if (ioc_stat & MPI_IOCSTATUS_MASK) {
if ((int)ioc->chip_type <= (int)FC929)
;
else
if (ioc->bus_type == SCSI)
mpt_sp_ioc_info(ioc, (u32)ioc_stat, mf);
}
} else {
......@@ -392,7 +389,7 @@ mpt_interrupt(int irq, void *bus_id, struct pt_regs *r)
}
#ifdef MPT_DEBUG_IRQ
if ((int)ioc->chip_type > (int)FC929) {
if (ioc->bus_type == SCSI) {
/* Verify mf, mr are reasonable.
*/
if ((mf) && ((mf >= MPT_INDEX_2_MFPTR(ioc, ioc->req_depth))
......@@ -603,22 +600,6 @@ mpt_register(MPT_CALLBACK cbfunc, MPT_DRIVER_CLASS dclass)
last_drv_idx = -1;
#ifndef MODULE
/*
* Handle possibility of the mptscsih_detect() routine getting
* called *before* fusion_init!
*/
if (!FusionInitCalled) {
dprintk((KERN_INFO MYNAM ": Hmmm, calling fusion_init from mpt_register!\n"));
/*
* NOTE! We'll get recursion here, as fusion_init()
* calls mpt_register()!
*/
fusion_init();
FusionInitCalled++;
}
#endif
/*
* Search for empty callback slot in this order: {N,...,7,6,5,...,1}
* (slot/handle 0 is reserved!)
......@@ -1220,22 +1201,21 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id)
ioc->pio_chip = (SYSIF_REGS __iomem *)pmem;
}
ioc->chip_type = FCUNK;
if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC909) {
ioc->chip_type = FC909;
ioc->prod_name = "LSIFC909";
ioc->bus_type = FC;
}
if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC929) {
ioc->chip_type = FC929;
ioc->prod_name = "LSIFC929";
ioc->bus_type = FC;
}
else if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC919) {
ioc->chip_type = FC919;
ioc->prod_name = "LSIFC919";
ioc->bus_type = FC;
}
else if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC929X) {
ioc->chip_type = FC929X;
pci_read_config_byte(pdev, PCI_CLASS_REVISION, &revision);
ioc->bus_type = FC;
if (revision < XL_929) {
ioc->prod_name = "LSIFC929X";
/* 929X Chip Fix. Set Split transactions level
......@@ -1254,8 +1234,8 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id)
}
}
else if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC919X) {
ioc->chip_type = FC919X;
ioc->prod_name = "LSIFC919X";
ioc->bus_type = FC;
/* 919X Chip Fix. Set Split transactions level
* for PCIX. Set MOST bits to zero.
*/
......@@ -1264,8 +1244,8 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id)
pci_write_config_byte(pdev, 0x6a, pcixcmd);
}
else if (pdev->device == MPI_MANUFACTPAGE_DEVID_53C1030) {
ioc->chip_type = C1030;
ioc->prod_name = "LSI53C1030";
ioc->bus_type = SCSI;
/* 1030 Chip Fix. Disable Split transactions
* for PCIX. Set MOST bits to zero if Rev < C0( = 8).
*/
......@@ -1277,8 +1257,8 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id)
}
}
else if (pdev->device == MPI_MANUFACTPAGE_DEVID_1030_53C1035) {
ioc->chip_type = C1035;
ioc->prod_name = "LSI53C1035";
ioc->bus_type = SCSI;
}
sprintf(ioc->name, "ioc%d", ioc->id);
......@@ -1326,8 +1306,6 @@ mptbase_probe(struct pci_dev *pdev, const struct pci_device_id *id)
/* NEW! 20010220 -sralston
* Check for "bound ports" (929, 929X, 1030, 1035) to reduce redundant resets.
*/
if ((ioc->chip_type == FC929) || (ioc->chip_type == C1030)
|| (ioc->chip_type == C1035) || (ioc->chip_type == FC929X))
mpt_detect_bound_ports(ioc, pdev);
if ((r = mpt_do_ioc_recovery(ioc,
......@@ -1760,7 +1738,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
* and we try GetLanConfigPages again...
*/
if ((ret == 0) && (reason == MPT_HOSTEVENT_IOC_BRINGUP)) {
if ((int)ioc->chip_type <= (int)FC929) {
if (ioc->bus_type == FC) {
/*
* Pre-fetch FC port WWN and stuff...
* (FCPortPage0_t stuff)
......@@ -2103,20 +2081,8 @@ MakeIocReady(MPT_ADAPTER *ioc, int force, int sleepFlag)
}
/* Is it already READY? */
if (!statefault && (ioc_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_READY) {
if ((int)ioc->chip_type <= (int)FC929)
return 0;
else {
if (!statefault && (ioc_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_READY)
return 0;
/* Workaround from broken 1030 FW.
* Force a diagnostic reset if fails.
*/
/* if ((r = SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET, sleepFlag)) == 0)
return 0;
else
statefault = 4; */
}
}
/*
* Check to see if IOC is in FAULT state.
......@@ -2513,11 +2479,11 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepFlag)
ddlprintk((MYIOC_s_INFO_FMT "upload_fw %d facts.Flags=%x\n",
ioc->name, ioc->upload_fw, ioc->facts.Flags));
if ((int)ioc->chip_type <= (int)FC929) {
if (ioc->bus_type == FC)
ioc_init.MaxDevices = MPT_MAX_FC_DEVICES;
} else {
else
ioc_init.MaxDevices = MPT_MAX_SCSI_DEVICES;
}
ioc_init.MaxBuses = MPT_MAX_BUS;
ioc_init.ReplyFrameSize = cpu_to_le16(ioc->reply_sz); /* in BYTES */
......@@ -2622,7 +2588,7 @@ SendPortEnable(MPT_ADAPTER *ioc, int portnum, int sleepFlag)
/* RAID FW may take a long time to enable
*/
if ((int)ioc->chip_type <= (int)FC929) {
if (ioc->bus_type == FC) {
ii = mpt_handshake_req_reply_wait(ioc, req_sz, (u32*)&port_enable,
reply_sz, (u16*)&reply_buf, 65 /*seconds*/, sleepFlag);
} else {
......@@ -2992,7 +2958,7 @@ KickStart(MPT_ADAPTER *ioc, int force, int sleepFlag)
int cnt,cntdn;
dinitprintk((KERN_WARNING MYNAM ": KickStarting %s!\n", ioc->name));
if ((int)ioc->chip_type > (int)FC929) {
if (ioc->bus_type == SCSI) {
/* Always issue a Msg Unit Reset first. This will clear some
* SCSI bus hang conditions.
*/
......@@ -3420,7 +3386,7 @@ initChainBuffers(MPT_ADAPTER *ioc)
dinitprintk((KERN_INFO MYNAM ": %s Now numSGE=%d num_sge=%d num_chain=%d\n",
ioc->name, numSGE, num_sge, num_chain));
if ((int) ioc->chip_type > (int) FC929)
if (ioc->bus_type == SCSI)
num_chain *= MPT_SCSI_CAN_QUEUE;
else
num_chain *= MPT_FC_CAN_QUEUE;
......@@ -5277,7 +5243,7 @@ procmpt_iocinfo_read(char *buf, char **start, off_t offset, int request, int *eo
len += sprintf(buf+len, " PortNumber = %d (of %d)\n",
p+1,
ioc->facts.NumberOfPorts);
if ((int)ioc->chip_type <= (int)FC929) {
if (ioc->bus_type == FC) {
if (ioc->pfacts[p].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN) {
u8 *a = (u8*)&ioc->lan_cnfg_page1.HardwareAddressLow;
len += sprintf(buf+len, " LanAddr = %02X:%02X:%02X:%02X:%02X:%02X\n",
......@@ -5921,11 +5887,6 @@ fusion_init(void)
int i;
int r;
if (FusionInitCalled++) {
dprintk((KERN_INFO MYNAM ": INFO - Driver late-init entry point called\n"));
return 0;
}
show_mptmod_ver(my_NAME, my_VERSION);
printk(KERN_INFO COPYRIGHT "\n");
......
......@@ -83,8 +83,8 @@
#define COPYRIGHT "Copyright (c) 1999-2004 " MODULEAUTHOR
#endif
#define MPT_LINUX_VERSION_COMMON "3.01.17"
#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.01.17"
#define MPT_LINUX_VERSION_COMMON "3.01.18"
#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.01.18"
#define WHAT_MAGIC_STRING "@" "(" "#" ")"
#define show_mptmod_ver(s,ver) \
......@@ -296,23 +296,6 @@ typedef struct _MPT_SGL64_HDR {
SGESimple64_t sge[1];
} MPT_SGL64_HDR;
/*
* Chip-specific stuff... FC929 delineates break between
* FC and Parallel SCSI parts. Do NOT re-order.
*/
typedef enum {
FC919X = 0x0819,
FC929X = 0x0829,
FC909 = 0x0909,
FC919 = 0x0919,
FC929 = 0x0929,
C1030 = 0x1030,
C1035 = 0x1035,
FCUNK = 0xFBAD
} CHIP_TYPE;
/*
* System interface register set
*/
......@@ -517,6 +500,7 @@ typedef struct _MPT_ADAPTER
char *prod_name; /* "LSIFC9x9" */
SYSIF_REGS __iomem *chip; /* == c8817000 (mmap) */
SYSIF_REGS __iomem *pio_chip; /* Programmed IO (downloadboot) */
u8 bus_type;
u32 mem_phys; /* == f4020000 (mmap) */
u32 pio_mem_phys; /* Programmed IO (downloadboot) */
int mem_size; /* mmap memory size */
......@@ -543,7 +527,6 @@ typedef struct _MPT_ADAPTER
dma_addr_t ChainBufferDMA;
struct list_head FreeChainQ;
spinlock_t FreeChainQlock;
CHIP_TYPE chip_type;
/* We (host driver) get to manage our own RequestQueue! */
dma_addr_t req_frames_dma;
MPT_FRAME_HDR *req_frames; /* Request msg frames - rounded up! */
......@@ -573,12 +556,6 @@ typedef struct _MPT_ADAPTER
int eventTypes; /* Event logging parameters */
int eventContext; /* Next event context */
int eventLogSize; /* Max number of cached events */
#ifdef MPTSCSIH_DBG_TIMEOUT
int timeout_hard;
int timeout_delta;
int timeout_cnt;
int timeout_maxcnt;
#endif
struct _mpt_ioctl_events *events; /* pointer to event log */
u8 *cached_fw; /* Pointer to FW */
dma_addr_t cached_fw_dma;
......@@ -894,6 +871,12 @@ typedef struct _MPT_LOCAL_REPLY {
#define TM_STATE_IN_PROGRESS (1)
#define TM_STATE_ERROR (2)
typedef enum {
FC,
SCSI,
SAS
} BUS_TYPE;
typedef struct _MPT_SCSI_HOST {
MPT_ADAPTER *ioc;
int port;
......@@ -909,7 +892,6 @@ typedef struct _MPT_SCSI_HOST {
*/
u8 tmPending;
u8 resetPending;
u8 is_spi; /* Parallel SCSI i/f */
u8 negoNvram; /* DV disabled, nego NVRAM */
u8 pad1;
u8 tmState;
......
......@@ -1218,7 +1218,7 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
/* Fill in the data and return the structure to the calling
* program
*/
if ((int)ioc->chip_type <= (int) FC929)
if (ioc->bus_type == FC)
karg->adapterType = MPT_IOCTL_INTERFACE_FC;
else
karg->adapterType = MPT_IOCTL_INTERFACE_SCSI;
......@@ -1518,7 +1518,7 @@ mptctl_readtest (unsigned long arg)
#ifdef MFCNT
karg.chip_type = ioc->mfcnt;
#else
karg.chip_type = ioc->chip_type;
karg.chip_type = ioc->pcidev->device;
#endif
strncpy (karg.name, ioc->name, MPT_MAX_NAME);
karg.name[MPT_MAX_NAME-1]='\0';
......@@ -2470,7 +2470,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
karg.base_io_addr = pci_resource_start(pdev, 0);
if ((int)ioc->chip_type <= (int) FC929)
if (ioc->bus_type == FC)
karg.bus_phys_width = HP_BUS_WIDTH_UNK;
else
karg.bus_phys_width = HP_BUS_WIDTH_16;
......@@ -2559,7 +2559,7 @@ mptctl_hp_targetinfo(unsigned long arg)
/* There is nothing to do for FCP parts.
*/
if ((int) ioc->chip_type <= (int) FC929)
if (ioc->bus_type == FC)
return 0;
if ((ioc->spi_data.sdp0length == 0) || (ioc->sh == NULL))
......
......@@ -96,10 +96,22 @@ MODULE_AUTHOR(MODULEAUTHOR);
MODULE_DESCRIPTION(my_NAME);
MODULE_LICENSE("GPL");
/* Set string for command line args from insmod */
#ifdef MODULE
char *mptscsih = NULL;
module_param(mptscsih, charp, 0);
static int dv = MPTSCSIH_DOMAIN_VALIDATION;
module_param(dv, int, 0);
MODULE_PARM_DESC(dv, "DV Algorithm: enhanced = 1, basic = 0 (default=MPTSCSIH_DOMAIN_VALIDATION=1)");
static int width = MPTSCSIH_MAX_WIDTH;
module_param(width, int, 0);
MODULE_PARM_DESC(width, "Max Bus Width: wide = 1, narrow = 0 (default=MPTSCSIH_MAX_WIDTH=1)");
static ushort factor = MPTSCSIH_MIN_SYNC;
module_param(factor, ushort, 0);
MODULE_PARM_DESC(factor, "Min Sync Factor: (default=MPTSCSIH_MIN_SYNC=0x08)");
static int saf_te = MPTSCSIH_SAF_TE;
module_param(saf_te, int, 0);
MODULE_PARM_DESC(saf_te, "Force enabling SEP Processor: (default=MPTSCSIH_SAF_TE=0)");
#endif
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
......@@ -200,9 +212,6 @@ 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);
......@@ -245,15 +254,9 @@ static DECLARE_WAIT_QUEUE_HEAD (scandv_waitq);
static int scandv_wait_done = 1;
/* Driver default setup
/* Driver command line structure
*/
static struct mptscsih_driver_setup
driver_setup = MPTSCSIH_DRIVER_SETUP;
#ifdef MPTSCSIH_DBG_TIMEOUT
static struct scsi_cmnd *foo_to[8];
#endif
static struct mptscsih_driver_setup driver_setup;
static struct scsi_host_template driver_template;
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
......@@ -653,27 +656,6 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
pScsiReq = (SCSIIORequest_t *) mf;
pScsiReply = (SCSIIOReply_t *) mr;
#ifdef MPTSCSIH_DBG_TIMEOUT
if (ioc->timeout_cnt > 0) {
int ii, left = 0;
for (ii=0; ii < 8; ii++) {
if (sc == foo_to[ii]) {
printk(MYIOC_s_INFO_FMT "complete (%p, %ld)\n",
ioc->name, sc, jiffies);
foo_to[ii] = NULL;
}
if (foo_to[ii] != NULL)
left++;
}
if (left == 0) {
ioc->timeout_maxcnt = 0;
ioc->timeout_cnt = 0;
}
}
#endif
if (pScsiReply == NULL) {
/* special context reply handling */
;
......@@ -686,13 +668,14 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
scsi_state = pScsiReply->SCSIState;
scsi_status = pScsiReply->SCSIStatus;
xfer_cnt = le32_to_cpu(pScsiReply->TransferCount);
sc->resid = sc->request_bufflen - xfer_cnt;
dreplyprintk((KERN_NOTICE " Reply (%d:%d:%d) mf=%p, mr=%p, sc=%p\n",
dreplyprintk((KERN_NOTICE "Reply ha=%d id=%d lun=%d:\n"
"IOCStatus=%04xh SCSIState=%02xh SCSIStatus=%02xh\n"
"resid=%d bufflen=%d xfer_cnt=%d\n",
ioc->id, pScsiReq->TargetID, pScsiReq->LUN[1],
mf, mr, sc));
dreplyprintk((KERN_NOTICE "IOCStatus=%04xh SCSIState=%02xh"
" SCSIStatus=%02xh xfer_cnt=%08xh\n",
status, scsi_state, scsi_status, xfer_cnt));
status, scsi_state, scsi_status, sc->resid,
sc->request_bufflen, xfer_cnt));
if (scsi_state & MPI_SCSI_STATE_AUTOSENSE_VALID)
copy_sense_data(sc, hd, mf, pScsiReply);
......@@ -737,12 +720,11 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
sc->result = DID_RESET << 16;
/* GEM Workaround. */
if (hd->is_spi)
if (ioc->bus_type == SCSI)
mptscsih_no_negotiate(hd, sc->device->id);
break;
case MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH: /* 0x0049 */
sc->resid = sc->request_bufflen - xfer_cnt;
if ( xfer_cnt >= sc->underflow ) {
/* Sufficient data transfer occurred */
sc->result = (DID_OK << 16) | scsi_status;
......@@ -771,7 +753,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
*/
;
} else {
if ( (xfer_cnt == 0) || (sc->underflow > xfer_cnt)) {
if (xfer_cnt < sc->underflow) {
sc->result = DID_SOFT_ERROR << 16;
}
if (scsi_state & (MPI_SCSI_STATE_AUTOSENSE_FAILED | MPI_SCSI_STATE_NO_SCSI_STATUS)) {
......@@ -785,15 +767,9 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
}
}
/* Give report and update residual count.
*/
dreplyprintk((KERN_NOTICE " sc->underflow={report ERR if < %02xh bytes xfer'd}\n",
sc->underflow));
dreplyprintk((KERN_NOTICE " ActBytesXferd=%02xh\n", xfer_cnt));
sc->resid = sc->request_bufflen - xfer_cnt;
dreplyprintk((KERN_NOTICE " SET sc->resid=%02xh\n", sc->resid));
/* Report Queue Full
*/
if (scsi_status == MPI_SCSI_STATUS_TASK_SET_FULL)
......@@ -1132,7 +1108,7 @@ mptscsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
* max_lun = 1 + actual last lun,
* see hosts.h :o(
*/
if ((int)ioc->chip_type > (int)FC929) {
if (ioc->bus_type == SCSI) {
sh->max_id = MPT_MAX_SCSI_DEVICES;
} else {
/* For FC, increase the queue depth
......@@ -1191,9 +1167,6 @@ mptscsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
hd = (MPT_SCSI_HOST *) sh->hostdata;
hd->ioc = ioc;
if ((int)ioc->chip_type > (int)FC929)
hd->is_spi = 1;
/* SCSI needs scsi_cmnd lookup table!
* (with size equal to req_depth*PtrSz!)
*/
......@@ -1259,15 +1232,7 @@ mptscsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
/* Moved Earlier Pam D */
/* ioc->sh = sh; */
#ifdef MPTSCSIH_DBG_TIMEOUT
ioc->timeout_hard = 0;
ioc->timeout_delta = 30 * HZ;
ioc->timeout_maxcnt = 0;
ioc->timeout_cnt = 0;
for (ii=0; ii < 8; ii++)
foo_to[ii] = NULL;
#endif
if (hd->is_spi) {
if (ioc->bus_type == SCSI) {
/* Update with the driver setup
* values.
*/
......@@ -1278,9 +1243,9 @@ mptscsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
}
if (ioc->spi_data.minSyncFactor <
driver_setup.min_sync_fac) {
driver_setup.min_sync_factor) {
ioc->spi_data.minSyncFactor =
driver_setup.min_sync_fac;
driver_setup.min_sync_factor;
}
if (ioc->spi_data.minSyncFactor == MPT_ASYNC) {
......@@ -1307,7 +1272,7 @@ mptscsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
"dv %x width %x factor %x saf_te %x\n",
ioc->name, driver_setup.dv,
driver_setup.max_width,
driver_setup.min_sync_fac,
driver_setup.min_sync_factor,
driver_setup.saf_te));
}
......@@ -1374,11 +1339,11 @@ mptscsih_remove(struct pci_dev *pdev)
hd = (MPT_SCSI_HOST *)host->hostdata;
if (hd != NULL) {
int sz1, sz3, sztarget=0;
int sz1;
mptscsih_shutdown(&pdev->dev);
sz1 = sz3 = 0;
sz1=0;
if (hd->ScsiLookup != NULL) {
sz1 = hd->ioc->req_depth * sizeof(void *);
......@@ -1387,36 +1352,16 @@ mptscsih_remove(struct pci_dev *pdev)
}
if (hd->Targets != NULL) {
int max, ii;
/*
* Free any target structures that were allocated.
*/
if (hd->is_spi) {
max = MPT_MAX_SCSI_DEVICES;
} else {
max = MPT_MAX_FC_DEVICES<256 ? MPT_MAX_FC_DEVICES : 255;
}
for (ii=0; ii < max; ii++) {
if (hd->Targets[ii]) {
kfree(hd->Targets[ii]);
hd->Targets[ii] = NULL;
sztarget += sizeof(VirtDevice);
}
}
/*
* Free pointer array.
*/
sz3 = max * sizeof(void *);
kfree(hd->Targets);
hd->Targets = NULL;
}
dprintk((MYIOC_s_INFO_FMT
"Free'd ScsiLookup (%d) Target (%d+%d) memory\n",
hd->ioc->name, sz1, sz3, sztarget));
dprintk(("Free'd done and free Q (%d) memory\n", szQ));
"Free'd ScsiLookup (%d) memory\n",
hd->ioc->name, sz1));
/* NULL the Scsi_Host pointer
*/
......@@ -1545,9 +1490,15 @@ mptscsih_init(void)
}
#ifdef MODULE
/* Evaluate the command line arguments, if any */
if (mptscsih)
mptscsih_setup(mptscsih);
dinitprintk((KERN_INFO MYNAM
": Command Line Args: dv=%d max_width=%d "
"factor=0x%x saf_te=%d\n",
dv, width, factor, saf_te));
driver_setup.dv = (dv) ? 1 : 0;
driver_setup.max_width = (width) ? 1 : 0;
driver_setup.min_sync_factor = factor;
driver_setup.saf_te = (saf_te) ? 1 : 0;;
#endif
if(mpt_device_driver_register(&mptscsih_driver,
......@@ -1676,129 +1627,6 @@ static int mptscsih_host_info(MPT_ADAPTER *ioc, char *pbuf, off_t offset, int le
return ((info.pos > info.offset) ? info.pos - info.offset : 0);
}
#ifndef MPTSCSIH_DBG_TIMEOUT
static int mptscsih_user_command(MPT_ADAPTER *ioc, char *pbuf, int len)
{
/* Not yet implemented */
return len;
}
#else
#define is_digit(c) ((c) >= '0' && (c) <= '9')
#define digit_to_bin(c) ((c) - '0')
#define is_space(c) ((c) == ' ' || (c) == '\t')
#define UC_DBG_TIMEOUT 0x01
#define UC_DBG_HARDRESET 0x02
static int skip_spaces(char *ptr, int len)
{
int cnt, c;
for (cnt = len; cnt > 0 && (c = *ptr++) && is_space(c); cnt --);
return (len - cnt);
}
static int get_int_arg(char *ptr, int len, ulong *pv)
{
int cnt, c;
ulong v;
for (v = 0, cnt = len; cnt > 0 && (c=*ptr++) && is_digit(c); cnt --) {
v = (v * 10) + digit_to_bin(c);
}
if (pv)
*pv = v;
return (len - cnt);
}
static int is_keyword(char *ptr, int len, char *verb)
{
int verb_len = strlen(verb);
if (len >= strlen(verb) && !memcmp(verb, ptr, verb_len))
return verb_len;
else
return 0;
}
#define SKIP_SPACES(min_spaces) \
if ((arg_len = skip_spaces(ptr,len)) < (min_spaces)) \
return -EINVAL; \
ptr += arg_len; \
len -= arg_len;
#define GET_INT_ARG(v) \
if (!(arg_len = get_int_arg(ptr,len, &(v)))) \
return -EINVAL; \
ptr += arg_len; \
len -= arg_len;
static int mptscsih_user_command(MPT_ADAPTER *ioc, char *buffer, int length)
{
char *ptr = buffer;
char btmp[24]; /* REMOVE */
int arg_len;
int len = length;
int cmd;
ulong number = 1;
ulong delta = 10;
if ((len > 0) && (ptr[len -1] == '\n'))
--len;
if (len < 22) {
strncpy(btmp, buffer, len);
btmp[len+1]='\0';
} else {
strncpy(btmp, buffer, 22);
btmp[23]='\0';
}
printk("user_command: ioc %d, buffer %s, length %d\n",
ioc->id, btmp, length);
if ((arg_len = is_keyword(ptr, len, "timeout")) != 0)
cmd = UC_DBG_TIMEOUT;
else if ((arg_len = is_keyword(ptr, len, "hardreset")) != 0)
cmd = UC_DBG_HARDRESET;
else
return -EINVAL;
ptr += arg_len;
len -= arg_len;
switch(cmd) {
case UC_DBG_TIMEOUT:
SKIP_SPACES(1);
GET_INT_ARG(number);
SKIP_SPACES(1);
GET_INT_ARG(delta);
break;
}
printk("user_command: cnt=%ld delta=%ld\n", number, delta);
if (len)
return -EINVAL;
else {
if (cmd == UC_DBG_HARDRESET) {
ioc->timeout_hard = 1;
} else if (cmd == UC_DBG_TIMEOUT) {
/* process this command ...
*/
ioc->timeout_maxcnt = 0;
ioc->timeout_delta = delta < 2 ? 2 : delta;
ioc->timeout_cnt = 0;
ioc->timeout_maxcnt = number < 8 ? number: 8;
}
}
/* Not yet implemented */
return length;
}
#endif
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/**
* mptscsih_proc_info - Return information about MPT adapter
......@@ -1821,7 +1649,9 @@ mptscsih_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t off
int size = 0;
if (func) {
size = mptscsih_user_command(ioc, buffer, length);
/*
* write is not supported
*/
} else {
if (start)
*start = buffer;
......@@ -1832,7 +1662,6 @@ mptscsih_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t off
return size;
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
#define ADD_INDEX_LOG(req_ent) do { } while(0)
......@@ -1863,11 +1692,7 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
u32 cmd_len;
int my_idx;
int ii;
int rc;
int did_errcode;
int issueCmd;
did_errcode = 0;
hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata;
target = SCpnt->device->id;
lun = SCpnt->device->lun;
......@@ -1966,29 +1791,26 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
/* Now add the SG list
* Always have a SGE even if null length.
*/
rc = SUCCESS;
if (datalen == 0) {
/* Add a NULL SGE */
mptscsih_add_sge((char *)&pScsiReq->SGL, MPT_SGE_FLAGS_SSIMPLE_READ | 0,
(dma_addr_t) -1);
} else {
/* Add a 32 or 64 bit SGE */
rc = mptscsih_AddSGE(hd->ioc, SCpnt, pScsiReq, my_idx);
if (mptscsih_AddSGE(hd->ioc, SCpnt, pScsiReq, my_idx) != SUCCESS)
goto fail;
}
if (rc == SUCCESS) {
hd->ScsiLookup[my_idx] = SCpnt;
SCpnt->host_scribble = NULL;
/* SCSI specific processing */
issueCmd = 1;
if (hd->is_spi) {
#ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION
if (hd->ioc->bus_type == SCSI) {
int dvStatus = hd->ioc->spi_data.dvStatus[target];
int issueCmd = 1;
if (dvStatus || hd->ioc->spi_data.forceDv) {
#ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION
if ((dvStatus & MPT_SCSICFG_NEED_DV) ||
(hd->ioc->spi_data.forceDv & MPT_SCSICFG_NEED_DV)) {
unsigned long lflags;
......@@ -2018,32 +1840,17 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
*/
if (dvStatus & MPT_SCSICFG_DV_NOT_DONE)
mptscsih_set_dvflags(hd, pScsiReq);
#endif
}
}
#ifdef MPTSCSIH_DBG_TIMEOUT
if (hd->ioc->timeout_cnt < hd->ioc->timeout_maxcnt) {
foo_to[hd->ioc->timeout_cnt] = SCpnt;
hd->ioc->timeout_cnt++;
//mod_timer(&SCpnt->eh_timeout, jiffies + hd->ioc->timeout_delta);
issueCmd = 0;
printk(MYIOC_s_WARN_FMT
"to pendingQ: (sc=%p, mf=%p, time=%ld)\n",
hd->ioc->name, SCpnt, mf, jiffies);
if (!issueCmd)
goto fail;
}
}
#endif
if (issueCmd) {
mpt_put_msg_frame(ScsiDoneCtx, hd->ioc, mf);
dmfprintk((MYIOC_s_INFO_FMT "Issued SCSI cmd (%p) mf=%p idx=%d\n",
hd->ioc->name, SCpnt, mf, my_idx));
DBG_DUMP_REQUEST_FRAME(mf)
} else
goto fail;
} else
goto fail;
return 0;
fail:
......@@ -2216,11 +2023,6 @@ mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, u8 lun, in
}
}
#ifdef MPTSCSIH_DBG_TIMEOUT
if (hd->ioc->timeout_hard)
rc = 1;
#endif
/* Only fall through to the HRH if this is a bus reset
*/
if ((type == MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS) && (rc ||
......@@ -2457,9 +2259,9 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt)
printk(KERN_WARNING MYNAM ": %s: >> Attempting target reset! (sc=%p)\n",
hd->ioc->name, SCpnt);
/* Unsupported for SCSI. Supported for FCP
/* Supported for FC only.
*/
if (hd->is_spi)
if (hd->ioc->bus_type == SCSI)
return FAILED;
spin_unlock_irq(host_lock);
......@@ -2767,20 +2569,23 @@ static int
mptscsih_slave_alloc(struct scsi_device *device)
{
struct Scsi_Host *host = device->host;
MPT_SCSI_HOST *hd;
MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
VirtDevice *vdev;
hd = (MPT_SCSI_HOST *)host->hostdata;
uint target = device->id;
if (hd == NULL)
return -ENODEV;
if ((vdev = hd->Targets[device->id]) == NULL) {
if ((vdev = kmalloc(sizeof(VirtDevice), GFP_ATOMIC)) == NULL) {
printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%d) FAILED!\n",
hd->ioc->name, (int)sizeof(VirtDevice));
if ((vdev = hd->Targets[target]) != NULL)
goto out;
vdev = kmalloc(sizeof(VirtDevice), GFP_KERNEL);
if (!vdev) {
printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%zd) FAILED!\n",
hd->ioc->name, sizeof(VirtDevice));
return -ENOMEM;
} else {
}
memset(vdev, 0, sizeof(VirtDevice));
vdev->tflags = MPT_TARGET_FLAGS_Q_YES;
vdev->ioc_id = hd->ioc->id;
......@@ -2788,7 +2593,7 @@ mptscsih_slave_alloc(struct scsi_device *device)
vdev->bus_id = device->channel;
vdev->raidVolume = 0;
hd->Targets[device->id] = vdev;
if (hd->is_spi) {
if (hd->ioc->bus_type == SCSI) {
if (hd->ioc->spi_data.isRaid & (1 << device->id)) {
vdev->raidVolume = 1;
ddvtprintk((KERN_INFO
......@@ -2797,9 +2602,23 @@ mptscsih_slave_alloc(struct scsi_device *device)
} else {
vdev->tflags |= MPT_TARGET_FLAGS_VALID_INQUIRY;
}
}
}
out:
vdev->num_luns++;
return 0;
}
static int mptscsih_is_raid_volume(MPT_SCSI_HOST *hd, uint id)
{
int i;
if (!hd->ioc->spi_data.isRaid || !hd->ioc->spi_data.pIocPg3)
return 0;
for (i = 0; i < hd->ioc->spi_data.pIocPg3->NumPhysDisks; i++) {
if (id == hd->ioc->spi_data.pIocPg3->PhysDisk[i].PhysDiskID)
return 1;
}
return 0;
}
......@@ -2812,59 +2631,37 @@ static void
mptscsih_slave_destroy(struct scsi_device *device)
{
struct Scsi_Host *host = device->host;
MPT_SCSI_HOST *hd;
MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
VirtDevice *vdev;
int raid_volume=0;
hd = (MPT_SCSI_HOST *)host->hostdata;
uint target = device->id;
uint lun = device->lun;
if (hd == NULL)
return;
mptscsih_search_running_cmds(hd, device->id, device->lun);
/* Free memory and reset all flags for this target
*/
if ((vdev = hd->Targets[device->id]) != NULL) {
vdev->num_luns--;
if (vdev->luns[0] & (1 << device->lun))
vdev->luns[0] &= ~(1 << device->lun);
/* Free device structure only if number of luns is 0.
*/
if (vdev->num_luns == 0) {
kfree(hd->Targets[device->id]);
hd->Targets[device->id] = NULL;
mptscsih_search_running_cmds(hd, target, lun);
if (!hd->is_spi)
vdev = hd->Targets[target];
vdev->luns[0] &= ~(1 << lun);
if (--vdev->num_luns)
return;
if((hd->ioc->spi_data.isRaid) && (hd->ioc->spi_data.pIocPg3)) {
int i;
for(i=0;i<hd->ioc->spi_data.pIocPg3->NumPhysDisks &&
raid_volume==0;i++)
kfree(hd->Targets[target]);
hd->Targets[target] = NULL;
if(device->id ==
hd->ioc->spi_data.pIocPg3->PhysDisk[i].PhysDiskID) {
raid_volume=1;
hd->ioc->spi_data.forceDv |=
MPT_SCSICFG_RELOAD_IOC_PG3;
}
}
if(!raid_volume){
hd->ioc->spi_data.dvStatus[device->id] =
if (hd->ioc->bus_type == SCSI) {
if (mptscsih_is_raid_volume(hd, target)) {
hd->ioc->spi_data.forceDv |= MPT_SCSICFG_RELOAD_IOC_PG3;
} else {
hd->ioc->spi_data.dvStatus[target] =
MPT_SCSICFG_NEGOTIATE;
if (hd->negoNvram == 0)
hd->ioc->spi_data.dvStatus[device->id]
|= MPT_SCSICFG_DV_NOT_DONE;
if (!hd->negoNvram) {
hd->ioc->spi_data.dvStatus[target] |=
MPT_SCSICFG_DV_NOT_DONE;
}
}
}
return;
}
static void
......@@ -2874,7 +2671,7 @@ mptscsih_set_queue_depth(struct scsi_device *device, MPT_SCSI_HOST *hd,
int max_depth;
int tagged;
if ( hd->is_spi ) {
if (hd->ioc->bus_type == SCSI) {
if (pTarget->tflags & MPT_TARGET_FLAGS_VALID_INQUIRY) {
if (!(pTarget->tflags & MPT_TARGET_FLAGS_Q_YES))
max_depth = 1;
......@@ -2989,7 +2786,6 @@ mptscsih_store_queue_depth(struct device *dev, const char *buf, size_t count)
return count;
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/*
* Private routines...
......@@ -3125,10 +2921,6 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
mpt_free_msg_frame(ioc, hd->tmPtr);
}
#ifdef MPTSCSIH_DBG_TIMEOUT
ioc->timeout_hard = 0;
#endif
dtmprintk((MYIOC_s_WARN_FMT "Pre-Reset complete.\n", ioc->name));
} else {
......@@ -3158,7 +2950,7 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
/* 4. Renegotiate to all devices, if SCSI
*/
if (hd->is_spi) {
if (ioc->bus_type == SCSI) {
dnegoprintk(("writeSDP1: ALL_IDS USE_NVRAM\n"));
mptscsih_writeSDP1(hd, 0, 0, MPT_SCSICFG_ALL_IDS | MPT_SCSICFG_USE_NVRAM);
}
......@@ -3187,7 +2979,7 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
/* 7. Set flag to force DV and re-read IOC Page 3
*/
if (hd->is_spi) {
if (ioc->bus_type == SCSI) {
ioc->spi_data.forceDv = MPT_SCSICFG_NEED_DV | MPT_SCSICFG_RELOAD_IOC_PG3;
ddvtprintk(("Set reload IOC Pg3 Flag\n"));
}
......@@ -3218,7 +3010,7 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
hd = NULL;
if (ioc->sh) {
hd = (MPT_SCSI_HOST *) ioc->sh->hostdata;
if (hd && (hd->is_spi) && (hd->soft_resets < -1))
if (hd && (ioc->bus_type == SCSI) && (hd->soft_resets < -1))
hd->soft_resets++;
}
break;
......@@ -3247,7 +3039,7 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
if (ioc->sh)
hd = (MPT_SCSI_HOST *) ioc->sh->hostdata;
if (hd && (hd->is_spi) && (hd->negoNvram == 0)) {
if (hd && (ioc->bus_type == SCSI) && (hd->negoNvram == 0)) {
ScsiCfgData *pSpi;
Ioc3PhysDisk_t *pPDisk;
int numPDisk;
......@@ -3394,7 +3186,7 @@ mptscsih_initTarget(MPT_SCSI_HOST *hd, int bus_id, int target_id, u8 lun, char *
indexed_lun = (lun % 32);
vdev->luns[lun_index] |= (1 << indexed_lun);
if (hd->is_spi) {
if (hd->ioc->bus_type == SCSI) {
if ((data[0] == TYPE_PROCESSOR) && (hd->ioc->spi_data.Saf_Te)) {
/* Treat all Processors as SAF-TE if
* command line option is set */
......@@ -4675,7 +4467,7 @@ mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, int portnum)
/* Write SDP1 for all SCSI devices
* Alloc memory and set up config buffer
*/
if (hd->is_spi) {
if (ioc->bus_type == SCSI) {
if (ioc->spi_data.sdp1length > 0) {
pcfg1Data = (SCSIDevicePage1_t *)pci_alloc_consistent(ioc->pcidev,
ioc->spi_data.sdp1length * 4, &cfg1_dma_addr);
......@@ -4818,7 +4610,7 @@ mptscsih_domainValidation(void *arg)
msleep(250);
/* DV only to SCSI adapters */
if ((int)ioc->chip_type <= (int)FC929)
if (ioc->bus_type != SCSI)
continue;
/* Make sure everything looks ok */
......@@ -6289,107 +6081,6 @@ mptscsih_fillbuf(char *buffer, int size, int index, int width)
#endif /* ~MPTSCSIH_ENABLE_DOMAIN_VALIDATION */
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/* Commandline Parsing routines and defines.
*
* insmod format:
* insmod mptscsih mptscsih="width:1 dv:n factor:0x09 saf-te:1"
* boot format:
* mptscsih=width:1,dv:n,factor:0x8,saf-te:1
*
*/
#ifdef MODULE
#define ARG_SEP ' '
#else
#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)
{
char *cur = setup_token;
char *pc;
int i = 0;
while (cur != NULL && (pc = strchr(cur, ':')) != NULL) {
++pc;
++i;
if (!strncmp(p, cur, pc - cur))
return i;
cur = pc;
}
return 0;
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
static int
mptscsih_setup(char *str)
{
char *cur = str;
char *pc, *pv;
unsigned long val;
int c;
while (cur != NULL && (pc = strchr(cur, ':')) != NULL) {
char *pe;
val = 0;
pv = pc;
c = *++pv;
if (c == 'n')
val = 0;
else if (c == 'y')
val = 1;
else
val = (int) simple_strtoul(pv, &pe, 0);
printk("Found Token: %s, value %x\n", cur, (int)val);
switch (get_setup_token(cur)) {
case OPT_DV:
driver_setup.dv = val;
break;
case OPT_MAX_WIDTH:
driver_setup.max_width = val;
break;
case OPT_MIN_SYNC_FACTOR:
driver_setup.min_sync_fac = val;
break;
case OPT_SAF_TE:
driver_setup.saf_te = val;
break;
default:
printk("mptscsih_setup: unexpected boot option '%.*s' ignored\n", (int)(pc-cur+1), cur);
break;
}
if ((cur = strchr(cur, ARG_SEP)) != NULL)
++cur;
}
return 1;
}
#endif
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
module_init(mptscsih_init);
module_exit(mptscsih_exit);
......@@ -95,17 +95,8 @@ struct mptscsih_driver_setup
{
u8 dv;
u8 max_width;
u8 min_sync_fac;
u8 min_sync_factor;
u8 saf_te;
};
#define MPTSCSIH_DRIVER_SETUP \
{ \
MPTSCSIH_DOMAIN_VALIDATION, \
MPTSCSIH_MAX_WIDTH, \
MPTSCSIH_MIN_SYNC, \
MPTSCSIH_SAF_TE, \
}
#endif
......@@ -34,8 +34,7 @@
#ifndef ZFCP_DEF_H
#define ZFCP_DEF_H
/* this drivers version (do not edit !!! generated and updated by cvs) */
#define ZFCP_DEF_REVISION "$Revision: 1.110 $"
#define ZFCP_DEF_REVISION "$Revision: 1.111 $"
/*************************** INCLUDES *****************************************/
......@@ -70,6 +69,7 @@
/********************* GENERAL DEFINES *********************************/
/* zfcp version number, it consists of major, minor, and patch-level number */
#define ZFCP_VERSION "4.2.0"
/**
......
......@@ -31,8 +31,7 @@
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_ERP
/* this drivers version (do not edit !!! generated and updated by cvs) */
#define ZFCP_ERP_REVISION "$Revision: 1.83 $"
#define ZFCP_ERP_REVISION "$Revision: 1.85 $"
#include "zfcp_ext.h"
......@@ -3482,9 +3481,8 @@ zfcp_erp_port_access_denied(struct zfcp_port *port)
debug_text_event(adapter->erp_dbf, 3, "p_access_block");
debug_event(adapter->erp_dbf, 3, &port->wwpn, sizeof(wwn_t));
read_lock_irqsave(&zfcp_data.config_lock, flags);
zfcp_erp_modify_port_status(port,
ZFCP_STATUS_COMMON_ERP_FAILED | ZFCP_STATUS_COMMON_ACCESS_DENIED,
ZFCP_SET);
zfcp_erp_modify_port_status(port, ZFCP_STATUS_COMMON_ERP_FAILED |
ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET);
read_unlock_irqrestore(&zfcp_data.config_lock, flags);
}
......@@ -3500,9 +3498,8 @@ zfcp_erp_unit_access_denied(struct zfcp_unit *unit)
debug_text_event(adapter->erp_dbf, 3, "u_access_block");
debug_event(adapter->erp_dbf, 3, &unit->fcp_lun, sizeof(fcp_lun_t));
zfcp_erp_modify_unit_status(unit,
ZFCP_STATUS_COMMON_ERP_FAILED | ZFCP_STATUS_COMMON_ACCESS_DENIED,
ZFCP_SET);
zfcp_erp_modify_unit_status(unit, ZFCP_STATUS_COMMON_ERP_FAILED |
ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET);
}
/*
......@@ -3541,19 +3538,21 @@ zfcp_erp_port_access_changed(struct zfcp_port *port)
debug_text_event(adapter->erp_dbf, 3, "p_access_unblock");
debug_event(adapter->erp_dbf, 3, &port->wwpn, sizeof(wwn_t));
if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED, &port->status)) {
if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED,
&port->status)) {
if (!atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status))
list_for_each_entry(unit, &port->unit_list_head, list)
zfcp_erp_unit_access_changed(unit);
return;
}
ZFCP_LOG_NORMAL("Trying to reopen port 0x%016Lx on adapter %s "
"due to update to access control table\n",
ZFCP_LOG_NORMAL("reopen of port 0x%016Lx on adapter %s "
"(due to ACT update)\n",
port->wwpn, zfcp_get_busid_by_adapter(adapter));
if (zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED) != 0)
ZFCP_LOG_NORMAL("Reopen of port 0x%016Lx on adapter %s failed\n",
port->wwpn, zfcp_get_busid_by_adapter(adapter));
ZFCP_LOG_NORMAL("failed reopen of port"
"(adapter %s, wwpn=0x%016Lx)\n",
zfcp_get_busid_by_adapter(adapter), port->wwpn);
}
/*
......@@ -3572,16 +3571,15 @@ zfcp_erp_unit_access_changed(struct zfcp_unit *unit)
if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED, &unit->status))
return;
ZFCP_LOG_NORMAL("Trying to reopen unit 0x%016Lx "
"on port 0x%016Lx on adapter %s "
"due to update to access control table\n",
ZFCP_LOG_NORMAL("reopen of unit 0x%016Lx on port 0x%016Lx "
" on adapter %s (due to ACT update)\n",
unit->fcp_lun, unit->port->wwpn,
zfcp_get_busid_by_adapter(adapter));
if (zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED) != 0)
ZFCP_LOG_NORMAL("Reopen of unit 0x%016Lx "
"on port 0x%016Lx on adapter %s failed\n",
unit->fcp_lun, unit->port->wwpn,
zfcp_get_busid_by_adapter(adapter));
ZFCP_LOG_NORMAL("failed reopen of unit (adapter %s, "
"wwpn=0x%016Lx, fcp_lun=0x%016Lx)\n",
zfcp_get_busid_by_adapter(adapter),
unit->port->wwpn, unit->fcp_lun);
}
#undef ZFCP_LOG_AREA
......@@ -31,8 +31,8 @@
#ifndef ZFCP_EXT_H
#define ZFCP_EXT_H
/* this drivers version (do not edit !!! generated and updated by cvs) */
#define ZFCP_EXT_REVISION "$Revision: 1.61 $"
#define ZFCP_EXT_REVISION "$Revision: 1.62 $"
#include "zfcp_def.h"
......
......@@ -30,8 +30,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* this drivers version (do not edit !!! generated and updated by cvs) */
#define ZFCP_FSF_C_REVISION "$Revision: 1.86 $"
#define ZFCP_FSF_C_REVISION "$Revision: 1.88 $"
#include "zfcp_ext.h"
......@@ -1737,7 +1736,7 @@ zfcp_fsf_send_els(struct zfcp_send_els *els)
adapter = els->adapter;
ret = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_ELS,
ZFCP_WAIT_FOR_SBAL|ZFCP_REQ_AUTO_CLEANUP,
ZFCP_REQ_AUTO_CLEANUP,
NULL, &lock_flags, &fsf_req);
if (ret < 0) {
ZFCP_LOG_INFO("error: creation of ELS request failed "
......@@ -3094,57 +3093,11 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req)
exclusive = bottom->lun_access_info & FSF_UNIT_ACCESS_EXCLUSIVE;
readwrite = bottom->lun_access_info & FSF_UNIT_ACCESS_OUTBOUND_TRANSFER;
if (!adapter->supported_features & FSF_FEATURE_CFDC)
goto no_cfdc;
atomic_clear_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED |
ZFCP_STATUS_UNIT_SHARED |
ZFCP_STATUS_UNIT_READONLY,
&unit->status);
if (!allowed)
atomic_set_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED, &unit->status);
if (!adapter->supported_features & FSF_FEATURE_LUN_SHARING)
goto no_lun_sharing;
if (!exclusive)
atomic_set_mask(ZFCP_STATUS_UNIT_SHARED, &unit->status);
if (!readwrite) {
atomic_set_mask(ZFCP_STATUS_UNIT_READONLY, &unit->status);
ZFCP_LOG_NORMAL("Unit 0x%016Lx on port 0x%016Lx on adapter %s "
"accessed read-only\n", unit->fcp_lun,
unit->port->wwpn, zfcp_get_busid_by_unit(unit));
}
if (exclusive && !readwrite) {
ZFCP_LOG_NORMAL("Exclusive access of read-only unit not "
"supported\n");
zfcp_erp_unit_failed(unit);
fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
goto skip_fsfstatus;
}
if (!exclusive && readwrite) {
ZFCP_LOG_NORMAL("Shared access of read-write unit is not "
"supported\n");
zfcp_erp_unit_failed(unit);
fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
goto skip_fsfstatus;
}
no_lun_sharing:
no_cfdc:
if (!(adapter->supported_features & FSF_FEATURE_CFDC) &&
(adapter->supported_features & FSF_FEATURE_LUN_SHARING)) {
ZFCP_LOG_NORMAL("LUN sharing without access control is not "
"supported.\n");
zfcp_erp_unit_failed(unit);
fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
goto skip_fsfstatus;
}
/* evaluate FSF status in QTCB */
switch (header->fsf_status) {
......@@ -3196,6 +3149,8 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req)
}
debug_text_event(adapter->erp_dbf, 1, "fsf_s_access");
zfcp_erp_unit_access_denied(unit);
atomic_clear_mask(ZFCP_STATUS_UNIT_SHARED, &unit->status);
atomic_clear_mask(ZFCP_STATUS_UNIT_READONLY, &unit->status);
fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
break;
......
......@@ -31,8 +31,7 @@
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_SCSI
/* this drivers version (do not edit !!! generated and updated by cvs) */
#define ZFCP_SCSI_REVISION "$Revision: 1.73 $"
#define ZFCP_SCSI_REVISION "$Revision: 1.74 $"
#include "zfcp_ext.h"
......
......@@ -1767,7 +1767,7 @@ config SCSI_SUNESP
config ZFCP
tristate "FCP host bus adapter driver for IBM eServer zSeries"
depends on ARCH_S390 && SCSI
depends on ARCH_S390 && QDIO && SCSI
select SCSI_FC_ATTRS
help
If you want to access SCSI devices attached to your IBM eServer
......
......@@ -645,9 +645,31 @@ int aac_get_adapter_info(struct aac_dev* dev)
dev->adapter_info.serial[1]);
dev->nondasd_support = 0;
dev->raid_scsi_mode = 0;
if(dev->adapter_info.options & AAC_OPT_NONDASD){
dev->nondasd_support = 1;
}
/*
* If the firmware supports ROMB RAID/SCSI mode and we are currently
* in RAID/SCSI mode, set the flag. For now if in this mode we will
* force nondasd support on. If we decide to allow the non-dasd flag
* additional changes changes will have to be made to support
* RAID/SCSI. the function aac_scsi_cmd in this module will have to be
* changed to support the new dev->raid_scsi_mode flag instead of
* leaching off of the dev->nondasd_support flag. Also in linit.c the
* function aac_detect will have to be modified where it sets up the
* max number of channels based on the aac->nondasd_support flag only.
*/
if ((dev->adapter_info.options & AAC_OPT_SCSI_MANAGED) &&
(dev->adapter_info.options & AAC_OPT_RAID_SCSI_MODE)) {
dev->nondasd_support = 1;
dev->raid_scsi_mode = 1;
}
if (dev->raid_scsi_mode != 0)
printk(KERN_INFO "%s%d: ROMB RAID/SCSI mode enabled\n",
dev->name, dev->id);
if(nondasd != -1) {
dev->nondasd_support = (nondasd!=0);
}
......@@ -1137,7 +1159,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
char *cp;
dprintk((KERN_DEBUG "READ CAPACITY command.\n"));
if (fsa_dev_ptr[cid].size <= 0x100000000)
if (fsa_dev_ptr[cid].size <= 0x100000000LL)
capacity = fsa_dev_ptr[cid].size - 1;
else
capacity = (u32)-1;
......@@ -1446,8 +1468,17 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
if( b==TYPE_TAPE || b==TYPE_WORM || b==TYPE_ROM || b==TYPE_MOD|| b==TYPE_MEDIUM_CHANGER
|| (b==TYPE_DISK && (b1&0x80)) ){
scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
/*
* We will allow disk devices if in RAID/SCSI mode and
* the channel is 2
*/
} else if ((dev->raid_scsi_mode) &&
(scsicmd->device->channel == 2)) {
scsicmd->result = DID_OK << 16 |
COMMAND_COMPLETE << 8;
} else {
scsicmd->result = DID_NO_CONNECT << 16 | COMMAND_COMPLETE << 8;
scsicmd->result = DID_NO_CONNECT << 16 |
COMMAND_COMPLETE << 8;
}
} else {
scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
......@@ -1479,8 +1510,17 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
if( b==TYPE_TAPE || b==TYPE_WORM || b==TYPE_ROM || b==TYPE_MOD|| b==TYPE_MEDIUM_CHANGER
|| (b==TYPE_DISK && (b1&0x80)) ){
scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
/*
* We will allow disk devices if in RAID/SCSI mode and
* the channel is 2
*/
} else if ((dev->raid_scsi_mode) &&
(scsicmd->device->channel == 2)) {
scsicmd->result = DID_OK << 16 |
COMMAND_COMPLETE << 8;
} else {
scsicmd->result = DID_NO_CONNECT << 16 | COMMAND_COMPLETE << 8;
scsicmd->result = DID_NO_CONNECT << 16 |
COMMAND_COMPLETE << 8;
}
break;
}
......
......@@ -805,6 +805,8 @@ struct aac_adapter_info
#define AAC_OPT_SGMAP_HOST64 cpu_to_le32(1<<10)
#define AAC_OPT_ALARM cpu_to_le32(1<<11)
#define AAC_OPT_NONDASD cpu_to_le32(1<<12)
#define AAC_OPT_SCSI_MANAGED cpu_to_le32(1<<13)
#define AAC_OPT_RAID_SCSI_MODE cpu_to_le32(1<<14)
struct aac_dev
{
......@@ -877,6 +879,7 @@ struct aac_dev
*/
u8 nondasd_support;
u8 dac_support;
u8 raid_scsi_mode;
};
#define aac_adapter_interrupt(dev) \
......
......@@ -540,7 +540,7 @@ struct ahd_platform_data {
uint32_t irq; /* IRQ for this adapter */
uint32_t bios_address;
uint32_t mem_busaddr; /* Mem Base Addr */
dma_addr_t hw_dma_mask;
uint64_t hw_dma_mask;
ahd_linux_softc_flags flags;
};
......
......@@ -170,24 +170,22 @@ ahd_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (sizeof(dma_addr_t) > 4) {
uint64_t memsize;
dma_addr_t mask_64bit;
dma_addr_t mask_39bit;
const uint64_t mask_39bit = 0x7FFFFFFFFFULL;
memsize = ahd_linux_get_memsize();
mask_64bit = (dma_addr_t)0xFFFFFFFFFFFFFFFFULL;
mask_39bit = (dma_addr_t)0x7FFFFFFFFFULL;
if (memsize >= 0x8000000000ULL
&& pci_set_dma_mask(pdev, mask_64bit) == 0) {
&& pci_set_dma_mask(pdev, DMA_64BIT_MASK) == 0) {
ahd->flags |= AHD_64BIT_ADDRESSING;
ahd->platform_data->hw_dma_mask = mask_64bit;
ahd->platform_data->hw_dma_mask = DMA_64BIT_MASK;
} else if (memsize > 0x80000000
&& pci_set_dma_mask(pdev, mask_39bit) == 0) {
ahd->flags |= AHD_39BIT_ADDRESSING;
ahd->platform_data->hw_dma_mask = mask_39bit;
}
} else {
pci_set_dma_mask(pdev, 0xFFFFFFFF);
ahd->platform_data->hw_dma_mask = 0xFFFFFFFF;
pci_set_dma_mask(pdev, DMA_32BIT_MASK);
ahd->platform_data->hw_dma_mask = DMA_32BIT_MASK;
}
ahd->dev_softc = pci;
error = ahd_pci_config(ahd, entry);
......
......@@ -545,7 +545,7 @@ struct ahc_platform_data {
uint32_t irq; /* IRQ for this adapter */
uint32_t bios_address;
uint32_t mem_busaddr; /* Mem Base Addr */
dma_addr_t hw_dma_mask;
uint64_t hw_dma_mask;
ahc_linux_softc_flags flags;
};
......
......@@ -175,7 +175,7 @@ static int
ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
char buf[80];
dma_addr_t mask_39bit;
const uint64_t mask_39bit = 0x7FFFFFFFFFULL;
struct ahc_softc *ahc;
ahc_dev_softc_t pci;
struct ahc_pci_identity *entry;
......@@ -226,18 +226,17 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
}
pci_set_master(pdev);
mask_39bit = 0x7FFFFFFFFFULL;
if (sizeof(dma_addr_t) > 4
&& ahc_linux_get_memsize() > 0x80000000
&& pci_set_dma_mask(pdev, mask_39bit) == 0) {
ahc->flags |= AHC_39BIT_ADDRESSING;
ahc->platform_data->hw_dma_mask = mask_39bit;
} else {
if (pci_set_dma_mask(pdev, 0xFFFFFFFF)) {
if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
printk(KERN_WARNING "aic7xxx: No suitable DMA available.\n");
return (-ENODEV);
}
ahc->platform_data->hw_dma_mask = 0xFFFFFFFF;
ahc->platform_data->hw_dma_mask = DMA_32BIT_MASK;
}
#endif
ahc->dev_softc = pci;
......
......@@ -118,6 +118,7 @@ static struct {
* Other types of devices that have special flags.
* Note that all USB devices should have the BLIST_INQUIRY_36 flag.
*/
{"3PARdata", "VV", NULL, BLIST_REPORTLUN2},
{"ADAPTEC", "AACRAID", NULL, BLIST_FORCELUN},
{"ADAPTEC", "Adaptec 5400S", NULL, BLIST_FORCELUN},
{"AFT PRO", "-IX CF", "0.0>", BLIST_FORCELUN},
......
......@@ -728,7 +728,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes,
req->sense_len = len;
}
} else
req->data_len -= cmd->bufflen;
req->data_len = cmd->resid;
}
/*
......
......@@ -361,9 +361,8 @@ static ssize_t store_spi_host_signalling(struct class_device *cdev,
enum spi_signal_type type = spi_signal_to_value(buf);
if (type != SPI_SIGNAL_UNKNOWN)
return count;
i->f->set_signalling(shost, type);
return count;
}
static CLASS_DEVICE_ATTR(signalling, S_IRUGO | S_IWUSR,
......@@ -635,7 +634,11 @@ spi_dv_device_internal(struct scsi_request *sreq, u8 *buffer)
/* OK, now we have our initial speed set by the read only inquiry
* test, now try an echo buffer test (if the device allows it) */
if ((len = spi_dv_device_get_echo_buffer(sreq, buffer)) == 0) {
len = 0;
if (sdev->ppr)
len = spi_dv_device_get_echo_buffer(sreq, buffer);
if (len == 0) {
SPI_PRINTK(sdev->sdev_target, KERN_INFO, "Domain Validation skipping write tests\n");
return;
}
......
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