aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_mbox.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_mbox.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_mbox.c76
1 files changed, 46 insertions, 30 deletions
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c
index 62d0957e1d4c..23403c650207 100644
--- a/drivers/scsi/lpfc/lpfc_mbox.c
+++ b/drivers/scsi/lpfc/lpfc_mbox.c
@@ -263,18 +263,19 @@ lpfc_heart_beat(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
263} 263}
264 264
265/** 265/**
266 * lpfc_read_la - Prepare a mailbox command for reading HBA link attention 266 * lpfc_read_topology - Prepare a mailbox command for reading HBA topology
267 * @phba: pointer to lpfc hba data structure. 267 * @phba: pointer to lpfc hba data structure.
268 * @pmb: pointer to the driver internal queue element for mailbox command. 268 * @pmb: pointer to the driver internal queue element for mailbox command.
269 * @mp: DMA buffer memory for reading the link attention information into. 269 * @mp: DMA buffer memory for reading the link attention information into.
270 * 270 *
271 * The read link attention mailbox command is issued to read the Link Event 271 * The read topology mailbox command is issued to read the link topology
272 * Attention information indicated by the HBA port when the Link Event bit 272 * information indicated by the HBA port when the Link Event bit of the Host
273 * of the Host Attention (HSTATT) register is set to 1. A Link Event 273 * Attention (HSTATT) register is set to 1 (For SLI-3) or when an FC Link
274 * Attention ACQE is received from the port (For SLI-4). A Link Event
274 * Attention occurs based on an exception detected at the Fibre Channel link 275 * Attention occurs based on an exception detected at the Fibre Channel link
275 * interface. 276 * interface.
276 * 277 *
277 * This routine prepares the mailbox command for reading HBA link attention 278 * This routine prepares the mailbox command for reading HBA link topology
278 * information. A DMA memory has been set aside and address passed to the 279 * information. A DMA memory has been set aside and address passed to the
279 * HBA through @mp for the HBA to DMA link attention information into the 280 * HBA through @mp for the HBA to DMA link attention information into the
280 * memory as part of the execution of the mailbox command. 281 * memory as part of the execution of the mailbox command.
@@ -283,7 +284,8 @@ lpfc_heart_beat(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
283 * 0 - Success (currently always return 0) 284 * 0 - Success (currently always return 0)
284 **/ 285 **/
285int 286int
286lpfc_read_la(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb, struct lpfc_dmabuf *mp) 287lpfc_read_topology(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb,
288 struct lpfc_dmabuf *mp)
287{ 289{
288 MAILBOX_t *mb; 290 MAILBOX_t *mb;
289 struct lpfc_sli *psli; 291 struct lpfc_sli *psli;
@@ -293,15 +295,15 @@ lpfc_read_la(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb, struct lpfc_dmabuf *mp)
293 memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); 295 memset(pmb, 0, sizeof (LPFC_MBOXQ_t));
294 296
295 INIT_LIST_HEAD(&mp->list); 297 INIT_LIST_HEAD(&mp->list);
296 mb->mbxCommand = MBX_READ_LA64; 298 mb->mbxCommand = MBX_READ_TOPOLOGY;
297 mb->un.varReadLA.un.lilpBde64.tus.f.bdeSize = 128; 299 mb->un.varReadTop.lilpBde64.tus.f.bdeSize = LPFC_ALPA_MAP_SIZE;
298 mb->un.varReadLA.un.lilpBde64.addrHigh = putPaddrHigh(mp->phys); 300 mb->un.varReadTop.lilpBde64.addrHigh = putPaddrHigh(mp->phys);
299 mb->un.varReadLA.un.lilpBde64.addrLow = putPaddrLow(mp->phys); 301 mb->un.varReadTop.lilpBde64.addrLow = putPaddrLow(mp->phys);
300 302
301 /* Save address for later completion and set the owner to host so that 303 /* Save address for later completion and set the owner to host so that
302 * the FW knows this mailbox is available for processing. 304 * the FW knows this mailbox is available for processing.
303 */ 305 */
304 pmb->context1 = (uint8_t *) mp; 306 pmb->context1 = (uint8_t *)mp;
305 mb->mbxOwner = OWN_HOST; 307 mb->mbxOwner = OWN_HOST;
306 return (0); 308 return (0);
307} 309}
@@ -516,18 +518,33 @@ lpfc_init_link(struct lpfc_hba * phba,
516 vpd = &phba->vpd; 518 vpd = &phba->vpd;
517 if (vpd->rev.feaLevelHigh >= 0x02){ 519 if (vpd->rev.feaLevelHigh >= 0x02){
518 switch(linkspeed){ 520 switch(linkspeed){
519 case LINK_SPEED_1G: 521 case LPFC_USER_LINK_SPEED_1G:
520 case LINK_SPEED_2G: 522 mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED;
521 case LINK_SPEED_4G: 523 mb->un.varInitLnk.link_speed = LINK_SPEED_1G;
522 case LINK_SPEED_8G: 524 break;
523 mb->un.varInitLnk.link_flags |= 525 case LPFC_USER_LINK_SPEED_2G:
524 FLAGS_LINK_SPEED; 526 mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED;
525 mb->un.varInitLnk.link_speed = linkspeed; 527 mb->un.varInitLnk.link_speed = LINK_SPEED_2G;
528 break;
529 case LPFC_USER_LINK_SPEED_4G:
530 mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED;
531 mb->un.varInitLnk.link_speed = LINK_SPEED_4G;
532 break;
533 case LPFC_USER_LINK_SPEED_8G:
534 mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED;
535 mb->un.varInitLnk.link_speed = LINK_SPEED_8G;
536 break;
537 case LPFC_USER_LINK_SPEED_10G:
538 mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED;
539 mb->un.varInitLnk.link_speed = LINK_SPEED_10G;
526 break; 540 break;
527 case LINK_SPEED_AUTO: 541 case LPFC_USER_LINK_SPEED_16G:
528 default: 542 mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED;
529 mb->un.varInitLnk.link_speed = 543 mb->un.varInitLnk.link_speed = LINK_SPEED_16G;
530 LINK_SPEED_AUTO; 544 break;
545 case LPFC_USER_LINK_SPEED_AUTO:
546 default:
547 mb->un.varInitLnk.link_speed = LINK_SPEED_AUTO;
531 break; 548 break;
532 } 549 }
533 550
@@ -693,7 +710,7 @@ lpfc_read_lnk_stat(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
693 * @did: remote port identifier. 710 * @did: remote port identifier.
694 * @param: pointer to memory holding the server parameters. 711 * @param: pointer to memory holding the server parameters.
695 * @pmb: pointer to the driver internal queue element for mailbox command. 712 * @pmb: pointer to the driver internal queue element for mailbox command.
696 * @flag: action flag to be passed back for the complete function. 713 * @rpi: the rpi to use in the registration (usually only used for SLI4.
697 * 714 *
698 * The registration login mailbox command is used to register an N_Port or 715 * The registration login mailbox command is used to register an N_Port or
699 * F_Port login. This registration allows the HBA to cache the remote N_Port 716 * F_Port login. This registration allows the HBA to cache the remote N_Port
@@ -712,7 +729,7 @@ lpfc_read_lnk_stat(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
712 **/ 729 **/
713int 730int
714lpfc_reg_rpi(struct lpfc_hba *phba, uint16_t vpi, uint32_t did, 731lpfc_reg_rpi(struct lpfc_hba *phba, uint16_t vpi, uint32_t did,
715 uint8_t *param, LPFC_MBOXQ_t *pmb, uint32_t flag) 732 uint8_t *param, LPFC_MBOXQ_t *pmb, uint16_t rpi)
716{ 733{
717 MAILBOX_t *mb = &pmb->u.mb; 734 MAILBOX_t *mb = &pmb->u.mb;
718 uint8_t *sparam; 735 uint8_t *sparam;
@@ -722,17 +739,13 @@ lpfc_reg_rpi(struct lpfc_hba *phba, uint16_t vpi, uint32_t did,
722 739
723 mb->un.varRegLogin.rpi = 0; 740 mb->un.varRegLogin.rpi = 0;
724 if (phba->sli_rev == LPFC_SLI_REV4) { 741 if (phba->sli_rev == LPFC_SLI_REV4) {
725 mb->un.varRegLogin.rpi = lpfc_sli4_alloc_rpi(phba); 742 mb->un.varRegLogin.rpi = rpi;
726 if (mb->un.varRegLogin.rpi == LPFC_RPI_ALLOC_ERROR) 743 if (mb->un.varRegLogin.rpi == LPFC_RPI_ALLOC_ERROR)
727 return 1; 744 return 1;
728 } 745 }
729
730 mb->un.varRegLogin.vpi = vpi + phba->vpi_base; 746 mb->un.varRegLogin.vpi = vpi + phba->vpi_base;
731 mb->un.varRegLogin.did = did; 747 mb->un.varRegLogin.did = did;
732 mb->un.varWords[30] = flag; /* Set flag to issue action on cmpl */
733
734 mb->mbxOwner = OWN_HOST; 748 mb->mbxOwner = OWN_HOST;
735
736 /* Get a buffer to hold NPorts Service Parameters */ 749 /* Get a buffer to hold NPorts Service Parameters */
737 mp = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL); 750 mp = kmalloc(sizeof (struct lpfc_dmabuf), GFP_KERNEL);
738 if (mp) 751 if (mp)
@@ -743,7 +756,7 @@ lpfc_reg_rpi(struct lpfc_hba *phba, uint16_t vpi, uint32_t did,
743 /* REG_LOGIN: no buffers */ 756 /* REG_LOGIN: no buffers */
744 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX, 757 lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX,
745 "0302 REG_LOGIN: no buffers, VPI:%d DID:x%x, " 758 "0302 REG_LOGIN: no buffers, VPI:%d DID:x%x, "
746 "flag x%x\n", vpi, did, flag); 759 "rpi x%x\n", vpi, did, rpi);
747 return (1); 760 return (1);
748 } 761 }
749 INIT_LIST_HEAD(&mp->list); 762 INIT_LIST_HEAD(&mp->list);
@@ -1918,11 +1931,14 @@ lpfc_init_vfi(struct lpfcMboxq *mbox, struct lpfc_vport *vport)
1918 struct lpfc_mbx_init_vfi *init_vfi; 1931 struct lpfc_mbx_init_vfi *init_vfi;
1919 1932
1920 memset(mbox, 0, sizeof(*mbox)); 1933 memset(mbox, 0, sizeof(*mbox));
1934 mbox->vport = vport;
1921 init_vfi = &mbox->u.mqe.un.init_vfi; 1935 init_vfi = &mbox->u.mqe.un.init_vfi;
1922 bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_INIT_VFI); 1936 bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_INIT_VFI);
1923 bf_set(lpfc_init_vfi_vr, init_vfi, 1); 1937 bf_set(lpfc_init_vfi_vr, init_vfi, 1);
1924 bf_set(lpfc_init_vfi_vt, init_vfi, 1); 1938 bf_set(lpfc_init_vfi_vt, init_vfi, 1);
1939 bf_set(lpfc_init_vfi_vp, init_vfi, 1);
1925 bf_set(lpfc_init_vfi_vfi, init_vfi, vport->vfi + vport->phba->vfi_base); 1940 bf_set(lpfc_init_vfi_vfi, init_vfi, vport->vfi + vport->phba->vfi_base);
1941 bf_set(lpfc_init_vpi_vpi, init_vfi, vport->vpi + vport->phba->vpi_base);
1926 bf_set(lpfc_init_vfi_fcfi, init_vfi, vport->phba->fcf.fcfi); 1942 bf_set(lpfc_init_vfi_fcfi, init_vfi, vport->phba->fcf.fcfi);
1927} 1943}
1928 1944