aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion/mptscsih.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/message/fusion/mptscsih.c')
-rw-r--r--drivers/message/fusion/mptscsih.c140
1 files changed, 73 insertions, 67 deletions
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index b9d4f78725b4..4a003dc5fde8 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -281,12 +281,12 @@ mptscsih_getFreeChainBuffer(MPT_ADAPTER *ioc, int *retIndex)
281 offset = (u8 *)chainBuf - (u8 *)ioc->ChainBuffer; 281 offset = (u8 *)chainBuf - (u8 *)ioc->ChainBuffer;
282 chain_idx = offset / ioc->req_sz; 282 chain_idx = offset / ioc->req_sz;
283 rc = SUCCESS; 283 rc = SUCCESS;
284 dsgprintk((MYIOC_s_INFO_FMT "getFreeChainBuffer (index %d), got buf=%p\n", 284 dsgprintk((MYIOC_s_ERR_FMT "getFreeChainBuffer chainBuf=%p ChainBuffer=%p offset=%d chain_idx=%d\n",
285 ioc->name, *retIndex, chainBuf)); 285 ioc->name, chainBuf, ioc->ChainBuffer, offset, chain_idx));
286 } else { 286 } else {
287 rc = FAILED; 287 rc = FAILED;
288 chain_idx = MPT_HOST_NO_CHAIN; 288 chain_idx = MPT_HOST_NO_CHAIN;
289 dfailprintk((MYIOC_s_ERR_FMT "getFreeChainBuffer failed\n", 289 dfailprintk((MYIOC_s_INFO_FMT "getFreeChainBuffer failed\n",
290 ioc->name)); 290 ioc->name));
291 } 291 }
292 spin_unlock_irqrestore(&ioc->FreeQlock, flags); 292 spin_unlock_irqrestore(&ioc->FreeQlock, flags);
@@ -432,7 +432,7 @@ nextSGEset:
432 */ 432 */
433 pReq->ChainOffset = 0; 433 pReq->ChainOffset = 0;
434 RequestNB = (((sgeOffset - 1) >> ioc->NBShiftFactor) + 1) & 0x03; 434 RequestNB = (((sgeOffset - 1) >> ioc->NBShiftFactor) + 1) & 0x03;
435 dsgprintk((MYIOC_s_ERR_FMT 435 dsgprintk((MYIOC_s_INFO_FMT
436 "Single Buffer RequestNB=%x, sgeOffset=%d\n", ioc->name, RequestNB, sgeOffset)); 436 "Single Buffer RequestNB=%x, sgeOffset=%d\n", ioc->name, RequestNB, sgeOffset));
437 ioc->RequestNB[req_idx] = RequestNB; 437 ioc->RequestNB[req_idx] = RequestNB;
438 } 438 }
@@ -491,11 +491,12 @@ nextSGEset:
491 /* NOTE: psge points to the beginning of the chain element 491 /* NOTE: psge points to the beginning of the chain element
492 * in current buffer. Get a chain buffer. 492 * in current buffer. Get a chain buffer.
493 */ 493 */
494 dsgprintk((MYIOC_s_INFO_FMT 494 if ((mptscsih_getFreeChainBuffer(ioc, &newIndex)) == FAILED) {
495 "calling getFreeChainBuffer SCSI cmd=%02x (%p)\n", 495 dfailprintk((MYIOC_s_INFO_FMT
496 ioc->name, pReq->CDB[0], SCpnt)); 496 "getFreeChainBuffer FAILED SCSI cmd=%02x (%p)\n",
497 if ((mptscsih_getFreeChainBuffer(ioc, &newIndex)) == FAILED) 497 ioc->name, pReq->CDB[0], SCpnt));
498 return FAILED; 498 return FAILED;
499 }
499 500
500 /* Update the tracking arrays. 501 /* Update the tracking arrays.
501 * If chainSge == NULL, update ReqToChain, else ChainToChain 502 * If chainSge == NULL, update ReqToChain, else ChainToChain
@@ -577,14 +578,20 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
577 return 1; 578 return 1;
578 } 579 }
579 580
580 dmfprintk((MYIOC_s_INFO_FMT
581 "ScsiDone (mf=%p,mr=%p,sc=%p,idx=%d)\n",
582 ioc->name, mf, mr, sc, req_idx));
583
584 sc->result = DID_OK << 16; /* Set default reply as OK */ 581 sc->result = DID_OK << 16; /* Set default reply as OK */
585 pScsiReq = (SCSIIORequest_t *) mf; 582 pScsiReq = (SCSIIORequest_t *) mf;
586 pScsiReply = (SCSIIOReply_t *) mr; 583 pScsiReply = (SCSIIOReply_t *) mr;
587 584
585 if((ioc->facts.MsgVersion >= MPI_VERSION_01_05) && pScsiReply){
586 dmfprintk((MYIOC_s_INFO_FMT
587 "ScsiDone (mf=%p,mr=%p,sc=%p,idx=%d,task-tag=%d)\n",
588 ioc->name, mf, mr, sc, req_idx, pScsiReply->TaskTag));
589 }else{
590 dmfprintk((MYIOC_s_INFO_FMT
591 "ScsiDone (mf=%p,mr=%p,sc=%p,idx=%d)\n",
592 ioc->name, mf, mr, sc, req_idx));
593 }
594
588 if (pScsiReply == NULL) { 595 if (pScsiReply == NULL) {
589 /* special context reply handling */ 596 /* special context reply handling */
590 ; 597 ;
@@ -658,8 +665,8 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
658 /* Sufficient data transfer occurred */ 665 /* Sufficient data transfer occurred */
659 sc->result = (DID_OK << 16) | scsi_status; 666 sc->result = (DID_OK << 16) | scsi_status;
660 } else if ( xfer_cnt == 0 ) { 667 } else if ( xfer_cnt == 0 ) {
661 /* A CRC Error causes this condition; retry */ 668 /* A CRC Error causes this condition; retry */
662 sc->result = (DRIVER_SENSE << 24) | (DID_OK << 16) | 669 sc->result = (DRIVER_SENSE << 24) | (DID_OK << 16) |
663 (CHECK_CONDITION << 1); 670 (CHECK_CONDITION << 1);
664 sc->sense_buffer[0] = 0x70; 671 sc->sense_buffer[0] = 0x70;
665 sc->sense_buffer[2] = NO_SENSE; 672 sc->sense_buffer[2] = NO_SENSE;
@@ -668,7 +675,9 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
668 } else { 675 } else {
669 sc->result = DID_SOFT_ERROR << 16; 676 sc->result = DID_SOFT_ERROR << 16;
670 } 677 }
671 dreplyprintk((KERN_NOTICE "RESIDUAL_MISMATCH: result=%x on id=%d\n", sc->result, sc->target)); 678 dreplyprintk((KERN_NOTICE
679 "RESIDUAL_MISMATCH: result=%x on id=%d\n",
680 sc->result, sc->device->id));
672 break; 681 break;
673 682
674 case MPI_IOCSTATUS_SCSI_DATA_UNDERRUN: /* 0x0045 */ 683 case MPI_IOCSTATUS_SCSI_DATA_UNDERRUN: /* 0x0045 */
@@ -796,7 +805,6 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
796 return 1; 805 return 1;
797} 806}
798 807
799
800/* 808/*
801 * mptscsih_flush_running_cmds - For each command found, search 809 * mptscsih_flush_running_cmds - For each command found, search
802 * Scsi_Host instance taskQ and reply to OS. 810 * Scsi_Host instance taskQ and reply to OS.
@@ -1017,7 +1025,7 @@ mptscsih_remove(struct pci_dev *pdev)
1017 scsi_host_put(host); 1025 scsi_host_put(host);
1018 1026
1019 mpt_detach(pdev); 1027 mpt_detach(pdev);
1020 1028
1021} 1029}
1022 1030
1023/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 1031/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -1072,7 +1080,7 @@ mptscsih_resume(struct pci_dev *pdev)
1072 MPT_SCSI_HOST *hd; 1080 MPT_SCSI_HOST *hd;
1073 1081
1074 mpt_resume(pdev); 1082 mpt_resume(pdev);
1075 1083
1076 if(!host) 1084 if(!host)
1077 return 0; 1085 return 0;
1078 1086
@@ -1214,8 +1222,8 @@ mptscsih_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t off
1214 int size = 0; 1222 int size = 0;
1215 1223
1216 if (func) { 1224 if (func) {
1217 /* 1225 /*
1218 * write is not supported 1226 * write is not supported
1219 */ 1227 */
1220 } else { 1228 } else {
1221 if (start) 1229 if (start)
@@ -1535,17 +1543,17 @@ mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, u8 lun, in
1535 */ 1543 */
1536 if (mptscsih_tm_pending_wait(hd) == FAILED) { 1544 if (mptscsih_tm_pending_wait(hd) == FAILED) {
1537 if (type == MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK) { 1545 if (type == MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK) {
1538 dtmprintk((KERN_WARNING MYNAM ": %s: TMHandler abort: " 1546 dtmprintk((KERN_INFO MYNAM ": %s: TMHandler abort: "
1539 "Timed out waiting for last TM (%d) to complete! \n", 1547 "Timed out waiting for last TM (%d) to complete! \n",
1540 hd->ioc->name, hd->tmPending)); 1548 hd->ioc->name, hd->tmPending));
1541 return FAILED; 1549 return FAILED;
1542 } else if (type == MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET) { 1550 } else if (type == MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET) {
1543 dtmprintk((KERN_WARNING MYNAM ": %s: TMHandler target reset: " 1551 dtmprintk((KERN_INFO MYNAM ": %s: TMHandler target reset: "
1544 "Timed out waiting for last TM (%d) to complete! \n", 1552 "Timed out waiting for last TM (%d) to complete! \n",
1545 hd->ioc->name, hd->tmPending)); 1553 hd->ioc->name, hd->tmPending));
1546 return FAILED; 1554 return FAILED;
1547 } else if (type == MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS) { 1555 } else if (type == MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS) {
1548 dtmprintk((KERN_WARNING MYNAM ": %s: TMHandler bus reset: " 1556 dtmprintk((KERN_INFO MYNAM ": %s: TMHandler bus reset: "
1549 "Timed out waiting for last TM (%d) to complete! \n", 1557 "Timed out waiting for last TM (%d) to complete! \n",
1550 hd->ioc->name, hd->tmPending)); 1558 hd->ioc->name, hd->tmPending));
1551 if (hd->tmPending & (1 << MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS)) 1559 if (hd->tmPending & (1 << MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS))
@@ -1631,8 +1639,7 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, u8 lun
1631 if ((mf = mpt_get_msg_frame(hd->ioc->TaskCtx, hd->ioc)) == NULL) { 1639 if ((mf = mpt_get_msg_frame(hd->ioc->TaskCtx, hd->ioc)) == NULL) {
1632 dfailprintk((MYIOC_s_ERR_FMT "IssueTaskMgmt, no msg frames!!\n", 1640 dfailprintk((MYIOC_s_ERR_FMT "IssueTaskMgmt, no msg frames!!\n",
1633 hd->ioc->name)); 1641 hd->ioc->name));
1634 //return FAILED; 1642 return FAILED;
1635 return -999;
1636 } 1643 }
1637 dtmprintk((MYIOC_s_INFO_FMT "IssueTaskMgmt request @ %p\n", 1644 dtmprintk((MYIOC_s_INFO_FMT "IssueTaskMgmt request @ %p\n",
1638 hd->ioc->name, mf)); 1645 hd->ioc->name, mf));
@@ -1661,9 +1668,8 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, u8 lun
1661 1668
1662 pScsiTm->TaskMsgContext = ctx2abort; 1669 pScsiTm->TaskMsgContext = ctx2abort;
1663 1670
1664 dtmprintk((MYIOC_s_INFO_FMT 1671 dtmprintk((MYIOC_s_INFO_FMT "IssueTaskMgmt: ctx2abort (0x%08x) type=%d\n",
1665 "IssueTaskMgmt: ctx2abort (0x%08x) type=%d\n", 1672 hd->ioc->name, ctx2abort, type));
1666 hd->ioc->name, ctx2abort, type));
1667 1673
1668 DBG_DUMP_TM_REQUEST_FRAME((u32 *)pScsiTm); 1674 DBG_DUMP_TM_REQUEST_FRAME((u32 *)pScsiTm);
1669 1675
@@ -1902,13 +1908,13 @@ mptscsih_host_reset(struct scsi_cmnd *SCpnt)
1902 1908
1903 /* If we can't locate the host to reset, then we failed. */ 1909 /* If we can't locate the host to reset, then we failed. */
1904 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){ 1910 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){
1905 dtmprintk( ( KERN_WARNING MYNAM ": mptscsih_host_reset: " 1911 dtmprintk( ( KERN_INFO MYNAM ": mptscsih_host_reset: "
1906 "Can't locate host! (sc=%p)\n", 1912 "Can't locate host! (sc=%p)\n",
1907 SCpnt ) ); 1913 SCpnt ) );
1908 return FAILED; 1914 return FAILED;
1909 } 1915 }
1910 1916
1911 printk(KERN_WARNING MYNAM ": %s: >> Attempting host reset! (sc=%p)\n", 1917 printk(KERN_WARNING MYNAM ": %s: Attempting host reset! (sc=%p)\n",
1912 hd->ioc->name, SCpnt); 1918 hd->ioc->name, SCpnt);
1913 1919
1914 /* If our attempts to reset the host failed, then return a failed 1920 /* If our attempts to reset the host failed, then return a failed
@@ -1924,7 +1930,7 @@ mptscsih_host_reset(struct scsi_cmnd *SCpnt)
1924 hd->tmState = TM_STATE_NONE; 1930 hd->tmState = TM_STATE_NONE;
1925 } 1931 }
1926 1932
1927 dtmprintk( ( KERN_WARNING MYNAM ": mptscsih_host_reset: " 1933 dtmprintk( ( KERN_INFO MYNAM ": mptscsih_host_reset: "
1928 "Status = %s\n", 1934 "Status = %s\n",
1929 (status == SUCCESS) ? "SUCCESS" : "FAILED" ) ); 1935 (status == SUCCESS) ? "SUCCESS" : "FAILED" ) );
1930 1936
@@ -1951,8 +1957,8 @@ mptscsih_tm_pending_wait(MPT_SCSI_HOST * hd)
1951 if (hd->tmState == TM_STATE_NONE) { 1957 if (hd->tmState == TM_STATE_NONE) {
1952 hd->tmState = TM_STATE_IN_PROGRESS; 1958 hd->tmState = TM_STATE_IN_PROGRESS;
1953 hd->tmPending = 1; 1959 hd->tmPending = 1;
1954 status = SUCCESS;
1955 spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags); 1960 spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags);
1961 status = SUCCESS;
1956 break; 1962 break;
1957 } 1963 }
1958 spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags); 1964 spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags);
@@ -1980,7 +1986,7 @@ mptscsih_tm_wait_for_completion(MPT_SCSI_HOST * hd, ulong timeout )
1980 spin_lock_irqsave(&hd->ioc->FreeQlock, flags); 1986 spin_lock_irqsave(&hd->ioc->FreeQlock, flags);
1981 if(hd->tmPending == 0) { 1987 if(hd->tmPending == 0) {
1982 status = SUCCESS; 1988 status = SUCCESS;
1983 spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags); 1989 spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags);
1984 break; 1990 break;
1985 } 1991 }
1986 spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags); 1992 spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags);
@@ -2318,10 +2324,10 @@ mptscsih_slave_configure(struct scsi_device *device)
2318 if (pTarget == NULL) { 2324 if (pTarget == NULL) {
2319 /* Driver doesn't know about this device. 2325 /* Driver doesn't know about this device.
2320 * Kernel may generate a "Dummy Lun 0" which 2326 * Kernel may generate a "Dummy Lun 0" which
2321 * may become a real Lun if a 2327 * may become a real Lun if a
2322 * "scsi add-single-device" command is executed 2328 * "scsi add-single-device" command is executed
2323 * while the driver is active (hot-plug a 2329 * while the driver is active (hot-plug a
2324 * device). LSI Raid controllers need 2330 * device). LSI Raid controllers need
2325 * queue_depth set to DEV_HIGH for this reason. 2331 * queue_depth set to DEV_HIGH for this reason.
2326 */ 2332 */
2327 scsi_adjust_queue_depth(device, MSG_SIMPLE_TAG, 2333 scsi_adjust_queue_depth(device, MSG_SIMPLE_TAG,
@@ -2691,7 +2697,7 @@ mptscsih_initTarget(MPT_SCSI_HOST *hd, int bus_id, int target_id, u8 lun, char *
2691 * If the peripheral qualifier filter is enabled then if the target reports a 0x1 2697 * If the peripheral qualifier filter is enabled then if the target reports a 0x1
2692 * (i.e. The targer is capable of supporting the specified peripheral device type 2698 * (i.e. The targer is capable of supporting the specified peripheral device type
2693 * on this logical unit; however, the physical device is not currently connected 2699 * on this logical unit; however, the physical device is not currently connected
2694 * to this logical unit) it will be converted to a 0x3 (i.e. The target is not 2700 * to this logical unit) it will be converted to a 0x3 (i.e. The target is not
2695 * capable of supporting a physical device on this logical unit). This is to work 2701 * capable of supporting a physical device on this logical unit). This is to work
2696 * around a bug in th emid-layer in some distributions in which the mid-layer will 2702 * around a bug in th emid-layer in some distributions in which the mid-layer will
2697 * continue to try to communicate to the LUN and evntually create a dummy LUN. 2703 * continue to try to communicate to the LUN and evntually create a dummy LUN.
@@ -3194,8 +3200,8 @@ mptscsih_writeSDP1(MPT_SCSI_HOST *hd, int portnum, int target_id, int flags)
3194 /* Get a MF for this command. 3200 /* Get a MF for this command.
3195 */ 3201 */
3196 if ((mf = mpt_get_msg_frame(ioc->DoneCtx, ioc)) == NULL) { 3202 if ((mf = mpt_get_msg_frame(ioc->DoneCtx, ioc)) == NULL) {
3197 dprintk((MYIOC_s_WARN_FMT "write SDP1: no msg frames!\n", 3203 dfailprintk((MYIOC_s_WARN_FMT "write SDP1: no msg frames!\n",
3198 ioc->name)); 3204 ioc->name));
3199 return -EAGAIN; 3205 return -EAGAIN;
3200 } 3206 }
3201 3207
@@ -3289,7 +3295,7 @@ mptscsih_writeIOCPage4(MPT_SCSI_HOST *hd, int target_id, int bus)
3289 /* Get a MF for this command. 3295 /* Get a MF for this command.
3290 */ 3296 */
3291 if ((mf = mpt_get_msg_frame(ioc->DoneCtx, ioc)) == NULL) { 3297 if ((mf = mpt_get_msg_frame(ioc->DoneCtx, ioc)) == NULL) {
3292 dprintk((MYIOC_s_WARN_FMT "writeIOCPage4 : no msg frames!\n", 3298 dfailprintk((MYIOC_s_WARN_FMT "writeIOCPage4 : no msg frames!\n",
3293 ioc->name)); 3299 ioc->name));
3294 return -EAGAIN; 3300 return -EAGAIN;
3295 } 3301 }
@@ -3447,7 +3453,7 @@ mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
3447 * some type of error occurred. 3453 * some type of error occurred.
3448 */ 3454 */
3449 MpiRaidActionReply_t *pr = (MpiRaidActionReply_t *)mr; 3455 MpiRaidActionReply_t *pr = (MpiRaidActionReply_t *)mr;
3450 if (pr->ActionStatus == MPI_RAID_ACTION_ASTATUS_SUCCESS) 3456 if (le16_to_cpu(pr->ActionStatus) == MPI_RAID_ACTION_ASTATUS_SUCCESS)
3451 completionCode = MPT_SCANDV_GOOD; 3457 completionCode = MPT_SCANDV_GOOD;
3452 else 3458 else
3453 completionCode = MPT_SCANDV_SOME_ERROR; 3459 completionCode = MPT_SCANDV_SOME_ERROR;
@@ -3955,7 +3961,7 @@ mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, int portnum)
3955 header1.PageLength = ioc->spi_data.sdp1length; 3961 header1.PageLength = ioc->spi_data.sdp1length;
3956 header1.PageNumber = 1; 3962 header1.PageNumber = 1;
3957 header1.PageType = MPI_CONFIG_PAGETYPE_SCSI_DEVICE; 3963 header1.PageType = MPI_CONFIG_PAGETYPE_SCSI_DEVICE;
3958 cfg.hdr = &header1; 3964 cfg.cfghdr.hdr = &header1;
3959 cfg.physAddr = cfg1_dma_addr; 3965 cfg.physAddr = cfg1_dma_addr;
3960 cfg.action = MPI_CONFIG_ACTION_PAGE_WRITE_CURRENT; 3966 cfg.action = MPI_CONFIG_ACTION_PAGE_WRITE_CURRENT;
3961 cfg.dir = 1; 3967 cfg.dir = 1;
@@ -3996,9 +4002,9 @@ mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, int portnum)
3996 dnegoprintk(("syncronize cache: id=%d width=0 factor=MPT_ASYNC " 4002 dnegoprintk(("syncronize cache: id=%d width=0 factor=MPT_ASYNC "
3997 "offset=0 negoFlags=%x request=%x config=%x\n", 4003 "offset=0 negoFlags=%x request=%x config=%x\n",
3998 id, flags, requested, configuration)); 4004 id, flags, requested, configuration));
3999 pcfg1Data->RequestedParameters = le32_to_cpu(requested); 4005 pcfg1Data->RequestedParameters = cpu_to_le32(requested);
4000 pcfg1Data->Reserved = 0; 4006 pcfg1Data->Reserved = 0;
4001 pcfg1Data->Configuration = le32_to_cpu(configuration); 4007 pcfg1Data->Configuration = cpu_to_le32(configuration);
4002 cfg.pageAddr = (bus<<8) | id; 4008 cfg.pageAddr = (bus<<8) | id;
4003 mpt_config(hd->ioc, &cfg); 4009 mpt_config(hd->ioc, &cfg);
4004 } 4010 }
@@ -4353,7 +4359,7 @@ mptscsih_doDv(MPT_SCSI_HOST *hd, int bus_number, int id)
4353 /* Prep cfg structure 4359 /* Prep cfg structure
4354 */ 4360 */
4355 cfg.pageAddr = (bus<<8) | id; 4361 cfg.pageAddr = (bus<<8) | id;
4356 cfg.hdr = NULL; 4362 cfg.cfghdr.hdr = NULL;
4357 4363
4358 /* Prep SDP0 header 4364 /* Prep SDP0 header
4359 */ 4365 */
@@ -4399,7 +4405,7 @@ mptscsih_doDv(MPT_SCSI_HOST *hd, int bus_number, int id)
4399 pcfg1Data = (SCSIDevicePage1_t *) (pDvBuf + sz); 4405 pcfg1Data = (SCSIDevicePage1_t *) (pDvBuf + sz);
4400 cfg1_dma_addr = dvbuf_dma + sz; 4406 cfg1_dma_addr = dvbuf_dma + sz;
4401 4407
4402 /* Skip this ID? Set cfg.hdr to force config page write 4408 /* Skip this ID? Set cfg.cfghdr.hdr to force config page write
4403 */ 4409 */
4404 { 4410 {
4405 ScsiCfgData *pspi_data = &hd->ioc->spi_data; 4411 ScsiCfgData *pspi_data = &hd->ioc->spi_data;
@@ -4417,7 +4423,7 @@ mptscsih_doDv(MPT_SCSI_HOST *hd, int bus_number, int id)
4417 4423
4418 dv.cmd = MPT_SET_MAX; 4424 dv.cmd = MPT_SET_MAX;
4419 mptscsih_dv_parms(hd, &dv, (void *)pcfg1Data); 4425 mptscsih_dv_parms(hd, &dv, (void *)pcfg1Data);
4420 cfg.hdr = &header1; 4426 cfg.cfghdr.hdr = &header1;
4421 4427
4422 /* Save the final negotiated settings to 4428 /* Save the final negotiated settings to
4423 * SCSI device page 1. 4429 * SCSI device page 1.
@@ -4483,7 +4489,7 @@ mptscsih_doDv(MPT_SCSI_HOST *hd, int bus_number, int id)
4483 dv.cmd = MPT_SET_MIN; 4489 dv.cmd = MPT_SET_MIN;
4484 mptscsih_dv_parms(hd, &dv, (void *)pcfg1Data); 4490 mptscsih_dv_parms(hd, &dv, (void *)pcfg1Data);
4485 4491
4486 cfg.hdr = &header1; 4492 cfg.cfghdr.hdr = &header1;
4487 cfg.physAddr = cfg1_dma_addr; 4493 cfg.physAddr = cfg1_dma_addr;
4488 cfg.action = MPI_CONFIG_ACTION_PAGE_WRITE_CURRENT; 4494 cfg.action = MPI_CONFIG_ACTION_PAGE_WRITE_CURRENT;
4489 cfg.dir = 1; 4495 cfg.dir = 1;
@@ -4596,8 +4602,8 @@ mptscsih_doDv(MPT_SCSI_HOST *hd, int bus_number, int id)
4596 if ((pbuf1[56] & 0x02) == 0) { 4602 if ((pbuf1[56] & 0x02) == 0) {
4597 pTarget->negoFlags |= MPT_TARGET_NO_NEGO_QAS; 4603 pTarget->negoFlags |= MPT_TARGET_NO_NEGO_QAS;
4598 hd->ioc->spi_data.noQas = MPT_TARGET_NO_NEGO_QAS; 4604 hd->ioc->spi_data.noQas = MPT_TARGET_NO_NEGO_QAS;
4599 ddvprintk((MYIOC_s_NOTE_FMT 4605 ddvprintk((MYIOC_s_NOTE_FMT
4600 "DV: Start Basic noQas on id=%d due to pbuf1[56]=%x\n", 4606 "DV: Start Basic noQas on id=%d due to pbuf1[56]=%x\n",
4601 ioc->name, id, pbuf1[56])); 4607 ioc->name, id, pbuf1[56]));
4602 } 4608 }
4603 } 4609 }
@@ -4637,7 +4643,7 @@ mptscsih_doDv(MPT_SCSI_HOST *hd, int bus_number, int id)
4637 u32 sdp0_info; 4643 u32 sdp0_info;
4638 u32 sdp0_nego; 4644 u32 sdp0_nego;
4639 4645
4640 cfg.hdr = &header0; 4646 cfg.cfghdr.hdr = &header0;
4641 cfg.physAddr = cfg0_dma_addr; 4647 cfg.physAddr = cfg0_dma_addr;
4642 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT; 4648 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
4643 cfg.dir = 0; 4649 cfg.dir = 0;
@@ -4673,7 +4679,7 @@ mptscsih_doDv(MPT_SCSI_HOST *hd, int bus_number, int id)
4673 if (!firstPass) 4679 if (!firstPass)
4674 doFallback = 1; 4680 doFallback = 1;
4675 } else { 4681 } else {
4676 ddvprintk((MYIOC_s_NOTE_FMT 4682 ddvprintk((MYIOC_s_NOTE_FMT
4677 "DV:Inquiry compared id=%d, calling initTarget\n", ioc->name, id)); 4683 "DV:Inquiry compared id=%d, calling initTarget\n", ioc->name, id));
4678 hd->ioc->spi_data.dvStatus[id] &= ~MPT_SCSICFG_DV_NOT_DONE; 4684 hd->ioc->spi_data.dvStatus[id] &= ~MPT_SCSICFG_DV_NOT_DONE;
4679 mptscsih_initTarget(hd, 4685 mptscsih_initTarget(hd,
@@ -4689,8 +4695,8 @@ mptscsih_doDv(MPT_SCSI_HOST *hd, int bus_number, int id)
4689 4695
4690 } else if (rc == MPT_SCANDV_ISSUE_SENSE) 4696 } else if (rc == MPT_SCANDV_ISSUE_SENSE)
4691 doFallback = 1; /* set fallback flag */ 4697 doFallback = 1; /* set fallback flag */
4692 else if ((rc == MPT_SCANDV_DID_RESET) || 4698 else if ((rc == MPT_SCANDV_DID_RESET) ||
4693 (rc == MPT_SCANDV_SENSE) || 4699 (rc == MPT_SCANDV_SENSE) ||
4694 (rc == MPT_SCANDV_FALLBACK)) 4700 (rc == MPT_SCANDV_FALLBACK))
4695 doFallback = 1; /* set fallback flag */ 4701 doFallback = 1; /* set fallback flag */
4696 else 4702 else
@@ -4722,7 +4728,7 @@ mptscsih_doDv(MPT_SCSI_HOST *hd, int bus_number, int id)
4722 * 4) release 4728 * 4) release
4723 * 5) update nego parms to target struct 4729 * 5) update nego parms to target struct
4724 */ 4730 */
4725 cfg.hdr = &header1; 4731 cfg.cfghdr.hdr = &header1;
4726 cfg.physAddr = cfg1_dma_addr; 4732 cfg.physAddr = cfg1_dma_addr;
4727 cfg.action = MPI_CONFIG_ACTION_PAGE_WRITE_CURRENT; 4733 cfg.action = MPI_CONFIG_ACTION_PAGE_WRITE_CURRENT;
4728 cfg.dir = 1; 4734 cfg.dir = 1;
@@ -5121,12 +5127,12 @@ target_done:
5121 5127
5122 /* Set if cfg1_dma_addr contents is valid 5128 /* Set if cfg1_dma_addr contents is valid
5123 */ 5129 */
5124 if ((cfg.hdr != NULL) && (retcode == 0)){ 5130 if ((cfg.cfghdr.hdr != NULL) && (retcode == 0)){
5125 /* If disk, not U320, disable QAS 5131 /* If disk, not U320, disable QAS
5126 */ 5132 */
5127 if ((inq0 == 0) && (dv.now.factor > MPT_ULTRA320)) { 5133 if ((inq0 == 0) && (dv.now.factor > MPT_ULTRA320)) {
5128 hd->ioc->spi_data.noQas = MPT_TARGET_NO_NEGO_QAS; 5134 hd->ioc->spi_data.noQas = MPT_TARGET_NO_NEGO_QAS;
5129 ddvprintk((MYIOC_s_NOTE_FMT 5135 ddvprintk((MYIOC_s_NOTE_FMT
5130 "noQas set due to id=%d has factor=%x\n", ioc->name, id, dv.now.factor)); 5136 "noQas set due to id=%d has factor=%x\n", ioc->name, id, dv.now.factor));
5131 } 5137 }
5132 5138
@@ -5137,7 +5143,7 @@ target_done:
5137 * skip save of the final negotiated settings to 5143 * skip save of the final negotiated settings to
5138 * SCSI device page 1. 5144 * SCSI device page 1.
5139 * 5145 *
5140 cfg.hdr = &header1; 5146 cfg.cfghdr.hdr = &header1;
5141 cfg.physAddr = cfg1_dma_addr; 5147 cfg.physAddr = cfg1_dma_addr;
5142 cfg.action = MPI_CONFIG_ACTION_PAGE_WRITE_CURRENT; 5148 cfg.action = MPI_CONFIG_ACTION_PAGE_WRITE_CURRENT;
5143 cfg.dir = 1; 5149 cfg.dir = 1;
@@ -5248,7 +5254,7 @@ mptscsih_dv_parms(MPT_SCSI_HOST *hd, DVPARAMETERS *dv,void *pPage)
5248 /* Update tmax values with those from Device Page 0.*/ 5254 /* Update tmax values with those from Device Page 0.*/
5249 pPage0 = (SCSIDevicePage0_t *) pPage; 5255 pPage0 = (SCSIDevicePage0_t *) pPage;
5250 if (pPage0) { 5256 if (pPage0) {
5251 val = cpu_to_le32(pPage0->NegotiatedParameters); 5257 val = le32_to_cpu(pPage0->NegotiatedParameters);
5252 dv->max.width = val & MPI_SCSIDEVPAGE0_NP_WIDE ? 1 : 0; 5258 dv->max.width = val & MPI_SCSIDEVPAGE0_NP_WIDE ? 1 : 0;
5253 dv->max.offset = (val&MPI_SCSIDEVPAGE0_NP_NEG_SYNC_OFFSET_MASK) >> 16; 5259 dv->max.offset = (val&MPI_SCSIDEVPAGE0_NP_NEG_SYNC_OFFSET_MASK) >> 16;
5254 dv->max.factor = (val&MPI_SCSIDEVPAGE0_NP_NEG_SYNC_PERIOD_MASK) >> 8; 5260 dv->max.factor = (val&MPI_SCSIDEVPAGE0_NP_NEG_SYNC_PERIOD_MASK) >> 8;
@@ -5276,12 +5282,12 @@ mptscsih_dv_parms(MPT_SCSI_HOST *hd, DVPARAMETERS *dv,void *pPage)
5276 dv->now.offset, &val, &configuration, dv->now.flags); 5282 dv->now.offset, &val, &configuration, dv->now.flags);
5277 dnegoprintk(("Setting Max: id=%d width=%d factor=%x offset=%x negoFlags=%x request=%x config=%x\n", 5283 dnegoprintk(("Setting Max: id=%d width=%d factor=%x offset=%x negoFlags=%x request=%x config=%x\n",
5278 id, dv->now.width, dv->now.factor, dv->now.offset, dv->now.flags, val, configuration)); 5284 id, dv->now.width, dv->now.factor, dv->now.offset, dv->now.flags, val, configuration));
5279 pPage1->RequestedParameters = le32_to_cpu(val); 5285 pPage1->RequestedParameters = cpu_to_le32(val);
5280 pPage1->Reserved = 0; 5286 pPage1->Reserved = 0;
5281 pPage1->Configuration = le32_to_cpu(configuration); 5287 pPage1->Configuration = cpu_to_le32(configuration);
5282 } 5288 }
5283 5289
5284 ddvprintk(("id=%d width=%d factor=%x offset=%x flags=%x request=%x configuration=%x\n", 5290 ddvprintk(("id=%d width=%d factor=%x offset=%x negoFlags=%x request=%x configuration=%x\n",
5285 id, dv->now.width, dv->now.factor, dv->now.offset, dv->now.flags, val, configuration)); 5291 id, dv->now.width, dv->now.factor, dv->now.offset, dv->now.flags, val, configuration));
5286 break; 5292 break;
5287 5293
@@ -5301,9 +5307,9 @@ mptscsih_dv_parms(MPT_SCSI_HOST *hd, DVPARAMETERS *dv,void *pPage)
5301 offset, &val, &configuration, negoFlags); 5307 offset, &val, &configuration, negoFlags);
5302 dnegoprintk(("Setting Min: id=%d width=%d factor=%x offset=%x negoFlags=%x request=%x config=%x\n", 5308 dnegoprintk(("Setting Min: id=%d width=%d factor=%x offset=%x negoFlags=%x request=%x config=%x\n",
5303 id, width, factor, offset, negoFlags, val, configuration)); 5309 id, width, factor, offset, negoFlags, val, configuration));
5304 pPage1->RequestedParameters = le32_to_cpu(val); 5310 pPage1->RequestedParameters = cpu_to_le32(val);
5305 pPage1->Reserved = 0; 5311 pPage1->Reserved = 0;
5306 pPage1->Configuration = le32_to_cpu(configuration); 5312 pPage1->Configuration = cpu_to_le32(configuration);
5307 } 5313 }
5308 ddvprintk(("id=%d width=%d factor=%x offset=%x request=%x config=%x negoFlags=%x\n", 5314 ddvprintk(("id=%d width=%d factor=%x offset=%x request=%x config=%x negoFlags=%x\n",
5309 id, width, factor, offset, val, configuration, negoFlags)); 5315 id, width, factor, offset, val, configuration, negoFlags));
@@ -5377,12 +5383,12 @@ mptscsih_dv_parms(MPT_SCSI_HOST *hd, DVPARAMETERS *dv,void *pPage)
5377 if (pPage1) { 5383 if (pPage1) {
5378 mptscsih_setDevicePage1Flags (width, factor, offset, &val, 5384 mptscsih_setDevicePage1Flags (width, factor, offset, &val,
5379 &configuration, dv->now.flags); 5385 &configuration, dv->now.flags);
5380 dnegoprintk(("Finish: id=%d width=%d offset=%d factor=%x flags=%x request=%x config=%x\n", 5386 dnegoprintk(("Finish: id=%d width=%d offset=%d factor=%x negoFlags=%x request=%x config=%x\n",
5381 id, width, offset, factor, dv->now.flags, val, configuration)); 5387 id, width, offset, factor, dv->now.flags, val, configuration));
5382 5388
5383 pPage1->RequestedParameters = le32_to_cpu(val); 5389 pPage1->RequestedParameters = cpu_to_le32(val);
5384 pPage1->Reserved = 0; 5390 pPage1->Reserved = 0;
5385 pPage1->Configuration = le32_to_cpu(configuration); 5391 pPage1->Configuration = cpu_to_le32(configuration);
5386 } 5392 }
5387 5393
5388 ddvprintk(("Finish: id=%d offset=%d factor=%x width=%d request=%x config=%x\n", 5394 ddvprintk(("Finish: id=%d offset=%d factor=%x width=%d request=%x config=%x\n",