diff options
author | James Smart <james.smart@emulex.com> | 2010-02-12 14:42:33 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-02-17 18:41:04 -0500 |
commit | 84d1b006978e78e27f22beb5cfbc4d349bac6df7 (patch) | |
tree | 0bb3f71b6a5389a8570e49493431d77b6ee5993c /drivers/scsi/lpfc/lpfc_init.c | |
parent | 28baac7492fa084dbff6a1b9c4b42ed0d014b558 (diff) |
[SCSI] lpfc 8.3.9: Changes to sysfs interface for the lpfc driver.
- Convert all sysfs parameters to uint instead of int.
- Add lpfc_supress_link_up parameter.
- Change link_state to writable sysfs parameter.
- Add support to be able to "up" or "down" link from link_state parameter.
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_init.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 100 |
1 files changed, 99 insertions, 1 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index b0b7bb39f054..89d886c72e0a 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -544,7 +544,7 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
544 | mempool_free(pmb, phba->mbox_mem_pool); | 544 | mempool_free(pmb, phba->mbox_mem_pool); |
545 | return -EIO; | 545 | return -EIO; |
546 | } | 546 | } |
547 | } else { | 547 | } else if (phba->cfg_suppress_link_up == 0) { |
548 | lpfc_init_link(phba, pmb, phba->cfg_topology, | 548 | lpfc_init_link(phba, pmb, phba->cfg_topology, |
549 | phba->cfg_link_speed); | 549 | phba->cfg_link_speed); |
550 | pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | 550 | pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
@@ -603,6 +603,102 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
603 | } | 603 | } |
604 | 604 | ||
605 | /** | 605 | /** |
606 | * lpfc_hba_init_link - Initialize the FC link | ||
607 | * @phba: pointer to lpfc hba data structure. | ||
608 | * | ||
609 | * This routine will issue the INIT_LINK mailbox command call. | ||
610 | * It is available to other drivers through the lpfc_hba data | ||
611 | * structure for use as a delayed link up mechanism with the | ||
612 | * module parameter lpfc_suppress_link_up. | ||
613 | * | ||
614 | * Return code | ||
615 | * 0 - success | ||
616 | * Any other value - error | ||
617 | **/ | ||
618 | int | ||
619 | lpfc_hba_init_link(struct lpfc_hba *phba) | ||
620 | { | ||
621 | struct lpfc_vport *vport = phba->pport; | ||
622 | LPFC_MBOXQ_t *pmb; | ||
623 | MAILBOX_t *mb; | ||
624 | int rc; | ||
625 | |||
626 | pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | ||
627 | if (!pmb) { | ||
628 | phba->link_state = LPFC_HBA_ERROR; | ||
629 | return -ENOMEM; | ||
630 | } | ||
631 | mb = &pmb->u.mb; | ||
632 | pmb->vport = vport; | ||
633 | |||
634 | lpfc_init_link(phba, pmb, phba->cfg_topology, | ||
635 | phba->cfg_link_speed); | ||
636 | pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | ||
637 | lpfc_set_loopback_flag(phba); | ||
638 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); | ||
639 | if (rc != MBX_SUCCESS) { | ||
640 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
641 | "0498 Adapter failed to init, mbxCmd x%x " | ||
642 | "INIT_LINK, mbxStatus x%x\n", | ||
643 | mb->mbxCommand, mb->mbxStatus); | ||
644 | /* Clear all interrupt enable conditions */ | ||
645 | writel(0, phba->HCregaddr); | ||
646 | readl(phba->HCregaddr); /* flush */ | ||
647 | /* Clear all pending interrupts */ | ||
648 | writel(0xffffffff, phba->HAregaddr); | ||
649 | readl(phba->HAregaddr); /* flush */ | ||
650 | phba->link_state = LPFC_HBA_ERROR; | ||
651 | if (rc != MBX_BUSY) | ||
652 | mempool_free(pmb, phba->mbox_mem_pool); | ||
653 | return -EIO; | ||
654 | } | ||
655 | phba->cfg_suppress_link_up = 0; | ||
656 | |||
657 | return 0; | ||
658 | } | ||
659 | |||
660 | /** | ||
661 | * lpfc_hba_down_link - this routine downs the FC link | ||
662 | * | ||
663 | * This routine will issue the DOWN_LINK mailbox command call. | ||
664 | * It is available to other drivers through the lpfc_hba data | ||
665 | * structure for use to stop the link. | ||
666 | * | ||
667 | * Return code | ||
668 | * 0 - success | ||
669 | * Any other value - error | ||
670 | **/ | ||
671 | int | ||
672 | lpfc_hba_down_link(struct lpfc_hba *phba) | ||
673 | { | ||
674 | LPFC_MBOXQ_t *pmb; | ||
675 | int rc; | ||
676 | |||
677 | pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | ||
678 | if (!pmb) { | ||
679 | phba->link_state = LPFC_HBA_ERROR; | ||
680 | return -ENOMEM; | ||
681 | } | ||
682 | |||
683 | lpfc_printf_log(phba, | ||
684 | KERN_ERR, LOG_INIT, | ||
685 | "0491 Adapter Link is disabled.\n"); | ||
686 | lpfc_down_link(phba, pmb); | ||
687 | pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | ||
688 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); | ||
689 | if ((rc != MBX_SUCCESS) && (rc != MBX_BUSY)) { | ||
690 | lpfc_printf_log(phba, | ||
691 | KERN_ERR, LOG_INIT, | ||
692 | "2522 Adapter failed to issue DOWN_LINK" | ||
693 | " mbox command rc 0x%x\n", rc); | ||
694 | |||
695 | mempool_free(pmb, phba->mbox_mem_pool); | ||
696 | return -EIO; | ||
697 | } | ||
698 | return 0; | ||
699 | } | ||
700 | |||
701 | /** | ||
606 | * lpfc_hba_down_prep - Perform lpfc uninitialization prior to HBA reset | 702 | * lpfc_hba_down_prep - Perform lpfc uninitialization prior to HBA reset |
607 | * @phba: pointer to lpfc HBA data structure. | 703 | * @phba: pointer to lpfc HBA data structure. |
608 | * | 704 | * |
@@ -3952,6 +4048,8 @@ lpfc_sli4_driver_resource_unset(struct lpfc_hba *phba) | |||
3952 | int | 4048 | int |
3953 | lpfc_init_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) | 4049 | lpfc_init_api_table_setup(struct lpfc_hba *phba, uint8_t dev_grp) |
3954 | { | 4050 | { |
4051 | phba->lpfc_hba_init_link = lpfc_hba_init_link; | ||
4052 | phba->lpfc_hba_down_link = lpfc_hba_down_link; | ||
3955 | switch (dev_grp) { | 4053 | switch (dev_grp) { |
3956 | case LPFC_PCI_DEV_LP: | 4054 | case LPFC_PCI_DEV_LP: |
3957 | phba->lpfc_hba_down_post = lpfc_hba_down_post_s3; | 4055 | phba->lpfc_hba_down_post = lpfc_hba_down_post_s3; |