diff options
Diffstat (limited to 'drivers/message/fusion/mptbase.c')
-rw-r--r-- | drivers/message/fusion/mptbase.c | 225 |
1 files changed, 119 insertions, 106 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index 35444ba4e78a..f517d0692d5f 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c | |||
@@ -218,8 +218,7 @@ pci_enable_io_access(struct pci_dev *pdev) | |||
218 | * (also referred to as a IO Controller or IOC). | 218 | * (also referred to as a IO Controller or IOC). |
219 | * This routine must clear the interrupt from the adapter and does | 219 | * This routine must clear the interrupt from the adapter and does |
220 | * so by reading the reply FIFO. Multiple replies may be processed | 220 | * so by reading the reply FIFO. Multiple replies may be processed |
221 | * per single call to this routine; up to MPT_MAX_REPLIES_PER_ISR | 221 | * per single call to this routine. |
222 | * which is currently set to 32 in mptbase.h. | ||
223 | * | 222 | * |
224 | * This routine handles register-level access of the adapter but | 223 | * This routine handles register-level access of the adapter but |
225 | * dispatches (calls) a protocol-specific callback routine to handle | 224 | * dispatches (calls) a protocol-specific callback routine to handle |
@@ -279,11 +278,11 @@ mpt_interrupt(int irq, void *bus_id, struct pt_regs *r) | |||
279 | cb_idx = mr->u.frame.hwhdr.msgctxu.fld.cb_idx; | 278 | cb_idx = mr->u.frame.hwhdr.msgctxu.fld.cb_idx; |
280 | mf = MPT_INDEX_2_MFPTR(ioc, req_idx); | 279 | mf = MPT_INDEX_2_MFPTR(ioc, req_idx); |
281 | 280 | ||
282 | dmfprintk((MYIOC_s_INFO_FMT "Got non-TURBO reply=%p req_idx=%x\n", | 281 | dmfprintk((MYIOC_s_INFO_FMT "Got non-TURBO reply=%p req_idx=%x cb_idx=%x Function=%x\n", |
283 | ioc->name, mr, req_idx)); | 282 | ioc->name, mr, req_idx, cb_idx, mr->u.hdr.Function)); |
284 | DBG_DUMP_REPLY_FRAME(mr) | 283 | DBG_DUMP_REPLY_FRAME(mr) |
285 | 284 | ||
286 | /* Check/log IOC log info | 285 | /* Check/log IOC log info |
287 | */ | 286 | */ |
288 | ioc_stat = le16_to_cpu(mr->u.reply.IOCStatus); | 287 | ioc_stat = le16_to_cpu(mr->u.reply.IOCStatus); |
289 | if (ioc_stat & MPI_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE) { | 288 | if (ioc_stat & MPI_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE) { |
@@ -345,7 +344,7 @@ mpt_interrupt(int irq, void *bus_id, struct pt_regs *r) | |||
345 | if ((mf) && ((mf >= MPT_INDEX_2_MFPTR(ioc, ioc->req_depth)) | 344 | if ((mf) && ((mf >= MPT_INDEX_2_MFPTR(ioc, ioc->req_depth)) |
346 | || (mf < ioc->req_frames)) ) { | 345 | || (mf < ioc->req_frames)) ) { |
347 | printk(MYIOC_s_WARN_FMT | 346 | printk(MYIOC_s_WARN_FMT |
348 | "mpt_interrupt: Invalid mf (%p) req_idx (%d)!\n", ioc->name, (void *)mf, req_idx); | 347 | "mpt_interrupt: Invalid mf (%p)!\n", ioc->name, (void *)mf); |
349 | cb_idx = 0; | 348 | cb_idx = 0; |
350 | pa = 0; | 349 | pa = 0; |
351 | freeme = 0; | 350 | freeme = 0; |
@@ -399,7 +398,7 @@ mpt_interrupt(int irq, void *bus_id, struct pt_regs *r) | |||
399 | * @mf: Pointer to original MPT request frame | 398 | * @mf: Pointer to original MPT request frame |
400 | * @reply: Pointer to MPT reply frame (NULL if TurboReply) | 399 | * @reply: Pointer to MPT reply frame (NULL if TurboReply) |
401 | * | 400 | * |
402 | * Returns 1 indicating original alloc'd request frame ptr | 401 | * Returns 1 indicating original alloc'd request frame ptr |
403 | * should be freed, or 0 if it shouldn't. | 402 | * should be freed, or 0 if it shouldn't. |
404 | */ | 403 | */ |
405 | static int | 404 | static int |
@@ -408,28 +407,17 @@ mpt_base_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *reply) | |||
408 | int freereq = 1; | 407 | int freereq = 1; |
409 | u8 func; | 408 | u8 func; |
410 | 409 | ||
411 | dprintk((MYIOC_s_INFO_FMT "mpt_base_reply() called\n", ioc->name)); | 410 | dmfprintk((MYIOC_s_INFO_FMT "mpt_base_reply() called\n", ioc->name)); |
412 | |||
413 | if ((mf == NULL) || | ||
414 | (mf >= MPT_INDEX_2_MFPTR(ioc, ioc->req_depth))) { | ||
415 | printk(MYIOC_s_ERR_FMT "NULL or BAD request frame ptr! (=%p)\n", | ||
416 | ioc->name, (void *)mf); | ||
417 | return 1; | ||
418 | } | ||
419 | |||
420 | if (reply == NULL) { | ||
421 | dprintk((MYIOC_s_ERR_FMT "Unexpected NULL Event (turbo?) reply!\n", | ||
422 | ioc->name)); | ||
423 | return 1; | ||
424 | } | ||
425 | 411 | ||
412 | #if defined(MPT_DEBUG_MSG_FRAME) | ||
426 | if (!(reply->u.hdr.MsgFlags & MPI_MSGFLAGS_CONTINUATION_REPLY)) { | 413 | if (!(reply->u.hdr.MsgFlags & MPI_MSGFLAGS_CONTINUATION_REPLY)) { |
427 | dmfprintk((KERN_INFO MYNAM ": Original request frame (@%p) header\n", mf)); | 414 | dmfprintk((KERN_INFO MYNAM ": Original request frame (@%p) header\n", mf)); |
428 | DBG_DUMP_REQUEST_FRAME_HDR(mf) | 415 | DBG_DUMP_REQUEST_FRAME_HDR(mf) |
429 | } | 416 | } |
417 | #endif | ||
430 | 418 | ||
431 | func = reply->u.hdr.Function; | 419 | func = reply->u.hdr.Function; |
432 | dprintk((MYIOC_s_INFO_FMT "mpt_base_reply, Function=%02Xh\n", | 420 | dmfprintk((MYIOC_s_INFO_FMT "mpt_base_reply, Function=%02Xh\n", |
433 | ioc->name, func)); | 421 | ioc->name, func)); |
434 | 422 | ||
435 | if (func == MPI_FUNCTION_EVENT_NOTIFICATION) { | 423 | if (func == MPI_FUNCTION_EVENT_NOTIFICATION) { |
@@ -448,8 +436,14 @@ mpt_base_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *reply) | |||
448 | * Hmmm... It seems that EventNotificationReply is an exception | 436 | * Hmmm... It seems that EventNotificationReply is an exception |
449 | * to the rule of one reply per request. | 437 | * to the rule of one reply per request. |
450 | */ | 438 | */ |
451 | if (pEvReply->MsgFlags & MPI_MSGFLAGS_CONTINUATION_REPLY) | 439 | if (pEvReply->MsgFlags & MPI_MSGFLAGS_CONTINUATION_REPLY) { |
452 | freereq = 0; | 440 | freereq = 0; |
441 | devtprintk((MYIOC_s_WARN_FMT "EVENT_NOTIFICATION reply %p does not return Request frame\n", | ||
442 | ioc->name, pEvReply)); | ||
443 | } else { | ||
444 | devtprintk((MYIOC_s_WARN_FMT "EVENT_NOTIFICATION reply %p returns Request frame\n", | ||
445 | ioc->name, pEvReply)); | ||
446 | } | ||
453 | 447 | ||
454 | #ifdef CONFIG_PROC_FS | 448 | #ifdef CONFIG_PROC_FS |
455 | // LogEvent(ioc, pEvReply); | 449 | // LogEvent(ioc, pEvReply); |
@@ -716,7 +710,7 @@ mpt_device_driver_deregister(int cb_idx) | |||
716 | if (dd_cbfunc->remove) | 710 | if (dd_cbfunc->remove) |
717 | dd_cbfunc->remove(ioc->pcidev); | 711 | dd_cbfunc->remove(ioc->pcidev); |
718 | } | 712 | } |
719 | 713 | ||
720 | MptDeviceDriverHandlers[cb_idx] = NULL; | 714 | MptDeviceDriverHandlers[cb_idx] = NULL; |
721 | } | 715 | } |
722 | 716 | ||
@@ -829,7 +823,7 @@ mpt_put_msg_frame(int handle, MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf) | |||
829 | } | 823 | } |
830 | #endif | 824 | #endif |
831 | 825 | ||
832 | mf_dma_addr = (ioc->req_frames_low_dma + req_offset) | ioc->RequestNB[req_idx]; | 826 | mf_dma_addr = (ioc->req_frames_low_dma + req_offset) | ioc->RequestNB[req_idx]; |
833 | dsgprintk((MYIOC_s_INFO_FMT "mf_dma_addr=%x req_idx=%d RequestNB=%x\n", ioc->name, mf_dma_addr, req_idx, ioc->RequestNB[req_idx])); | 827 | dsgprintk((MYIOC_s_INFO_FMT "mf_dma_addr=%x req_idx=%d RequestNB=%x\n", ioc->name, mf_dma_addr, req_idx, ioc->RequestNB[req_idx])); |
834 | CHIPREG_WRITE32(&ioc->chip->RequestFifo, mf_dma_addr); | 828 | CHIPREG_WRITE32(&ioc->chip->RequestFifo, mf_dma_addr); |
835 | } | 829 | } |
@@ -931,7 +925,7 @@ mpt_send_handshake_request(int handle, MPT_ADAPTER *ioc, int reqBytes, u32 *req, | |||
931 | 925 | ||
932 | /* Make sure there are no doorbells */ | 926 | /* Make sure there are no doorbells */ |
933 | CHIPREG_WRITE32(&ioc->chip->IntStatus, 0); | 927 | CHIPREG_WRITE32(&ioc->chip->IntStatus, 0); |
934 | 928 | ||
935 | CHIPREG_WRITE32(&ioc->chip->Doorbell, | 929 | CHIPREG_WRITE32(&ioc->chip->Doorbell, |
936 | ((MPI_FUNCTION_HANDSHAKE<<MPI_DOORBELL_FUNCTION_SHIFT) | | 930 | ((MPI_FUNCTION_HANDSHAKE<<MPI_DOORBELL_FUNCTION_SHIFT) | |
937 | ((reqBytes/4)<<MPI_DOORBELL_ADD_DWORDS_SHIFT))); | 931 | ((reqBytes/4)<<MPI_DOORBELL_ADD_DWORDS_SHIFT))); |
@@ -946,14 +940,14 @@ mpt_send_handshake_request(int handle, MPT_ADAPTER *ioc, int reqBytes, u32 *req, | |||
946 | return -5; | 940 | return -5; |
947 | 941 | ||
948 | dhsprintk((KERN_INFO MYNAM ": %s: mpt_send_handshake_request start, WaitCnt=%d\n", | 942 | dhsprintk((KERN_INFO MYNAM ": %s: mpt_send_handshake_request start, WaitCnt=%d\n", |
949 | ioc->name, ii)); | 943 | ioc->name, ii)); |
950 | 944 | ||
951 | CHIPREG_WRITE32(&ioc->chip->IntStatus, 0); | 945 | CHIPREG_WRITE32(&ioc->chip->IntStatus, 0); |
952 | 946 | ||
953 | if ((r = WaitForDoorbellAck(ioc, 5, sleepFlag)) < 0) { | 947 | if ((r = WaitForDoorbellAck(ioc, 5, sleepFlag)) < 0) { |
954 | return -2; | 948 | return -2; |
955 | } | 949 | } |
956 | 950 | ||
957 | /* Send request via doorbell handshake */ | 951 | /* Send request via doorbell handshake */ |
958 | req_as_bytes = (u8 *) req; | 952 | req_as_bytes = (u8 *) req; |
959 | for (ii = 0; ii < reqBytes/4; ii++) { | 953 | for (ii = 0; ii < reqBytes/4; ii++) { |
@@ -999,9 +993,9 @@ mpt_verify_adapter(int iocid, MPT_ADAPTER **iocpp) | |||
999 | if (ioc->id == iocid) { | 993 | if (ioc->id == iocid) { |
1000 | *iocpp =ioc; | 994 | *iocpp =ioc; |
1001 | return iocid; | 995 | return iocid; |
1002 | } | 996 | } |
1003 | } | 997 | } |
1004 | 998 | ||
1005 | *iocpp = NULL; | 999 | *iocpp = NULL; |
1006 | return -1; | 1000 | return -1; |
1007 | } | 1001 | } |
@@ -1043,9 +1037,9 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1043 | 1037 | ||
1044 | if (pci_enable_device(pdev)) | 1038 | if (pci_enable_device(pdev)) |
1045 | return r; | 1039 | return r; |
1046 | 1040 | ||
1047 | dinitprintk((KERN_WARNING MYNAM ": mpt_adapter_install\n")); | 1041 | dinitprintk((KERN_WARNING MYNAM ": mpt_adapter_install\n")); |
1048 | 1042 | ||
1049 | if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) { | 1043 | if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) { |
1050 | dprintk((KERN_INFO MYNAM | 1044 | dprintk((KERN_INFO MYNAM |
1051 | ": 64 BIT PCI BUS DMA ADDRESSING SUPPORTED\n")); | 1045 | ": 64 BIT PCI BUS DMA ADDRESSING SUPPORTED\n")); |
@@ -1070,7 +1064,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1070 | ioc->alloc_total = sizeof(MPT_ADAPTER); | 1064 | ioc->alloc_total = sizeof(MPT_ADAPTER); |
1071 | ioc->req_sz = MPT_DEFAULT_FRAME_SIZE; /* avoid div by zero! */ | 1065 | ioc->req_sz = MPT_DEFAULT_FRAME_SIZE; /* avoid div by zero! */ |
1072 | ioc->reply_sz = MPT_REPLY_FRAME_SIZE; | 1066 | ioc->reply_sz = MPT_REPLY_FRAME_SIZE; |
1073 | 1067 | ||
1074 | ioc->pcidev = pdev; | 1068 | ioc->pcidev = pdev; |
1075 | ioc->diagPending = 0; | 1069 | ioc->diagPending = 0; |
1076 | spin_lock_init(&ioc->diagLock); | 1070 | spin_lock_init(&ioc->diagLock); |
@@ -1099,7 +1093,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1099 | /* Find lookup slot. */ | 1093 | /* Find lookup slot. */ |
1100 | INIT_LIST_HEAD(&ioc->list); | 1094 | INIT_LIST_HEAD(&ioc->list); |
1101 | ioc->id = mpt_ids++; | 1095 | ioc->id = mpt_ids++; |
1102 | 1096 | ||
1103 | mem_phys = msize = 0; | 1097 | mem_phys = msize = 0; |
1104 | port = psize = 0; | 1098 | port = psize = 0; |
1105 | for (ii=0; ii < DEVICE_COUNT_RESOURCE; ii++) { | 1099 | for (ii=0; ii < DEVICE_COUNT_RESOURCE; ii++) { |
@@ -1154,7 +1148,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1154 | ioc->prod_name = "LSIFC909"; | 1148 | ioc->prod_name = "LSIFC909"; |
1155 | ioc->bus_type = FC; | 1149 | ioc->bus_type = FC; |
1156 | } | 1150 | } |
1157 | if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC929) { | 1151 | else if (pdev->device == MPI_MANUFACTPAGE_DEVICEID_FC929) { |
1158 | ioc->prod_name = "LSIFC929"; | 1152 | ioc->prod_name = "LSIFC929"; |
1159 | ioc->bus_type = FC; | 1153 | ioc->bus_type = FC; |
1160 | } | 1154 | } |
@@ -1333,7 +1327,7 @@ mpt_detach(struct pci_dev *pdev) | |||
1333 | remove_proc_entry(pname, NULL); | 1327 | remove_proc_entry(pname, NULL); |
1334 | sprintf(pname, MPT_PROCFS_MPTBASEDIR "/%s", ioc->name); | 1328 | sprintf(pname, MPT_PROCFS_MPTBASEDIR "/%s", ioc->name); |
1335 | remove_proc_entry(pname, NULL); | 1329 | remove_proc_entry(pname, NULL); |
1336 | 1330 | ||
1337 | /* call per device driver remove entry point */ | 1331 | /* call per device driver remove entry point */ |
1338 | for(ii=0; ii<MPT_MAX_PROTOCOL_DRIVERS; ii++) { | 1332 | for(ii=0; ii<MPT_MAX_PROTOCOL_DRIVERS; ii++) { |
1339 | if(MptDeviceDriverHandlers[ii] && | 1333 | if(MptDeviceDriverHandlers[ii] && |
@@ -1341,7 +1335,7 @@ mpt_detach(struct pci_dev *pdev) | |||
1341 | MptDeviceDriverHandlers[ii]->remove(pdev); | 1335 | MptDeviceDriverHandlers[ii]->remove(pdev); |
1342 | } | 1336 | } |
1343 | } | 1337 | } |
1344 | 1338 | ||
1345 | /* Disable interrupts! */ | 1339 | /* Disable interrupts! */ |
1346 | CHIPREG_WRITE32(&ioc->chip->IntMask, 0xFFFFFFFF); | 1340 | CHIPREG_WRITE32(&ioc->chip->IntMask, 0xFFFFFFFF); |
1347 | 1341 | ||
@@ -1414,7 +1408,7 @@ mpt_resume(struct pci_dev *pdev) | |||
1414 | u32 device_state = pdev->current_state; | 1408 | u32 device_state = pdev->current_state; |
1415 | int recovery_state; | 1409 | int recovery_state; |
1416 | int ii; | 1410 | int ii; |
1417 | 1411 | ||
1418 | printk(MYIOC_s_INFO_FMT | 1412 | printk(MYIOC_s_INFO_FMT |
1419 | "pci-resume: pdev=0x%p, slot=%s, Previous operating state [D%d]\n", | 1413 | "pci-resume: pdev=0x%p, slot=%s, Previous operating state [D%d]\n", |
1420 | ioc->name, pdev, pci_name(pdev), device_state); | 1414 | ioc->name, pdev, pci_name(pdev), device_state); |
@@ -1545,7 +1539,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) | |||
1545 | if ((rc = GetIocFacts(ioc, sleepFlag, reason)) == 0) | 1539 | if ((rc = GetIocFacts(ioc, sleepFlag, reason)) == 0) |
1546 | break; | 1540 | break; |
1547 | } | 1541 | } |
1548 | 1542 | ||
1549 | 1543 | ||
1550 | if (ii == 5) { | 1544 | if (ii == 5) { |
1551 | dinitprintk((MYIOC_s_INFO_FMT "Retry IocFacts failed rc=%x\n", ioc->name, rc)); | 1545 | dinitprintk((MYIOC_s_INFO_FMT "Retry IocFacts failed rc=%x\n", ioc->name, rc)); |
@@ -1553,7 +1547,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) | |||
1553 | } else if (reason == MPT_HOSTEVENT_IOC_BRINGUP) { | 1547 | } else if (reason == MPT_HOSTEVENT_IOC_BRINGUP) { |
1554 | MptDisplayIocCapabilities(ioc); | 1548 | MptDisplayIocCapabilities(ioc); |
1555 | } | 1549 | } |
1556 | 1550 | ||
1557 | if (alt_ioc_ready) { | 1551 | if (alt_ioc_ready) { |
1558 | if ((rc = GetIocFacts(ioc->alt_ioc, sleepFlag, reason)) != 0) { | 1552 | if ((rc = GetIocFacts(ioc->alt_ioc, sleepFlag, reason)) != 0) { |
1559 | dinitprintk((MYIOC_s_INFO_FMT "Initial Alt IocFacts failed rc=%x\n", ioc->name, rc)); | 1553 | dinitprintk((MYIOC_s_INFO_FMT "Initial Alt IocFacts failed rc=%x\n", ioc->name, rc)); |
@@ -1624,7 +1618,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) | |||
1624 | 1618 | ||
1625 | if (reset_alt_ioc_active && ioc->alt_ioc) { | 1619 | if (reset_alt_ioc_active && ioc->alt_ioc) { |
1626 | /* (re)Enable alt-IOC! (reply interrupt) */ | 1620 | /* (re)Enable alt-IOC! (reply interrupt) */ |
1627 | dprintk((KERN_INFO MYNAM ": alt-%s reply irq re-enabled\n", | 1621 | dinitprintk((KERN_INFO MYNAM ": alt-%s reply irq re-enabled\n", |
1628 | ioc->alt_ioc->name)); | 1622 | ioc->alt_ioc->name)); |
1629 | CHIPREG_WRITE32(&ioc->alt_ioc->chip->IntMask, ~(MPI_HIM_RIM)); | 1623 | CHIPREG_WRITE32(&ioc->alt_ioc->chip->IntMask, ~(MPI_HIM_RIM)); |
1630 | ioc->alt_ioc->active = 1; | 1624 | ioc->alt_ioc->active = 1; |
@@ -1681,7 +1675,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) | |||
1681 | 1675 | ||
1682 | /* Find IM volumes | 1676 | /* Find IM volumes |
1683 | */ | 1677 | */ |
1684 | if (ioc->facts.MsgVersion >= 0x0102) | 1678 | if (ioc->facts.MsgVersion >= MPI_VERSION_01_02) |
1685 | mpt_findImVolumes(ioc); | 1679 | mpt_findImVolumes(ioc); |
1686 | 1680 | ||
1687 | /* Check, and possibly reset, the coalescing value | 1681 | /* Check, and possibly reset, the coalescing value |
@@ -1711,7 +1705,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag) | |||
1711 | } | 1705 | } |
1712 | 1706 | ||
1713 | if (alt_ioc_ready && MptResetHandlers[ii]) { | 1707 | if (alt_ioc_ready && MptResetHandlers[ii]) { |
1714 | dprintk((MYIOC_s_INFO_FMT "Calling alt-%s post_reset handler #%d\n", | 1708 | drsprintk((MYIOC_s_INFO_FMT "Calling alt-%s post_reset handler #%d\n", |
1715 | ioc->name, ioc->alt_ioc->name, ii)); | 1709 | ioc->name, ioc->alt_ioc->name, ii)); |
1716 | rc += (*(MptResetHandlers[ii]))(ioc->alt_ioc, MPT_IOC_POST_RESET); | 1710 | rc += (*(MptResetHandlers[ii]))(ioc->alt_ioc, MPT_IOC_POST_RESET); |
1717 | handlers++; | 1711 | handlers++; |
@@ -1744,8 +1738,8 @@ mpt_detect_bound_ports(MPT_ADAPTER *ioc, struct pci_dev *pdev) | |||
1744 | 1738 | ||
1745 | dprintk((MYIOC_s_INFO_FMT "PCI device %s devfn=%x/%x," | 1739 | dprintk((MYIOC_s_INFO_FMT "PCI device %s devfn=%x/%x," |
1746 | " searching for devfn match on %x or %x\n", | 1740 | " searching for devfn match on %x or %x\n", |
1747 | ioc->name, pci_name(pdev), pdev->devfn, | 1741 | ioc->name, pci_name(pdev), pdev->bus->number, |
1748 | func-1, func+1)); | 1742 | pdev->devfn, func-1, func+1)); |
1749 | 1743 | ||
1750 | peer = pci_get_slot(pdev->bus, PCI_DEVFN(slot,func-1)); | 1744 | peer = pci_get_slot(pdev->bus, PCI_DEVFN(slot,func-1)); |
1751 | if (!peer) { | 1745 | if (!peer) { |
@@ -1872,36 +1866,39 @@ mpt_adapter_disable(MPT_ADAPTER *ioc) | |||
1872 | static void | 1866 | static void |
1873 | mpt_adapter_dispose(MPT_ADAPTER *ioc) | 1867 | mpt_adapter_dispose(MPT_ADAPTER *ioc) |
1874 | { | 1868 | { |
1875 | if (ioc != NULL) { | 1869 | int sz_first, sz_last; |
1876 | int sz_first, sz_last; | ||
1877 | 1870 | ||
1878 | sz_first = ioc->alloc_total; | 1871 | if (ioc == NULL) |
1872 | return; | ||
1879 | 1873 | ||
1880 | mpt_adapter_disable(ioc); | 1874 | sz_first = ioc->alloc_total; |
1881 | 1875 | ||
1882 | if (ioc->pci_irq != -1) { | 1876 | mpt_adapter_disable(ioc); |
1883 | free_irq(ioc->pci_irq, ioc); | ||
1884 | ioc->pci_irq = -1; | ||
1885 | } | ||
1886 | 1877 | ||
1887 | if (ioc->memmap != NULL) | 1878 | if (ioc->pci_irq != -1) { |
1888 | iounmap(ioc->memmap); | 1879 | free_irq(ioc->pci_irq, ioc); |
1880 | ioc->pci_irq = -1; | ||
1881 | } | ||
1882 | |||
1883 | if (ioc->memmap != NULL) { | ||
1884 | iounmap(ioc->memmap); | ||
1885 | ioc->memmap = NULL; | ||
1886 | } | ||
1889 | 1887 | ||
1890 | #if defined(CONFIG_MTRR) && 0 | 1888 | #if defined(CONFIG_MTRR) && 0 |
1891 | if (ioc->mtrr_reg > 0) { | 1889 | if (ioc->mtrr_reg > 0) { |
1892 | mtrr_del(ioc->mtrr_reg, 0, 0); | 1890 | mtrr_del(ioc->mtrr_reg, 0, 0); |
1893 | dprintk((KERN_INFO MYNAM ": %s: MTRR region de-registered\n", ioc->name)); | 1891 | dprintk((KERN_INFO MYNAM ": %s: MTRR region de-registered\n", ioc->name)); |
1894 | } | 1892 | } |
1895 | #endif | 1893 | #endif |
1896 | 1894 | ||
1897 | /* Zap the adapter lookup ptr! */ | 1895 | /* Zap the adapter lookup ptr! */ |
1898 | list_del(&ioc->list); | 1896 | list_del(&ioc->list); |
1899 | 1897 | ||
1900 | sz_last = ioc->alloc_total; | 1898 | sz_last = ioc->alloc_total; |
1901 | dprintk((KERN_INFO MYNAM ": %s: free'd %d of %d bytes\n", | 1899 | dprintk((KERN_INFO MYNAM ": %s: free'd %d of %d bytes\n", |
1902 | ioc->name, sz_first-sz_last+(int)sizeof(*ioc), sz_first)); | 1900 | ioc->name, sz_first-sz_last+(int)sizeof(*ioc), sz_first)); |
1903 | kfree(ioc); | 1901 | kfree(ioc); |
1904 | } | ||
1905 | } | 1902 | } |
1906 | 1903 | ||
1907 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1904 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
@@ -1988,7 +1985,7 @@ MakeIocReady(MPT_ADAPTER *ioc, int force, int sleepFlag) | |||
1988 | } | 1985 | } |
1989 | 1986 | ||
1990 | /* Is it already READY? */ | 1987 | /* Is it already READY? */ |
1991 | if (!statefault && (ioc_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_READY) | 1988 | if (!statefault && (ioc_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_READY) |
1992 | return 0; | 1989 | return 0; |
1993 | 1990 | ||
1994 | /* | 1991 | /* |
@@ -2006,7 +2003,7 @@ MakeIocReady(MPT_ADAPTER *ioc, int force, int sleepFlag) | |||
2006 | * Hmmm... Did it get left operational? | 2003 | * Hmmm... Did it get left operational? |
2007 | */ | 2004 | */ |
2008 | if ((ioc_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_OPERATIONAL) { | 2005 | if ((ioc_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_OPERATIONAL) { |
2009 | dinitprintk((MYIOC_s_WARN_FMT "IOC operational unexpected\n", | 2006 | dinitprintk((MYIOC_s_INFO_FMT "IOC operational unexpected\n", |
2010 | ioc->name)); | 2007 | ioc->name)); |
2011 | 2008 | ||
2012 | /* Check WhoInit. | 2009 | /* Check WhoInit. |
@@ -2015,8 +2012,8 @@ MakeIocReady(MPT_ADAPTER *ioc, int force, int sleepFlag) | |||
2015 | * Else, fall through to KickStart case | 2012 | * Else, fall through to KickStart case |
2016 | */ | 2013 | */ |
2017 | whoinit = (ioc_state & MPI_DOORBELL_WHO_INIT_MASK) >> MPI_DOORBELL_WHO_INIT_SHIFT; | 2014 | whoinit = (ioc_state & MPI_DOORBELL_WHO_INIT_MASK) >> MPI_DOORBELL_WHO_INIT_SHIFT; |
2018 | dprintk((KERN_WARNING MYNAM | 2015 | dinitprintk((KERN_INFO MYNAM |
2019 | ": whoinit 0x%x\n statefault %d force %d\n", | 2016 | ": whoinit 0x%x statefault %d force %d\n", |
2020 | whoinit, statefault, force)); | 2017 | whoinit, statefault, force)); |
2021 | if (whoinit == MPI_WHOINIT_PCI_PEER) | 2018 | if (whoinit == MPI_WHOINIT_PCI_PEER) |
2022 | return -4; | 2019 | return -4; |
@@ -2151,8 +2148,8 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepFlag, int reason) | |||
2151 | get_facts.Function = MPI_FUNCTION_IOC_FACTS; | 2148 | get_facts.Function = MPI_FUNCTION_IOC_FACTS; |
2152 | /* Assert: All other get_facts fields are zero! */ | 2149 | /* Assert: All other get_facts fields are zero! */ |
2153 | 2150 | ||
2154 | dinitprintk((MYIOC_s_INFO_FMT | 2151 | dinitprintk((MYIOC_s_INFO_FMT |
2155 | "Sending get IocFacts request req_sz=%d reply_sz=%d\n", | 2152 | "Sending get IocFacts request req_sz=%d reply_sz=%d\n", |
2156 | ioc->name, req_sz, reply_sz)); | 2153 | ioc->name, req_sz, reply_sz)); |
2157 | 2154 | ||
2158 | /* No non-zero fields in the get_facts request are greater than | 2155 | /* No non-zero fields in the get_facts request are greater than |
@@ -2232,7 +2229,7 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepFlag, int reason) | |||
2232 | if ( sz & 0x02 ) | 2229 | if ( sz & 0x02 ) |
2233 | sz += 2; | 2230 | sz += 2; |
2234 | facts->FWImageSize = sz; | 2231 | facts->FWImageSize = sz; |
2235 | 2232 | ||
2236 | if (!facts->RequestFrameSize) { | 2233 | if (!facts->RequestFrameSize) { |
2237 | /* Something is wrong! */ | 2234 | /* Something is wrong! */ |
2238 | printk(MYIOC_s_ERR_FMT "IOC reported invalid 0 request size!\n", | 2235 | printk(MYIOC_s_ERR_FMT "IOC reported invalid 0 request size!\n", |
@@ -2251,7 +2248,7 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepFlag, int reason) | |||
2251 | ioc->NBShiftFactor = shiftFactor; | 2248 | ioc->NBShiftFactor = shiftFactor; |
2252 | dinitprintk((MYIOC_s_INFO_FMT "NB_for_64_byte_frame=%x NBShiftFactor=%x BlockSize=%x\n", | 2249 | dinitprintk((MYIOC_s_INFO_FMT "NB_for_64_byte_frame=%x NBShiftFactor=%x BlockSize=%x\n", |
2253 | ioc->name, vv, shiftFactor, r)); | 2250 | ioc->name, vv, shiftFactor, r)); |
2254 | 2251 | ||
2255 | if (reason == MPT_HOSTEVENT_IOC_BRINGUP) { | 2252 | if (reason == MPT_HOSTEVENT_IOC_BRINGUP) { |
2256 | /* | 2253 | /* |
2257 | * Set values for this IOC's request & reply frame sizes, | 2254 | * Set values for this IOC's request & reply frame sizes, |
@@ -2272,7 +2269,7 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepFlag, int reason) | |||
2272 | return r; | 2269 | return r; |
2273 | } | 2270 | } |
2274 | } else { | 2271 | } else { |
2275 | printk(MYIOC_s_ERR_FMT | 2272 | printk(MYIOC_s_ERR_FMT |
2276 | "Invalid IOC facts reply, msgLength=%d offsetof=%zd!\n", | 2273 | "Invalid IOC facts reply, msgLength=%d offsetof=%zd!\n", |
2277 | ioc->name, facts->MsgLength, (offsetof(IOCFactsReply_t, | 2274 | ioc->name, facts->MsgLength, (offsetof(IOCFactsReply_t, |
2278 | RequestFrameSize)/sizeof(u32))); | 2275 | RequestFrameSize)/sizeof(u32))); |
@@ -2424,9 +2421,11 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepFlag) | |||
2424 | 2421 | ||
2425 | dhsprintk((MYIOC_s_INFO_FMT "Sending PortEnable (req @ %p)\n", | 2422 | dhsprintk((MYIOC_s_INFO_FMT "Sending PortEnable (req @ %p)\n", |
2426 | ioc->name, &ioc_init)); | 2423 | ioc->name, &ioc_init)); |
2427 | 2424 | ||
2428 | if ((r = SendPortEnable(ioc, 0, sleepFlag)) != 0) | 2425 | if ((r = SendPortEnable(ioc, 0, sleepFlag)) != 0) { |
2426 | printk(MYIOC_s_ERR_FMT "Sending PortEnable failed(%d)!\n",ioc->name, r); | ||
2429 | return r; | 2427 | return r; |
2428 | } | ||
2430 | 2429 | ||
2431 | /* YIKES! SUPER IMPORTANT!!! | 2430 | /* YIKES! SUPER IMPORTANT!!! |
2432 | * Poll IocState until _OPERATIONAL while IOC is doing | 2431 | * Poll IocState until _OPERATIONAL while IOC is doing |
@@ -2451,7 +2450,7 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepFlag) | |||
2451 | state = mpt_GetIocState(ioc, 1); | 2450 | state = mpt_GetIocState(ioc, 1); |
2452 | count++; | 2451 | count++; |
2453 | } | 2452 | } |
2454 | dhsprintk((MYIOC_s_INFO_FMT "INFO - Wait IOC_OPERATIONAL state (cnt=%d)\n", | 2453 | dinitprintk((MYIOC_s_INFO_FMT "INFO - Wait IOC_OPERATIONAL state (cnt=%d)\n", |
2455 | ioc->name, count)); | 2454 | ioc->name, count)); |
2456 | 2455 | ||
2457 | return r; | 2456 | return r; |
@@ -2540,7 +2539,7 @@ mpt_free_fw_memory(MPT_ADAPTER *ioc) | |||
2540 | int sz; | 2539 | int sz; |
2541 | 2540 | ||
2542 | sz = ioc->facts.FWImageSize; | 2541 | sz = ioc->facts.FWImageSize; |
2543 | dinitprintk((KERN_WARNING MYNAM "free_fw_memory: FW Image @ %p[%p], sz=%d[%x] bytes\n", | 2542 | dinitprintk((KERN_INFO MYNAM "free_fw_memory: FW Image @ %p[%p], sz=%d[%x] bytes\n", |
2544 | ioc->cached_fw, (void *)(ulong)ioc->cached_fw_dma, sz, sz)); | 2543 | ioc->cached_fw, (void *)(ulong)ioc->cached_fw_dma, sz, sz)); |
2545 | pci_free_consistent(ioc->pcidev, sz, | 2544 | pci_free_consistent(ioc->pcidev, sz, |
2546 | ioc->cached_fw, ioc->cached_fw_dma); | 2545 | ioc->cached_fw, ioc->cached_fw_dma); |
@@ -2584,9 +2583,9 @@ mpt_do_upload(MPT_ADAPTER *ioc, int sleepFlag) | |||
2584 | 2583 | ||
2585 | mpt_alloc_fw_memory(ioc, sz); | 2584 | mpt_alloc_fw_memory(ioc, sz); |
2586 | 2585 | ||
2587 | dinitprintk((KERN_WARNING MYNAM ": FW Image @ %p[%p], sz=%d[%x] bytes\n", | 2586 | dinitprintk((KERN_INFO MYNAM ": FW Image @ %p[%p], sz=%d[%x] bytes\n", |
2588 | ioc->cached_fw, (void *)(ulong)ioc->cached_fw_dma, sz, sz)); | 2587 | ioc->cached_fw, (void *)(ulong)ioc->cached_fw_dma, sz, sz)); |
2589 | 2588 | ||
2590 | if (ioc->cached_fw == NULL) { | 2589 | if (ioc->cached_fw == NULL) { |
2591 | /* Major Failure. | 2590 | /* Major Failure. |
2592 | */ | 2591 | */ |
@@ -2616,14 +2615,14 @@ mpt_do_upload(MPT_ADAPTER *ioc, int sleepFlag) | |||
2616 | mpt_add_sge(&request[sgeoffset], flagsLength, ioc->cached_fw_dma); | 2615 | mpt_add_sge(&request[sgeoffset], flagsLength, ioc->cached_fw_dma); |
2617 | 2616 | ||
2618 | sgeoffset += sizeof(u32) + sizeof(dma_addr_t); | 2617 | sgeoffset += sizeof(u32) + sizeof(dma_addr_t); |
2619 | dinitprintk((KERN_WARNING MYNAM "Sending FW Upload (req @ %p) sgeoffset=%d \n", | 2618 | dinitprintk((KERN_INFO MYNAM ": Sending FW Upload (req @ %p) sgeoffset=%d \n", |
2620 | prequest, sgeoffset)); | 2619 | prequest, sgeoffset)); |
2621 | DBG_DUMP_FW_REQUEST_FRAME(prequest) | 2620 | DBG_DUMP_FW_REQUEST_FRAME(prequest) |
2622 | 2621 | ||
2623 | ii = mpt_handshake_req_reply_wait(ioc, sgeoffset, (u32*)prequest, | 2622 | ii = mpt_handshake_req_reply_wait(ioc, sgeoffset, (u32*)prequest, |
2624 | reply_sz, (u16*)preply, 65 /*seconds*/, sleepFlag); | 2623 | reply_sz, (u16*)preply, 65 /*seconds*/, sleepFlag); |
2625 | 2624 | ||
2626 | dinitprintk((KERN_WARNING MYNAM "FW Upload completed rc=%x \n", ii)); | 2625 | dinitprintk((KERN_INFO MYNAM ": FW Upload completed rc=%x \n", ii)); |
2627 | 2626 | ||
2628 | cmdStatus = -EFAULT; | 2627 | cmdStatus = -EFAULT; |
2629 | if (ii == 0) { | 2628 | if (ii == 0) { |
@@ -2638,10 +2637,10 @@ mpt_do_upload(MPT_ADAPTER *ioc, int sleepFlag) | |||
2638 | cmdStatus = 0; | 2637 | cmdStatus = 0; |
2639 | } | 2638 | } |
2640 | } | 2639 | } |
2641 | dinitprintk((MYIOC_s_INFO_FMT ": do_upload status %d \n", | 2640 | dinitprintk((MYIOC_s_INFO_FMT ": do_upload cmdStatus=%d \n", |
2642 | ioc->name, cmdStatus)); | 2641 | ioc->name, cmdStatus)); |
2643 | 2642 | ||
2644 | 2643 | ||
2645 | if (cmdStatus) { | 2644 | if (cmdStatus) { |
2646 | 2645 | ||
2647 | ddlprintk((MYIOC_s_INFO_FMT ": fw upload failed, freeing image \n", | 2646 | ddlprintk((MYIOC_s_INFO_FMT ": fw upload failed, freeing image \n", |
@@ -2772,8 +2771,8 @@ mpt_downloadboot(MPT_ADAPTER *ioc, int sleepFlag) | |||
2772 | fwSize = (pExtImage->ImageSize + 3) >> 2; | 2771 | fwSize = (pExtImage->ImageSize + 3) >> 2; |
2773 | ptrFw = (u32 *)pExtImage; | 2772 | ptrFw = (u32 *)pExtImage; |
2774 | 2773 | ||
2775 | ddlprintk((MYIOC_s_INFO_FMT "Write Ext Image: 0x%x bytes @ %p load_addr=%x\n", | 2774 | ddlprintk((MYIOC_s_INFO_FMT "Write Ext Image: 0x%x (%d) bytes @ %p load_addr=%x\n", |
2776 | ioc->name, fwSize*4, ptrFw, load_addr)); | 2775 | ioc->name, fwSize*4, fwSize*4, ptrFw, load_addr)); |
2777 | CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwAddress, load_addr); | 2776 | CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwAddress, load_addr); |
2778 | 2777 | ||
2779 | while (fwSize--) { | 2778 | while (fwSize--) { |
@@ -2856,9 +2855,9 @@ mpt_downloadboot(MPT_ADAPTER *ioc, int sleepFlag) | |||
2856 | * 0 else | 2855 | * 0 else |
2857 | * | 2856 | * |
2858 | * Returns: | 2857 | * Returns: |
2859 | * 1 - hard reset, READY | 2858 | * 1 - hard reset, READY |
2860 | * 0 - no reset due to History bit, READY | 2859 | * 0 - no reset due to History bit, READY |
2861 | * -1 - no reset due to History bit but not READY | 2860 | * -1 - no reset due to History bit but not READY |
2862 | * OR reset but failed to come READY | 2861 | * OR reset but failed to come READY |
2863 | * -2 - no reset, could not enter DIAG mode | 2862 | * -2 - no reset, could not enter DIAG mode |
2864 | * -3 - reset but bad FW bit | 2863 | * -3 - reset but bad FW bit |
@@ -3001,7 +3000,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag) | |||
3001 | * | 3000 | * |
3002 | */ | 3001 | */ |
3003 | CHIPREG_WRITE32(&ioc->chip->Diagnostic, diag0val | MPI_DIAG_DISABLE_ARM); | 3002 | CHIPREG_WRITE32(&ioc->chip->Diagnostic, diag0val | MPI_DIAG_DISABLE_ARM); |
3004 | mdelay (1); | 3003 | mdelay(1); |
3005 | 3004 | ||
3006 | /* | 3005 | /* |
3007 | * Now hit the reset bit in the Diagnostic register | 3006 | * Now hit the reset bit in the Diagnostic register |
@@ -3181,7 +3180,7 @@ SendIocReset(MPT_ADAPTER *ioc, u8 reset_type, int sleepFlag) | |||
3181 | u32 state; | 3180 | u32 state; |
3182 | int cntdn, count; | 3181 | int cntdn, count; |
3183 | 3182 | ||
3184 | drsprintk((KERN_WARNING MYNAM ": %s: Sending IOC reset(0x%02x)!\n", | 3183 | drsprintk((KERN_INFO MYNAM ": %s: Sending IOC reset(0x%02x)!\n", |
3185 | ioc->name, reset_type)); | 3184 | ioc->name, reset_type)); |
3186 | CHIPREG_WRITE32(&ioc->chip->Doorbell, reset_type<<MPI_DOORBELL_FUNCTION_SHIFT); | 3185 | CHIPREG_WRITE32(&ioc->chip->Doorbell, reset_type<<MPI_DOORBELL_FUNCTION_SHIFT); |
3187 | if ((r = WaitForDoorbellAck(ioc, 5, sleepFlag)) < 0) | 3186 | if ((r = WaitForDoorbellAck(ioc, 5, sleepFlag)) < 0) |
@@ -3385,6 +3384,9 @@ PrimeIocFifos(MPT_ADAPTER *ioc) | |||
3385 | ioc->reply_frames = (MPT_FRAME_HDR *) mem; | 3384 | ioc->reply_frames = (MPT_FRAME_HDR *) mem; |
3386 | ioc->reply_frames_low_dma = (u32) (alloc_dma & 0xFFFFFFFF); | 3385 | ioc->reply_frames_low_dma = (u32) (alloc_dma & 0xFFFFFFFF); |
3387 | 3386 | ||
3387 | dinitprintk((KERN_INFO MYNAM ": %s ReplyBuffers @ %p[%p]\n", | ||
3388 | ioc->name, ioc->reply_frames, (void *)(ulong)alloc_dma)); | ||
3389 | |||
3388 | alloc_dma += reply_sz; | 3390 | alloc_dma += reply_sz; |
3389 | mem += reply_sz; | 3391 | mem += reply_sz; |
3390 | 3392 | ||
@@ -3393,7 +3395,7 @@ PrimeIocFifos(MPT_ADAPTER *ioc) | |||
3393 | ioc->req_frames = (MPT_FRAME_HDR *) mem; | 3395 | ioc->req_frames = (MPT_FRAME_HDR *) mem; |
3394 | ioc->req_frames_dma = alloc_dma; | 3396 | ioc->req_frames_dma = alloc_dma; |
3395 | 3397 | ||
3396 | dinitprintk((KERN_INFO MYNAM ": %s.RequestBuffers @ %p[%p]\n", | 3398 | dinitprintk((KERN_INFO MYNAM ": %s RequestBuffers @ %p[%p]\n", |
3397 | ioc->name, mem, (void *)(ulong)alloc_dma)); | 3399 | ioc->name, mem, (void *)(ulong)alloc_dma)); |
3398 | 3400 | ||
3399 | ioc->req_frames_low_dma = (u32) (alloc_dma & 0xFFFFFFFF); | 3401 | ioc->req_frames_low_dma = (u32) (alloc_dma & 0xFFFFFFFF); |
@@ -3419,7 +3421,7 @@ PrimeIocFifos(MPT_ADAPTER *ioc) | |||
3419 | ioc->ChainBuffer = mem; | 3421 | ioc->ChainBuffer = mem; |
3420 | ioc->ChainBufferDMA = alloc_dma; | 3422 | ioc->ChainBufferDMA = alloc_dma; |
3421 | 3423 | ||
3422 | dinitprintk((KERN_INFO MYNAM " :%s.ChainBuffers @ %p(%p)\n", | 3424 | dinitprintk((KERN_INFO MYNAM " :%s ChainBuffers @ %p(%p)\n", |
3423 | ioc->name, ioc->ChainBuffer, (void *)(ulong)ioc->ChainBufferDMA)); | 3425 | ioc->name, ioc->ChainBuffer, (void *)(ulong)ioc->ChainBufferDMA)); |
3424 | 3426 | ||
3425 | /* Initialize the free chain Q. | 3427 | /* Initialize the free chain Q. |
@@ -3524,7 +3526,7 @@ out_fail: | |||
3524 | */ | 3526 | */ |
3525 | static int | 3527 | static int |
3526 | mpt_handshake_req_reply_wait(MPT_ADAPTER *ioc, int reqBytes, u32 *req, | 3528 | mpt_handshake_req_reply_wait(MPT_ADAPTER *ioc, int reqBytes, u32 *req, |
3527 | int replyBytes, u16 *u16reply, int maxwait, int sleepFlag) | 3529 | int replyBytes, u16 *u16reply, int maxwait, int sleepFlag) |
3528 | { | 3530 | { |
3529 | MPIDefaultReply_t *mptReply; | 3531 | MPIDefaultReply_t *mptReply; |
3530 | int failcnt = 0; | 3532 | int failcnt = 0; |
@@ -3599,7 +3601,7 @@ mpt_handshake_req_reply_wait(MPT_ADAPTER *ioc, int reqBytes, u32 *req, | |||
3599 | */ | 3601 | */ |
3600 | if (!failcnt && (t = WaitForDoorbellReply(ioc, maxwait, sleepFlag)) < 0) | 3602 | if (!failcnt && (t = WaitForDoorbellReply(ioc, maxwait, sleepFlag)) < 0) |
3601 | failcnt++; | 3603 | failcnt++; |
3602 | 3604 | ||
3603 | dhsprintk((MYIOC_s_INFO_FMT "HandShake reply count=%d%s\n", | 3605 | dhsprintk((MYIOC_s_INFO_FMT "HandShake reply count=%d%s\n", |
3604 | ioc->name, t, failcnt ? " - MISSING DOORBELL REPLY!" : "")); | 3606 | ioc->name, t, failcnt ? " - MISSING DOORBELL REPLY!" : "")); |
3605 | 3607 | ||
@@ -3758,7 +3760,7 @@ WaitForDoorbellReply(MPT_ADAPTER *ioc, int howlong, int sleepFlag) | |||
3758 | } | 3760 | } |
3759 | 3761 | ||
3760 | dhsprintk((MYIOC_s_INFO_FMT "WaitCnt=%d First handshake reply word=%08x%s\n", | 3762 | dhsprintk((MYIOC_s_INFO_FMT "WaitCnt=%d First handshake reply word=%08x%s\n", |
3761 | ioc->name, t, le32_to_cpu(*(u32 *)hs_reply), | 3763 | ioc->name, t, le32_to_cpu(*(u32 *)hs_reply), |
3762 | failcnt ? " - MISSING DOORBELL HANDSHAKE!" : "")); | 3764 | failcnt ? " - MISSING DOORBELL HANDSHAKE!" : "")); |
3763 | 3765 | ||
3764 | /* | 3766 | /* |
@@ -4133,6 +4135,8 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum) | |||
4133 | ioc->spi_data.minSyncFactor = MPT_ASYNC; | 4135 | ioc->spi_data.minSyncFactor = MPT_ASYNC; |
4134 | ioc->spi_data.busType = MPT_HOST_BUS_UNKNOWN; | 4136 | ioc->spi_data.busType = MPT_HOST_BUS_UNKNOWN; |
4135 | rc = 1; | 4137 | rc = 1; |
4138 | ddvprintk((MYIOC_s_INFO_FMT "Unable to read PortPage0 minSyncFactor=%x\n", | ||
4139 | ioc->name, ioc->spi_data.minSyncFactor)); | ||
4136 | } else { | 4140 | } else { |
4137 | /* Save the Port Page 0 data | 4141 | /* Save the Port Page 0 data |
4138 | */ | 4142 | */ |
@@ -4142,7 +4146,7 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum) | |||
4142 | 4146 | ||
4143 | if ( (pPP0->Capabilities & MPI_SCSIPORTPAGE0_CAP_QAS) == 0 ) { | 4147 | if ( (pPP0->Capabilities & MPI_SCSIPORTPAGE0_CAP_QAS) == 0 ) { |
4144 | ioc->spi_data.noQas |= MPT_TARGET_NO_NEGO_QAS; | 4148 | ioc->spi_data.noQas |= MPT_TARGET_NO_NEGO_QAS; |
4145 | dinitprintk((KERN_INFO MYNAM " :%s noQas due to Capabilities=%x\n", | 4149 | ddvprintk((KERN_INFO MYNAM " :%s noQas due to Capabilities=%x\n", |
4146 | ioc->name, pPP0->Capabilities)); | 4150 | ioc->name, pPP0->Capabilities)); |
4147 | } | 4151 | } |
4148 | ioc->spi_data.maxBusWidth = pPP0->Capabilities & MPI_SCSIPORTPAGE0_CAP_WIDE ? 1 : 0; | 4152 | ioc->spi_data.maxBusWidth = pPP0->Capabilities & MPI_SCSIPORTPAGE0_CAP_WIDE ? 1 : 0; |
@@ -4151,6 +4155,8 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum) | |||
4151 | ioc->spi_data.maxSyncOffset = (u8) (data >> 16); | 4155 | ioc->spi_data.maxSyncOffset = (u8) (data >> 16); |
4152 | data = pPP0->Capabilities & MPI_SCSIPORTPAGE0_CAP_MIN_SYNC_PERIOD_MASK; | 4156 | data = pPP0->Capabilities & MPI_SCSIPORTPAGE0_CAP_MIN_SYNC_PERIOD_MASK; |
4153 | ioc->spi_data.minSyncFactor = (u8) (data >> 8); | 4157 | ioc->spi_data.minSyncFactor = (u8) (data >> 8); |
4158 | ddvprintk((MYIOC_s_INFO_FMT "PortPage0 minSyncFactor=%x\n", | ||
4159 | ioc->name, ioc->spi_data.minSyncFactor)); | ||
4154 | } else { | 4160 | } else { |
4155 | ioc->spi_data.maxSyncOffset = 0; | 4161 | ioc->spi_data.maxSyncOffset = 0; |
4156 | ioc->spi_data.minSyncFactor = MPT_ASYNC; | 4162 | ioc->spi_data.minSyncFactor = MPT_ASYNC; |
@@ -4163,8 +4169,11 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum) | |||
4163 | if ((ioc->spi_data.busType == MPI_SCSIPORTPAGE0_PHY_SIGNAL_HVD) || | 4169 | if ((ioc->spi_data.busType == MPI_SCSIPORTPAGE0_PHY_SIGNAL_HVD) || |
4164 | (ioc->spi_data.busType == MPI_SCSIPORTPAGE0_PHY_SIGNAL_SE)) { | 4170 | (ioc->spi_data.busType == MPI_SCSIPORTPAGE0_PHY_SIGNAL_SE)) { |
4165 | 4171 | ||
4166 | if (ioc->spi_data.minSyncFactor < MPT_ULTRA) | 4172 | if (ioc->spi_data.minSyncFactor < MPT_ULTRA) { |
4167 | ioc->spi_data.minSyncFactor = MPT_ULTRA; | 4173 | ioc->spi_data.minSyncFactor = MPT_ULTRA; |
4174 | ddvprintk((MYIOC_s_INFO_FMT "HVD or SE detected, minSyncFactor=%x\n", | ||
4175 | ioc->name, ioc->spi_data.minSyncFactor)); | ||
4176 | } | ||
4168 | } | 4177 | } |
4169 | } | 4178 | } |
4170 | if (pbuf) { | 4179 | if (pbuf) { |
@@ -4591,13 +4600,13 @@ SendEventNotification(MPT_ADAPTER *ioc, u8 EvSwitch) | |||
4591 | 4600 | ||
4592 | evnp = (EventNotification_t *) mpt_get_msg_frame(mpt_base_index, ioc); | 4601 | evnp = (EventNotification_t *) mpt_get_msg_frame(mpt_base_index, ioc); |
4593 | if (evnp == NULL) { | 4602 | if (evnp == NULL) { |
4594 | dprintk((MYIOC_s_WARN_FMT "Unable to allocate event request frame!\n", | 4603 | devtprintk((MYIOC_s_WARN_FMT "Unable to allocate event request frame!\n", |
4595 | ioc->name)); | 4604 | ioc->name)); |
4596 | return 0; | 4605 | return 0; |
4597 | } | 4606 | } |
4598 | memset(evnp, 0, sizeof(*evnp)); | 4607 | memset(evnp, 0, sizeof(*evnp)); |
4599 | 4608 | ||
4600 | dprintk((MYIOC_s_INFO_FMT "Sending EventNotification(%d)\n", ioc->name, EvSwitch)); | 4609 | devtprintk((MYIOC_s_INFO_FMT "Sending EventNotification (%d) request %p\n", ioc->name, EvSwitch, evnp)); |
4601 | 4610 | ||
4602 | evnp->Function = MPI_FUNCTION_EVENT_NOTIFICATION; | 4611 | evnp->Function = MPI_FUNCTION_EVENT_NOTIFICATION; |
4603 | evnp->ChainOffset = 0; | 4612 | evnp->ChainOffset = 0; |
@@ -4621,8 +4630,10 @@ SendEventAck(MPT_ADAPTER *ioc, EventNotificationReply_t *evnp) | |||
4621 | EventAck_t *pAck; | 4630 | EventAck_t *pAck; |
4622 | 4631 | ||
4623 | if ((pAck = (EventAck_t *) mpt_get_msg_frame(mpt_base_index, ioc)) == NULL) { | 4632 | if ((pAck = (EventAck_t *) mpt_get_msg_frame(mpt_base_index, ioc)) == NULL) { |
4624 | printk(MYIOC_s_WARN_FMT "Unable to allocate event ACK request frame!\n", | 4633 | printk(MYIOC_s_WARN_FMT "Unable to allocate event ACK " |
4625 | ioc->name); | 4634 | "request frame for Event=%x EventContext=%x EventData=%x!\n", |
4635 | ioc->name, evnp->Event, le32_to_cpu(evnp->EventContext), | ||
4636 | le32_to_cpu(evnp->Data[0])); | ||
4626 | return -1; | 4637 | return -1; |
4627 | } | 4638 | } |
4628 | memset(pAck, 0, sizeof(*pAck)); | 4639 | memset(pAck, 0, sizeof(*pAck)); |
@@ -5538,6 +5549,8 @@ ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *pEventReply | |||
5538 | * If needed, send (a single) EventAck. | 5549 | * If needed, send (a single) EventAck. |
5539 | */ | 5550 | */ |
5540 | if (pEventReply->AckRequired == MPI_EVENT_NOTIFICATION_ACK_REQUIRED) { | 5551 | if (pEventReply->AckRequired == MPI_EVENT_NOTIFICATION_ACK_REQUIRED) { |
5552 | devtprintk((MYIOC_s_WARN_FMT | ||
5553 | "EventAck required\n",ioc->name)); | ||
5541 | if ((ii = SendEventAck(ioc, pEventReply)) != 0) { | 5554 | if ((ii = SendEventAck(ioc, pEventReply)) != 0) { |
5542 | devtprintk((MYIOC_s_WARN_FMT "SendEventAck returned %d\n", | 5555 | devtprintk((MYIOC_s_WARN_FMT "SendEventAck returned %d\n", |
5543 | ioc->name, ii)); | 5556 | ioc->name, ii)); |
@@ -5618,7 +5631,7 @@ mpt_sp_log_info(MPT_ADAPTER *ioc, u32 log_info) | |||
5618 | case 0x00080000: | 5631 | case 0x00080000: |
5619 | desc = "Outbound DMA Overrun"; | 5632 | desc = "Outbound DMA Overrun"; |
5620 | break; | 5633 | break; |
5621 | 5634 | ||
5622 | case 0x00090000: | 5635 | case 0x00090000: |
5623 | desc = "Task Management"; | 5636 | desc = "Task Management"; |
5624 | break; | 5637 | break; |
@@ -5634,7 +5647,7 @@ mpt_sp_log_info(MPT_ADAPTER *ioc, u32 log_info) | |||
5634 | case 0x000C0000: | 5647 | case 0x000C0000: |
5635 | desc = "Untagged Table Size"; | 5648 | desc = "Untagged Table Size"; |
5636 | break; | 5649 | break; |
5637 | 5650 | ||
5638 | } | 5651 | } |
5639 | 5652 | ||
5640 | printk(MYIOC_s_INFO_FMT "LogInfo(0x%08x): F/W: %s\n", ioc->name, log_info, desc); | 5653 | printk(MYIOC_s_INFO_FMT "LogInfo(0x%08x): F/W: %s\n", ioc->name, log_info, desc); |
@@ -5726,7 +5739,7 @@ mpt_sp_ioc_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf) | |||
5726 | break; | 5739 | break; |
5727 | 5740 | ||
5728 | case MPI_IOCSTATUS_SCSI_DATA_UNDERRUN: /* 0x0045 */ | 5741 | case MPI_IOCSTATUS_SCSI_DATA_UNDERRUN: /* 0x0045 */ |
5729 | /* This error is checked in scsi_io_done(). Skip. | 5742 | /* This error is checked in scsi_io_done(). Skip. |
5730 | desc = "SCSI Data Underrun"; | 5743 | desc = "SCSI Data Underrun"; |
5731 | */ | 5744 | */ |
5732 | break; | 5745 | break; |