diff options
author | James Smart <James.Smart@Emulex.Com> | 2009-05-22 14:52:52 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-06-08 12:24:50 -0400 |
commit | 04c684968487eb4f98728363a97b8da48f3bb958 (patch) | |
tree | 33f59839ca26a1904c4e2d2895598f543266feb0 /drivers/scsi/lpfc/lpfc_attr.c | |
parent | 4f774513f7b3fe96648b8936f60f835e6ceaa88e (diff) |
[SCSI] lpfc 8.3.2 : Addition of SLI4 Interface - Mailbox handling
The mailbox commands themselves are the same, or very similar to
their SLI3 counterparts. This patch genericizes mailbox command
handling and adds support for the new SLI4 mailbox queue.
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_attr.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_attr.c | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 82016fc672b1..463104d96867 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
@@ -507,12 +507,14 @@ lpfc_issue_lip(struct Scsi_Host *shost) | |||
507 | return -ENOMEM; | 507 | return -ENOMEM; |
508 | 508 | ||
509 | memset((void *)pmboxq, 0, sizeof (LPFC_MBOXQ_t)); | 509 | memset((void *)pmboxq, 0, sizeof (LPFC_MBOXQ_t)); |
510 | pmboxq->mb.mbxCommand = MBX_DOWN_LINK; | 510 | pmboxq->u.mb.mbxCommand = MBX_DOWN_LINK; |
511 | pmboxq->mb.mbxOwner = OWN_HOST; | 511 | pmboxq->u.mb.mbxOwner = OWN_HOST; |
512 | 512 | ||
513 | mbxstatus = lpfc_sli_issue_mbox_wait(phba, pmboxq, LPFC_MBOX_TMO * 2); | 513 | mbxstatus = lpfc_sli_issue_mbox_wait(phba, pmboxq, LPFC_MBOX_TMO * 2); |
514 | 514 | ||
515 | if ((mbxstatus == MBX_SUCCESS) && (pmboxq->mb.mbxStatus == 0)) { | 515 | if ((mbxstatus == MBX_SUCCESS) && |
516 | (pmboxq->u.mb.mbxStatus == 0 || | ||
517 | pmboxq->u.mb.mbxStatus == MBXERR_LINK_DOWN)) { | ||
516 | memset((void *)pmboxq, 0, sizeof (LPFC_MBOXQ_t)); | 518 | memset((void *)pmboxq, 0, sizeof (LPFC_MBOXQ_t)); |
517 | lpfc_init_link(phba, pmboxq, phba->cfg_topology, | 519 | lpfc_init_link(phba, pmboxq, phba->cfg_topology, |
518 | phba->cfg_link_speed); | 520 | phba->cfg_link_speed); |
@@ -791,7 +793,8 @@ lpfc_get_hba_info(struct lpfc_hba *phba, | |||
791 | uint32_t *mrpi, uint32_t *arpi, | 793 | uint32_t *mrpi, uint32_t *arpi, |
792 | uint32_t *mvpi, uint32_t *avpi) | 794 | uint32_t *mvpi, uint32_t *avpi) |
793 | { | 795 | { |
794 | struct lpfc_sli *psli = &phba->sli; | 796 | struct lpfc_sli *psli = &phba->sli; |
797 | struct lpfc_mbx_read_config *rd_config; | ||
795 | LPFC_MBOXQ_t *pmboxq; | 798 | LPFC_MBOXQ_t *pmboxq; |
796 | MAILBOX_t *pmb; | 799 | MAILBOX_t *pmb; |
797 | int rc = 0; | 800 | int rc = 0; |
@@ -813,7 +816,7 @@ lpfc_get_hba_info(struct lpfc_hba *phba, | |||
813 | return 0; | 816 | return 0; |
814 | memset(pmboxq, 0, sizeof (LPFC_MBOXQ_t)); | 817 | memset(pmboxq, 0, sizeof (LPFC_MBOXQ_t)); |
815 | 818 | ||
816 | pmb = &pmboxq->mb; | 819 | pmb = &pmboxq->u.mb; |
817 | pmb->mbxCommand = MBX_READ_CONFIG; | 820 | pmb->mbxCommand = MBX_READ_CONFIG; |
818 | pmb->mbxOwner = OWN_HOST; | 821 | pmb->mbxOwner = OWN_HOST; |
819 | pmboxq->context1 = NULL; | 822 | pmboxq->context1 = NULL; |
@@ -3247,7 +3250,7 @@ sysfs_mbox_write(struct kobject *kobj, struct bin_attribute *bin_attr, | |||
3247 | } | 3250 | } |
3248 | } | 3251 | } |
3249 | 3252 | ||
3250 | memcpy((uint8_t *) & phba->sysfs_mbox.mbox->mb + off, | 3253 | memcpy((uint8_t *) &phba->sysfs_mbox.mbox->u.mb + off, |
3251 | buf, count); | 3254 | buf, count); |
3252 | 3255 | ||
3253 | phba->sysfs_mbox.offset = off + count; | 3256 | phba->sysfs_mbox.offset = off + count; |
@@ -3289,6 +3292,7 @@ sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr, | |||
3289 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 3292 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
3290 | struct lpfc_hba *phba = vport->phba; | 3293 | struct lpfc_hba *phba = vport->phba; |
3291 | int rc; | 3294 | int rc; |
3295 | MAILBOX_t *pmb; | ||
3292 | 3296 | ||
3293 | if (off > MAILBOX_CMD_SIZE) | 3297 | if (off > MAILBOX_CMD_SIZE) |
3294 | return -ERANGE; | 3298 | return -ERANGE; |
@@ -3313,8 +3317,8 @@ sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr, | |||
3313 | if (off == 0 && | 3317 | if (off == 0 && |
3314 | phba->sysfs_mbox.state == SMBOX_WRITING && | 3318 | phba->sysfs_mbox.state == SMBOX_WRITING && |
3315 | phba->sysfs_mbox.offset >= 2 * sizeof(uint32_t)) { | 3319 | phba->sysfs_mbox.offset >= 2 * sizeof(uint32_t)) { |
3316 | 3320 | pmb = &phba->sysfs_mbox.mbox->u.mb; | |
3317 | switch (phba->sysfs_mbox.mbox->mb.mbxCommand) { | 3321 | switch (pmb->mbxCommand) { |
3318 | /* Offline only */ | 3322 | /* Offline only */ |
3319 | case MBX_INIT_LINK: | 3323 | case MBX_INIT_LINK: |
3320 | case MBX_DOWN_LINK: | 3324 | case MBX_DOWN_LINK: |
@@ -3331,7 +3335,7 @@ sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr, | |||
3331 | if (!(vport->fc_flag & FC_OFFLINE_MODE)) { | 3335 | if (!(vport->fc_flag & FC_OFFLINE_MODE)) { |
3332 | printk(KERN_WARNING "mbox_read:Command 0x%x " | 3336 | printk(KERN_WARNING "mbox_read:Command 0x%x " |
3333 | "is illegal in on-line state\n", | 3337 | "is illegal in on-line state\n", |
3334 | phba->sysfs_mbox.mbox->mb.mbxCommand); | 3338 | pmb->mbxCommand); |
3335 | sysfs_mbox_idle(phba); | 3339 | sysfs_mbox_idle(phba); |
3336 | spin_unlock_irq(&phba->hbalock); | 3340 | spin_unlock_irq(&phba->hbalock); |
3337 | return -EPERM; | 3341 | return -EPERM; |
@@ -3367,13 +3371,13 @@ sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr, | |||
3367 | case MBX_CONFIG_PORT: | 3371 | case MBX_CONFIG_PORT: |
3368 | case MBX_RUN_BIU_DIAG: | 3372 | case MBX_RUN_BIU_DIAG: |
3369 | printk(KERN_WARNING "mbox_read: Illegal Command 0x%x\n", | 3373 | printk(KERN_WARNING "mbox_read: Illegal Command 0x%x\n", |
3370 | phba->sysfs_mbox.mbox->mb.mbxCommand); | 3374 | pmb->mbxCommand); |
3371 | sysfs_mbox_idle(phba); | 3375 | sysfs_mbox_idle(phba); |
3372 | spin_unlock_irq(&phba->hbalock); | 3376 | spin_unlock_irq(&phba->hbalock); |
3373 | return -EPERM; | 3377 | return -EPERM; |
3374 | default: | 3378 | default: |
3375 | printk(KERN_WARNING "mbox_read: Unknown Command 0x%x\n", | 3379 | printk(KERN_WARNING "mbox_read: Unknown Command 0x%x\n", |
3376 | phba->sysfs_mbox.mbox->mb.mbxCommand); | 3380 | pmb->mbxCommand); |
3377 | sysfs_mbox_idle(phba); | 3381 | sysfs_mbox_idle(phba); |
3378 | spin_unlock_irq(&phba->hbalock); | 3382 | spin_unlock_irq(&phba->hbalock); |
3379 | return -EPERM; | 3383 | return -EPERM; |
@@ -3383,14 +3387,14 @@ sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr, | |||
3383 | * or RESTART mailbox commands until the HBA is restarted. | 3387 | * or RESTART mailbox commands until the HBA is restarted. |
3384 | */ | 3388 | */ |
3385 | if (phba->pport->stopped && | 3389 | if (phba->pport->stopped && |
3386 | phba->sysfs_mbox.mbox->mb.mbxCommand != MBX_DUMP_MEMORY && | 3390 | pmb->mbxCommand != MBX_DUMP_MEMORY && |
3387 | phba->sysfs_mbox.mbox->mb.mbxCommand != MBX_RESTART && | 3391 | pmb->mbxCommand != MBX_RESTART && |
3388 | phba->sysfs_mbox.mbox->mb.mbxCommand != MBX_WRITE_VPARMS && | 3392 | pmb->mbxCommand != MBX_WRITE_VPARMS && |
3389 | phba->sysfs_mbox.mbox->mb.mbxCommand != MBX_WRITE_WWN) | 3393 | pmb->mbxCommand != MBX_WRITE_WWN) |
3390 | lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, | 3394 | lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, |
3391 | "1259 mbox: Issued mailbox cmd " | 3395 | "1259 mbox: Issued mailbox cmd " |
3392 | "0x%x while in stopped state.\n", | 3396 | "0x%x while in stopped state.\n", |
3393 | phba->sysfs_mbox.mbox->mb.mbxCommand); | 3397 | pmb->mbxCommand); |
3394 | 3398 | ||
3395 | phba->sysfs_mbox.mbox->vport = vport; | 3399 | phba->sysfs_mbox.mbox->vport = vport; |
3396 | 3400 | ||
@@ -3416,8 +3420,7 @@ sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr, | |||
3416 | spin_unlock_irq(&phba->hbalock); | 3420 | spin_unlock_irq(&phba->hbalock); |
3417 | rc = lpfc_sli_issue_mbox_wait (phba, | 3421 | rc = lpfc_sli_issue_mbox_wait (phba, |
3418 | phba->sysfs_mbox.mbox, | 3422 | phba->sysfs_mbox.mbox, |
3419 | lpfc_mbox_tmo_val(phba, | 3423 | lpfc_mbox_tmo_val(phba, pmb->mbxCommand) * HZ); |
3420 | phba->sysfs_mbox.mbox->mb.mbxCommand) * HZ); | ||
3421 | spin_lock_irq(&phba->hbalock); | 3424 | spin_lock_irq(&phba->hbalock); |
3422 | } | 3425 | } |
3423 | 3426 | ||
@@ -3439,7 +3442,7 @@ sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr, | |||
3439 | return -EAGAIN; | 3442 | return -EAGAIN; |
3440 | } | 3443 | } |
3441 | 3444 | ||
3442 | memcpy(buf, (uint8_t *) & phba->sysfs_mbox.mbox->mb + off, count); | 3445 | memcpy(buf, (uint8_t *) &pmb + off, count); |
3443 | 3446 | ||
3444 | phba->sysfs_mbox.offset = off + count; | 3447 | phba->sysfs_mbox.offset = off + count; |
3445 | 3448 | ||
@@ -3711,14 +3714,14 @@ lpfc_get_stats(struct Scsi_Host *shost) | |||
3711 | return NULL; | 3714 | return NULL; |
3712 | memset(pmboxq, 0, sizeof (LPFC_MBOXQ_t)); | 3715 | memset(pmboxq, 0, sizeof (LPFC_MBOXQ_t)); |
3713 | 3716 | ||
3714 | pmb = &pmboxq->mb; | 3717 | pmb = &pmboxq->u.mb; |
3715 | pmb->mbxCommand = MBX_READ_STATUS; | 3718 | pmb->mbxCommand = MBX_READ_STATUS; |
3716 | pmb->mbxOwner = OWN_HOST; | 3719 | pmb->mbxOwner = OWN_HOST; |
3717 | pmboxq->context1 = NULL; | 3720 | pmboxq->context1 = NULL; |
3718 | pmboxq->vport = vport; | 3721 | pmboxq->vport = vport; |
3719 | 3722 | ||
3720 | if ((vport->fc_flag & FC_OFFLINE_MODE) || | 3723 | if ((vport->fc_flag & FC_OFFLINE_MODE) || |
3721 | (!(psli->sli_flag & LPFC_SLI2_ACTIVE))) | 3724 | (!(psli->sli_flag & LPFC_SLI_ACTIVE))) |
3722 | rc = lpfc_sli_issue_mbox(phba, pmboxq, MBX_POLL); | 3725 | rc = lpfc_sli_issue_mbox(phba, pmboxq, MBX_POLL); |
3723 | else | 3726 | else |
3724 | rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); | 3727 | rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); |
@@ -3817,7 +3820,7 @@ lpfc_reset_stats(struct Scsi_Host *shost) | |||
3817 | return; | 3820 | return; |
3818 | memset(pmboxq, 0, sizeof(LPFC_MBOXQ_t)); | 3821 | memset(pmboxq, 0, sizeof(LPFC_MBOXQ_t)); |
3819 | 3822 | ||
3820 | pmb = &pmboxq->mb; | 3823 | pmb = &pmboxq->u.mb; |
3821 | pmb->mbxCommand = MBX_READ_STATUS; | 3824 | pmb->mbxCommand = MBX_READ_STATUS; |
3822 | pmb->mbxOwner = OWN_HOST; | 3825 | pmb->mbxOwner = OWN_HOST; |
3823 | pmb->un.varWords[0] = 0x1; /* reset request */ | 3826 | pmb->un.varWords[0] = 0x1; /* reset request */ |