49 #include <linux/kernel.h>
50 #include <linux/module.h>
51 #include <linux/errno.h>
54 #include <linux/slab.h>
55 #include <linux/types.h>
56 #include <linux/pci.h>
57 #include <linux/kdev_t.h>
73 #define my_NAME "Fusion MPT base driver"
74 #define my_VERSION MPT_LINUX_VERSION_COMMON
75 #define MYNAM "mptbase"
86 static int mpt_msi_enable_spi;
89 " Enable MSI Support for SPI controllers (default=0)");
91 static int mpt_msi_enable_fc;
94 " Enable MSI Support for FC controllers (default=0)");
96 static int mpt_msi_enable_sas;
99 " Enable MSI Support for SAS controllers (default=0)");
101 static int mpt_channel_mapping;
103 MODULE_PARM_DESC(mpt_channel_mapping,
" Mapping id's to channels (default=0)");
105 static int mpt_debug_level;
106 static int mpt_set_debug_level(
const char *
val,
struct kernel_param *kp);
108 &mpt_debug_level, 0600);
110 " debug level - refer to mptdebug.h - (default=0)");
116 "Enable detection of Firmware fault and halt Firmware on fault - (default=0)");
122 static int mfcounter = 0;
123 #define PRINT_MF_COUNT 20000
131 #define WHOINIT_UNKNOWN 0xAA
149 #ifdef CONFIG_PROC_FS
157 static u8 last_drv_idx;
163 static irqreturn_t mpt_interrupt(
int irq,
void *bus_id);
164 static int mptbase_reply(MPT_ADAPTER *
ioc, MPT_FRAME_HDR *
req,
165 MPT_FRAME_HDR *reply);
166 static int mpt_handshake_req_reply_wait(MPT_ADAPTER *
ioc,
int reqBytes,
167 u32 *
req,
int replyBytes,
u16 *u16reply,
int maxwait,
169 static int mpt_do_ioc_recovery(MPT_ADAPTER *
ioc,
u32 reason,
int sleepFlag);
170 static void mpt_detect_bound_ports(MPT_ADAPTER *
ioc,
struct pci_dev *pdev);
171 static void mpt_adapter_disable(MPT_ADAPTER *
ioc);
172 static void mpt_adapter_dispose(MPT_ADAPTER *
ioc);
174 static void MptDisplayIocCapabilities(MPT_ADAPTER *
ioc);
175 static int MakeIocReady(MPT_ADAPTER *
ioc,
int force,
int sleepFlag);
176 static int GetIocFacts(MPT_ADAPTER *
ioc,
int sleepFlag,
int reason);
177 static int GetPortFacts(MPT_ADAPTER *
ioc,
int portnum,
int sleepFlag);
178 static int SendIocInit(MPT_ADAPTER *
ioc,
int sleepFlag);
179 static int SendPortEnable(MPT_ADAPTER *
ioc,
int portnum,
int sleepFlag);
180 static int mpt_do_upload(MPT_ADAPTER *
ioc,
int sleepFlag);
181 static int mpt_downloadboot(MPT_ADAPTER *
ioc,
MpiFwHeader_t *pFwHeader,
int sleepFlag);
182 static int mpt_diag_reset(MPT_ADAPTER *
ioc,
int ignore,
int sleepFlag);
183 static int KickStart(MPT_ADAPTER *
ioc,
int ignore,
int sleepFlag);
184 static int SendIocReset(MPT_ADAPTER *
ioc,
u8 reset_type,
int sleepFlag);
185 static int PrimeIocFifos(MPT_ADAPTER *
ioc);
186 static int WaitForDoorbellAck(MPT_ADAPTER *
ioc,
int howlong,
int sleepFlag);
187 static int WaitForDoorbellInt(MPT_ADAPTER *
ioc,
int howlong,
int sleepFlag);
188 static int WaitForDoorbellReply(MPT_ADAPTER *
ioc,
int howlong,
int sleepFlag);
189 static int GetLanConfigPages(MPT_ADAPTER *
ioc);
190 static int GetIoUnitPage2(MPT_ADAPTER *
ioc);
192 static int mpt_GetScsiPortSettings(MPT_ADAPTER *
ioc,
int portnum);
193 static int mpt_readScsiDevicePageHeaders(MPT_ADAPTER *
ioc,
int portnum);
194 static void mpt_read_ioc_pg_1(MPT_ADAPTER *
ioc);
195 static void mpt_read_ioc_pg_4(MPT_ADAPTER *
ioc);
196 static void mpt_get_manufacturing_pg_0(MPT_ADAPTER *
ioc);
197 static int SendEventNotification(MPT_ADAPTER *
ioc,
u8 EvSwitch,
200 static int mpt_host_page_access_control(MPT_ADAPTER *
ioc,
u8 access_control_value,
int sleepFlag);
201 static int mpt_host_page_alloc(MPT_ADAPTER *
ioc,
pIOCInit_t ioc_init);
203 #ifdef CONFIG_PROC_FS
208 static void mpt_get_fw_exp_ver(
char *
buf, MPT_ADAPTER *
ioc);
210 static int ProcessEventNotification(MPT_ADAPTER *
ioc,
212 static void mpt_iocstatus_info(MPT_ADAPTER *
ioc,
u32 ioc_status, MPT_FRAME_HDR *mf);
213 static void mpt_fc_log_info(MPT_ADAPTER *
ioc,
u32 log_info);
214 static void mpt_spi_log_info(MPT_ADAPTER *
ioc,
u32 log_info);
215 static void mpt_sas_log_info(MPT_ADAPTER *
ioc,
u32 log_info ,
u8 cb_idx);
216 static int mpt_read_ioc_pg_3(MPT_ADAPTER *
ioc);
217 static void mpt_inactive_raid_list_free(MPT_ADAPTER *
ioc);
220 static int __init fusion_init (
void);
221 static void __exit fusion_exit (
void);
223 #define CHIPREG_READ32(addr) readl_relaxed(addr)
224 #define CHIPREG_READ32_dmasync(addr) readl(addr)
225 #define CHIPREG_WRITE32(addr,val) writel(val, addr)
226 #define CHIPREG_PIO_WRITE32(addr,val) outl(val, (unsigned long)addr)
227 #define CHIPREG_PIO_READ32(addr) inl((unsigned long)addr)
230 pci_disable_io_access(
struct pci_dev *pdev)
234 pci_read_config_word(pdev,
PCI_COMMAND, &command_reg);
236 pci_write_config_word(pdev,
PCI_COMMAND, command_reg);
240 pci_enable_io_access(
struct pci_dev *pdev)
244 pci_read_config_word(pdev,
PCI_COMMAND, &command_reg);
246 pci_write_config_word(pdev,
PCI_COMMAND, command_reg);
249 static int mpt_set_debug_level(
const char *
val,
struct kernel_param *kp)
258 ioc->debug_level = mpt_debug_level;
269 mpt_get_cb_idx(MPT_DRIVER_CLASS dclass)
274 if (MptDriverClass[cb_idx] == dclass)
286 mpt_is_discovery_complete(MPT_ADAPTER *ioc)
295 memset(&cfg, 0,
sizeof(CONFIGPARMS));
299 cfg.cfghdr.ehdr = &
hdr;
316 goto out_free_consistent;
337 static int mpt_remove_dead_ioc_func(
void *
arg)
339 MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg;
371 if (ioc->ioc_reset_in_progress || !ioc->active)
377 printk(MYIOC_s_INFO_FMT
"%s: IOC is non-operational !!!!\n",
378 ioc->name, __func__);
387 hd = shost_priv(ioc->sh);
388 ioc->schedule_dead_ioc_flush_running_cmds(hd);
392 "mpt_dead_ioc_%d", ioc->id);
395 "%s: Running mpt_dead_ioc thread failed !\n",
396 ioc->name, __func__);
399 "%s: Running mpt_dead_ioc thread success !\n",
400 ioc->name, __func__);
405 if ((ioc_raw_state & MPI_IOC_STATE_MASK)
407 printk(MYIOC_s_WARN_FMT
"IOC is in FAULT state (%04xh)!!!\n",
409 printk(MYIOC_s_WARN_FMT
"Issuing HardReset from %s!!\n",
410 ioc->name, __func__);
412 printk(MYIOC_s_WARN_FMT
"%s: HardReset: %s\n", ioc->name,
413 __func__, (rc == 0) ?
"success" :
"failed");
416 printk(MYIOC_s_WARN_FMT
"IOC is in FAULT state after "
417 "reset (%04xh)\n", ioc->name, ioc_raw_state &
419 }
else if (ioc->bus_type ==
SAS && ioc->sas_discovery_quiesce_io) {
420 if ((mpt_is_discovery_complete(ioc))) {
422 "discovery_quiesce_io flag\n", ioc->name));
423 ioc->sas_discovery_quiesce_io = 0;
436 if (ioc->reset_work_q)
439 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
447 mpt_turbo_reply(MPT_ADAPTER *ioc,
u32 pa)
449 MPT_FRAME_HDR *mf =
NULL;
450 MPT_FRAME_HDR *mr =
NULL;
454 dmfprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"Got TURBO reply req_idx=%08x\n",
459 req_idx = pa & 0x0000FFFF;
460 cb_idx = (pa & 0x00FF0000) >> 16;
461 mf = MPT_INDEX_2_MFPTR(ioc, req_idx);
464 cb_idx = mpt_get_cb_idx(MPTLAN_DRIVER);
474 if ((pa & 0x58000000) == 0x58000000) {
475 req_idx = pa & 0x0000FFFF;
476 mf = MPT_INDEX_2_MFPTR(ioc, req_idx);
485 cb_idx = mpt_get_cb_idx(MPTSTM_DRIVER);
495 MptCallbacks[cb_idx] ==
NULL) {
496 printk(MYIOC_s_WARN_FMT
"%s: Invalid cb_idx (%d)!\n",
497 __func__, ioc->name, cb_idx);
501 if (MptCallbacks[cb_idx](ioc, mf, mr))
508 mpt_reply(MPT_ADAPTER *ioc,
u32 pa)
529 reply_dma_low = (pa <<= 1);
530 mr = (MPT_FRAME_HDR *)((
u8 *)ioc->reply_frames +
531 (reply_dma_low - ioc->reply_frames_low_dma));
533 req_idx =
le16_to_cpu(mr->u.frame.hwhdr.msgctxu.fld.req_idx);
534 cb_idx = mr->u.frame.hwhdr.msgctxu.fld.cb_idx;
535 mf = MPT_INDEX_2_MFPTR(ioc, req_idx);
537 dmfprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"Got non-TURBO reply=%p req_idx=%x cb_idx=%x Function=%x\n",
538 ioc->name, mr, req_idx, cb_idx, mr->u.hdr.Function));
546 if (ioc->bus_type ==
FC)
547 mpt_fc_log_info(ioc, log_info);
548 else if (ioc->bus_type ==
SPI)
549 mpt_spi_log_info(ioc, log_info);
550 else if (ioc->bus_type ==
SAS)
551 mpt_sas_log_info(ioc, log_info, cb_idx);
555 mpt_iocstatus_info(ioc, (
u32)ioc_stat, mf);
559 MptCallbacks[cb_idx] ==
NULL) {
560 printk(MYIOC_s_WARN_FMT
"%s: Invalid cb_idx (%d)!\n",
561 __func__, ioc->name, cb_idx);
566 freeme = MptCallbacks[cb_idx](ioc, mf, mr);
595 mpt_interrupt(
int irq,
void *bus_id)
597 MPT_ADAPTER *ioc = bus_id;
600 if (pa == 0xFFFFFFFF)
610 mpt_turbo_reply(ioc, pa);
612 }
while (pa != 0xFFFFFFFF);
632 mptbase_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *
req, MPT_FRAME_HDR *reply)
639 switch (reply->u.hdr.Function) {
643 ProcessEventNotification(ioc, pEventReply, &evHandlers);
651 ioc->mptbase_cmds.status |= MPT_MGMT_STATUS_COMMAND_GOOD;
653 ioc->mptbase_cmds.status |= MPT_MGMT_STATUS_RF_VALID;
654 memcpy(ioc->mptbase_cmds.reply, reply,
656 4 * reply->u.reply.MsgLength));
658 if (ioc->mptbase_cmds.status & MPT_MGMT_STATUS_PENDING) {
659 ioc->mptbase_cmds.status &= ~MPT_MGMT_STATUS_PENDING;
663 if (ioc->mptbase_cmds.status & MPT_MGMT_STATUS_FREE_MF)
668 "EventAck reply received\n", ioc->name));
672 "Unexpected msg function (=%02Xh) reply received!\n",
673 ioc->name, reply->u.hdr.Function);
716 if (MptCallbacks[cb_idx] ==
NULL) {
717 MptCallbacks[cb_idx] = cbfunc;
718 MptDriverClass[cb_idx] = dclass;
719 MptEvHandlers[cb_idx] =
NULL;
720 last_drv_idx = cb_idx;
721 strlcpy(MptCallbacksName[cb_idx], func_name,
742 MptCallbacks[cb_idx] =
NULL;
743 MptDriverClass[cb_idx] = MPTUNKNOWN_DRIVER;
744 MptEvHandlers[cb_idx] =
NULL;
767 MptEvHandlers[cb_idx] = ev_cbfunc;
786 MptEvHandlers[cb_idx] =
NULL;
806 MptResetHandlers[cb_idx] = reset_func;
825 MptResetHandlers[cb_idx] =
NULL;
843 MptDeviceDriverHandlers[cb_idx] = dd_cbfunc;
847 id = ioc->pcidev->driver ?
848 ioc->pcidev->driver->id_table :
NULL;
849 if (dd_cbfunc->probe)
850 dd_cbfunc->probe(ioc->pcidev,
id);
864 struct mpt_pci_driver *dd_cbfunc;
870 dd_cbfunc = MptDeviceDriverHandlers[cb_idx];
873 if (dd_cbfunc->remove)
874 dd_cbfunc->remove(ioc->pcidev);
877 MptDeviceDriverHandlers[cb_idx] =
NULL;
904 printk(MYIOC_s_WARN_FMT
"IOC Not Active! mpt_get_msg_frame "
905 "returning NULL!\n", ioc->name);
913 if (!list_empty(&ioc->FreeQ)) {
916 mf =
list_entry(ioc->FreeQ.next, MPT_FRAME_HDR,
917 u.frame.linkage.list);
918 list_del(&mf->u.frame.linkage.list);
919 mf->u.frame.linkage.arg1 = 0;
920 mf->u.frame.hwhdr.msgctxu.fld.cb_idx = cb_idx;
921 req_offset = (
u8 *)mf - (
u8 *)ioc->req_frames;
923 req_idx = req_offset / ioc->req_sz;
924 mf->u.frame.hwhdr.msgctxu.fld.req_idx =
cpu_to_le16(req_idx);
925 mf->u.frame.hwhdr.msgctxu.fld.rsvd = 0;
927 ioc->RequestNB[req_idx] = ioc->NB_for_64_byte_frame;
934 spin_unlock_irqrestore(&ioc->FreeQlock, flags);
938 printk(MYIOC_s_WARN_FMT
"IOC Active. No free Msg Frames! "
939 "Count 0x%x Max 0x%x\n", ioc->name, ioc->mfcnt,
942 if (mfcounter == PRINT_MF_COUNT)
943 printk(MYIOC_s_INFO_FMT
"MF Count 0x%x Max 0x%x \n", ioc->name,
944 ioc->mfcnt, ioc->req_depth);
947 dmfprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"mpt_get_msg_frame(%d,%d), got mf=%p\n",
948 ioc->name, cb_idx, ioc->id, mf));
970 mf->u.frame.hwhdr.msgctxu.fld.cb_idx = cb_idx;
971 req_offset = (
u8 *)mf - (
u8 *)ioc->req_frames;
973 req_idx = req_offset / ioc->req_sz;
974 mf->u.frame.hwhdr.msgctxu.fld.req_idx =
cpu_to_le16(req_idx);
975 mf->u.frame.hwhdr.msgctxu.fld.rsvd = 0;
979 mf_dma_addr = (ioc->req_frames_low_dma + req_offset) | ioc->RequestNB[req_idx];
981 "RequestNB=%x\n", ioc->name, mf_dma_addr, req_idx,
982 ioc->RequestNB[req_idx]));
1006 mf->u.frame.hwhdr.msgctxu.fld.cb_idx = cb_idx;
1007 req_offset = (
u8 *)mf - (
u8 *)ioc->req_frames;
1008 req_idx = req_offset / ioc->req_sz;
1009 mf->u.frame.hwhdr.msgctxu.fld.req_idx =
cpu_to_le16(req_idx);
1010 mf->u.frame.hwhdr.msgctxu.fld.rsvd = 0;
1014 mf_dma_addr = (ioc->req_frames_low_dma + req_offset);
1015 dsgprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"mf_dma_addr=%x req_idx=%d\n",
1016 ioc->name, mf_dma_addr, req_idx));
1032 unsigned long flags;
1036 if (
cpu_to_le32(mf->u.frame.linkage.arg1) == 0xdeadbeaf)
1039 mf->u.frame.linkage.arg1 =
cpu_to_le32(0xdeadbeaf);
1045 spin_unlock_irqrestore(&ioc->FreeQlock, flags);
1084 ((flagslength | MPT_SGE_FLAGS_64_BIT_ADDRESSING));
1097 mpt_add_sge_64bit_1078(
void *pAddr,
u32 flagslength,
dma_addr_t dma_addr)
1115 "addr = 0x%llx len = %d\n",
1116 (
unsigned long long)dma_addr,
1122 (flagslength | MPT_SGE_FLAGS_64_BIT_ADDRESSING));
1157 u32 tmp = dma_addr & 0xFFFFFFFF;
1204 ii = MFPTR_2_MPT_INDEX(ioc,(MPT_FRAME_HDR*)req);
1205 if (reqBytes >= 12 && ii >= 0 && ii < ioc->req_depth) {
1206 MPT_FRAME_HDR *mf = (MPT_FRAME_HDR*)req;
1207 mf->u.frame.hwhdr.msgctxu.fld.req_idx =
cpu_to_le16(ii);
1208 mf->u.frame.hwhdr.msgctxu.fld.cb_idx = cb_idx;
1219 if ((ii = WaitForDoorbellInt(ioc, 5, sleepFlag)) < 0) {
1227 dhsprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"mpt_send_handshake_request start, WaitCnt=%d\n",
1232 if ((r = WaitForDoorbellAck(ioc, 5, sleepFlag)) < 0) {
1237 req_as_bytes = (
u8 *) req;
1238 for (ii = 0; ii < reqBytes/4; ii++) {
1241 word = ((req_as_bytes[(ii*4) + 0] << 0) |
1242 (req_as_bytes[(ii*4) + 1] << 8) |
1243 (req_as_bytes[(ii*4) + 2] << 16) |
1244 (req_as_bytes[(ii*4) + 3] << 24));
1246 if ((r = WaitForDoorbellAck(ioc, 5, sleepFlag)) < 0) {
1252 if (r >= 0 && WaitForDoorbellInt(ioc, 10, sleepFlag) >= 0)
1283 mpt_host_page_access_control(MPT_ADAPTER *ioc,
u8 access_control_value,
int sleepFlag)
1297 (access_control_value<<12)));
1300 if ((r = WaitForDoorbellAck(ioc, 5, sleepFlag)) < 0) {
1316 mpt_host_page_alloc(MPT_ADAPTER *ioc,
pIOCInit_t ioc_init)
1320 u32 host_page_buffer_sz=0;
1322 if(!ioc->HostPageBuffer) {
1324 host_page_buffer_sz =
1325 le32_to_cpu(ioc->facts.HostPageBufferSGE.FlagsLength) & 0xFFFFFF;
1327 if(!host_page_buffer_sz)
1331 while(host_page_buffer_sz > 0) {
1335 host_page_buffer_sz,
1336 &ioc->HostPageBuffer_dma)) !=
NULL) {
1339 "host_page_buffer @ %p, dma @ %x, sz=%d bytes\n",
1340 ioc->name, ioc->HostPageBuffer,
1341 (
u32)ioc->HostPageBuffer_dma,
1342 host_page_buffer_sz));
1343 ioc->alloc_total += host_page_buffer_sz;
1344 ioc->HostPageBuffer_sz = host_page_buffer_sz;
1348 host_page_buffer_sz -= (4*1024);
1352 if(!ioc->HostPageBuffer) {
1354 "Failed to alloc memory for host_page_buffer!\n",
1365 flags_length |= ioc->HostPageBuffer_sz;
1366 ioc->add_sge(psge, flags_length, ioc->HostPageBuffer_dma);
1390 if (ioc->id == iocid) {
1414 char *product_str =
NULL;
1423 product_str =
"BRE040 A0";
1426 product_str =
"BRE040 A1";
1429 product_str =
"BRE040";
1440 product_str =
"LSIFC909 B1";
1443 product_str =
"LSIFC919 B0";
1446 product_str =
"LSIFC929 B0";
1449 if (revision < 0x80)
1450 product_str =
"LSIFC919X A0";
1452 product_str =
"LSIFC919XL A1";
1455 if (revision < 0x80)
1456 product_str =
"LSIFC929X A0";
1458 product_str =
"LSIFC929XL A1";
1461 product_str =
"LSIFC939X A1";
1464 product_str =
"LSIFC949X A1";
1470 product_str =
"LSIFC949E A0";
1473 product_str =
"LSIFC949E A1";
1476 product_str =
"LSIFC949E";
1484 product_str =
"LSI53C1030 A0";
1487 product_str =
"LSI53C1030 B0";
1490 product_str =
"LSI53C1030 B1";
1493 product_str =
"LSI53C1030 B2";
1496 product_str =
"LSI53C1030 C0";
1499 product_str =
"LSI53C1030T A0";
1502 product_str =
"LSI53C1030T A2";
1505 product_str =
"LSI53C1030T A3";
1508 product_str =
"LSI53C1020A A1";
1511 product_str =
"LSI53C1030";
1519 product_str =
"LSI53C1035 A2";
1522 product_str =
"LSI53C1035 B0";
1525 product_str =
"LSI53C1035";
1533 product_str =
"LSISAS1064 A1";
1536 product_str =
"LSISAS1064 A2";
1539 product_str =
"LSISAS1064 A3";
1542 product_str =
"LSISAS1064 A4";
1545 product_str =
"LSISAS1064";
1553 product_str =
"LSISAS1064E A0";
1556 product_str =
"LSISAS1064E B0";
1559 product_str =
"LSISAS1064E B1";
1562 product_str =
"LSISAS1064E B2";
1565 product_str =
"LSISAS1064E B3";
1568 product_str =
"LSISAS1064E";
1576 product_str =
"LSISAS1068 A0";
1579 product_str =
"LSISAS1068 B0";
1582 product_str =
"LSISAS1068 B1";
1585 product_str =
"LSISAS1068";
1593 product_str =
"LSISAS1068E A0";
1596 product_str =
"LSISAS1068E B0";
1599 product_str =
"LSISAS1068E B1";
1602 product_str =
"LSISAS1068E B2";
1605 product_str =
"LSISAS1068E B3";
1608 product_str =
"LSISAS1068E";
1616 product_str =
"LSISAS1078 A0";
1619 product_str =
"LSISAS1078 B0";
1622 product_str =
"LSISAS1078 C0";
1625 product_str =
"LSISAS1078 C1";
1628 product_str =
"LSISAS1078 C2";
1631 product_str =
"LSISAS1078";
1639 sprintf(prod_name,
"%s", product_str);
1648 mpt_mapresources(MPT_ADAPTER *ioc)
1662 printk(MYIOC_s_ERR_FMT
"pci_enable_device_mem() "
1663 "failed\n", ioc->name);
1667 printk(MYIOC_s_ERR_FMT
"pci_request_selected_regions() with "
1668 "MEM failed\n", ioc->name);
1669 goto out_pci_disable_device;
1677 && !pci_set_consistent_dma_mask(pdev,
1681 ": 64 BIT PCI BUS DMA ADDRESSING SUPPORTED\n",
1684 && !pci_set_consistent_dma_mask(pdev,
1688 ": 32 BIT PCI BUS DMA ADDRESSING SUPPORTED\n",
1691 printk(MYIOC_s_WARN_FMT
"no suitable DMA mask for %s\n",
1692 ioc->name, pci_name(pdev));
1693 goto out_pci_release_region;
1697 && !pci_set_consistent_dma_mask(pdev,
1701 ": 32 BIT PCI BUS DMA ADDRESSING SUPPORTED\n",
1704 printk(MYIOC_s_WARN_FMT
"no suitable DMA mask for %s\n",
1705 ioc->name, pci_name(pdev));
1706 goto out_pci_release_region;
1710 mem_phys = msize = 0;
1727 ioc->mem_size = msize;
1732 mem =
ioremap(mem_phys, msize);
1734 printk(MYIOC_s_ERR_FMT
": ERROR - Unable to map adapter"
1735 " memory!\n", ioc->name);
1737 goto out_pci_release_region;
1741 ioc->name, mem, (
unsigned long long)mem_phys));
1743 ioc->mem_phys = mem_phys;
1744 ioc->chip = (SYSIF_REGS
__iomem *)mem;
1747 ioc->pio_mem_phys =
port;
1748 ioc->pio_chip = (SYSIF_REGS
__iomem *)port;
1752 out_pci_release_region:
1754 out_pci_disable_device:
1784 static int mpt_ids = 0;
1785 #ifdef CONFIG_PROC_FS
1789 ioc = kzalloc(
sizeof(MPT_ADAPTER),
GFP_ATOMIC);
1795 ioc->id = mpt_ids++;
1796 sprintf(ioc->name,
"ioc%d", ioc->id);
1804 ioc->debug_level = mpt_debug_level;
1805 if (mpt_debug_level)
1808 dinitprintk(ioc,
printk(MYIOC_s_INFO_FMT
": mpt_adapter_install\n", ioc->name));
1811 if (mpt_mapresources(ioc)) {
1821 ioc->add_sge = &mpt_add_sge_64bit_1078;
1823 ioc->add_sge = &mpt_add_sge_64bit;
1824 ioc->add_chain = &mpt_add_chain_64bit;
1825 ioc->sg_addr_size = 8;
1827 ioc->add_sge = &mpt_add_sge;
1828 ioc->add_chain = &mpt_add_chain;
1829 ioc->sg_addr_size = 4;
1831 ioc->SGE_size =
sizeof(
u32) + ioc->sg_addr_size;
1833 ioc->alloc_total =
sizeof(MPT_ADAPTER);
1840 init_completion(&ioc->internal_cmds.done);
1842 init_completion(&ioc->mptbase_cmds.done);
1844 init_completion(&ioc->taskmgmt_cmds.done);
1848 ioc->eventTypes = 0;
1849 ioc->eventContext = 0;
1850 ioc->eventLogSize = 0;
1858 ioc->cached_fw =
NULL;
1862 memset(&ioc->spi_data, 0,
sizeof(SpiCfgData));
1866 INIT_LIST_HEAD(&ioc->fc_rports);
1869 INIT_LIST_HEAD(&ioc->list);
1876 "mpt_poll_%d", ioc->id);
1879 if (!ioc->reset_work_q) {
1880 printk(MYIOC_s_ERR_FMT
"Insufficient memory to add adapter!\n",
1888 ioc->name, &ioc->facts, &ioc->pfacts[0]));
1897 ioc->errata_flag_1064 = 1;
1910 pci_read_config_byte(pdev, 0x6a, &pcixcmd);
1912 pci_write_config_byte(pdev, 0x6a, pcixcmd);
1916 pci_read_config_byte(pdev, 0x6a, &pcixcmd);
1918 pci_write_config_byte(pdev, 0x6a, pcixcmd);
1927 pci_read_config_byte(pdev, 0x6a, &pcixcmd);
1929 pci_write_config_byte(pdev, 0x6a, pcixcmd);
1938 pci_read_config_byte(pdev, 0x6a, &pcixcmd);
1940 pci_write_config_byte(pdev, 0x6a, pcixcmd);
1944 ioc->bus_type =
SPI;
1949 ioc->errata_flag_1064 = 1;
1950 ioc->bus_type =
SAS;
1956 ioc->bus_type =
SAS;
1961 switch (ioc->bus_type) {
1964 ioc->msi_enable = mpt_msi_enable_sas;
1968 ioc->msi_enable = mpt_msi_enable_spi;
1972 ioc->msi_enable = mpt_msi_enable_fc;
1976 ioc->msi_enable = 0;
1980 ioc->fw_events_off = 1;
1982 if (ioc->errata_flag_1064)
1983 pci_disable_io_access(pdev);
1993 pci_set_drvdata(ioc->pcidev, ioc);
2000 mpt_detect_bound_ports(ioc, pdev);
2002 INIT_LIST_HEAD(&ioc->fw_event_list);
2007 if ((r = mpt_do_ioc_recovery(ioc, MPT_HOSTEVENT_IOC_BRINGUP,
2009 printk(MYIOC_s_ERR_FMT
"didn't initialize properly! (%d)\n",
2014 ioc->alt_ioc->alt_ioc =
NULL;
2020 ioc->reset_work_q =
NULL;
2023 pci_set_drvdata(pdev,
NULL);
2029 if(MptDeviceDriverHandlers[cb_idx] &&
2030 MptDeviceDriverHandlers[cb_idx]->probe) {
2031 MptDeviceDriverHandlers[cb_idx]->probe(pdev,
id);
2035 #ifdef CONFIG_PROC_FS
2039 dent =
proc_mkdir(ioc->name, mpt_proc_root_dir);
2062 MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
2065 unsigned long flags;
2072 wq = ioc->reset_work_q;
2073 ioc->reset_work_q =
NULL;
2074 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
2079 wq = ioc->fw_event_q;
2080 ioc->fw_event_q =
NULL;
2081 spin_unlock_irqrestore(&ioc->fw_event_lock, flags);
2093 if(MptDeviceDriverHandlers[cb_idx] &&
2094 MptDeviceDriverHandlers[cb_idx]->
remove) {
2095 MptDeviceDriverHandlers[cb_idx]->remove(pdev);
2110 mpt_adapter_dispose(ioc);
2128 MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
2131 printk(MYIOC_s_INFO_FMT
"pci-suspend: pdev=0x%p, slot=%s, Entering "
2132 "operating state [D%d]\n", ioc->name, pdev, pci_name(pdev),
2138 "pci-suspend: IOC msg unit reset failed!\n", ioc->name);
2149 if (ioc->msi_enable)
2165 mpt_resume(
struct pci_dev *pdev)
2167 MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
2172 printk(MYIOC_s_INFO_FMT
"pci-resume: pdev=0x%p, slot=%s, Previous "
2173 "operating state [D%d]\n", ioc->name, pdev, pci_name(pdev),
2177 pci_enable_wake(pdev,
PCI_D0, 0);
2180 err = mpt_mapresources(ioc);
2186 ioc->add_sge = &mpt_add_sge_64bit_1078;
2188 ioc->add_sge = &mpt_add_sge_64bit;
2189 ioc->add_chain = &mpt_add_chain_64bit;
2190 ioc->sg_addr_size = 8;
2193 ioc->add_sge = &mpt_add_sge;
2194 ioc->add_chain = &mpt_add_chain;
2195 ioc->sg_addr_size = 4;
2197 ioc->SGE_size =
sizeof(
u32) + ioc->sg_addr_size;
2199 printk(MYIOC_s_INFO_FMT
"pci-resume: ioc-state=0x%x,doorbell=0x%x\n",
2210 if (ioc->bus_type ==
SAS && (pdev->
device ==
2214 printk(MYIOC_s_WARN_FMT
"pci-resume: Cannot recover\n",
2221 printk(MYIOC_s_INFO_FMT
"Sending mpt_do_ioc_recovery\n", ioc->name);
2222 recovery_state = mpt_do_ioc_recovery(ioc, MPT_HOSTEVENT_IOC_BRINGUP,
2224 if (recovery_state != 0)
2225 printk(MYIOC_s_WARN_FMT
"pci-resume: Cannot recover, "
2226 "error:[%x]\n", ioc->name, recovery_state);
2229 "pci-resume: success\n", ioc->name);
2237 mpt_signal_reset(
u8 index, MPT_ADAPTER *ioc,
int reset_phase)
2239 if ((MptDriverClass[index] == MPTSPI_DRIVER &&
2240 ioc->bus_type !=
SPI) ||
2241 (MptDriverClass[index] == MPTFC_DRIVER &&
2242 ioc->bus_type !=
FC) ||
2243 (MptDriverClass[index] == MPTSAS_DRIVER &&
2244 ioc->bus_type !=
SAS))
2248 return (MptResetHandlers[index])(ioc, reset_phase);
2274 mpt_do_ioc_recovery(MPT_ADAPTER *ioc,
u32 reason,
int sleepFlag)
2276 int hard_reset_done = 0;
2277 int alt_ioc_ready = 0;
2282 int reset_alt_ioc_active = 0;
2283 int irq_allocated = 0;
2286 printk(MYIOC_s_INFO_FMT
"Initiating %s\n", ioc->name,
2287 reason == MPT_HOSTEVENT_IOC_BRINGUP ?
"bringup" :
"recovery");
2294 if (ioc->alt_ioc->active ||
2295 reason == MPT_HOSTEVENT_IOC_RECOVER) {
2296 reset_alt_ioc_active = 1;
2302 ioc->alt_ioc->active = 0;
2307 if (reason == MPT_HOSTEVENT_IOC_BRINGUP)
2310 if ((hard_reset_done = MakeIocReady(ioc, hard, sleepFlag)) < 0) {
2311 if (hard_reset_done == -4) {
2312 printk(MYIOC_s_WARN_FMT
"Owned by PEER..skipping!\n",
2315 if (reset_alt_ioc_active && ioc->alt_ioc) {
2318 "alt_ioc reply irq re-enabled\n", ioc->alt_ioc->name));
2320 ioc->alt_ioc->active = 1;
2325 "NOT READY WARNING!\n", ioc->name);
2334 if (hard_reset_done && reset_alt_ioc_active && ioc->alt_ioc) {
2335 if ((rc = MakeIocReady(ioc->alt_ioc, 0, sleepFlag)) == 0)
2339 ": alt-ioc Not ready WARNING!\n",
2340 ioc->alt_ioc->name);
2343 for (ii=0; ii<5; ii++) {
2345 if ((rc = GetIocFacts(ioc, sleepFlag, reason)) == 0)
2352 "Retry IocFacts failed rc=%x\n", ioc->name, rc));
2354 }
else if (reason == MPT_HOSTEVENT_IOC_BRINGUP) {
2355 MptDisplayIocCapabilities(ioc);
2358 if (alt_ioc_ready) {
2359 if ((rc = GetIocFacts(ioc->alt_ioc, sleepFlag, reason)) != 0) {
2361 "Initial Alt IocFacts failed rc=%x\n",
2365 rc = GetIocFacts(ioc->alt_ioc, sleepFlag, reason);
2369 "Retry Alt IocFacts failed rc=%x\n", ioc->name, rc));
2371 reset_alt_ioc_active = 0;
2372 }
else if (reason == MPT_HOSTEVENT_IOC_BRINGUP) {
2373 MptDisplayIocCapabilities(ioc->alt_ioc);
2377 if ((ret == 0) && (reason == MPT_HOSTEVENT_IOC_BRINGUP) &&
2394 if ((ret == 0) && (reason == MPT_HOSTEVENT_IOC_BRINGUP)) {
2396 if (ioc->pcidev->irq) {
2397 if (ioc->msi_enable && !pci_enable_msi(ioc->pcidev))
2398 printk(MYIOC_s_INFO_FMT
"PCI-MSI enabled\n",
2401 ioc->msi_enable = 0;
2405 printk(MYIOC_s_ERR_FMT
"Unable to allocate "
2407 ioc->name, ioc->pcidev->irq);
2408 if (ioc->msi_enable)
2414 ioc->pci_irq = ioc->pcidev->irq;
2416 pci_set_drvdata(ioc->pcidev, ioc);
2418 "installed at interrupt %d\n", ioc->name,
2430 if ((ret == 0) && ((rc = PrimeIocFifos(ioc)) != 0))
2438 if ((ret == 0) && ((rc = SendIocInit(ioc, sleepFlag)) != 0))
2441 if (alt_ioc_ready && ((rc = PrimeIocFifos(ioc->alt_ioc)) != 0)) {
2443 ": alt-ioc (%d) FIFO mgmt alloc WARNING!\n",
2444 ioc->alt_ioc->name, rc);
2446 reset_alt_ioc_active = 0;
2449 if (alt_ioc_ready) {
2450 if ((rc = SendIocInit(ioc->alt_ioc, sleepFlag)) != 0) {
2452 reset_alt_ioc_active = 0;
2454 ": alt-ioc: (%d) init failure WARNING!\n",
2455 ioc->alt_ioc->name, rc);
2459 if (reason == MPT_HOSTEVENT_IOC_BRINGUP){
2460 if (ioc->upload_fw) {
2462 "firmware upload required!\n", ioc->name));
2467 rc = mpt_do_upload(ioc, sleepFlag);
2469 if (ioc->alt_ioc && ioc->alt_ioc->cached_fw) {
2478 "mpt_upload: alt_%s has cached_fw=%p \n",
2479 ioc->name, ioc->alt_ioc->name, ioc->alt_ioc->cached_fw));
2480 ioc->cached_fw =
NULL;
2484 "firmware upload failure!\n", ioc->name);
2494 if ((ret == 0) && (!ioc->facts.EventState)) {
2496 "SendEventNotification\n",
2498 ret = SendEventNotification(ioc, 1, sleepFlag);
2501 if (ioc->alt_ioc && alt_ioc_ready && !ioc->alt_ioc->facts.EventState)
2502 rc = SendEventNotification(ioc->alt_ioc, 1, sleepFlag);
2510 if (reset_alt_ioc_active && ioc->alt_ioc) {
2513 "reply irq re-enabled\n",
2514 ioc->alt_ioc->name));
2517 ioc->alt_ioc->active = 1;
2528 if ((ret == 0) && (reason == MPT_HOSTEVENT_IOC_BRINGUP)) {
2533 mutex_init(&ioc->raid_data.inactive_list_mutex);
2534 INIT_LIST_HEAD(&ioc->raid_data.inactive_list);
2536 switch (ioc->bus_type) {
2540 if(ioc->facts.IOCExceptions &
2554 mpt_read_ioc_pg_1(ioc);
2559 if ((ioc->pfacts[0].ProtocolFlags &
2561 (ioc->lan_cnfg_page0.Header.PageLength == 0)) {
2566 (
void) GetLanConfigPages(ioc);
2567 a = (
u8*)&ioc->lan_cnfg_page1.HardwareAddressLow;
2569 "LanAddr = %02X:%02X:%02X"
2570 ":%02X:%02X:%02X\n",
2571 ioc->name, a[5], a[4],
2572 a[3], a[2], a[1], a[0]));
2579 mpt_GetScsiPortSettings(ioc, 0);
2583 mpt_readScsiDevicePageHeaders(ioc, 0);
2592 mpt_read_ioc_pg_1(ioc);
2594 mpt_read_ioc_pg_4(ioc);
2599 GetIoUnitPage2(ioc);
2600 mpt_get_manufacturing_pg_0(ioc);
2604 if ((ret != 0) && irq_allocated) {
2606 if (ioc->msi_enable)
2626 mpt_detect_bound_ports(MPT_ADAPTER *ioc,
struct pci_dev *pdev)
2631 MPT_ADAPTER *ioc_srch;
2633 dprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"PCI device %s devfn=%x/%x,"
2634 " searching for devfn match on %x or %x\n",
2635 ioc->name, pci_name(pdev), pdev->
bus->number,
2636 pdev->
devfn, func-1, func+1));
2646 struct pci_dev *_pcidev = ioc_srch->pcidev;
2647 if (_pcidev == peer) {
2649 if (ioc->alt_ioc !=
NULL) {
2651 "Oops, already bound (%s <==> %s)!\n",
2652 ioc->name, ioc->name, ioc->alt_ioc->name);
2654 }
else if (ioc_srch->alt_ioc !=
NULL) {
2656 "Oops, already bound (%s <==> %s)!\n",
2657 ioc_srch->name, ioc_srch->name,
2658 ioc_srch->alt_ioc->name);
2662 "FOUND! binding %s <==> %s\n",
2663 ioc->name, ioc->name, ioc_srch->name));
2664 ioc_srch->alt_ioc = ioc;
2665 ioc->alt_ioc = ioc_srch;
2677 mpt_adapter_disable(MPT_ADAPTER *ioc)
2682 if (ioc->cached_fw !=
NULL) {
2684 "%s: Pushing FW onto adapter\n", __func__, ioc->name));
2688 ": firmware downloadboot failure (%d)!\n",
2700 printk(MYIOC_s_ERR_FMT
"%s: IOC msg unit "
2701 "reset failed to put ioc in ready state!\n",
2702 ioc->name, __func__);
2704 printk(MYIOC_s_ERR_FMT
"%s: IOC msg unit reset "
2705 "failed!\n", ioc->name, __func__);
2718 if (ioc->alloc !=
NULL) {
2721 ioc->name, ioc->alloc, ioc->alloc_sz));
2723 ioc->alloc, ioc->alloc_dma);
2724 ioc->reply_frames =
NULL;
2725 ioc->req_frames =
NULL;
2727 ioc->alloc_total -= sz;
2730 if (ioc->sense_buf_pool !=
NULL) {
2733 ioc->sense_buf_pool, ioc->sense_buf_pool_dma);
2734 ioc->sense_buf_pool =
NULL;
2735 ioc->alloc_total -= sz;
2738 if (ioc->events !=
NULL){
2742 ioc->alloc_total -= sz;
2747 kfree(ioc->spi_data.nvram);
2748 mpt_inactive_raid_list_free(ioc);
2749 kfree(ioc->raid_data.pIocPg2);
2750 kfree(ioc->raid_data.pIocPg3);
2751 ioc->spi_data.nvram =
NULL;
2752 ioc->raid_data.pIocPg3 =
NULL;
2754 if (ioc->spi_data.pIocPg4 !=
NULL) {
2755 sz = ioc->spi_data.IocPg4Sz;
2757 ioc->spi_data.pIocPg4,
2758 ioc->spi_data.IocPg4_dma);
2759 ioc->spi_data.pIocPg4 =
NULL;
2760 ioc->alloc_total -= sz;
2763 if (ioc->ReqToChain !=
NULL) {
2764 kfree(ioc->ReqToChain);
2765 kfree(ioc->RequestNB);
2766 ioc->ReqToChain =
NULL;
2769 kfree(ioc->ChainToChain);
2770 ioc->ChainToChain =
NULL;
2772 if (ioc->HostPageBuffer !=
NULL) {
2773 if((ret = mpt_host_page_access_control(ioc,
2776 ": %s: host page buffers free failed (%d)!\n",
2777 ioc->name, __func__, ret);
2780 "HostPageBuffer free @ %p, sz=%d bytes\n",
2781 ioc->name, ioc->HostPageBuffer,
2782 ioc->HostPageBuffer_sz));
2784 ioc->HostPageBuffer, ioc->HostPageBuffer_dma);
2785 ioc->HostPageBuffer =
NULL;
2786 ioc->HostPageBuffer_sz = 0;
2787 ioc->alloc_total -= ioc->HostPageBuffer_sz;
2790 pci_set_drvdata(ioc->pcidev,
NULL);
2801 mpt_adapter_dispose(MPT_ADAPTER *ioc)
2803 int sz_first, sz_last;
2808 sz_first = ioc->alloc_total;
2810 mpt_adapter_disable(ioc);
2812 if (ioc->pci_irq != -1) {
2814 if (ioc->msi_enable)
2819 if (ioc->memmap !=
NULL) {
2827 #if defined(CONFIG_MTRR) && 0
2828 if (ioc->mtrr_reg > 0) {
2830 dprintk(ioc,
printk(MYIOC_s_INFO_FMT
"MTRR region de-registered\n", ioc->name));
2837 sz_last = ioc->alloc_total;
2838 dprintk(ioc,
printk(MYIOC_s_INFO_FMT
"free'd %d of %d bytes\n",
2839 ioc->name, sz_first-sz_last+(
int)
sizeof(*ioc), sz_first));
2842 ioc->alt_ioc->alt_ioc =
NULL;
2853 MptDisplayIocCapabilities(MPT_ADAPTER *ioc)
2859 printk(
"%s: ", ioc->prod_name);
2860 printk(
"Capabilities={");
2868 printk(
"%sTarget", i ?
"," :
"");
2873 printk(
"%sLAN", i ?
"," :
"");
2882 printk(
"%sLogBusAddr", i ?
"," :
"");
2906 MakeIocReady(MPT_ADAPTER *ioc,
int force,
int sleepFlag)
2911 int hard_reset_done = 0;
2918 dhsprintk(ioc,
printk(MYIOC_s_INFO_FMT
"MakeIocReady [raw] state=%08x\n", ioc->name, ioc_state));
2926 printk(MYIOC_s_WARN_FMT
"Unexpected doorbell active!\n",
2934 "IOC is in READY state\n", ioc->name));
2943 printk(MYIOC_s_WARN_FMT
"IOC is in FAULT state!!!\n",
2945 printk(MYIOC_s_WARN_FMT
" FAULT code = %04xh\n",
2963 "whoinit 0x%x statefault %d force %d\n",
2964 ioc->name, whoinit, statefault, force));
2968 if ((statefault == 0 ) && (force == 0)) {
2976 hard_reset_done = KickStart(ioc, statefault||force, sleepFlag);
2977 if (hard_reset_done < 0)
2984 cntdn = ((sleepFlag ==
CAN_SLEEP) ?
HZ : 1000) * 5;
2993 printk(MYIOC_s_ERR_FMT
"IOC msg unit reset failed!\n", ioc->name);
3002 printk(MYIOC_s_ERR_FMT
"IO unit reset failed!\n", ioc->name);
3010 "Wait IOC_READY state (0x%x) timeout(%d)!\n",
3011 ioc->name, ioc_state, (
int)((ii+5)/
HZ));
3023 if (statefault < 3) {
3024 printk(MYIOC_s_INFO_FMT
"Recovered from %s\n", ioc->name,
3025 statefault == 1 ?
"stuck handshake" :
"IOC FAULT");
3028 return hard_reset_done;
3050 ioc->last_state =
sc;
3052 return cooked ? sc :
s;
3065 GetIocFacts(MPT_ADAPTER *ioc,
int sleepFlag,
int reason)
3079 ": ERROR - Can't get IOCFacts, %s NOT READY! (%08x)\n",
3080 ioc->name, ioc->last_state);
3084 facts = &ioc->facts;
3087 reply_sz =
sizeof(*facts);
3088 memset(facts, 0, reply_sz);
3091 req_sz =
sizeof(get_facts);
3092 memset(&get_facts, 0, req_sz);
3098 "Sending get IocFacts request req_sz=%d reply_sz=%d\n",
3099 ioc->name, req_sz, reply_sz));
3104 r = mpt_handshake_req_reply_wait(ioc, req_sz, (
u32*)&get_facts,
3105 reply_sz, (
u16*)facts, 5 , sleepFlag);
3118 if (reason == MPT_HOSTEVENT_IOC_BRINGUP) {
3123 ioc->FirstWhoInit = facts->
WhoInit;
3148 ((oldv<<12) & 0xFF000000) |
3149 ((oldv<<8) & 0x000FFF00);
3157 ioc->ir_firmware = 1;
3187 printk(MYIOC_s_ERR_FMT
"IOC reported invalid 0 request size!\n",
3193 vv = ((63 / (sz * 4)) + 1) & 0x03;
3194 ioc->NB_for_64_byte_frame = vv;
3200 ioc->NBShiftFactor = shiftFactor;
3202 "NB_for_64_byte_frame=%x NBShiftFactor=%x BlockSize=%x\n",
3203 ioc->name, vv, shiftFactor, r));
3205 if (reason == MPT_HOSTEVENT_IOC_BRINGUP) {
3216 ioc->name, ioc->reply_sz, ioc->reply_depth));
3218 ioc->name, ioc->req_sz, ioc->req_depth));
3221 if ( (r = GetPortFacts(ioc, 0, sleepFlag)) != 0 )
3226 "Invalid IOC facts reply, msgLength=%d offsetof=%zd!\n",
3228 RequestFrameSize)/
sizeof(
u32)));
3245 GetPortFacts(MPT_ADAPTER *ioc,
int portnum,
int sleepFlag)
3256 printk(MYIOC_s_ERR_FMT
"Can't get PortFacts NOT READY! (%08x)\n",
3257 ioc->name, ioc->last_state );
3261 pfacts = &ioc->pfacts[portnum];
3264 reply_sz =
sizeof(*pfacts);
3265 memset(pfacts, 0, reply_sz);
3268 req_sz =
sizeof(get_pfacts);
3269 memset(&get_pfacts, 0, req_sz);
3275 dinitprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"Sending get PortFacts(%d) request\n",
3276 ioc->name, portnum));
3281 ii = mpt_handshake_req_reply_wait(ioc, req_sz, (
u32*)&get_pfacts,
3282 reply_sz, (
u16*)pfacts, 5 , sleepFlag);
3301 ioc->devices_per_bus = (max_id > 255) ? 256 : max_id;
3302 ioc->number_of_buses = (ioc->devices_per_bus < 256) ? 1 : max_id/256;
3309 if (mpt_channel_mapping) {
3310 ioc->devices_per_bus = 1;
3311 ioc->number_of_buses = (max_id > 255) ? 255 : max_id;
3328 SendIocInit(MPT_ADAPTER *ioc,
int sleepFlag)
3337 memset(&ioc_init, 0,
sizeof(ioc_init));
3338 memset(&init_reply, 0,
sizeof(init_reply));
3351 ddlprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"upload_fw %d facts.Flags=%x\n",
3352 ioc->name, ioc->upload_fw, ioc->facts.Flags));
3355 ioc_init.
MaxBuses = (
U8)ioc->number_of_buses;
3358 ioc->name, ioc->facts.MsgVersion));
3366 }
else if(mpt_host_page_alloc(ioc, &ioc_init))
3371 if (ioc->sg_addr_size ==
sizeof(
u64)) {
3386 ioc->facts.MaxBuses = ioc_init.
MaxBuses;
3388 dhsprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"Sending IOCInit (req @ %p)\n",
3389 ioc->name, &ioc_init));
3391 r = mpt_handshake_req_reply_wait(ioc,
sizeof(
IOCInit_t), (
u32*)&ioc_init,
3394 printk(MYIOC_s_ERR_FMT
"Sending IOCInit failed(%d)!\n",ioc->name, r);
3402 dhsprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"Sending PortEnable (req @ %p)\n",
3403 ioc->name, &ioc_init));
3405 if ((r = SendPortEnable(ioc, 0, sleepFlag)) != 0) {
3406 printk(MYIOC_s_ERR_FMT
"Sending PortEnable failed(%d)!\n",ioc->name, r);
3415 cntdn = ((sleepFlag ==
CAN_SLEEP) ?
HZ : 1000) * 60;
3425 printk(MYIOC_s_ERR_FMT
"Wait IOC_OP state timeout(%d)!\n",
3426 ioc->name, (
int)((count+5)/
HZ));
3433 dinitprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"Wait IOC_OPERATIONAL state (cnt=%d)\n",
3436 ioc->aen_event_read_flag=0;
3452 SendPortEnable(MPT_ADAPTER *ioc,
int portnum,
int sleepFlag)
3462 memset(&reply_buf, 0, reply_sz);
3465 memset(&port_enable, 0, req_sz);
3473 dinitprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"Sending Port(%d)Enable (req @ %p)\n",
3474 ioc->name, portnum, &port_enable));
3478 if (ioc->ir_firmware || ioc->bus_type ==
SAS) {
3479 rc = mpt_handshake_req_reply_wait(ioc, req_sz,
3480 (
u32*)&port_enable, reply_sz, (
u16*)&reply_buf,
3483 rc = mpt_handshake_req_reply_wait(ioc, req_sz,
3484 (
u32*)&port_enable, reply_sz, (
u16*)&reply_buf,
3505 if (ioc->cached_fw) {
3509 else if (ioc->alt_ioc && ioc->alt_ioc->cached_fw) {
3510 ioc->cached_fw = ioc->alt_ioc->cached_fw;
3511 ioc->cached_fw_dma = ioc->alt_ioc->cached_fw_dma;
3516 if (!ioc->cached_fw) {
3517 printk(MYIOC_s_ERR_FMT
"Unable to allocate memory for the cached firmware image!\n",
3521 dinitprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"FW Image @ %p[%p], sz=%d[%x] bytes\n",
3522 ioc->name, ioc->cached_fw, (
void *)(
ulong)ioc->cached_fw_dma, size, size));
3523 ioc->alloc_total +=
size;
3542 if (!ioc->cached_fw)
3545 sz = ioc->facts.FWImageSize;
3546 dinitprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"free_fw_memory: FW Image @ %p[%p], sz=%d[%x] bytes\n",
3547 ioc->name, ioc->cached_fw, (
void *)(
ulong)ioc->cached_fw_dma, sz, sz));
3549 ioc->alloc_total -= sz;
3550 ioc->cached_fw =
NULL;
3568 mpt_do_upload(MPT_ADAPTER *ioc,
int sleepFlag)
3575 int ii, sz, reply_sz;
3580 if ((sz = ioc->facts.FWImageSize) == 0)
3586 dinitprintk(ioc,
printk(MYIOC_s_INFO_FMT
": FW Image @ %p[%p], sz=%d[%x] bytes\n",
3587 ioc->name, ioc->cached_fw, (
void *)(
ulong)ioc->cached_fw_dma, sz, sz));
3593 "while allocating memory \n", ioc->name));
3600 reply_sz =
sizeof(reply);
3601 memset(preply, 0, reply_sz);
3613 ioc->add_sge((
char *)ptcsge, flagsLength, ioc->cached_fw_dma);
3617 " (req @ %p) fw_size=%d mf_request_size=%d\n", ioc->name, prequest,
3618 ioc->facts.FWImageSize, request_size));
3621 ii = mpt_handshake_req_reply_wait(ioc, request_size, (
u32 *)prequest,
3622 reply_sz, (
u16 *)preply, 65 , sleepFlag);
3625 "rc=%x \n", ioc->name, ii));
3636 ioc->facts.FWImageSize ==
3641 ioc->name, cmdStatus));
3646 "freeing image \n", ioc->name));
3669 mpt_downloadboot(MPT_ADAPTER *ioc,
MpiFwHeader_t *pFwHeader,
int sleepFlag)
3681 ddlprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"downloadboot: fw size 0x%x (%d), FW Ptr %p\n",
3703 for (count = 0; count < 30; count ++) {
3706 ddlprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"RESET_ADAPTER cleared, count=%d\n",
3718 if ( count == 30 ) {
3720 "Unable to get MPI_DIAG_DRWE mode, diag0val=%x\n",
3721 ioc->name, diag0val));
3736 ptrFw = (
u32 *) pFwHeader;
3741 if (ioc->errata_flag_1064)
3742 pci_enable_io_access(ioc->pcidev);
3745 ddlprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"LoadStart addr written 0x%x \n",
3748 ddlprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"Write FW Image: 0x%x bytes @ %p\n",
3749 ioc->name, fwSize*4, ptrFw));
3760 fwSize = (pExtImage->
ImageSize + 3) >> 2;
3761 ptrFw = (
u32 *)pExtImage;
3763 ddlprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"Write Ext Image: 0x%x (%d) bytes @ %p load_addr=%x\n",
3764 ioc->name, fwSize*4, fwSize*4, ptrFw, load_addr));
3784 if (ioc->bus_type ==
SPI) {
3791 diagRwData |= 0x40000000;
3808 if (ioc->errata_flag_1064)
3809 pci_disable_io_access(ioc->pcidev);
3813 "turning off PREVENT_IOC_BOOT, DISABLE_ARM, RW_ENABLE\n",
3814 ioc->name, diag0val));
3816 ddlprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"downloadboot now diag0val=%x\n",
3817 ioc->name, diag0val));
3823 if (ioc->bus_type ==
SAS) {
3825 if ( (GetIocFacts(ioc, sleepFlag,
3826 MPT_HOSTEVENT_IOC_BRINGUP)) != 0 ) {
3827 ddlprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"GetIocFacts failed: IocState=%x\n",
3828 ioc->name, ioc_state));
3833 for (count=0; count<
HZ*20; count++) {
3836 "downloadboot successful! (count=%d) IocState=%x\n",
3837 ioc->name, count, ioc_state));
3838 if (ioc->bus_type ==
SAS) {
3841 if ((SendIocInit(ioc, sleepFlag)) != 0) {
3843 "downloadboot: SendIocInit failed\n",
3848 "downloadboot: SendIocInit successful\n",
3859 "downloadboot failed! IocState=%x\n",ioc->name, ioc_state));
3890 KickStart(MPT_ADAPTER *ioc,
int force,
int sleepFlag)
3892 int hard_reset_done = 0;
3897 if (ioc->bus_type ==
SPI) {
3910 hard_reset_done = mpt_diag_reset(ioc, force, sleepFlag);
3911 if (hard_reset_done < 0)
3912 return hard_reset_done;
3917 cntdn = ((sleepFlag ==
CAN_SLEEP) ? HZ : 1000) * 2;
3918 for (cnt=0; cnt<cntdn; cnt++) {
3923 return hard_reset_done;
3932 dinitprintk(ioc,
printk(MYIOC_s_ERR_FMT
"Failed to come READY after reset! IocState=%x\n",
3957 mpt_diag_reset(MPT_ADAPTER *ioc,
int ignore,
int sleepFlag)
3961 int hard_reset_done = 0;
3976 "address=%p\n", ioc->name, __func__,
3977 &ioc->chip->Doorbell, &ioc->chip->Reset_1078));
3991 if (MptResetHandlers[cb_idx])
3992 (*(MptResetHandlers[cb_idx]))(ioc,
3996 for (count = 0; count < 60; count ++) {
4001 "looking for READY STATE: doorbell=%x"
4003 ioc->name, doorbell, count));
4024 dprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"DbG1: diag0=%08x, diag1=%08x\n",
4025 ioc->name, diag0val, diag1val));
4052 printk(MYIOC_s_ERR_FMT
"Enable Diagnostic mode FAILED! (%02xh)\n",
4053 ioc->name, diag0val);
4060 dprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"Wrote magic DiagWriteEn sequence (%x)\n",
4061 ioc->name, diag0val));
4067 dprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"DbG2: diag0=%08x, diag1=%08x\n",
4068 ioc->name, diag0val, diag1val));
4081 CHIPREG_WRITE32(&ioc->chip->Diagnostic, diag0val | MPI_DIAG_RESET_ADAPTER);
4082 hard_reset_done = 1;
4083 dprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"Diagnostic reset performed\n",
4093 if (MptResetHandlers[cb_idx]) {
4094 mpt_signal_reset(cb_idx,
4095 ioc, MPT_IOC_PRE_RESET);
4097 mpt_signal_reset(cb_idx,
4098 ioc->alt_ioc, MPT_IOC_PRE_RESET);
4105 else if (ioc->alt_ioc && ioc->alt_ioc->cached_fw)
4114 for (count = 0; count < 30; count ++) {
4116 if (!(diag0val & MPI_DIAG_RESET_ADAPTER)) {
4120 dprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"cached_fw: diag0val=%x count=%d\n",
4121 ioc->name, diag0val, count));
4129 if ((count = mpt_downloadboot(ioc, cached_fw, sleepFlag)) < 0) {
4131 "firmware downloadboot failure (%d)!\n", ioc->name, count);
4141 for (count = 0; count < 60; count ++) {
4146 "looking for READY STATE: doorbell=%x"
4147 " count=%d\n", ioc->name, doorbell, count));
4162 printk(MYIOC_s_ERR_FMT
"Failed to come READY "
4163 "after reset! IocState=%x", ioc->name,
4172 dprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"DbG3: diag0=%08x, diag1=%08x\n",
4173 ioc->name, diag0val, diag1val));
4181 while ((diag0val & MPI_DIAG_DRWE) == 0) {
4201 printk(MYIOC_s_ERR_FMT
"Enable Diagnostic mode FAILED! (%02xh)\n",
4202 ioc->name, diag0val);
4207 diag0val &= ~MPI_DIAG_RESET_HISTORY;
4210 if (diag0val & MPI_DIAG_RESET_HISTORY) {
4211 printk(MYIOC_s_WARN_FMT
"ResetHistory bit failed to clear!\n",
4223 printk(MYIOC_s_ERR_FMT
"Diagnostic reset FAILED! (%02xh)\n",
4224 ioc->name, diag0val);
4231 dprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"DbG4: diag0=%08x, diag1=%08x\n",
4232 ioc->name, diag0val, diag1val));
4238 ioc->facts.EventState = 0;
4241 ioc->alt_ioc->facts.EventState = 0;
4243 return hard_reset_done;
4259 SendIocReset(MPT_ADAPTER *ioc,
u8 reset_type,
int sleepFlag)
4265 drsprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"Sending IOC reset(0x%02x)!\n",
4266 ioc->name, reset_type));
4268 if ((r = WaitForDoorbellAck(ioc, 5, sleepFlag)) < 0)
4274 cntdn = ((sleepFlag ==
CAN_SLEEP) ? HZ : 1000) * 15;
4284 "Wait IOC_READY state (0x%x) timeout(%d)!\n",
4285 ioc->name, state, (
int)((count+5)/HZ));
4300 if (ioc->facts.Function)
4301 ioc->facts.EventState = 0;
4315 initChainBuffers(MPT_ADAPTER *ioc)
4318 int sz, ii, num_chain;
4319 int scale, num_sge, numSGE;
4324 if (ioc->ReqToChain ==
NULL) {
4325 sz = ioc->req_depth *
sizeof(
int);
4330 ioc->ReqToChain = (
int *) mem;
4331 dinitprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"ReqToChain alloc @ %p, sz=%d bytes\n",
4332 ioc->name, mem, sz));
4337 ioc->RequestNB = (
int *) mem;
4338 dinitprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"RequestNB alloc @ %p, sz=%d bytes\n",
4339 ioc->name, mem, sz));
4341 for (ii = 0; ii < ioc->req_depth; ii++) {
4342 ioc->ReqToChain[ii] = MPT_HOST_NO_CHAIN;
4355 scale = ioc->req_sz / ioc->SGE_size;
4356 if (ioc->sg_addr_size ==
sizeof(
u64))
4357 num_sge = scale + (ioc->req_sz - 60) / ioc->SGE_size;
4359 num_sge = 1 + scale + (ioc->req_sz - 64) / ioc->SGE_size;
4361 if (ioc->sg_addr_size ==
sizeof(
u64)) {
4362 numSGE = (scale - 1) * (ioc->facts.MaxChainDepth-1) + scale +
4363 (ioc->req_sz - 60) / ioc->SGE_size;
4365 numSGE = 1 + (scale - 1) * (ioc->facts.MaxChainDepth-1) +
4366 scale + (ioc->req_sz - 64) / ioc->SGE_size;
4369 ioc->name, num_sge, numSGE));
4371 if (ioc->bus_type ==
FC) {
4380 while (numSGE - num_sge > 0) {
4382 num_sge += (scale - 1);
4386 dinitprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"Now numSGE=%d num_sge=%d num_chain=%d\n",
4387 ioc->name, numSGE, num_sge, num_chain));
4389 if (ioc->bus_type ==
SPI)
4391 else if (ioc->bus_type ==
SAS)
4396 ioc->num_chain = num_chain;
4398 sz = num_chain *
sizeof(
int);
4399 if (ioc->ChainToChain ==
NULL) {
4404 ioc->ChainToChain = (
int *) mem;
4405 dinitprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"ChainToChain alloc @ %p, sz=%d bytes\n",
4406 ioc->name, mem, sz));
4408 mem = (
u8 *) ioc->ChainToChain;
4426 PrimeIocFifos(MPT_ADAPTER *ioc)
4429 unsigned long flags;
4439 if (ioc->reply_frames ==
NULL) {
4440 if ( (num_chain = initChainBuffers(ioc)) < 0)
4448 && !pci_set_consistent_dma_mask(ioc->pcidev,
4452 "setting 35 bit addressing for "
4453 "Request/Reply/Chain and Sense Buffers\n",
4457 pci_set_dma_mask(ioc->pcidev,
4459 pci_set_consistent_dma_mask(ioc->pcidev,
4463 "failed setting 35 bit addressing for "
4464 "Request/Reply/Chain and Sense Buffers\n",
4470 total_size = reply_sz = (ioc->reply_sz * ioc->reply_depth);
4471 dinitprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"ReplyBuffer sz=%d bytes, ReplyDepth=%d\n",
4472 ioc->name, ioc->reply_sz, ioc->reply_depth));
4474 ioc->name, reply_sz, reply_sz));
4476 sz = (ioc->req_sz * ioc->req_depth);
4477 dinitprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"RequestBuffer sz=%d bytes, RequestDepth=%d\n",
4478 ioc->name, ioc->req_sz, ioc->req_depth));
4480 ioc->name, sz, sz));
4483 sz = num_chain * ioc->req_sz;
4484 dinitprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"ChainBuffer sz=%d bytes, ChainDepth=%d\n",
4485 ioc->name, ioc->req_sz, num_chain));
4486 dinitprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"ChainBuffer sz=%d[%x] bytes num_chain=%d\n",
4487 ioc->name, sz, sz, num_chain));
4492 printk(MYIOC_s_ERR_FMT
"Unable to allocate Reply, Request, Chain Buffers!\n",
4497 dinitprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"Total alloc @ %p[%p], sz=%d[%x] bytes\n",
4498 ioc->name, mem, (
void *)(
ulong)alloc_dma, total_size, total_size));
4500 memset(mem, 0, total_size);
4503 ioc->alloc_dma = alloc_dma;
4505 ioc->reply_frames = (MPT_FRAME_HDR *) mem;
4506 ioc->reply_frames_low_dma = (
u32) (alloc_dma & 0xFFFFFFFF);
4509 ioc->name, ioc->reply_frames, (
void *)(
ulong)alloc_dma));
4511 alloc_dma += reply_sz;
4516 ioc->req_frames = (MPT_FRAME_HDR *) mem;
4517 ioc->req_frames_dma = alloc_dma;
4520 ioc->name, mem, (
void *)(
ulong)alloc_dma));
4522 ioc->req_frames_low_dma = (
u32) (alloc_dma & 0xFFFFFFFF);
4524 #if defined(CONFIG_MTRR) && 0
4530 ioc->mtrr_reg =
mtrr_add(ioc->req_frames_dma,
4533 dprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"MTRR region registered (base:size=%08x:%x)\n",
4534 ioc->name, ioc->req_frames_dma, sz));
4537 for (i = 0; i < ioc->req_depth; i++) {
4538 alloc_dma += ioc->req_sz;
4542 ioc->ChainBuffer =
mem;
4543 ioc->ChainBufferDMA = alloc_dma;
4546 ioc->name, ioc->ChainBuffer, (
void *)(
ulong)ioc->ChainBufferDMA));
4551 INIT_LIST_HEAD(&ioc->FreeChainQ);
4555 mem = (
u8 *)ioc->ChainBuffer;
4556 for (i=0; i < num_chain; i++) {
4557 mf = (MPT_FRAME_HDR *) mem;
4564 alloc_dma = ioc->req_frames_dma;
4565 mem = (
u8 *) ioc->req_frames;
4568 INIT_LIST_HEAD(&ioc->FreeQ);
4569 for (i = 0; i < ioc->req_depth; i++) {
4570 mf = (MPT_FRAME_HDR *) mem;
4577 spin_unlock_irqrestore(&ioc->FreeQlock, flags);
4580 ioc->sense_buf_pool =
4582 if (ioc->sense_buf_pool ==
NULL) {
4583 printk(MYIOC_s_ERR_FMT
"Unable to allocate Sense Buffers!\n",
4588 ioc->sense_buf_low_dma = (
u32) (ioc->sense_buf_pool_dma & 0xFFFFFFFF);
4589 ioc->alloc_total += sz;
4591 ioc->name, ioc->sense_buf_pool, (
void *)(
ulong)ioc->sense_buf_pool_dma));
4597 alloc_dma = ioc->alloc_dma;
4599 ioc->name, ioc->reply_frames, (
void *)(
ulong)alloc_dma));
4601 for (i = 0; i < ioc->reply_depth; i++) {
4604 alloc_dma += ioc->reply_sz;
4607 if (dma_mask ==
DMA_BIT_MASK(35) && !pci_set_dma_mask(ioc->pcidev,
4608 ioc->dma_mask) && !pci_set_consistent_dma_mask(ioc->pcidev,
4611 "restoring 64 bit addressing\n", ioc->name));
4617 if (ioc->alloc !=
NULL) {
4621 ioc->alloc, ioc->alloc_dma);
4622 ioc->reply_frames =
NULL;
4623 ioc->req_frames =
NULL;
4624 ioc->alloc_total -= sz;
4626 if (ioc->sense_buf_pool !=
NULL) {
4630 ioc->sense_buf_pool, ioc->sense_buf_pool_dma);
4631 ioc->sense_buf_pool =
NULL;
4634 if (dma_mask ==
DMA_BIT_MASK(35) && !pci_set_dma_mask(ioc->pcidev,
4635 DMA_BIT_MASK(64)) && !pci_set_consistent_dma_mask(ioc->pcidev,
4638 "restoring 64 bit addressing\n", ioc->name));
4663 mpt_handshake_req_reply_wait(MPT_ADAPTER *ioc,
int reqBytes,
u32 *req,
4664 int replyBytes,
u16 *u16reply,
int maxwait,
int sleepFlag)
4673 ioc->hs_reply_idx = 0;
4690 if ((t = WaitForDoorbellInt(ioc, 5, sleepFlag)) < 0)
4693 dhsprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"HandShake request start reqBytes=%d, WaitCnt=%d%s\n",
4694 ioc->name, reqBytes, t, failcnt ?
" - MISSING DOORBELL HANDSHAKE!" :
""));
4697 if (!(
CHIPREG_READ32(&ioc->chip->Doorbell) & MPI_DOORBELL_ACTIVE))
4706 if (!failcnt && (t = WaitForDoorbellAck(ioc, 5, sleepFlag)) < 0)
4711 u8 *req_as_bytes = (
u8 *) req;
4717 for (ii = 0; !failcnt && ii < reqBytes/4; ii++) {
4718 u32 word = ((req_as_bytes[(ii*4) + 0] << 0) |
4719 (req_as_bytes[(ii*4) + 1] << 8) |
4720 (req_as_bytes[(ii*4) + 2] << 16) |
4721 (req_as_bytes[(ii*4) + 3] << 24));
4724 if ((t = WaitForDoorbellAck(ioc, 5, sleepFlag)) < 0)
4728 dhsprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"Handshake request frame (@%p) header\n", ioc->name, req));
4731 dhsprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"HandShake request post done, WaitCnt=%d%s\n",
4732 ioc->name, t, failcnt ?
" - MISSING DOORBELL ACK!" :
""));
4737 if (!failcnt && (t = WaitForDoorbellReply(ioc, maxwait, sleepFlag)) < 0)
4740 dhsprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"HandShake reply count=%d%s\n",
4741 ioc->name, t, failcnt ?
" - MISSING DOORBELL REPLY!" :
""));
4746 for (ii=0; ii <
min(replyBytes/2,mptReply->
MsgLength*2); ii++)
4747 u16reply[ii] = ioc->hs_reply[ii];
4769 WaitForDoorbellAck(MPT_ADAPTER *ioc,
int howlong,
int sleepFlag)
4775 cntdn = 1000 * howlong;
4796 dprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"WaitForDoorbell ACK (count=%d)\n",
4801 printk(MYIOC_s_ERR_FMT
"Doorbell ACK timeout (count=%d), IntStatus=%x!\n",
4802 ioc->name, count, intstat);
4819 WaitForDoorbellInt(MPT_ADAPTER *ioc,
int howlong,
int sleepFlag)
4825 cntdn = 1000 * howlong;
4845 dprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"WaitForDoorbell INT (cnt=%d) howlong=%d\n",
4846 ioc->name, count, howlong));
4850 printk(MYIOC_s_ERR_FMT
"Doorbell INT timeout (count=%d), IntStatus=%x!\n",
4851 ioc->name, count, intstat);
4869 WaitForDoorbellReply(MPT_ADAPTER *ioc,
int howlong,
int sleepFlag)
4874 u16 *hs_reply = ioc->hs_reply;
4878 hs_reply[0] = hs_reply[1] = hs_reply[7] = 0;
4884 if ((t = WaitForDoorbellInt(ioc, howlong, sleepFlag)) < 0) {
4889 if ((t = WaitForDoorbellInt(ioc, 5, sleepFlag)) < 0)
4897 dhsprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"WaitCnt=%d First handshake reply word=%08x%s\n",
4899 failcnt ?
" - MISSING DOORBELL HANDSHAKE!" :
""));
4905 for (u16cnt=2; !failcnt && u16cnt < (2 * mptReply->
MsgLength); u16cnt++) {
4906 if ((t = WaitForDoorbellInt(ioc, 5, sleepFlag)) < 0)
4911 hs_reply[u16cnt] = hword;
4915 if (!failcnt && (t = WaitForDoorbellInt(ioc, 5, sleepFlag)) < 0)
4920 printk(MYIOC_s_ERR_FMT
"Handshake reply failure!\n",
4925 else if (u16cnt != (2 * mptReply->
MsgLength)) {
4933 dhsprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"Got Handshake reply:\n", ioc->name));
4936 dhsprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"WaitForDoorbell REPLY WaitCnt=%d (sz=%d)\n",
4937 ioc->name, t, u16cnt/2));
4953 GetLanConfigPages(MPT_ADAPTER *ioc)
4970 cfg.cfghdr.hdr = &
hdr;
4985 memset((
u8 *)ppage0_alloc, 0, data_sz);
4986 cfg.physAddr = page0_dma;
4992 memcpy(&ioc->lan_cnfg_page0, ppage0_alloc, copy_sz);
5014 cfg.cfghdr.hdr = &
hdr;
5030 memset((
u8 *)ppage1_alloc, 0, data_sz);
5031 cfg.physAddr = page1_dma;
5037 memcpy(&ioc->lan_cnfg_page1, ppage1_alloc, copy_sz);
5073 MPT_FRAME_HDR *mf =
NULL;
5076 unsigned long timeleft;
5082 INITIALIZE_MGMT_STATUS(ioc->mptbase_cmds.status)
5085 switch(persist_opcode) {
5097 __func__, persist_opcode);
5112 sasIoUnitCntrReq->
Operation = persist_opcode;
5116 if (!(ioc->mptbase_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
5119 if (ioc->mptbase_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET)
5123 "Issuing Reset from %s!!, doorbell=0x%08x\n",
5131 if (!(ioc->mptbase_cmds.status & MPT_MGMT_STATUS_RF_VALID)) {
5136 sasIoUnitCntrReply =
5140 __func__, sasIoUnitCntrReply->
IOCStatus,
5148 CLEAR_MGMT_STATUS(ioc->mptbase_cmds.status)
5156 mptbase_raid_process_event_data(MPT_ADAPTER *ioc,
5170 flags = (status >> 0) & 0xff;
5171 state = (status >> 8) & 0xff;
5180 printk(MYIOC_s_INFO_FMT
"RAID STATUS CHANGE for PhysDisk %d id=%d\n",
5181 ioc->name, disk, volume);
5183 printk(MYIOC_s_INFO_FMT
"RAID STATUS CHANGE for VolumeID %d\n",
5189 printk(MYIOC_s_INFO_FMT
" volume has been created\n",
5195 printk(MYIOC_s_INFO_FMT
" volume has been deleted\n",
5200 printk(MYIOC_s_INFO_FMT
" volume settings have been changed\n",
5205 printk(MYIOC_s_INFO_FMT
" volume is now %s%s%s%s\n",
5217 ?
", quiesced" :
"",
5219 ?
", resync in progress" :
"" );
5223 printk(MYIOC_s_INFO_FMT
" volume membership of PhysDisk %d has changed\n",
5228 printk(MYIOC_s_INFO_FMT
" PhysDisk has been created\n",
5233 printk(MYIOC_s_INFO_FMT
" PhysDisk has been deleted\n",
5238 printk(MYIOC_s_INFO_FMT
" PhysDisk settings have been changed\n",
5243 printk(MYIOC_s_INFO_FMT
" PhysDisk is now %s%s%s\n",
5256 ?
"offline requested"
5258 ?
"failed requested"
5263 ?
", out of sync" :
"",
5265 ?
", quiesced" :
"" );
5269 printk(MYIOC_s_INFO_FMT
" Domain Validation needed for PhysDisk %d\n",
5274 printk(MYIOC_s_INFO_FMT
" SMART data received, ASC/ASCQ = %02xh/%02xh\n",
5275 ioc->name, pRaidEventData->
ASC, pRaidEventData->
ASCQ);
5279 printk(MYIOC_s_INFO_FMT
" replacement of PhysDisk %d has started\n",
5297 GetIoUnitPage2(MPT_ADAPTER *ioc)
5311 cfg.cfghdr.hdr = &
hdr;
5329 memset((
u8 *)ppage_alloc, 0, data_sz);
5330 cfg.physAddr = page_dma;
5365 mpt_GetScsiPortSettings(MPT_ADAPTER *ioc,
int portnum)
5376 if (!ioc->spi_data.nvram) {
5384 ioc->spi_data.nvram = (
int *) mem;
5386 dprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"SCSI device NVRAM settings @ %p, sz=%d\n",
5387 ioc->name, ioc->spi_data.nvram, sz));
5393 ioc->spi_data.nvram[ii] = MPT_HOST_NVRAM_INVALID;
5402 cfg.cfghdr.hdr = &header;
5404 cfg.pageAddr = portnum;
5415 cfg.physAddr = buf_dma;
5418 ioc->spi_data.maxSyncOffset = 0;
5419 ioc->spi_data.minSyncFactor =
MPT_ASYNC;
5420 ioc->spi_data.busType = MPT_HOST_BUS_UNKNOWN;
5423 "Unable to read PortPage0 minSyncFactor=%x\n",
5424 ioc->name, ioc->spi_data.minSyncFactor));
5433 ioc->spi_data.noQas |= MPT_TARGET_NO_NEGO_QAS;
5435 "noQas due to Capabilities=%x\n",
5441 ioc->spi_data.maxSyncOffset = (
u8) (data >> 16);
5443 ioc->spi_data.minSyncFactor = (
u8) (data >> 8);
5445 "PortPage0 minSyncFactor=%x\n",
5446 ioc->name, ioc->spi_data.minSyncFactor));
5448 ioc->spi_data.maxSyncOffset = 0;
5449 ioc->spi_data.minSyncFactor =
MPT_ASYNC;
5459 if (ioc->spi_data.minSyncFactor <
MPT_ULTRA) {
5460 ioc->spi_data.minSyncFactor =
MPT_ULTRA;
5462 "HVD or SE detected, minSyncFactor=%x\n",
5463 ioc->name, ioc->spi_data.minSyncFactor));
5479 cfg.cfghdr.hdr = &header;
5481 cfg.pageAddr = portnum;
5493 cfg.physAddr = buf_dma;
5502 ATTO_SCSIPortPage2_t *pPP2 = (ATTO_SCSIPortPage2_t *) pbuf;
5503 ATTODeviceInfo_t *pdevice =
NULL;
5510 pdevice = &pPP2->DeviceSettings[ii];
5516 if (ATTOFlags & ATTOFLAG_DISC)
5518 if (ATTOFlags & ATTOFLAG_ID_ENB)
5520 if (ATTOFlags & ATTOFLAG_LUN_ENB)
5522 if (ATTOFlags & ATTOFLAG_TAGGED)
5524 if (!(ATTOFlags & ATTOFLAG_WIDE_ENB))
5527 data = (data << 16) | (pdevice->Period << 8) | 10;
5528 ioc->spi_data.nvram[ii] =
data;
5537 ioc->spi_data.bus_reset =
5546 ioc->spi_data.PortFlags =
data;
5551 ioc->spi_data.nvram[ii] =
data;
5577 mpt_readScsiDevicePageHeaders(MPT_ADAPTER *ioc,
int portnum)
5588 cfg.cfghdr.hdr = &header;
5590 cfg.pageAddr = portnum;
5597 ioc->spi_data.sdp1version = cfg.cfghdr.hdr->PageVersion;
5598 ioc->spi_data.sdp1length = cfg.cfghdr.hdr->PageLength;
5607 ioc->spi_data.sdp0version = cfg.cfghdr.hdr->PageVersion;
5608 ioc->spi_data.sdp0length = cfg.cfghdr.hdr->PageLength;
5610 dcprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"Headers: 0: version %d length %d\n",
5611 ioc->name, ioc->spi_data.sdp0version, ioc->spi_data.sdp0length));
5613 dcprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"Headers: 1: version %d length %d\n",
5614 ioc->name, ioc->spi_data.sdp1version, ioc->spi_data.sdp1length));
5623 mpt_inactive_raid_list_free(MPT_ADAPTER *ioc)
5625 struct inactive_raid_component_info *component_info, *pNext;
5627 if (list_empty(&ioc->raid_data.inactive_list))
5630 mutex_lock(&ioc->raid_data.inactive_list_mutex);
5632 &ioc->raid_data.inactive_list,
list) {
5634 kfree(component_info);
5647 mpt_inactive_raid_volumes(MPT_ADAPTER *ioc,
u8 channel,
u8 id)
5655 struct inactive_raid_component_info *component_info;
5656 int handle_inactive_volumes;
5658 memset(&cfg, 0 ,
sizeof(CONFIGPARMS));
5661 cfg.pageAddr = (channel << 8) +
id;
5662 cfg.cfghdr.hdr = &
hdr;
5686 handle_inactive_volumes =
5692 if (!handle_inactive_volumes)
5695 mutex_lock(&ioc->raid_data.inactive_list_mutex);
5701 if ((component_info =
kmalloc(
sizeof (*component_info),
5705 component_info->volumeID =
id;
5706 component_info->volumeBus =
channel;
5707 component_info->d.PhysDiskNum = phys_disk.
PhysDiskNum;
5708 component_info->d.PhysDiskBus = phys_disk.
PhysDiskBus;
5709 component_info->d.PhysDiskID = phys_disk.
PhysDiskID;
5710 component_info->d.PhysDiskIOC = phys_disk.
PhysDiskIOC;
5713 &ioc->raid_data.inactive_list);
5744 memset(&cfg, 0 ,
sizeof(CONFIGPARMS));
5750 cfg.cfghdr.hdr = &
hdr;
5774 cfg.pageAddr = phys_disk_num;
5782 memcpy(phys_disk, buffer,
sizeof(*buffer));
5811 memset(&cfg, 0 ,
sizeof(CONFIGPARMS));
5817 cfg.cfghdr.hdr = &
hdr;
5841 cfg.pageAddr = phys_disk_num;
5882 memset(&cfg, 0 ,
sizeof(CONFIGPARMS));
5889 cfg.cfghdr.hdr = &
hdr;
5913 cfg.pageAddr = phys_disk_num;
5935 &sas_address,
sizeof(
__le64));
5970 if (!ioc->ir_firmware)
5975 kfree(ioc->raid_data.pIocPg2);
5976 ioc->raid_data.pIocPg2 =
NULL;
5977 mpt_inactive_raid_list_free(ioc);
5985 cfg.cfghdr.hdr = &header;
6003 cfg.physAddr = ioc2_dma;
6013 memcpy(mem, (
u8 *)pIoc2, iocpage2sz);
6016 mpt_read_ioc_pg_3(ioc);
6019 mpt_inactive_raid_volumes(ioc,
6030 mpt_read_ioc_pg_3(MPT_ADAPTER *ioc)
6041 kfree(ioc->raid_data.pIocPg3);
6042 ioc->raid_data.pIocPg3 =
NULL;
6051 cfg.cfghdr.hdr = &header;
6073 cfg.physAddr = ioc3_dma;
6078 memcpy(mem, (
u8 *)pIoc3, iocpage3sz);
6089 mpt_read_ioc_pg_4(MPT_ADAPTER *ioc)
6103 cfg.cfghdr.hdr = &header;
6115 if ( (pIoc4 = ioc->spi_data.pIocPg4) ==
NULL ) {
6120 ioc->alloc_total += iocpage4sz;
6122 ioc4_dma = ioc->spi_data.IocPg4_dma;
6123 iocpage4sz = ioc->spi_data.IocPg4Sz;
6128 cfg.physAddr = ioc4_dma;
6131 ioc->spi_data.pIocPg4 = (
IOCPage4_t *) pIoc4;
6132 ioc->spi_data.IocPg4_dma = ioc4_dma;
6133 ioc->spi_data.IocPg4Sz = iocpage4sz;
6136 ioc->spi_data.pIocPg4 =
NULL;
6137 ioc->alloc_total -= iocpage4sz;
6142 mpt_read_ioc_pg_1(MPT_ADAPTER *ioc)
6157 cfg.cfghdr.hdr = &header;
6178 cfg.physAddr = ioc1_dma;
6186 dprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"Coalescing Enabled Timeout = %d\n",
6197 dprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"Reset Current Coalescing Timeout to = %d\n",
6203 "Reset NVRAM Coalescing Timeout to = %d\n",
6207 "Reset NVRAM Coalescing Timeout Failed\n",
6213 "Reset of Current Coalescing Timeout Failed!\n",
6219 dprintk(ioc,
printk(MYIOC_s_WARN_FMT
"Coalescing Disabled\n", ioc->name));
6229 mpt_get_manufacturing_pg_0(MPT_ADAPTER *ioc)
6236 memset(&cfg, 0 ,
sizeof(CONFIGPARMS));
6240 cfg.cfghdr.hdr = &
hdr;
6248 if (!cfg.cfghdr.hdr->PageLength)
6256 cfg.physAddr = buf_dma;
6279 SendEventNotification(MPT_ADAPTER *ioc,
u8 EvSwitch,
int sleepFlag)
6292 "Sending EventNotification (%d) request %p\n",
6293 ioc->name, EvSwitch, &evn));
6313 ioc->name, __func__));
6357 u8 page_type = 0, extend_page;
6358 unsigned long timeleft;
6359 unsigned long flags;
6361 u8 issue_hard_reset = 0;
6369 dcprintk(ioc,
printk(MYIOC_s_WARN_FMT
"Config request not allowed in ISR context!\n",
6376 if (ioc->ioc_reset_in_progress) {
6378 "%s: busy with host reset\n", ioc->name, __func__));
6379 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
6382 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
6388 "%s: ioc not operational, %d, %xh\n",
6389 ioc->name, __func__, ioc->active,
6398 INITIALIZE_MGMT_STATUS(ioc->mptbase_cmds.status)
6404 "mpt_config: no msg frames!\n", ioc->name));
6410 pReq->
Action = pCfg->action;
6420 for (ii=0; ii < 8; ii++)
6455 flagsLength |= pCfg->cfghdr.hdr->PageLength * 4;
6461 "Sending Config request type 0x%x, page 0x%x and action %d\n",
6464 ioc->add_sge((
char *)&pReq->
PageBufferSGE, flagsLength, pCfg->physAddr);
6465 timeout = (pCfg->timeout < 15) ? HZ*15 : HZ*pCfg->timeout;
6469 if (!(ioc->mptbase_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
6472 "Failed Sending Config request type 0x%x, page 0x%x,"
6473 " action %d, status %xh, time left %ld\n\n",
6475 pReq->
Action, ioc->mptbase_cmds.status, timeleft));
6476 if (ioc->mptbase_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET)
6480 if (ioc->ioc_reset_in_progress) {
6481 spin_unlock_irqrestore(&ioc->taskmgmt_lock,
6483 printk(MYIOC_s_INFO_FMT
"%s: host reset in"
6484 " progress mpt_config timed out.!!\n",
6485 __func__, ioc->name);
6489 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
6490 issue_hard_reset = 1;
6495 if (!(ioc->mptbase_cmds.status & MPT_MGMT_STATUS_RF_VALID)) {
6503 pCfg->cfghdr.ehdr->ExtPageLength =
6505 pCfg->cfghdr.ehdr->ExtPageType =
6516 printk(MYIOC_s_INFO_FMT
"Retry completed "
6517 "ret=0x%x timeleft=%ld\n",
6518 ioc->name, ret, timeleft);
6525 CLEAR_MGMT_STATUS(ioc->mptbase_cmds.status)
6527 if (issue_hard_reset) {
6528 issue_hard_reset = 0;
6530 "Issuing Reset from %s!!, doorbell=0x%08x\n",
6532 if (retry_count == 0) {
6540 if (retry_count < 2) {
6542 "Attempting Retry Config request"
6543 " type 0x%x, page 0x%x,"
6544 " action %d\n", ioc->name, page_type,
6545 pCfg->cfghdr.hdr->PageNumber, pCfg->action);
6563 mpt_ioc_reset(MPT_ADAPTER *ioc,
int reset_phase)
6565 switch (reset_phase) {
6566 case MPT_IOC_SETUP_RESET:
6567 ioc->taskmgmt_quiesce_io = 1;
6569 "%s: MPT_IOC_SETUP_RESET\n", ioc->name, __func__));
6571 case MPT_IOC_PRE_RESET:
6573 "%s: MPT_IOC_PRE_RESET\n", ioc->name, __func__));
6575 case MPT_IOC_POST_RESET:
6577 "%s: MPT_IOC_POST_RESET\n", ioc->name, __func__));
6579 if (ioc->mptbase_cmds.status & MPT_MGMT_STATUS_PENDING) {
6580 ioc->mptbase_cmds.status |=
6581 MPT_MGMT_STATUS_DID_IOCRESET;
6585 if (ioc->taskmgmt_cmds.status & MPT_MGMT_STATUS_PENDING) {
6586 ioc->taskmgmt_cmds.status |=
6587 MPT_MGMT_STATUS_DID_IOCRESET;
6588 complete(&ioc->taskmgmt_cmds.done);
6599 #ifdef CONFIG_PROC_FS
6611 procmpt_create(
void)
6614 if (mpt_proc_root_dir ==
NULL)
6617 proc_create(
"summary",
S_IRUGO, mpt_proc_root_dir, &mpt_summary_proc_fops);
6618 proc_create(
"version",
S_IRUGO, mpt_proc_root_dir, &mpt_version_proc_fops);
6629 procmpt_destroy(
void)
6640 static void seq_mpt_print_ioc_summary(MPT_ADAPTER *ioc,
struct seq_file *
m,
int showlan);
6642 static int mpt_summary_proc_show(
struct seq_file *
m,
void *
v)
6644 MPT_ADAPTER *ioc = m->
private;
6647 seq_mpt_print_ioc_summary(ioc, m, 1);
6650 seq_mpt_print_ioc_summary(ioc, m, 1);
6659 return single_open(file, mpt_summary_proc_show, PDE(inode)->data);
6664 .open = mpt_summary_proc_open,
6670 static int mpt_version_proc_show(
struct seq_file *m,
void *v)
6679 scsi = fc = sas = lan = ctl = targ = dmp = 0;
6682 if (MptCallbacks[cb_idx]) {
6683 switch (MptDriverClass[cb_idx]) {
6685 if (!scsi++) drvname =
"SPI host";
6688 if (!fc++) drvname =
"FC host";
6691 if (!sas++) drvname =
"SAS host";
6694 if (!lan++) drvname =
"LAN";
6697 if (!targ++) drvname =
"SCSI target";
6700 if (!ctl++) drvname =
"ioctl";
6705 seq_printf(m,
" Fusion MPT %s driver\n", drvname);
6712 static int mpt_version_proc_open(
struct inode *inode,
struct file *file)
6719 .open = mpt_version_proc_open,
6725 static int mpt_iocinfo_proc_show(
struct seq_file *m,
void *v)
6727 MPT_ADAPTER *ioc = m->
private;
6732 mpt_get_fw_exp_ver(expVer, ioc);
6736 seq_printf(m,
" (f/w download boot flag set)");
6740 seq_printf(m,
"\n ProductID = 0x%04x (%s)\n",
6741 ioc->facts.ProductID,
6743 seq_printf(m,
" FWVersion = 0x%08x%s", ioc->facts.FWVersion.Word, expVer);
6744 if (ioc->facts.FWImageSize)
6745 seq_printf(m,
" (fw_size=%d)", ioc->facts.FWImageSize);
6746 seq_printf(m,
"\n MsgVersion = 0x%04x\n", ioc->facts.MsgVersion);
6747 seq_printf(m,
" FirstWhoInit = 0x%02x\n", ioc->FirstWhoInit);
6748 seq_printf(m,
" EventState = 0x%02x\n", ioc->facts.EventState);
6750 seq_printf(m,
" CurrentHostMfaHighAddr = 0x%08x\n",
6751 ioc->facts.CurrentHostMfaHighAddr);
6752 seq_printf(m,
" CurrentSenseBufferHighAddr = 0x%08x\n",
6753 ioc->facts.CurrentSenseBufferHighAddr);
6755 seq_printf(m,
" MaxChainDepth = 0x%02x frames\n", ioc->facts.MaxChainDepth);
6756 seq_printf(m,
" MinBlockSize = 0x%02x bytes\n", 4*ioc->facts.BlockSize);
6758 seq_printf(m,
" RequestFrames @ 0x%p (Dma @ 0x%p)\n",
6759 (
void *)ioc->req_frames, (
void *)(
ulong)ioc->req_frames_dma);
6763 sz = (ioc->req_sz * ioc->req_depth) + 128;
6764 sz = ((sz + 0x1000
UL - 1
UL) / 0x1000) * 0x1000;
6765 seq_printf(m,
" {CurReqSz=%d} x {CurReqDepth=%d} = %d bytes ^= 0x%x\n",
6766 ioc->req_sz, ioc->req_depth, ioc->req_sz*ioc->req_depth, sz);
6767 seq_printf(m,
" {MaxReqSz=%d} {MaxReqDepth=%d}\n",
6768 4*ioc->facts.RequestFrameSize,
6769 ioc->facts.GlobalCredits);
6771 seq_printf(m,
" Frames @ 0x%p (Dma @ 0x%p)\n",
6772 (
void *)ioc->alloc, (
void *)(
ulong)ioc->alloc_dma);
6773 sz = (ioc->reply_sz * ioc->reply_depth) + 128;
6774 seq_printf(m,
" {CurRepSz=%d} x {CurRepDepth=%d} = %d bytes ^= 0x%x\n",
6775 ioc->reply_sz, ioc->reply_depth, ioc->reply_sz*ioc->reply_depth, sz);
6776 seq_printf(m,
" {MaxRepSz=%d} {MaxRepDepth=%d}\n",
6777 ioc->facts.CurReplyFrameSize,
6778 ioc->facts.ReplyQueueDepth);
6781 (ioc->facts.MaxDevices==0) ? 255 : ioc->facts.MaxDevices);
6782 seq_printf(m,
" MaxBuses = %d\n", ioc->facts.MaxBuses);
6785 for (p=0; p < ioc->facts.NumberOfPorts; p++) {
6788 ioc->facts.NumberOfPorts);
6789 if (ioc->bus_type ==
FC) {
6791 u8 *a = (
u8*)&ioc->lan_cnfg_page1.HardwareAddressLow;
6792 seq_printf(m,
" LanAddr = %02X:%02X:%02X:%02X:%02X:%02X\n",
6793 a[5], a[4], a[3], a[2], a[1], a[0]);
6796 ioc->fc_port_page0[p].WWNN.High,
6797 ioc->fc_port_page0[p].WWNN.Low,
6798 ioc->fc_port_page0[p].WWPN.High,
6799 ioc->fc_port_page0[p].WWPN.Low);
6806 static int mpt_iocinfo_proc_open(
struct inode *inode,
struct file *file)
6808 return single_open(file, mpt_iocinfo_proc_show, PDE(inode)->data);
6813 .open = mpt_iocinfo_proc_open,
6822 mpt_get_fw_exp_ver(
char *
buf, MPT_ADAPTER *ioc)
6825 if ((ioc->facts.FWVersion.Word >> 24) == 0x0E) {
6826 sprintf(buf,
" (Exp %02d%02d)",
6827 (ioc->facts.FWVersion.Word >> 16) & 0x00FF,
6828 (ioc->facts.FWVersion.Word >> 8) & 0x1F);
6831 if ((ioc->facts.FWVersion.Word >> 8) & 0x80)
6854 mpt_get_fw_exp_ver(expVer, ioc);
6859 y =
sprintf(buffer+len,
"%s: %s, %s%08xh%s, Ports=%d, MaxQ=%d",
6863 ioc->facts.FWVersion.Word,
6865 ioc->facts.NumberOfPorts,
6869 u8 *a = (
u8*)&ioc->lan_cnfg_page1.HardwareAddressLow;
6870 y +=
sprintf(buffer+len+y,
", LanAddr=%02X:%02X:%02X:%02X:%02X:%02X",
6871 a[5], a[4], a[3], a[2], a[1], a[0]);
6874 y +=
sprintf(buffer+len+y,
", IRQ=%d", ioc->pci_irq);
6877 y +=
sprintf(buffer+len+y,
" (disabled)");
6879 y +=
sprintf(buffer+len+y,
"\n");
6884 static void seq_mpt_print_ioc_summary(MPT_ADAPTER *ioc,
struct seq_file *m,
int showlan)
6888 mpt_get_fw_exp_ver(expVer, ioc);
6893 seq_printf(m,
"%s: %s, %s%08xh%s, Ports=%d, MaxQ=%d",
6897 ioc->facts.FWVersion.Word,
6899 ioc->facts.NumberOfPorts,
6903 u8 *a = (
u8*)&ioc->lan_cnfg_page1.HardwareAddressLow;
6904 seq_printf(m,
", LanAddr=%02X:%02X:%02X:%02X:%02X:%02X",
6905 a[5], a[4], a[3], a[2], a[1], a[0]);
6927 unsigned long flags;
6931 if (ioc->ioc_reset_in_progress || ioc->taskmgmt_in_progress ||
6932 (ioc->alt_ioc && ioc->alt_ioc->taskmgmt_in_progress)) {
6937 ioc->taskmgmt_in_progress = 1;
6938 ioc->taskmgmt_quiesce_io = 1;
6940 ioc->alt_ioc->taskmgmt_in_progress = 1;
6941 ioc->alt_ioc->taskmgmt_quiesce_io = 1;
6944 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
6957 unsigned long flags;
6960 ioc->taskmgmt_in_progress = 0;
6961 ioc->taskmgmt_quiesce_io = 0;
6963 ioc->alt_ioc->taskmgmt_in_progress = 0;
6964 ioc->alt_ioc->taskmgmt_quiesce_io = 0;
6966 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
6985 printk(MYIOC_s_ERR_FMT
"IOC is in FAULT state (%04xh)!!!\n",
6987 panic(
"%s: IOC Fault (%04xh)!!!\n", ioc->name,
6988 ioc_raw_state & MPI_DOORBELL_DATA_MASK);
6991 panic(
"%s: Firmware is halted due to command timeout\n",
7016 unsigned long flags;
7018 unsigned long time_count;
7020 dtmprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"SoftResetHandler Entered!\n",
7031 "skipping, either in FAULT or RESET state!\n", ioc->name));
7035 if (ioc->bus_type ==
FC) {
7037 "skipping, because the bus type is FC!\n", ioc->name));
7042 if (ioc->ioc_reset_in_progress) {
7043 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
7046 ioc->ioc_reset_in_progress = 1;
7047 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
7052 if (MptResetHandlers[cb_idx])
7053 mpt_signal_reset(cb_idx, ioc, MPT_IOC_SETUP_RESET);
7057 if (ioc->taskmgmt_in_progress) {
7058 ioc->ioc_reset_in_progress = 0;
7059 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
7062 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
7071 if (MptResetHandlers[cb_idx])
7072 mpt_signal_reset(cb_idx, ioc, MPT_IOC_PRE_RESET);
7082 for (ii = 0; ii < 5; ii++) {
7084 rc = GetIocFacts(ioc, sleepFlag,
7085 MPT_HOSTEVENT_IOC_RECOVER);
7096 rc = PrimeIocFifos(ioc);
7100 rc = SendIocInit(ioc, sleepFlag);
7104 rc = SendEventNotification(ioc, 1, sleepFlag);
7108 if (ioc->hard_resets < -1)
7120 ioc->ioc_reset_in_progress = 0;
7121 ioc->taskmgmt_quiesce_io = 0;
7122 ioc->taskmgmt_in_progress = 0;
7123 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
7127 if (MptResetHandlers[cb_idx])
7128 mpt_signal_reset(cb_idx, ioc,
7129 MPT_IOC_POST_RESET);
7134 "SoftResetHandler: completed (%d seconds): %s\n",
7136 ((rc == 0) ?
"SUCCESS" :
"FAILED")));
7188 unsigned long flags;
7189 unsigned long time_count;
7191 dtmprintk(ioc,
printk(MYIOC_s_DEBUG_FMT
"HardResetHandler Entered!\n", ioc->name));
7193 printk(MYIOC_s_INFO_FMT
"HardResetHandler Entered!\n", ioc->name);
7194 printk(
"MF count 0x%x !\n", ioc->mfcnt);
7203 if (ioc->ioc_reset_in_progress) {
7204 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
7205 ioc->wait_on_reset_completion = 1;
7208 }
while (ioc->ioc_reset_in_progress == 1);
7209 ioc->wait_on_reset_completion = 0;
7210 return ioc->reset_status;
7212 if (ioc->wait_on_reset_completion) {
7213 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
7218 ioc->ioc_reset_in_progress = 1;
7220 ioc->alt_ioc->ioc_reset_in_progress = 1;
7221 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
7230 if (MptResetHandlers[cb_idx]) {
7231 mpt_signal_reset(cb_idx, ioc, MPT_IOC_SETUP_RESET);
7233 mpt_signal_reset(cb_idx, ioc->alt_ioc,
7234 MPT_IOC_SETUP_RESET);
7239 rc = mpt_do_ioc_recovery(ioc, MPT_HOSTEVENT_IOC_RECOVER, sleepFlag);
7242 ": WARNING - (%d) Cannot recover %s, doorbell=0x%08x\n",
7245 if (ioc->hard_resets < -1)
7250 ioc->ioc_reset_in_progress = 0;
7251 ioc->taskmgmt_quiesce_io = 0;
7252 ioc->taskmgmt_in_progress = 0;
7253 ioc->reset_status =
rc;
7255 ioc->alt_ioc->ioc_reset_in_progress = 0;
7256 ioc->alt_ioc->taskmgmt_quiesce_io = 0;
7257 ioc->alt_ioc->taskmgmt_in_progress = 0;
7259 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
7262 if (MptResetHandlers[cb_idx]) {
7263 mpt_signal_reset(cb_idx, ioc, MPT_IOC_POST_RESET);
7265 mpt_signal_reset(cb_idx,
7266 ioc->alt_ioc, MPT_IOC_POST_RESET);
7272 "HardResetHandler: completed (%d seconds): %s\n", ioc->name,
7274 "SUCCESS" :
"FAILED")));
7279 #ifdef CONFIG_FUSION_LOGGING
7287 char *evStr = ioc->evStr;
7300 ds =
"State Change";
7303 ds =
"Unit Attention";
7306 ds =
"IOC Bus Reset";
7309 ds =
"External Bus Reset";
7312 ds =
"Bus Rescan Event";
7316 ds =
"Link Status(FAILURE) Change";
7318 ds =
"Link Status(ACTIVE) Change";
7322 ds =
"Loop State(LIP) Change";
7324 ds =
"Loop State(LPE) Change";
7326 ds =
"Loop State(LPB) Change";
7339 u8 ReasonCode = (
u8)(evData0 >> 16);
7340 switch (ReasonCode) {
7342 ds =
"Integrated Raid: Volume Created";
7345 ds =
"Integrated Raid: Volume Deleted";
7348 ds =
"Integrated Raid: Volume Settings Changed";
7351 ds =
"Integrated Raid: Volume Status Changed";
7354 ds =
"Integrated Raid: Volume Physdisk Changed";
7357 ds =
"Integrated Raid: Physdisk Created";
7360 ds =
"Integrated Raid: Physdisk Deleted";
7363 ds =
"Integrated Raid: Physdisk Settings Changed";
7366 ds =
"Integrated Raid: Physdisk Status Changed";
7369 ds =
"Integrated Raid: Domain Validation Needed";
7372 ds =
"Integrated Raid; Smart Data";
7375 ds =
"Integrated Raid: Replace Action Started";
7378 ds =
"Integrated Raid";
7384 ds =
"SCSI Device Status Change";
7388 u8 id = (
u8)(evData0);
7389 u8 channel = (
u8)(evData0 >> 8);
7390 u8 ReasonCode = (
u8)(evData0 >> 16);
7391 switch (ReasonCode) {
7394 "SAS Device Status Change: Added: "
7395 "id=%d channel=%d",
id, channel);
7399 "SAS Device Status Change: Deleted: "
7400 "id=%d channel=%d",
id, channel);
7404 "SAS Device Status Change: SMART Data: "
7405 "id=%d channel=%d",
id, channel);
7409 "SAS Device Status Change: No Persistancy: "
7410 "id=%d channel=%d",
id, channel);
7414 "SAS Device Status Change: Unsupported Device "
7415 "Discovered : id=%d channel=%d",
id, channel);
7419 "SAS Device Status Change: Internal Device "
7420 "Reset : id=%d channel=%d",
id, channel);
7424 "SAS Device Status Change: Internal Task "
7425 "Abort : id=%d channel=%d",
id, channel);
7429 "SAS Device Status Change: Internal Abort "
7430 "Task Set : id=%d channel=%d",
id, channel);
7434 "SAS Device Status Change: Internal Clear "
7435 "Task Set : id=%d channel=%d",
id, channel);
7439 "SAS Device Status Change: Internal Query "
7440 "Task : id=%d channel=%d",
id, channel);
7444 "SAS Device Status Change: Unknown: "
7445 "id=%d channel=%d",
id, channel);
7451 ds =
"Bus Timer Expired";
7455 u16 curr_depth = (
u16)(evData0 >> 16);
7456 u8 channel = (
u8)(evData0 >> 8);
7457 u8 id = (
u8)(evData0);
7460 "Queue Full: channel=%d id=%d depth=%d",
7461 channel,
id, curr_depth);
7465 ds =
"SAS SES Event";
7468 ds =
"Persistent Table Full";
7472 u8 LinkRates = (
u8)(evData0 >> 8);
7473 u8 PhyNumber = (
u8)(evData0);
7476 switch (LinkRates) {
7479 "SAS PHY Link Status: Phy=%d:"
7480 " Rate Unknown",PhyNumber);
7484 "SAS PHY Link Status: Phy=%d:"
7485 " Phy Disabled",PhyNumber);
7489 "SAS PHY Link Status: Phy=%d:"
7490 " Failed Speed Nego",PhyNumber);
7494 "SAS PHY Link Status: Phy=%d:"
7495 " Sata OOB Completed",PhyNumber);
7499 "SAS PHY Link Status: Phy=%d:"
7500 " Rate 1.5 Gbps",PhyNumber);
7504 "SAS PHY Link Status: Phy=%d:"
7505 " Rate 3.0 Gbps", PhyNumber);
7509 "SAS PHY Link Status: Phy=%d:"
7510 " Rate 6.0 Gbps", PhyNumber);
7514 "SAS PHY Link Status: Phy=%d", PhyNumber);
7520 ds =
"SAS Discovery Error";
7524 u8 resync_complete = (
u8)(evData0 >> 16);
7526 "IR Resync Update: Complete = %d:",resync_complete);
7531 u8 id = (
u8)(evData0);
7532 u8 channel = (
u8)(evData0 >> 8);
7533 u8 phys_num = (
u8)(evData0 >> 24);
7534 u8 ReasonCode = (
u8)(evData0 >> 16);
7536 switch (ReasonCode) {
7539 "IR2: LD State Changed: "
7540 "id=%d channel=%d phys_num=%d",
7541 id, channel, phys_num);
7545 "IR2: PD State Changed "
7546 "id=%d channel=%d phys_num=%d",
7547 id, channel, phys_num);
7551 "IR2: Bad Block Table Full: "
7552 "id=%d channel=%d phys_num=%d",
7553 id, channel, phys_num);
7557 "IR2: PD Inserted: "
7558 "id=%d channel=%d phys_num=%d",
7559 id, channel, phys_num);
7564 "id=%d channel=%d phys_num=%d",
7565 id, channel, phys_num);
7569 "IR2: Foreign CFG Detected: "
7570 "id=%d channel=%d phys_num=%d",
7571 id, channel, phys_num);
7575 "IR2: Rebuild Medium Error: "
7576 "id=%d channel=%d phys_num=%d",
7577 id, channel, phys_num);
7581 "IR2: Dual Port Added: "
7582 "id=%d channel=%d phys_num=%d",
7583 id, channel, phys_num);
7587 "IR2: Dual Port Removed: "
7588 "id=%d channel=%d phys_num=%d",
7589 id, channel, phys_num);
7600 ds =
"SAS Discovery: Start";
7602 ds =
"SAS Discovery: Stop";
7606 ds =
"SAS Log Entry Added";
7611 u8 phy_num = (
u8)(evData0);
7613 u8 port_width = (
u8)(evData0 >> 16);
7614 u8 primative = (
u8)(evData0 >> 24);
7616 "SAS Broadcase Primative: phy=%d port=%d "
7617 "width=%d primative=0x%02x",
7618 phy_num, port_num, port_width, primative);
7624 u8 reason = (
u8)(evData0);
7628 ds =
"SAS Initiator Status Change: Added";
7631 ds =
"SAS Initiator Status Change: Deleted";
7634 ds =
"SAS Initiator Status Change";
7642 u8 max_init = (
u8)(evData0);
7643 u8 current_init = (
u8)(evData0 >> 8);
7646 "SAS Initiator Device Table Overflow: max initiators=%02d "
7647 "current initators=%02d",
7648 max_init, current_init);
7653 u8 status = (
u8)(evData0);
7654 u8 port_num = (
u8)(evData0 >> 8);
7659 "SAS SMP Error: port=%d result=0x%02x",
7663 "SAS SMP Error: port=%d : CRC Error",
7667 "SAS SMP Error: port=%d : Timeout",
7671 "SAS SMP Error: port=%d : No Destination",
7675 "SAS SMP Error: port=%d : Bad Destination",
7679 "SAS SMP Error: port=%d : status=0x%02x",
7686 u8 reason = (
u8)(evData0);
7690 ds =
"Expander Status Change: Added";
7693 ds =
"Expander Status Change: Deleted";
7696 ds =
"Expander Status Change";
7714 "MPT event:(%02Xh) : %s\n",
7715 ioc->name, event, evStr));
7718 ": Event data:\n"));
7756 #ifdef CONFIG_FUSION_LOGGING
7758 mpt_display_event_info(ioc, pEventReply);
7767 u8 evState = evData0 & 0xFF;
7772 if (ioc->facts.Function) {
7773 ioc->facts.EventState = evState;
7778 mptbase_raid_process_event_data(ioc,
7789 if (ioc->events && (ioc->eventTypes & ( 1 << event))) {
7792 idx = ioc->eventContext % MPTCTL_EVENT_LOG_SIZE;
7795 ioc->events[
idx].eventContext = ioc->eventContext;
7797 for (ii = 0; ii < 2; ii++) {
7801 ioc->events[
idx].data[ii] = 0;
7804 ioc->eventContext++;
7812 if (MptEvHandlers[cb_idx]) {
7814 "Routing Event to event handler #%d\n",
7815 ioc->name, cb_idx));
7816 r += (*(MptEvHandlers[cb_idx]))(ioc, pEventReply);
7827 "EventAck required\n",ioc->name));
7828 if ((ii = SendEventAck(ioc, pEventReply)) != 0) {
7834 *evHandlers = handlers;
7847 mpt_fc_log_info(MPT_ADAPTER *ioc,
u32 log_info)
7849 char *
desc =
"unknown";
7851 switch (log_info & 0xFF000000) {
7853 desc =
"FCP Initiator";
7856 desc =
"FCP Target";
7862 desc =
"MPI Message Layer";
7868 desc =
"Context Manager";
7871 desc =
"Invalid Field Offset";
7874 desc =
"State Change Info";
7878 printk(MYIOC_s_INFO_FMT
"LogInfo(0x%08x): SubClass={%s}, Value=(0x%06x)\n",
7879 ioc->name, log_info, desc, (log_info & 0xFFFFFF));
7891 mpt_spi_log_info(MPT_ADAPTER *ioc,
u32 log_info)
7893 u32 info = log_info & 0x00FF0000;
7894 char *desc =
"unknown";
7898 desc =
"bug! MID not found";
7902 desc =
"Parity Error";
7906 desc =
"ASYNC Outbound Overrun";
7910 desc =
"SYNC Offset Error";
7918 desc =
"Msg In Overflow";
7926 desc =
"Outbound DMA Overrun";
7930 desc =
"Task Management";
7934 desc =
"Device Problem";
7938 desc =
"Invalid Phase Change";
7942 desc =
"Untagged Table Size";
7947 printk(MYIOC_s_INFO_FMT
"LogInfo(0x%08x): F/W: %s\n", ioc->name, log_info, desc);
7951 static char *originator_str[] = {
7956 static char *iop_code_str[] = {
7958 "Invalid SAS Address",
7961 "Diag Message Error",
7963 "Enclosure Management",
7966 static char *pl_code_str[] = {
7969 "Invalid Scatter Gather List",
7970 "Wrong Relative Offset or Frame Length",
7971 "Frame Transfer Error",
7972 "Transmit Frame Connected Low",
7973 "SATA Non-NCQ RW Error Bit Set",
7974 "SATA Read Log Receive Data Error",
7975 "SATA NCQ Fail All Commands After Error",
7976 "SATA Error in Receive Set Device Bit FIS",
7977 "Receive Frame Invalid Message",
7978 "Receive Context Message Valid Error",
7979 "Receive Frame Current Frame Error",
7981 "Discovery SATA Init W IOS",
7982 "Config Invalid Page",
7983 "Discovery SATA Init Timeout",
7986 "IO Not Yet Executed",
7988 "Persistent Reservation Out Not Affiliation "
7990 "Open Transmit DMA Abort",
7991 "IO Device Missing Delay Retry",
7992 "IO Cancelled Due to Receive Error",
8000 "Enclosure Management"
8002 static char *ir_code_str[] = {
8003 "Raid Action Error",
8013 static char *raid_sub_code_str[] = {
8015 "Volume Creation Failed: Data Passed too "
8017 "Volume Creation Failed: Duplicate Volumes "
8019 "Volume Creation Failed: Max Number "
8020 "Supported Volumes Exceeded",
8021 "Volume Creation Failed: DMA Error",
8022 "Volume Creation Failed: Invalid Volume Type",
8023 "Volume Creation Failed: Error Reading "
8025 "Volume Creation Failed: Creating Internal "
8035 "Activation failed: Already Active Volume",
8036 "Activation failed: Unsupported Volume Type",
8037 "Activation failed: Too Many Active Volumes",
8038 "Activation failed: Volume ID in Use",
8039 "Activation failed: Reported Failure",
8040 "Activation failed: Importing a Volume",
8051 "Phys Disk failed: Too Many Phys Disks",
8052 "Phys Disk failed: Data Passed too Large",
8053 "Phys Disk failed: DMA Error",
8054 "Phys Disk failed: Invalid <channel:id>",
8055 "Phys Disk failed: Creating Phys Disk Config "
8068 "Compatibility Error: IR Disabled",
8069 "Compatibility Error: Inquiry Command Failed",
8070 "Compatibility Error: Device not Direct Access "
8072 "Compatibility Error: Removable Device Found",
8073 "Compatibility Error: Device SCSI Version not "
8075 "Compatibility Error: SATA Device, 48 BIT LBA "
8077 "Compatibility Error: Device doesn't have "
8078 "512 Byte Block Sizes",
8079 "Compatibility Error: Volume Type Check Failed",
8080 "Compatibility Error: Volume Type is "
8081 "Unsupported by FW",
8082 "Compatibility Error: Disk Drive too Small for "
8084 "Compatibility Error: Phys Disk for Create "
8086 "Compatibility Error: Too Many or too Few "
8087 "Disks for Volume Type",
8088 "Compatibility Error: Disk stripe Sizes "
8090 "Compatibility Error: IME Size Limited to < 2TB",
8103 mpt_sas_log_info(MPT_ADAPTER *ioc,
u32 log_info,
u8 cb_idx)
8105 union loginfo_type {
8114 union loginfo_type sas_loginfo;
8115 char *originator_desc =
NULL;
8116 char *code_desc =
NULL;
8117 char *sub_code_desc =
NULL;
8119 sas_loginfo.loginfo = log_info;
8120 if ((sas_loginfo.dw.bus_type != 3 ) &&
8121 (sas_loginfo.dw.originator <
ARRAY_SIZE(originator_str)))
8124 originator_desc = originator_str[sas_loginfo.dw.originator];
8126 switch (sas_loginfo.dw.originator) {
8129 if (sas_loginfo.dw.code <
8131 code_desc = iop_code_str[sas_loginfo.dw.code];
8134 if (sas_loginfo.dw.code <
8136 code_desc = pl_code_str[sas_loginfo.dw.code];
8139 if (sas_loginfo.dw.code >=
8142 code_desc = ir_code_str[sas_loginfo.dw.code];
8143 if (sas_loginfo.dw.subcode >=
8146 if (sas_loginfo.dw.code == 0)
8148 raid_sub_code_str[sas_loginfo.dw.subcode];
8154 if (sub_code_desc !=
NULL)
8156 "LogInfo(0x%08x): Originator={%s}, Code={%s},"
8157 " SubCode={%s} cb_idx %s\n",
8158 ioc->name, log_info, originator_desc, code_desc,
8159 sub_code_desc, MptCallbacksName[cb_idx]);
8160 else if (code_desc !=
NULL)
8162 "LogInfo(0x%08x): Originator={%s}, Code={%s},"
8163 " SubCode(0x%04x) cb_idx %s\n",
8164 ioc->name, log_info, originator_desc, code_desc,
8165 sas_loginfo.dw.subcode, MptCallbacksName[cb_idx]);
8168 "LogInfo(0x%08x): Originator={%s}, Code=(0x%02x),"
8169 " SubCode(0x%04x) cb_idx %s\n",
8170 ioc->name, log_info, originator_desc,
8171 sas_loginfo.dw.code, sas_loginfo.dw.subcode,
8172 MptCallbacksName[cb_idx]);
8185 mpt_iocstatus_info_config(MPT_ADAPTER *ioc,
u32 ioc_status, MPT_FRAME_HDR *mf)
8217 "type=%02Xh, page=%02Xh, action=%02Xh, form=%08Xh",
8220 switch (ioc_status) {
8223 desc =
"Config Page Invalid Action";
8227 desc =
"Config Page Invalid Type";
8231 desc =
"Config Page Invalid Page";
8235 desc =
"Config Page Invalid Data";
8239 desc =
"Config Page No Defaults";
8243 desc =
"Config Page Can't Commit";
8251 ioc->name, ioc_status, desc, extend_desc));
8263 mpt_iocstatus_info(MPT_ADAPTER *ioc,
u32 ioc_status, MPT_FRAME_HDR *mf)
8275 desc =
"Invalid Function";
8283 desc =
"Invalid SGL";
8287 desc =
"Internal Error";
8295 desc =
"Insufficient Resources";
8299 desc =
"Invalid Field";
8303 desc =
"Invalid State";
8316 mpt_iocstatus_info_config(ioc, status, mf);
8346 desc =
"Target: Priority IO";
8350 desc =
"Target: Invalid Port";
8354 desc =
"Target Invalid IO Index:";
8358 desc =
"Target: Aborted";
8362 desc =
"Target: No Conn Retryable";
8366 desc =
"Target: No Connection";
8370 desc =
"Target: Transfer Count Mismatch";
8374 desc =
"Target: STS Data not Sent";
8378 desc =
"Target: Data Offset Error";
8382 desc =
"Target: Too Much Write Data";
8386 desc =
"Target: IU Too Short";
8390 desc =
"Target: ACK NAK Timeout";
8394 desc =
"Target: Nak Received";
8402 desc =
"FC: Aborted";
8406 desc =
"FC: RX ID Invalid";
8410 desc =
"FC: DID Invalid";
8414 desc =
"FC: Node Logged Out";
8418 desc =
"FC: Exchange Canceled";
8426 desc =
"LAN: Device not Found";
8430 desc =
"LAN: Device Failure";
8434 desc =
"LAN: Transmit Error";
8438 desc =
"LAN: Transmit Aborted";
8442 desc =
"LAN: Receive Error";
8446 desc =
"LAN: Receive Aborted";
8450 desc =
"LAN: Partial Packet";
8454 desc =
"LAN: Canceled";
8462 desc =
"SAS: SMP Request Failed";
8466 desc =
"SAS: SMP Data Overrun";
8478 ioc->name, status, desc));
8528 MptCallbacks[cb_idx] =
NULL;
8529 MptDriverClass[cb_idx] = MPTUNKNOWN_DRIVER;
8530 MptEvHandlers[cb_idx] =
NULL;
8531 MptResetHandlers[cb_idx] =
NULL;
8537 mpt_base_index =
mpt_register(mptbase_reply, MPTBASE_DRIVER,
8544 #ifdef CONFIG_PROC_FS
8545 (
void) procmpt_create();
8563 #ifdef CONFIG_PROC_FS