diff options
Diffstat (limited to 'drivers/message/fusion/mptbase.c')
-rw-r--r-- | drivers/message/fusion/mptbase.c | 113 |
1 files changed, 1 insertions, 112 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index a3751d86216e..642a61b6d0a4 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c | |||
@@ -452,8 +452,7 @@ mpt_base_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *reply) | |||
452 | } else if (func == MPI_FUNCTION_EVENT_ACK) { | 452 | } else if (func == MPI_FUNCTION_EVENT_ACK) { |
453 | dprintk((MYIOC_s_INFO_FMT "mpt_base_reply, EventAck reply received\n", | 453 | dprintk((MYIOC_s_INFO_FMT "mpt_base_reply, EventAck reply received\n", |
454 | ioc->name)); | 454 | ioc->name)); |
455 | } else if (func == MPI_FUNCTION_CONFIG || | 455 | } else if (func == MPI_FUNCTION_CONFIG) { |
456 | func == MPI_FUNCTION_TOOLBOX) { | ||
457 | CONFIGPARMS *pCfg; | 456 | CONFIGPARMS *pCfg; |
458 | unsigned long flags; | 457 | unsigned long flags; |
459 | 458 | ||
@@ -5327,115 +5326,6 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg) | |||
5327 | } | 5326 | } |
5328 | 5327 | ||
5329 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 5328 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
5330 | /** | ||
5331 | * mpt_toolbox - Generic function to issue toolbox message | ||
5332 | * @ioc - Pointer to an adapter structure | ||
5333 | * @cfg - Pointer to a toolbox structure. Struct contains | ||
5334 | * action, page address, direction, physical address | ||
5335 | * and pointer to a configuration page header | ||
5336 | * Page header is updated. | ||
5337 | * | ||
5338 | * Returns 0 for success | ||
5339 | * -EPERM if not allowed due to ISR context | ||
5340 | * -EAGAIN if no msg frames currently available | ||
5341 | * -EFAULT for non-successful reply or no reply (timeout) | ||
5342 | */ | ||
5343 | int | ||
5344 | mpt_toolbox(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg) | ||
5345 | { | ||
5346 | ToolboxIstwiReadWriteRequest_t *pReq; | ||
5347 | MPT_FRAME_HDR *mf; | ||
5348 | struct pci_dev *pdev; | ||
5349 | unsigned long flags; | ||
5350 | int rc; | ||
5351 | u32 flagsLength; | ||
5352 | int in_isr; | ||
5353 | |||
5354 | /* Prevent calling wait_event() (below), if caller happens | ||
5355 | * to be in ISR context, because that is fatal! | ||
5356 | */ | ||
5357 | in_isr = in_interrupt(); | ||
5358 | if (in_isr) { | ||
5359 | dcprintk((MYIOC_s_WARN_FMT "toobox request not allowed in ISR context!\n", | ||
5360 | ioc->name)); | ||
5361 | return -EPERM; | ||
5362 | } | ||
5363 | |||
5364 | /* Get and Populate a free Frame | ||
5365 | */ | ||
5366 | if ((mf = mpt_get_msg_frame(mpt_base_index, ioc)) == NULL) { | ||
5367 | dcprintk((MYIOC_s_WARN_FMT "mpt_toolbox: no msg frames!\n", | ||
5368 | ioc->name)); | ||
5369 | return -EAGAIN; | ||
5370 | } | ||
5371 | pReq = (ToolboxIstwiReadWriteRequest_t *)mf; | ||
5372 | pReq->Tool = pCfg->action; | ||
5373 | pReq->Reserved = 0; | ||
5374 | pReq->ChainOffset = 0; | ||
5375 | pReq->Function = MPI_FUNCTION_TOOLBOX; | ||
5376 | pReq->Reserved1 = 0; | ||
5377 | pReq->Reserved2 = 0; | ||
5378 | pReq->MsgFlags = 0; | ||
5379 | pReq->Flags = pCfg->dir; | ||
5380 | pReq->BusNum = 0; | ||
5381 | pReq->Reserved3 = 0; | ||
5382 | pReq->NumAddressBytes = 0x01; | ||
5383 | pReq->Reserved4 = 0; | ||
5384 | pReq->DataLength = cpu_to_le16(0x04); | ||
5385 | pdev = ioc->pcidev; | ||
5386 | if (pdev->devfn & 1) | ||
5387 | pReq->DeviceAddr = 0xB2; | ||
5388 | else | ||
5389 | pReq->DeviceAddr = 0xB0; | ||
5390 | pReq->Addr1 = 0; | ||
5391 | pReq->Addr2 = 0; | ||
5392 | pReq->Addr3 = 0; | ||
5393 | pReq->Reserved5 = 0; | ||
5394 | |||
5395 | /* Add a SGE to the config request. | ||
5396 | */ | ||
5397 | |||
5398 | flagsLength = MPT_SGE_FLAGS_SSIMPLE_READ | 4; | ||
5399 | |||
5400 | mpt_add_sge((char *)&pReq->SGL, flagsLength, pCfg->physAddr); | ||
5401 | |||
5402 | dcprintk((MYIOC_s_INFO_FMT "Sending Toolbox request, Tool=%x\n", | ||
5403 | ioc->name, pReq->Tool)); | ||
5404 | |||
5405 | /* Append pCfg pointer to end of mf | ||
5406 | */ | ||
5407 | *((void **) (((u8 *) mf) + (ioc->req_sz - sizeof(void *)))) = (void *) pCfg; | ||
5408 | |||
5409 | /* Initalize the timer | ||
5410 | */ | ||
5411 | init_timer(&pCfg->timer); | ||
5412 | pCfg->timer.data = (unsigned long) ioc; | ||
5413 | pCfg->timer.function = mpt_timer_expired; | ||
5414 | pCfg->wait_done = 0; | ||
5415 | |||
5416 | /* Set the timer; ensure 10 second minimum */ | ||
5417 | if (pCfg->timeout < 10) | ||
5418 | pCfg->timer.expires = jiffies + HZ*10; | ||
5419 | else | ||
5420 | pCfg->timer.expires = jiffies + HZ*pCfg->timeout; | ||
5421 | |||
5422 | /* Add to end of Q, set timer and then issue this command */ | ||
5423 | spin_lock_irqsave(&ioc->FreeQlock, flags); | ||
5424 | list_add_tail(&pCfg->linkage, &ioc->configQ); | ||
5425 | spin_unlock_irqrestore(&ioc->FreeQlock, flags); | ||
5426 | |||
5427 | add_timer(&pCfg->timer); | ||
5428 | mpt_put_msg_frame(mpt_base_index, ioc, mf); | ||
5429 | wait_event(mpt_waitq, pCfg->wait_done); | ||
5430 | |||
5431 | /* mf has been freed - do not access */ | ||
5432 | |||
5433 | rc = pCfg->status; | ||
5434 | |||
5435 | return rc; | ||
5436 | } | ||
5437 | |||
5438 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | ||
5439 | /* | 5329 | /* |
5440 | * mpt_timer_expired - Call back for timer process. | 5330 | * mpt_timer_expired - Call back for timer process. |
5441 | * Used only internal config functionality. | 5331 | * Used only internal config functionality. |
@@ -6540,7 +6430,6 @@ EXPORT_SYMBOL(mpt_lan_index); | |||
6540 | EXPORT_SYMBOL(mpt_stm_index); | 6430 | EXPORT_SYMBOL(mpt_stm_index); |
6541 | EXPORT_SYMBOL(mpt_HardResetHandler); | 6431 | EXPORT_SYMBOL(mpt_HardResetHandler); |
6542 | EXPORT_SYMBOL(mpt_config); | 6432 | EXPORT_SYMBOL(mpt_config); |
6543 | EXPORT_SYMBOL(mpt_toolbox); | ||
6544 | EXPORT_SYMBOL(mpt_findImVolumes); | 6433 | EXPORT_SYMBOL(mpt_findImVolumes); |
6545 | EXPORT_SYMBOL(mpt_read_ioc_pg_3); | 6434 | EXPORT_SYMBOL(mpt_read_ioc_pg_3); |
6546 | EXPORT_SYMBOL(mpt_alloc_fw_memory); | 6435 | EXPORT_SYMBOL(mpt_alloc_fw_memory); |