cregit-Linux how code gets into the kernel

Release 4.14 drivers/message/fusion/mptspi.c

/*
 *  linux/drivers/message/fusion/mptspi.c
 *      For use with LSI PCI chip/adapter(s)
 *      running LSI Fusion MPT (Message Passing Technology) firmware.
 *
 *  Copyright (c) 1999-2008 LSI Corporation
 *  (mailto:DL-MPTFusionLinux@lsi.com)
 *
 */
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/*
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; version 2 of the License.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    NO WARRANTY
    THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
    CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
    LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
    MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
    solely responsible for determining the appropriateness of using and
    distributing the Program and assumes all risks associated with its
    exercise of rights under this Agreement, including but not limited to
    the risks and costs of program errors, damage to or loss of data,
    programs or equipment, and unavailability or interruption of operations.

    DISCLAIMER OF LIABILITY
    NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
    DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
    TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
    USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
    HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/kdev_t.h>
#include <linux/blkdev.h>
#include <linux/delay.h>	/* for mdelay */
#include <linux/interrupt.h>	/* needed for in_interrupt() proto */
#include <linux/reboot.h>	/* notifier code */
#include <linux/workqueue.h>
#include <linux/raid_class.h>

#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_tcq.h>
#include <scsi/scsi_transport.h>
#include <scsi/scsi_transport_spi.h>
#include <scsi/scsi_dbg.h>

#include "mptbase.h"
#include "mptscsih.h"

/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/

#define my_NAME		"Fusion MPT SPI Host driver"

#define my_VERSION	MPT_LINUX_VERSION_COMMON

#define MYNAM		"mptspi"


MODULE_AUTHOR(MODULEAUTHOR);

MODULE_DESCRIPTION(my_NAME);
MODULE_LICENSE("GPL");

MODULE_VERSION(my_VERSION);

/* Command line args */

static int mpt_saf_te = MPTSCSIH_SAF_TE;
module_param(mpt_saf_te, int, 0);
MODULE_PARM_DESC(mpt_saf_te, " Force enabling SEP Processor: enable=1  (default=MPTSCSIH_SAF_TE=0)");

static void mptspi_write_offset(struct scsi_target *, int);
static void mptspi_write_width(struct scsi_target *, int);
static int mptspi_write_spi_device_pg1(struct scsi_target *,
				       struct _CONFIG_PAGE_SCSI_DEVICE_1 *);


static struct scsi_transport_template *mptspi_transport_template = NULL;


static u8	mptspiDoneCtx = MPT_MAX_PROTOCOL_DRIVERS;

static u8	mptspiTaskCtx = MPT_MAX_PROTOCOL_DRIVERS;

static u8	mptspiInternalCtx = MPT_MAX_PROTOCOL_DRIVERS; 
/* Used only for internal commands */

/**
 *      mptspi_setTargetNegoParms  - Update the target negotiation parameters
 *      @hd: Pointer to a SCSI Host Structure
 *      @target: per target private data
 *      @sdev: SCSI device
 *
 *      Update the target negotiation parameters based on the the Inquiry
 *      data, adapter capabilities, and NVRAM settings.
 **/

static void mptspi_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtTarget *target, struct scsi_device *sdev) { MPT_ADAPTER *ioc = hd->ioc; SpiCfgData *pspi_data = &ioc->spi_data; int id = (int) target->id; int nvram; u8 width = MPT_NARROW; u8 factor = MPT_ASYNC; u8 offset = 0; u8 nfactor; u8 noQas = 1; target->negoFlags = pspi_data->noQas; if (sdev->scsi_level < SCSI_2) { width = 0; factor = MPT_ULTRA2; offset = pspi_data->maxSyncOffset; target->tflags &= ~MPT_TARGET_FLAGS_Q_YES; } else { if (scsi_device_wide(sdev)) width = 1; if (scsi_device_sync(sdev)) { factor = pspi_data->minSyncFactor; if (!scsi_device_dt(sdev)) factor = MPT_ULTRA2; else { if (!scsi_device_ius(sdev) && !scsi_device_qas(sdev)) factor = MPT_ULTRA160; else { factor = MPT_ULTRA320; if (scsi_device_qas(sdev)) { ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Enabling QAS due to " "byte56=%02x on id=%d!\n", ioc->name, scsi_device_qas(sdev), id)); noQas = 0; } if (sdev->type == TYPE_TAPE && scsi_device_ius(sdev)) target->negoFlags |= MPT_TAPE_NEGO_IDP; } } offset = pspi_data->maxSyncOffset; /* If RAID, never disable QAS * else if non RAID, do not disable * QAS if bit 1 is set * bit 1 QAS support, non-raid only * bit 0 IU support */ if (target->raidVolume == 1) noQas = 0; } else { factor = MPT_ASYNC; offset = 0; } } if (!sdev->tagged_supported) target->tflags &= ~MPT_TARGET_FLAGS_Q_YES; /* Update tflags based on NVRAM settings. (SCSI only) */ if (pspi_data->nvram && (pspi_data->nvram[id] != MPT_HOST_NVRAM_INVALID)) { nvram = pspi_data->nvram[id]; nfactor = (nvram & MPT_NVRAM_SYNC_MASK) >> 8; if (width) width = nvram & MPT_NVRAM_WIDE_DISABLE ? 0 : 1; if (offset > 0) { /* Ensure factor is set to the * maximum of: adapter, nvram, inquiry */ if (nfactor) { if (nfactor < pspi_data->minSyncFactor ) nfactor = pspi_data->minSyncFactor; factor = max(factor, nfactor); if (factor == MPT_ASYNC) offset = 0; } else { offset = 0; factor = MPT_ASYNC; } } else { factor = MPT_ASYNC; } } /* Make sure data is consistent */ if ((!width) && (factor < MPT_ULTRA2)) factor = MPT_ULTRA2; /* Save the data to the target structure. */ target->minSyncFactor = factor; target->maxOffset = offset; target->maxWidth = width; spi_min_period(scsi_target(sdev)) = factor; spi_max_offset(scsi_target(sdev)) = offset; spi_max_width(scsi_target(sdev)) = width; target->tflags |= MPT_TARGET_FLAGS_VALID_NEGO; /* Disable unused features. */ if (!width) target->negoFlags |= MPT_TARGET_NO_NEGO_WIDE; if (!offset) target->negoFlags |= MPT_TARGET_NO_NEGO_SYNC; if ( factor > MPT_ULTRA320 ) noQas = 0; if (noQas && (pspi_data->noQas == 0)) { pspi_data->noQas |= MPT_TARGET_NO_NEGO_QAS; target->negoFlags |= MPT_TARGET_NO_NEGO_QAS; /* Disable QAS in a mixed configuration case */ ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Disabling QAS due to noQas=%02x on id=%d!\n", ioc->name, noQas, id)); } }

Contributors

PersonTokensPropCommitsCommitProp
Eric Moore50491.64%360.00%
Kashyap Desai305.45%120.00%
Sathya Prakash M R162.91%120.00%
Total550100.00%5100.00%

/** * mptspi_writeIOCPage4 - write IOC Page 4 * @hd: Pointer to a SCSI Host Structure * @channel: channel number * @id: write IOC Page4 for this ID & Bus * * Return: -EAGAIN if unable to obtain a Message Frame * or 0 if success. * * Remark: We do not wait for a return, write pages sequentially. **/
static int mptspi_writeIOCPage4(MPT_SCSI_HOST *hd, u8 channel , u8 id) { MPT_ADAPTER *ioc = hd->ioc; Config_t *pReq; IOCPage4_t *IOCPage4Ptr; MPT_FRAME_HDR *mf; dma_addr_t dataDma; u16 req_idx; u32 frameOffset; u32 flagsLength; int ii; /* Get a MF for this command. */ if ((mf = mpt_get_msg_frame(ioc->DoneCtx, ioc)) == NULL) { dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "writeIOCPage4 : no msg frames!\n",ioc->name)); return -EAGAIN; } /* Set the request and the data pointers. * Place data at end of MF. */ pReq = (Config_t *)mf; req_idx = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx); frameOffset = ioc->req_sz - sizeof(IOCPage4_t); /* Complete the request frame (same for all requests). */ pReq->Action = MPI_CONFIG_ACTION_PAGE_WRITE_CURRENT; pReq->Reserved = 0; pReq->ChainOffset = 0; pReq->Function = MPI_FUNCTION_CONFIG; pReq->ExtPageLength = 0; pReq->ExtPageType = 0; pReq->MsgFlags = 0; for (ii=0; ii < 8; ii++) { pReq->Reserved2[ii] = 0; } IOCPage4Ptr = ioc->spi_data.pIocPg4; dataDma = ioc->spi_data.IocPg4_dma; ii = IOCPage4Ptr->ActiveSEP++; IOCPage4Ptr->SEP[ii].SEPTargetID = id; IOCPage4Ptr->SEP[ii].SEPBus = channel; pReq->Header = IOCPage4Ptr->Header; pReq->PageAddress = cpu_to_le32(id | (channel << 8 )); /* Add a SGE to the config request. */ flagsLength = MPT_SGE_FLAGS_SSIMPLE_WRITE | (IOCPage4Ptr->Header.PageLength + ii) * 4; ioc->add_sge((char *)&pReq->PageBufferSGE, flagsLength, dataDma); ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "writeIOCPage4: MaxSEP=%d ActiveSEP=%d id=%d bus=%d\n", ioc->name, IOCPage4Ptr->MaxSEP, IOCPage4Ptr->ActiveSEP, id, channel)); mpt_put_msg_frame(ioc->DoneCtx, ioc, mf); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Eric Moore32094.12%133.33%
Sathya Prakash M R175.00%133.33%
Kashyap Desai30.88%133.33%
Total340100.00%3100.00%

/** * mptspi_initTarget - Target, LUN alloc/free functionality. * @hd: Pointer to MPT_SCSI_HOST structure * @vtarget: per target private data * @sdev: SCSI device * * NOTE: It's only SAFE to call this routine if data points to * sane & valid STANDARD INQUIRY data! * * Allocate and initialize memory for this target. * Save inquiry data. * **/
static void mptspi_initTarget(MPT_SCSI_HOST *hd, VirtTarget *vtarget, struct scsi_device *sdev) { /* Is LUN supported? If so, upper 2 bits will be 0 * in first byte of inquiry data. */ if (sdev->inq_periph_qual != 0) return; if (vtarget == NULL) return; vtarget->type = sdev->type; if ((sdev->type == TYPE_PROCESSOR) && (hd->ioc->spi_data.Saf_Te)) { /* Treat all Processors as SAF-TE if * command line option is set */ vtarget->tflags |= MPT_TARGET_FLAGS_SAF_TE_ISSUED; mptspi_writeIOCPage4(hd, vtarget->channel, vtarget->id); }else if ((sdev->type == TYPE_PROCESSOR) && !(vtarget->tflags & MPT_TARGET_FLAGS_SAF_TE_ISSUED )) { if (sdev->inquiry_len > 49 ) { if (sdev->inquiry[44] == 'S' && sdev->inquiry[45] == 'A' && sdev->inquiry[46] == 'F' && sdev->inquiry[47] == '-' && sdev->inquiry[48] == 'T' && sdev->inquiry[49] == 'E' ) { vtarget->tflags |= MPT_TARGET_FLAGS_SAF_TE_ISSUED; mptspi_writeIOCPage4(hd, vtarget->channel, vtarget->id); } } } mptspi_setTargetNegoParms(hd, vtarget, sdev); }

Contributors

PersonTokensPropCommitsCommitProp
Eric Moore204100.00%1100.00%
Total204100.00%1100.00%

/** * mptspi_is_raid - Determines whether target is belonging to volume * @hd: Pointer to a SCSI HOST structure * @id: target device id * * Return: * non-zero = true * zero = false * */
static int mptspi_is_raid(struct _MPT_SCSI_HOST *hd, u32 id) { int i, rc = 0; MPT_ADAPTER *ioc = hd->ioc; if (!ioc->raid_data.pIocPg2) goto out; if (!ioc->raid_data.pIocPg2->NumActiveVolumes) goto out; for (i=0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++) { if (ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID == id) { rc = 1; goto out; } } out: return rc; }

Contributors

PersonTokensPropCommitsCommitProp
Eric Moore107100.00%2100.00%
Total107100.00%2100.00%


static int mptspi_target_alloc(struct scsi_target *starget) { struct Scsi_Host *shost = dev_to_shost(&starget->dev); struct _MPT_SCSI_HOST *hd = shost_priv(shost); VirtTarget *vtarget; MPT_ADAPTER *ioc; if (hd == NULL) return -ENODEV; ioc = hd->ioc; vtarget = kzalloc(sizeof(VirtTarget), GFP_KERNEL); if (!vtarget) return -ENOMEM; vtarget->ioc_id = ioc->id; vtarget->tflags = MPT_TARGET_FLAGS_Q_YES; vtarget->id = (u8)starget->id; vtarget->channel = (u8)starget->channel; vtarget->starget = starget; starget->hostdata = vtarget; if (starget->channel == 1) { if (mptscsih_is_phys_disk(ioc, 0, starget->id) == 0) return 0; vtarget->tflags |= MPT_TARGET_FLAGS_RAID_COMPONENT; /* The real channel for this device is zero */ vtarget->channel = 0; /* The actual physdisknum (for RAID passthrough) */ vtarget->id = mptscsih_raid_id_to_num(ioc, 0, starget->id); } if (starget->channel == 0 && mptspi_is_raid(hd, starget->id)) { vtarget->raidVolume = 1; ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "RAID Volume @ channel=%d id=%d\n", ioc->name, starget->channel, starget->id)); } if (ioc->spi_data.nvram && ioc->spi_data.nvram[starget->id] != MPT_HOST_NVRAM_INVALID) { u32 nvram = ioc->spi_data.nvram[starget->id]; spi_min_period(starget) = (nvram & MPT_NVRAM_SYNC_MASK) >> MPT_NVRAM_SYNC_SHIFT; spi_max_width(starget) = nvram & MPT_NVRAM_WIDE_DISABLE ? 0 : 1; } else { spi_min_period(starget) = ioc->spi_data.minSyncFactor; spi_max_width(starget) = ioc->spi_data.maxBusWidth; } spi_max_offset(starget) = ioc->spi_data.maxSyncOffset; spi_offset(starget) = 0; spi_period(starget) = 0xFF; mptspi_write_width(starget, 0); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
James Bottomley18150.99%112.50%
Eric Moore16045.07%562.50%
Sathya Prakash M R143.94%225.00%
Total355100.00%8100.00%


static void mptspi_target_destroy(struct scsi_target *starget) { kfree(starget->hostdata); starget->hostdata = NULL; }

Contributors

PersonTokensPropCommitsCommitProp
Eric Moore2395.83%150.00%
Adrian Bunk14.17%150.00%
Total24100.00%2100.00%

/** * mptspi_print_write_nego - negotiation parameters debug info that is being sent * @hd: Pointer to a SCSI HOST structure * @starget: SCSI target * @ii: negotiation parameters * */
static void mptspi_print_write_nego(struct _MPT_SCSI_HOST *hd, struct scsi_target *starget, u32 ii) { ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "id=%d Requested = 0x%08x" " ( %s factor = 0x%02x @ offset = 0x%02x %s%s%s%s%s%s%s%s)\n", hd->ioc->name, starget->id, ii, ii & MPI_SCSIDEVPAGE0_NP_WIDE ? "Wide ": "", ((ii >> 8) & 0xFF), ((ii >> 16) & 0xFF), ii & MPI_SCSIDEVPAGE0_NP_IU ? "IU ": "", ii & MPI_SCSIDEVPAGE0_NP_DT ? "DT ": "", ii & MPI_SCSIDEVPAGE0_NP_QAS ? "QAS ": "", ii & MPI_SCSIDEVPAGE0_NP_HOLD_MCS ? "HOLDMCS ": "", ii & MPI_SCSIDEVPAGE0_NP_WR_FLOW ? "WRFLOW ": "", ii & MPI_SCSIDEVPAGE0_NP_RD_STRM ? "RDSTRM ": "", ii & MPI_SCSIDEVPAGE0_NP_RTI ? "RTI ": "", ii & MPI_SCSIDEVPAGE0_NP_PCOMP_EN ? "PCOMP ": "")); }

Contributors

PersonTokensPropCommitsCommitProp
Eric Moore11583.94%150.00%
Sathya Prakash M R2216.06%150.00%
Total137100.00%2100.00%

/** * mptspi_print_read_nego - negotiation parameters debug info that is being read * @hd: Pointer to a SCSI HOST structure * @starget: SCSI target * @ii: negotiation parameters * */
static void mptspi_print_read_nego(struct _MPT_SCSI_HOST *hd, struct scsi_target *starget, u32 ii) { ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "id=%d Read = 0x%08x" " ( %s factor = 0x%02x @ offset = 0x%02x %s%s%s%s%s%s%s%s)\n", hd->ioc->name, starget->id, ii, ii & MPI_SCSIDEVPAGE0_NP_WIDE ? "Wide ": "", ((ii >> 8) & 0xFF), ((ii >> 16) & 0xFF), ii & MPI_SCSIDEVPAGE0_NP_IU ? "IU ": "", ii & MPI_SCSIDEVPAGE0_NP_DT ? "DT ": "", ii & MPI_SCSIDEVPAGE0_NP_QAS ? "QAS ": "", ii & MPI_SCSIDEVPAGE0_NP_HOLD_MCS ? "HOLDMCS ": "", ii & MPI_SCSIDEVPAGE0_NP_WR_FLOW ? "WRFLOW ": "", ii & MPI_SCSIDEVPAGE0_NP_RD_STRM ? "RDSTRM ": "", ii & MPI_SCSIDEVPAGE0_NP_RTI ? "RTI ": "", ii & MPI_SCSIDEVPAGE0_NP_PCOMP_EN ? "PCOMP ": "")); }

Contributors

PersonTokensPropCommitsCommitProp
Eric Moore11583.94%150.00%
Sathya Prakash M R2216.06%150.00%
Total137100.00%2100.00%


static int mptspi_read_spi_device_pg0(struct scsi_target *starget, struct _CONFIG_PAGE_SCSI_DEVICE_0 *pass_pg0) { struct Scsi_Host *shost = dev_to_shost(&starget->dev); struct _MPT_SCSI_HOST *hd = shost_priv(shost); struct _MPT_ADAPTER *ioc = hd->ioc; struct _CONFIG_PAGE_SCSI_DEVICE_0 *spi_dev_pg0; dma_addr_t spi_dev_pg0_dma; int size; struct _x_config_parms cfg; struct _CONFIG_PAGE_HEADER hdr; int err = -EBUSY; /* No SPI parameters for RAID devices */ if (starget->channel == 0 && mptspi_is_raid(hd, starget->id)) return -1; size = ioc->spi_data.sdp0length * 4; /* if (ioc->spi_data.sdp0length & 1) size += size + 4; size += 2048; */ spi_dev_pg0 = dma_alloc_coherent(&ioc->pcidev->dev, size, &spi_dev_pg0_dma, GFP_KERNEL); if (spi_dev_pg0 == NULL) { starget_printk(KERN_ERR, starget, MYIOC_s_FMT "dma_alloc_coherent for parameters failed\n", ioc->name); return -EINVAL; } memset(&hdr, 0, sizeof(hdr)); hdr.PageVersion = ioc->spi_data.sdp0version; hdr.PageLength = ioc->spi_data.sdp0length; hdr.PageNumber = 0; hdr.PageType = MPI_CONFIG_PAGETYPE_SCSI_DEVICE; memset(&cfg, 0, sizeof(cfg)); cfg.cfghdr.hdr = &hdr; cfg.physAddr = spi_dev_pg0_dma; cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT; cfg.dir = 0; cfg.pageAddr = starget->id; cfg.timeout = 60; if (mpt_config(ioc, &cfg)) { starget_printk(KERN_ERR, starget, MYIOC_s_FMT "mpt_config failed\n", ioc->name); goto out_free; } err = 0; memcpy(pass_pg0, spi_dev_pg0, size); mptspi_print_read_nego(hd, starget, le32_to_cpu(spi_dev_pg0->NegotiatedParameters)); out_free: dma_free_coherent(&ioc->pcidev->dev, size, spi_dev_pg0, spi_dev_pg0_dma); return err; }

Contributors

PersonTokensPropCommitsCommitProp
James Bottomley27985.32%112.50%
Eric Moore4212.84%675.00%
Kashyap Desai61.83%112.50%
Total327100.00%8100.00%


static u32 mptspi_getRP(struct scsi_target *starget) { u32 nego = 0; nego |= spi_iu(starget) ? MPI_SCSIDEVPAGE1_RP_IU : 0; nego |= spi_dt(starget) ? MPI_SCSIDEVPAGE1_RP_DT : 0; nego |= spi_qas(starget) ? MPI_SCSIDEVPAGE1_RP_QAS : 0; nego |= spi_hold_mcs(starget) ? MPI_SCSIDEVPAGE1_RP_HOLD_MCS : 0; nego |= spi_wr_flow(starget) ? MPI_SCSIDEVPAGE1_RP_WR_FLOW : 0; nego |= spi_rd_strm(starget) ? MPI_SCSIDEVPAGE1_RP_RD_STRM : 0; nego |= spi_rti(starget) ? MPI_SCSIDEVPAGE1_RP_RTI : 0; nego |= spi_pcomp_en(starget) ? MPI_SCSIDEVPAGE1_RP_PCOMP_EN : 0; nego |= (spi_period(starget) << MPI_SCSIDEVPAGE1_RP_SHIFT_MIN_SYNC_PERIOD) & MPI_SCSIDEVPAGE1_RP_MIN_SYNC_PERIOD_MASK; nego |= (spi_offset(starget) << MPI_SCSIDEVPAGE1_RP_SHIFT_MAX_SYNC_OFFSET) & MPI_SCSIDEVPAGE1_RP_MAX_SYNC_OFFSET_MASK; nego |= spi_width(starget) ? MPI_SCSIDEVPAGE1_RP_WIDE : 0; return nego; }

Contributors

PersonTokensPropCommitsCommitProp
James Bottomley144100.00%1100.00%
Total144100.00%1100.00%


static void mptspi_read_parameters(struct scsi_target *starget) { int nego; struct _CONFIG_PAGE_SCSI_DEVICE_0 spi_dev_pg0; mptspi_read_spi_device_pg0(starget, &spi_dev_pg0); nego = le32_to_cpu(spi_dev_pg0.NegotiatedParameters); spi_iu(starget) = (nego & MPI_SCSIDEVPAGE0_NP_IU) ? 1 : 0; spi_dt(starget) = (nego & MPI_SCSIDEVPAGE0_NP_DT) ? 1 : 0; spi_qas(starget) = (nego & MPI_SCSIDEVPAGE0_NP_QAS) ? 1 : 0; spi_wr_flow(starget) = (nego & MPI_SCSIDEVPAGE0_NP_WR_FLOW) ? 1 : 0; spi_rd_strm(starget) = (nego & MPI_SCSIDEVPAGE0_NP_RD_STRM) ? 1 : 0; spi_rti(starget) = (nego & MPI_SCSIDEVPAGE0_NP_RTI) ? 1 : 0; spi_pcomp_en(starget) = (nego & MPI_SCSIDEVPAGE0_NP_PCOMP_EN) ? 1 : 0; spi_hold_mcs(starget) = (nego & MPI_SCSIDEVPAGE0_NP_HOLD_MCS) ? 1 : 0; spi_period(starget) = (nego & MPI_SCSIDEVPAGE0_NP_NEG_SYNC_PERIOD_MASK) >> MPI_SCSIDEVPAGE0_NP_SHIFT_SYNC_PERIOD; spi_offset(starget) = (nego & MPI_SCSIDEVPAGE0_NP_NEG_SYNC_OFFSET_MASK) >> MPI_SCSIDEVPAGE0_NP_SHIFT_SYNC_OFFSET; spi_width(starget) = (nego & MPI_SCSIDEVPAGE0_NP_WIDE) ? 1 : 0; }

Contributors

PersonTokensPropCommitsCommitProp
James Bottomley19398.47%150.00%
Eric Moore31.53%150.00%
Total196100.00%2100.00%


static int mptscsih_quiesce_raid(MPT_SCSI_HOST *hd, int quiesce, u8 channel, u8 id) { MPT_ADAPTER *ioc = hd->ioc; MpiRaidActionRequest_t *pReq; MPT_FRAME_HDR *mf; int ret; unsigned long timeleft; mutex_lock(&ioc->internal_cmds.mutex); /* Get and Populate a free Frame */ if ((mf = mpt_get_msg_frame(ioc->InternalCtx, ioc)) == NULL) { dfailprintk(hd->ioc, printk(MYIOC_s_WARN_FMT "%s: no msg frames!\n", ioc->name, __func__)); ret = -EAGAIN; goto out; } pReq = (MpiRaidActionRequest_t *)mf; if (quiesce) pReq->Action = MPI_RAID_ACTION_QUIESCE_PHYS_IO; else pReq->Action = MPI_RAID_ACTION_ENABLE_PHYS_IO; pReq->Reserved1 = 0; pReq->ChainOffset = 0; pReq->Function = MPI_FUNCTION_RAID_ACTION; pReq->VolumeID = id; pReq->VolumeBus = channel; pReq->PhysDiskNum = 0; pReq->MsgFlags = 0; pReq->Reserved2 = 0; pReq->ActionDataWord = 0; /* Reserved for this action */ ioc->add_sge((char *)&pReq->ActionDataSGE, MPT_SGE_FLAGS_SSIMPLE_READ | 0, (dma_addr_t) -1); ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "RAID Volume action=%x channel=%d id=%d\n", ioc->name, pReq->Action, channel, id)); INITIALIZE_MGMT_STATUS(ioc->internal_cmds.status) mpt_put_msg_frame(ioc->InternalCtx, ioc, mf); timeleft = wait_for_completion_timeout(&ioc->internal_cmds.done, 10*HZ); if (!(ioc->internal_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) { ret = -ETIME; dfailprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: TIMED OUT!\n", ioc