lpfc_init.c (8fa38513ddc1076f3e26c651f3567b084c273ba2) lpfc_init.c (a0c87cbdb52467a16343b31251f2722643db603c)
1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2009 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com *
7 * Portions Copyright (C) 2004-2005 Christoph Hellwig *
8 * *

--- 197 unchanged lines hidden (view full) ---

206 sizeof (phba->RandomData));
207
208 /* Get adapter VPD information */
209 lpfc_vpd_data = kmalloc(DMP_VPD_SIZE, GFP_KERNEL);
210 if (!lpfc_vpd_data)
211 goto out_free_mbox;
212
213 do {
1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2009 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com *
7 * Portions Copyright (C) 2004-2005 Christoph Hellwig *
8 * *

--- 197 unchanged lines hidden (view full) ---

206 sizeof (phba->RandomData));
207
208 /* Get adapter VPD information */
209 lpfc_vpd_data = kmalloc(DMP_VPD_SIZE, GFP_KERNEL);
210 if (!lpfc_vpd_data)
211 goto out_free_mbox;
212
213 do {
214 lpfc_dump_mem(phba, pmb, offset);
214 lpfc_dump_mem(phba, pmb, offset, DMP_REGION_VPD);
215 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL);
216
217 if (rc != MBX_SUCCESS) {
218 lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
219 "0441 VPD not present on adapter, "
220 "mbxCmd x%x DUMP VPD, mbxStatus x%x\n",
221 mb->mbxCommand, mb->mbxStatus);
222 mb->un.varDmp.word_cnt = 0;

--- 197 unchanged lines hidden (view full) ---

420 "0453 Adapter failed to init, mbxCmd x%x "
421 "READ_CONFIG, mbxStatus x%x\n",
422 mb->mbxCommand, mb->mbxStatus);
423 phba->link_state = LPFC_HBA_ERROR;
424 mempool_free( pmb, phba->mbox_mem_pool);
425 return -EIO;
426 }
427
215 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL);
216
217 if (rc != MBX_SUCCESS) {
218 lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
219 "0441 VPD not present on adapter, "
220 "mbxCmd x%x DUMP VPD, mbxStatus x%x\n",
221 mb->mbxCommand, mb->mbxStatus);
222 mb->un.varDmp.word_cnt = 0;

--- 197 unchanged lines hidden (view full) ---

420 "0453 Adapter failed to init, mbxCmd x%x "
421 "READ_CONFIG, mbxStatus x%x\n",
422 mb->mbxCommand, mb->mbxStatus);
423 phba->link_state = LPFC_HBA_ERROR;
424 mempool_free( pmb, phba->mbox_mem_pool);
425 return -EIO;
426 }
427
428 /* Check if the port is disabled */
429 lpfc_sli_read_link_ste(phba);
430
428 /* Reset the DFT_HBA_Q_DEPTH to the max xri */
429 if (phba->cfg_hba_queue_depth > (mb->un.varRdConfig.max_xri+1))
430 phba->cfg_hba_queue_depth =
431 (mb->un.varRdConfig.max_xri + 1) -
432 lpfc_sli4_get_els_iocb_cnt(phba);
433
434 phba->lmt = mb->un.varRdConfig.lmt;
435

--- 83 unchanged lines hidden (view full) ---

519 mod_timer(&vport->els_tmofunc, jiffies + HZ * timeout);
520 /* Set up heart beat (HB) timer */
521 mod_timer(&phba->hb_tmofunc, jiffies + HZ * LPFC_HB_MBOX_INTERVAL);
522 phba->hb_outstanding = 0;
523 phba->last_completion_time = jiffies;
524 /* Set up error attention (ERATT) polling timer */
525 mod_timer(&phba->eratt_poll, jiffies + HZ * LPFC_ERATT_POLL_INTERVAL);
526
431 /* Reset the DFT_HBA_Q_DEPTH to the max xri */
432 if (phba->cfg_hba_queue_depth > (mb->un.varRdConfig.max_xri+1))
433 phba->cfg_hba_queue_depth =
434 (mb->un.varRdConfig.max_xri + 1) -
435 lpfc_sli4_get_els_iocb_cnt(phba);
436
437 phba->lmt = mb->un.varRdConfig.lmt;
438

--- 83 unchanged lines hidden (view full) ---

522 mod_timer(&vport->els_tmofunc, jiffies + HZ * timeout);
523 /* Set up heart beat (HB) timer */
524 mod_timer(&phba->hb_tmofunc, jiffies + HZ * LPFC_HB_MBOX_INTERVAL);
525 phba->hb_outstanding = 0;
526 phba->last_completion_time = jiffies;
527 /* Set up error attention (ERATT) polling timer */
528 mod_timer(&phba->eratt_poll, jiffies + HZ * LPFC_ERATT_POLL_INTERVAL);
529
527 lpfc_init_link(phba, pmb, phba->cfg_topology, phba->cfg_link_speed);
528 pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
529 lpfc_set_loopback_flag(phba);
530 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT);
531 if (rc != MBX_SUCCESS) {
532 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
530 /* Check if the port is disabled */
531 lpfc_sli_read_serdes_param(phba);
532
533 if (phba->hba_flag & LINK_DISABLED) {
534 lpfc_printf_log(phba,
535 KERN_ERR, LOG_INIT,
536 "2598 Adapter Link is disabled.\n");
537 lpfc_down_link(phba, pmb);
538 pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
539 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT);
540 if ((rc != MBX_SUCCESS) && (rc != MBX_BUSY)) {
541 lpfc_printf_log(phba,
542 KERN_ERR, LOG_INIT,
543 "2599 Adapter failed to issue DOWN_LINK"
544 " mbox command rc 0x%x\n", rc);
545
546 mempool_free(pmb, phba->mbox_mem_pool);
547 return -EIO;
548 }
549 } else {
550 lpfc_init_link(phba, pmb, phba->cfg_topology,
551 phba->cfg_link_speed);
552 pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
553 lpfc_set_loopback_flag(phba);
554 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT);
555 if (rc != MBX_SUCCESS) {
556 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
533 "0454 Adapter failed to init, mbxCmd x%x "
534 "INIT_LINK, mbxStatus x%x\n",
535 mb->mbxCommand, mb->mbxStatus);
536
557 "0454 Adapter failed to init, mbxCmd x%x "
558 "INIT_LINK, mbxStatus x%x\n",
559 mb->mbxCommand, mb->mbxStatus);
560
537 /* Clear all interrupt enable conditions */
538 writel(0, phba->HCregaddr);
539 readl(phba->HCregaddr); /* flush */
540 /* Clear all pending interrupts */
541 writel(0xffffffff, phba->HAregaddr);
542 readl(phba->HAregaddr); /* flush */
561 /* Clear all interrupt enable conditions */
562 writel(0, phba->HCregaddr);
563 readl(phba->HCregaddr); /* flush */
564 /* Clear all pending interrupts */
565 writel(0xffffffff, phba->HAregaddr);
566 readl(phba->HAregaddr); /* flush */
543
567
544 phba->link_state = LPFC_HBA_ERROR;
545 if (rc != MBX_BUSY)
546 mempool_free(pmb, phba->mbox_mem_pool);
547 return -EIO;
568 phba->link_state = LPFC_HBA_ERROR;
569 if (rc != MBX_BUSY)
570 mempool_free(pmb, phba->mbox_mem_pool);
571 return -EIO;
572 }
548 }
549 /* MBOX buffer will be freed in mbox compl */
550 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
551 lpfc_config_async(phba, pmb, LPFC_ELS_RING);
552 pmb->mbox_cmpl = lpfc_config_async_cmpl;
553 pmb->vport = phba->pport;
554 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT);
555

--- 7487 unchanged lines hidden ---
573 }
574 /* MBOX buffer will be freed in mbox compl */
575 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
576 lpfc_config_async(phba, pmb, LPFC_ELS_RING);
577 pmb->mbox_cmpl = lpfc_config_async_cmpl;
578 pmb->vport = phba->pport;
579 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT);
580

--- 7487 unchanged lines hidden ---