aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_mbox.c
diff options
context:
space:
mode:
authorJames Smart <James.Smart@Emulex.Com>2007-06-17 20:56:36 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-06-17 23:05:45 -0400
commit2e0fef85e098f6794956b8b80b111179fbb4cbb7 (patch)
treef632090be67f95e9a637eeb044938ba1591e848f /drivers/scsi/lpfc/lpfc_mbox.c
parent4c2baaaf2ba4875d1d2d59b3b3e1216d3277b17a (diff)
[SCSI] lpfc: NPIV: split ports
The driver is reorganized to separate the handling of the adapter from the handling of the FC port. Adapter handling includes submissions of command requests, receiving responses, and managing adapter resources. The FC port includes the discovery engine, login handling, and the mapping of a Scsi_Host on the "port". Although not a large functional change, as it touches core structures and functions, resulting in a large text delta. Signed-off-by: James Smart <James.Smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_mbox.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_mbox.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c
index 8041c3f06f7b..86757ec53057 100644
--- a/drivers/scsi/lpfc/lpfc_mbox.c
+++ b/drivers/scsi/lpfc/lpfc_mbox.c
@@ -106,7 +106,7 @@ lpfc_read_la(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb, struct lpfc_dmabuf *mp)
106 */ 106 */
107 pmb->context1 = (uint8_t *) mp; 107 pmb->context1 = (uint8_t *) mp;
108 mb->mbxOwner = OWN_HOST; 108 mb->mbxOwner = OWN_HOST;
109 return (0); 109 return 0;
110} 110}
111 111
112/**********************************************/ 112/**********************************************/
@@ -134,6 +134,7 @@ lpfc_clear_la(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
134void 134void
135lpfc_config_link(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) 135lpfc_config_link(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
136{ 136{
137 struct lpfc_vport *vport = phba->pport;
137 MAILBOX_t *mb = &pmb->mb; 138 MAILBOX_t *mb = &pmb->mb;
138 memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); 139 memset(pmb, 0, sizeof (LPFC_MBOXQ_t));
139 140
@@ -147,7 +148,7 @@ lpfc_config_link(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
147 mb->un.varCfgLnk.cr_count = phba->cfg_cr_count; 148 mb->un.varCfgLnk.cr_count = phba->cfg_cr_count;
148 } 149 }
149 150
150 mb->un.varCfgLnk.myId = phba->fc_myDID; 151 mb->un.varCfgLnk.myId = vport->fc_myDID;
151 mb->un.varCfgLnk.edtov = phba->fc_edtov; 152 mb->un.varCfgLnk.edtov = phba->fc_edtov;
152 mb->un.varCfgLnk.arbtov = phba->fc_arbtov; 153 mb->un.varCfgLnk.arbtov = phba->fc_arbtov;
153 mb->un.varCfgLnk.ratov = phba->fc_ratov; 154 mb->un.varCfgLnk.ratov = phba->fc_ratov;
@@ -208,7 +209,7 @@ lpfc_init_link(struct lpfc_hba * phba,
208 */ 209 */
209 vpd = &phba->vpd; 210 vpd = &phba->vpd;
210 if (vpd->rev.feaLevelHigh >= 0x02){ 211 if (vpd->rev.feaLevelHigh >= 0x02){
211 switch(linkspeed){ 212 switch (linkspeed){
212 case LINK_SPEED_1G: 213 case LINK_SPEED_1G:
213 case LINK_SPEED_2G: 214 case LINK_SPEED_2G:
214 case LINK_SPEED_4G: 215 case LINK_SPEED_4G:
@@ -263,7 +264,7 @@ lpfc_read_sparam(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
263 LOG_MBOX, 264 LOG_MBOX,
264 "%d:0301 READ_SPARAM: no buffers\n", 265 "%d:0301 READ_SPARAM: no buffers\n",
265 phba->brd_no); 266 phba->brd_no);
266 return (1); 267 return 1;
267 } 268 }
268 INIT_LIST_HEAD(&mp->list); 269 INIT_LIST_HEAD(&mp->list);
269 mb->mbxCommand = MBX_READ_SPARM64; 270 mb->mbxCommand = MBX_READ_SPARM64;
@@ -274,7 +275,7 @@ lpfc_read_sparam(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
274 /* save address for completion */ 275 /* save address for completion */
275 pmb->context1 = mp; 276 pmb->context1 = mp;
276 277
277 return (0); 278 return 0;
278} 279}
279 280
280/********************************************/ 281/********************************************/
@@ -282,7 +283,7 @@ lpfc_read_sparam(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
282/* mailbox command */ 283/* mailbox command */
283/********************************************/ 284/********************************************/
284void 285void
285lpfc_unreg_did(struct lpfc_hba * phba, uint32_t did, LPFC_MBOXQ_t * pmb) 286lpfc_unreg_did(struct lpfc_hba *phba, uint32_t did, LPFC_MBOXQ_t *pmb)
286{ 287{
287 MAILBOX_t *mb; 288 MAILBOX_t *mb;
288 289
@@ -335,16 +336,13 @@ lpfc_read_lnk_stat(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
335/* mailbox command */ 336/* mailbox command */
336/********************************************/ 337/********************************************/
337int 338int
338lpfc_reg_login(struct lpfc_hba * phba, 339lpfc_reg_login(struct lpfc_hba *phba, uint32_t did, uint8_t *param,
339 uint32_t did, uint8_t * param, LPFC_MBOXQ_t * pmb, uint32_t flag) 340 LPFC_MBOXQ_t *pmb, uint32_t flag)
340{ 341{
342 MAILBOX_t *mb = &pmb->mb;
341 uint8_t *sparam; 343 uint8_t *sparam;
342 struct lpfc_dmabuf *mp; 344 struct lpfc_dmabuf *mp;
343 MAILBOX_t *mb;
344 struct lpfc_sli *psli;
345 345
346 psli = &phba->sli;
347 mb = &pmb->mb;
348 memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); 346 memset(pmb, 0, sizeof (LPFC_MBOXQ_t));
349 347
350 mb->un.varRegLogin.rpi = 0; 348 mb->un.varRegLogin.rpi = 0;
@@ -365,7 +363,7 @@ lpfc_reg_login(struct lpfc_hba * phba,
365 "%d:0302 REG_LOGIN: no buffers Data x%x x%x\n", 363 "%d:0302 REG_LOGIN: no buffers Data x%x x%x\n",
366 phba->brd_no, 364 phba->brd_no,
367 (uint32_t) did, (uint32_t) flag); 365 (uint32_t) did, (uint32_t) flag);
368 return (1); 366 return 1;
369 } 367 }
370 INIT_LIST_HEAD(&mp->list); 368 INIT_LIST_HEAD(&mp->list);
371 sparam = mp->virt; 369 sparam = mp->virt;
@@ -381,7 +379,7 @@ lpfc_reg_login(struct lpfc_hba * phba,
381 mb->un.varRegLogin.un.sp64.addrHigh = putPaddrHigh(mp->phys); 379 mb->un.varRegLogin.un.sp64.addrHigh = putPaddrHigh(mp->phys);
382 mb->un.varRegLogin.un.sp64.addrLow = putPaddrLow(mp->phys); 380 mb->un.varRegLogin.un.sp64.addrLow = putPaddrLow(mp->phys);
383 381
384 return (0); 382 return 0;
385} 383}
386 384
387/**********************************************/ 385/**********************************************/
@@ -389,7 +387,7 @@ lpfc_reg_login(struct lpfc_hba * phba,
389/* mailbox command */ 387/* mailbox command */
390/**********************************************/ 388/**********************************************/
391void 389void
392lpfc_unreg_login(struct lpfc_hba * phba, uint32_t rpi, LPFC_MBOXQ_t * pmb) 390lpfc_unreg_login(struct lpfc_hba *phba, uint32_t rpi, LPFC_MBOXQ_t * pmb)
393{ 391{
394 MAILBOX_t *mb; 392 MAILBOX_t *mb;
395 393
@@ -412,14 +410,14 @@ lpfc_config_pcb_setup(struct lpfc_hba * phba)
412 PCB_t *pcbp = &phba->slim2p->pcb; 410 PCB_t *pcbp = &phba->slim2p->pcb;
413 dma_addr_t pdma_addr; 411 dma_addr_t pdma_addr;
414 uint32_t offset; 412 uint32_t offset;
415 uint32_t iocbCnt; 413 uint32_t iocbCnt = 0;
416 int i; 414 int i;
417 415
418 pcbp->maxRing = (psli->num_rings - 1); 416 pcbp->maxRing = (psli->num_rings - 1);
419 417
420 iocbCnt = 0;
421 for (i = 0; i < psli->num_rings; i++) { 418 for (i = 0; i < psli->num_rings; i++) {
422 pring = &psli->ring[i]; 419 pring = &psli->ring[i];
420
423 /* A ring MUST have both cmd and rsp entries defined to be 421 /* A ring MUST have both cmd and rsp entries defined to be
424 valid */ 422 valid */
425 if ((pring->numCiocb == 0) || (pring->numRiocb == 0)) { 423 if ((pring->numCiocb == 0) || (pring->numRiocb == 0)) {
@@ -462,9 +460,7 @@ lpfc_config_pcb_setup(struct lpfc_hba * phba)
462void 460void
463lpfc_read_rev(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) 461lpfc_read_rev(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
464{ 462{
465 MAILBOX_t *mb; 463 MAILBOX_t *mb = &pmb->mb;
466
467 mb = &pmb->mb;
468 memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); 464 memset(pmb, 0, sizeof (LPFC_MBOXQ_t));
469 mb->un.varRdRev.cv = 1; 465 mb->un.varRdRev.cv = 1;
470 mb->mbxCommand = MBX_READ_REV; 466 mb->mbxCommand = MBX_READ_REV;
@@ -644,8 +640,7 @@ lpfc_mbox_get(struct lpfc_hba * phba)
644 LPFC_MBOXQ_t *mbq = NULL; 640 LPFC_MBOXQ_t *mbq = NULL;
645 struct lpfc_sli *psli = &phba->sli; 641 struct lpfc_sli *psli = &phba->sli;
646 642
647 list_remove_head((&psli->mboxq), mbq, LPFC_MBOXQ_t, 643 list_remove_head((&psli->mboxq), mbq, LPFC_MBOXQ_t, list);
648 list);
649 if (mbq) { 644 if (mbq) {
650 psli->mboxq_cnt--; 645 psli->mboxq_cnt--;
651 } 646 }