1 /*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2006 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. *
8 * This program is free software; you can redistribute it and/or *
9 * modify it under the terms of version 2 of the GNU General *
10 * Public License as published by the Free Software Foundation. *
11 * This program is distributed in the hope that it will be useful. *
12 * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND *
13 * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, *
14 * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE *
15 * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
16 * TO BE LEGALLY INVALID. See the GNU General Public License for *
17 * more details, a copy of which can be found in the file COPYING *
18 * included with this package. *
19 *******************************************************************/
22 * Fibre Channel SCSI LAN Device Driver CT support
25 #include <linux/blkdev.h>
26 #include <linux/pci.h>
27 #include <linux/interrupt.h>
28 #include <linux/utsname.h>
30 #include <scsi/scsi.h>
31 #include <scsi/scsi_device.h>
32 #include <scsi/scsi_host.h>
33 #include <scsi/scsi_transport_fc.h>
37 #include "lpfc_disc.h"
38 #include "lpfc_scsi.h"
40 #include "lpfc_logmsg.h"
41 #include "lpfc_crtn.h"
42 #include "lpfc_version.h"
44 #define HBA_PORTSPEED_UNKNOWN 0 /* Unknown - transceiver
45 * incapable of reporting */
46 #define HBA_PORTSPEED_1GBIT 1 /* 1 GBit/sec */
47 #define HBA_PORTSPEED_2GBIT 2 /* 2 GBit/sec */
48 #define HBA_PORTSPEED_4GBIT 8 /* 4 GBit/sec */
49 #define HBA_PORTSPEED_8GBIT 16 /* 8 GBit/sec */
50 #define HBA_PORTSPEED_10GBIT 4 /* 10 GBit/sec */
51 #define HBA_PORTSPEED_NOT_NEGOTIATED 5 /* Speed not established */
56 static char *lpfc_release_version
= LPFC_DRIVER_VERSION
;
62 lpfc_ct_unsol_event(struct lpfc_hba
* phba
,
63 struct lpfc_sli_ring
* pring
, struct lpfc_iocbq
* piocbq
)
66 struct lpfc_iocbq
*next_piocbq
;
67 struct lpfc_dmabuf
*pmbuf
= NULL
;
68 struct lpfc_dmabuf
*matp
, *next_matp
;
69 uint32_t ctx
= 0, size
= 0, cnt
= 0;
70 IOCB_t
*icmd
= &piocbq
->iocb
;
71 IOCB_t
*save_icmd
= icmd
;
73 struct list_head head
;
75 if ((icmd
->ulpStatus
== IOSTAT_LOCAL_REJECT
) &&
76 ((icmd
->un
.ulpWord
[4] & 0xff) == IOERR_RCV_BUFFER_WAITING
)) {
77 /* Not enough posted buffers; Try posting more buffers */
78 phba
->fc_stat
.NoRcvBuf
++;
79 lpfc_post_buffer(phba
, pring
, 0, 1);
83 /* If there are no BDEs associated with this IOCB,
84 * there is nothing to do.
86 if (icmd
->ulpBdeCount
== 0)
89 INIT_LIST_HEAD(&head
);
90 list_add_tail(&head
, &piocbq
->list
);
92 list_for_each_entry_safe(piocbq
, next_piocbq
, &head
, list
) {
95 ctx
= (uint32_t) (icmd
->ulpContext
);
96 if (icmd
->ulpBdeCount
== 0)
99 for (i
= 0; i
< icmd
->ulpBdeCount
; i
++) {
100 matp
= lpfc_sli_ringpostbuf_get(phba
, pring
,
108 /* Insert lpfc log message here */
109 lpfc_post_buffer(phba
, pring
, cnt
, 1);
111 goto ct_unsol_event_exit_piocbq
;
114 /* Typically for Unsolicited CT requests */
117 INIT_LIST_HEAD(&pmbuf
->list
);
119 list_add_tail(&matp
->list
, &pmbuf
->list
);
121 size
+= icmd
->un
.cont64
[i
].tus
.f
.bdeSize
;
125 icmd
->ulpBdeCount
= 0;
128 lpfc_post_buffer(phba
, pring
, cnt
, 1);
129 if (save_icmd
->ulpStatus
) {
133 ct_unsol_event_exit_piocbq
:
136 list_for_each_entry_safe(matp
, next_matp
, &pmbuf
->list
, list
) {
137 lpfc_mbuf_free(phba
, matp
->virt
, matp
->phys
);
138 list_del(&matp
->list
);
141 lpfc_mbuf_free(phba
, pmbuf
->virt
, pmbuf
->phys
);
148 lpfc_free_ct_rsp(struct lpfc_hba
* phba
, struct lpfc_dmabuf
* mlist
)
150 struct lpfc_dmabuf
*mlast
, *next_mlast
;
152 list_for_each_entry_safe(mlast
, next_mlast
, &mlist
->list
, list
) {
153 lpfc_mbuf_free(phba
, mlast
->virt
, mlast
->phys
);
154 list_del(&mlast
->list
);
157 lpfc_mbuf_free(phba
, mlist
->virt
, mlist
->phys
);
162 static struct lpfc_dmabuf
*
163 lpfc_alloc_ct_rsp(struct lpfc_hba
* phba
, int cmdcode
, struct ulp_bde64
* bpl
,
164 uint32_t size
, int *entries
)
166 struct lpfc_dmabuf
*mlist
= NULL
;
167 struct lpfc_dmabuf
*mp
;
170 /* We get chucks of FCELSSIZE */
171 cnt
= size
> FCELSSIZE
? FCELSSIZE
: size
;
174 /* Allocate buffer for rsp payload */
175 mp
= kmalloc(sizeof(struct lpfc_dmabuf
), GFP_KERNEL
);
178 lpfc_free_ct_rsp(phba
, mlist
);
182 INIT_LIST_HEAD(&mp
->list
);
184 if (cmdcode
== be16_to_cpu(SLI_CTNS_GID_FT
))
185 mp
->virt
= lpfc_mbuf_alloc(phba
, MEM_PRI
, &(mp
->phys
));
187 mp
->virt
= lpfc_mbuf_alloc(phba
, 0, &(mp
->phys
));
191 lpfc_free_ct_rsp(phba
, mlist
);
195 /* Queue it to a linked list */
199 list_add_tail(&mp
->list
, &mlist
->list
);
201 bpl
->tus
.f
.bdeFlags
= BUFF_USE_RCV
;
202 /* build buffer ptr list for IOCB */
203 bpl
->addrLow
= le32_to_cpu( putPaddrLow(mp
->phys
) );
204 bpl
->addrHigh
= le32_to_cpu( putPaddrHigh(mp
->phys
) );
205 bpl
->tus
.f
.bdeSize
= (uint16_t) cnt
;
206 bpl
->tus
.w
= le32_to_cpu(bpl
->tus
.w
);
218 lpfc_gen_req(struct lpfc_hba
*phba
, struct lpfc_dmabuf
*bmp
,
219 struct lpfc_dmabuf
*inp
, struct lpfc_dmabuf
*outp
,
220 void (*cmpl
) (struct lpfc_hba
*, struct lpfc_iocbq
*,
221 struct lpfc_iocbq
*),
222 struct lpfc_nodelist
*ndlp
, uint32_t usr_flg
, uint32_t num_entry
,
226 struct lpfc_sli
*psli
= &phba
->sli
;
227 struct lpfc_sli_ring
*pring
= &psli
->ring
[LPFC_ELS_RING
];
229 struct lpfc_iocbq
*geniocb
;
231 /* Allocate buffer for command iocb */
232 spin_lock_irq(phba
->host
->host_lock
);
233 geniocb
= lpfc_sli_get_iocbq(phba
);
234 spin_unlock_irq(phba
->host
->host_lock
);
239 icmd
= &geniocb
->iocb
;
240 icmd
->un
.genreq64
.bdl
.ulpIoTag32
= 0;
241 icmd
->un
.genreq64
.bdl
.addrHigh
= putPaddrHigh(bmp
->phys
);
242 icmd
->un
.genreq64
.bdl
.addrLow
= putPaddrLow(bmp
->phys
);
243 icmd
->un
.genreq64
.bdl
.bdeFlags
= BUFF_TYPE_BDL
;
244 icmd
->un
.genreq64
.bdl
.bdeSize
= (num_entry
* sizeof (struct ulp_bde64
));
247 geniocb
->context3
= NULL
;
249 geniocb
->context3
= (uint8_t *) bmp
;
251 /* Save for completion so we can release these resources */
252 geniocb
->context1
= (uint8_t *) inp
;
253 geniocb
->context2
= (uint8_t *) outp
;
255 /* Fill in payload, bp points to frame payload */
256 icmd
->ulpCommand
= CMD_GEN_REQUEST64_CR
;
258 /* Fill in rest of iocb */
259 icmd
->un
.genreq64
.w5
.hcsw
.Fctl
= (SI
| LA
);
260 icmd
->un
.genreq64
.w5
.hcsw
.Dfctl
= 0;
261 icmd
->un
.genreq64
.w5
.hcsw
.Rctl
= FC_UNSOL_CTL
;
262 icmd
->un
.genreq64
.w5
.hcsw
.Type
= FC_COMMON_TRANSPORT_ULP
;
265 /* FC spec states we need 3 * ratov for CT requests */
266 tmo
= (3 * phba
->fc_ratov
);
268 icmd
->ulpTimeout
= tmo
;
269 icmd
->ulpBdeCount
= 1;
271 icmd
->ulpClass
= CLASS3
;
272 icmd
->ulpContext
= ndlp
->nlp_rpi
;
274 /* Issue GEN REQ IOCB for NPORT <did> */
275 lpfc_printf_log(phba
, KERN_INFO
, LOG_ELS
,
276 "%d:0119 Issue GEN REQ IOCB for NPORT x%x "
277 "Data: x%x x%x\n", phba
->brd_no
, icmd
->un
.ulpWord
[5],
278 icmd
->ulpIoTag
, phba
->hba_state
);
279 geniocb
->iocb_cmpl
= cmpl
;
280 geniocb
->drvrTimeout
= icmd
->ulpTimeout
+ LPFC_DRVR_TIMEOUT
;
281 spin_lock_irq(phba
->host
->host_lock
);
282 if (lpfc_sli_issue_iocb(phba
, pring
, geniocb
, 0) == IOCB_ERROR
) {
283 lpfc_sli_release_iocbq(phba
, geniocb
);
284 spin_unlock_irq(phba
->host
->host_lock
);
287 spin_unlock_irq(phba
->host
->host_lock
);
293 lpfc_ct_cmd(struct lpfc_hba
*phba
, struct lpfc_dmabuf
*inmp
,
294 struct lpfc_dmabuf
*bmp
, struct lpfc_nodelist
*ndlp
,
295 void (*cmpl
) (struct lpfc_hba
*, struct lpfc_iocbq
*,
296 struct lpfc_iocbq
*),
299 struct ulp_bde64
*bpl
= (struct ulp_bde64
*) bmp
->virt
;
300 struct lpfc_dmabuf
*outmp
;
302 int cmdcode
= ((struct lpfc_sli_ct_request
*) inmp
->virt
)->
303 CommandResponse
.bits
.CmdRsp
;
305 bpl
++; /* Skip past ct request */
307 /* Put buffer(s) for ct rsp in bpl */
308 outmp
= lpfc_alloc_ct_rsp(phba
, cmdcode
, bpl
, rsp_size
, &cnt
);
312 status
= lpfc_gen_req(phba
, bmp
, inmp
, outmp
, cmpl
, ndlp
, 0,
315 lpfc_free_ct_rsp(phba
, outmp
);
322 lpfc_ns_rsp(struct lpfc_hba
* phba
, struct lpfc_dmabuf
* mp
, uint32_t Size
)
324 struct lpfc_sli_ct_request
*Response
=
325 (struct lpfc_sli_ct_request
*) mp
->virt
;
326 struct lpfc_nodelist
*ndlp
= NULL
;
327 struct lpfc_nodelist
*next_ndlp
;
328 struct lpfc_dmabuf
*mlast
, *next_mp
;
329 uint32_t *ctptr
= (uint32_t *) & Response
->un
.gid
.PortType
;
333 struct list_head head
;
335 lpfc_set_disctmo(phba
);
337 Cnt
= Size
> FCELSSIZE
? FCELSSIZE
: Size
;
339 list_add_tail(&head
, &mp
->list
);
340 list_for_each_entry_safe(mp
, next_mp
, &head
, list
) {
346 ctptr
= (uint32_t *) mlast
->virt
;
348 Cnt
-= 16; /* subtract length of CT header */
350 /* Loop through entire NameServer list of DIDs */
353 /* Get next DID from NameServer List */
355 Did
= ((be32_to_cpu(CTentry
)) & Mask_DID
);
358 if (Did
!= phba
->fc_myDID
) {
359 /* Check for rscn processing or not */
360 ndlp
= lpfc_setup_disc_node(phba
, Did
);
362 /* Mark all node table entries that are in the
366 lpfc_printf_log(phba
, KERN_INFO
, LOG_DISCOVERY
,
367 "%d:0238 Process x%x NameServer"
368 " Rsp Data: x%x x%x x%x\n",
372 phba
->fc_rscn_id_cnt
);
375 lpfc_printf_log(phba
,
378 "%d:0239 Skip x%x NameServer "
379 "Rsp Data: x%x x%x x%x\n",
381 Did
, Size
, phba
->fc_flag
,
382 phba
->fc_rscn_id_cnt
);
385 if (CTentry
& (be32_to_cpu(SLI_CT_LAST_ENTRY
)))
387 Cnt
-= sizeof (uint32_t);
397 * The driver has cycled through all Nports in the RSCN payload.
398 * Complete the handling by cleaning up and marking the
399 * current driver state.
401 if (phba
->hba_state
== LPFC_HBA_READY
) {
404 * Switch ports that connect a loop of multiple targets need
405 * special consideration. The driver wants to unregister the
406 * rpi only on the target that was pulled from the loop. On
407 * RSCN, the driver wants to rediscover an NPort only if the
408 * driver flagged it as NLP_NPR_2B_DISC. Provided adisc is
409 * not enabled and the NPort is not capable of retransmissions
410 * (FC Tape) prevent timing races with the scsi error handler by
411 * unregistering the Nport's RPI. This action causes all
412 * outstanding IO to flush back to the midlayer.
414 list_for_each_entry_safe(ndlp
, next_ndlp
, &phba
->fc_npr_list
,
416 if (!(ndlp
->nlp_flag
& NLP_NPR_2B_DISC
) &&
417 (lpfc_rscn_payload_check(phba
, ndlp
->nlp_DID
))) {
418 if ((phba
->cfg_use_adisc
== 0) &&
419 !(ndlp
->nlp_fcp_info
&
421 lpfc_unreg_rpi(phba
, ndlp
);
422 ndlp
->nlp_flag
&= ~NLP_NPR_ADISC
;
426 lpfc_els_flush_rscn(phba
);
427 spin_lock_irq(phba
->host
->host_lock
);
428 phba
->fc_flag
|= FC_RSCN_MODE
; /* we are still in RSCN mode */
429 spin_unlock_irq(phba
->host
->host_lock
);
438 lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba
* phba
, struct lpfc_iocbq
* cmdiocb
,
439 struct lpfc_iocbq
* rspiocb
)
442 struct lpfc_sli
*psli
;
443 struct lpfc_dmabuf
*bmp
;
444 struct lpfc_dmabuf
*inp
;
445 struct lpfc_dmabuf
*outp
;
446 struct lpfc_nodelist
*ndlp
;
447 struct lpfc_sli_ct_request
*CTrsp
;
450 /* we pass cmdiocb to state machine which needs rspiocb as well */
451 cmdiocb
->context_un
.rsp_iocb
= rspiocb
;
453 inp
= (struct lpfc_dmabuf
*) cmdiocb
->context1
;
454 outp
= (struct lpfc_dmabuf
*) cmdiocb
->context2
;
455 bmp
= (struct lpfc_dmabuf
*) cmdiocb
->context3
;
457 irsp
= &rspiocb
->iocb
;
458 if (irsp
->ulpStatus
) {
459 if ((irsp
->ulpStatus
== IOSTAT_LOCAL_REJECT
) &&
460 ((irsp
->un
.ulpWord
[4] == IOERR_SLI_DOWN
) ||
461 (irsp
->un
.ulpWord
[4] == IOERR_SLI_ABORTED
))) {
465 /* Check for retry */
466 if (phba
->fc_ns_retry
< LPFC_MAX_NS_RETRY
) {
468 /* CT command is being retried */
470 lpfc_findnode_did(phba
, NLP_SEARCH_UNMAPPED
,
473 if (lpfc_ns_cmd(phba
, ndlp
, SLI_CTNS_GID_FT
) ==
480 /* Good status, continue checking */
481 CTrsp
= (struct lpfc_sli_ct_request
*) outp
->virt
;
482 if (CTrsp
->CommandResponse
.bits
.CmdRsp
==
483 be16_to_cpu(SLI_CT_RESPONSE_FS_ACC
)) {
484 lpfc_printf_log(phba
, KERN_INFO
, LOG_DISCOVERY
,
485 "%d:0208 NameServer Rsp "
489 lpfc_ns_rsp(phba
, outp
,
490 (uint32_t) (irsp
->un
.genreq64
.bdl
.bdeSize
));
491 } else if (CTrsp
->CommandResponse
.bits
.CmdRsp
==
492 be16_to_cpu(SLI_CT_RESPONSE_FS_RJT
)) {
493 /* NameServer Rsp Error */
494 lpfc_printf_log(phba
, KERN_INFO
, LOG_DISCOVERY
,
495 "%d:0240 NameServer Rsp Error "
496 "Data: x%x x%x x%x x%x\n",
498 CTrsp
->CommandResponse
.bits
.CmdRsp
,
499 (uint32_t) CTrsp
->ReasonCode
,
500 (uint32_t) CTrsp
->Explanation
,
503 /* NameServer Rsp Error */
504 lpfc_printf_log(phba
,
507 "%d:0241 NameServer Rsp Error "
508 "Data: x%x x%x x%x x%x\n",
510 CTrsp
->CommandResponse
.bits
.CmdRsp
,
511 (uint32_t) CTrsp
->ReasonCode
,
512 (uint32_t) CTrsp
->Explanation
,
516 /* Link up / RSCN discovery */
517 lpfc_disc_start(phba
);
519 lpfc_free_ct_rsp(phba
, outp
);
520 lpfc_mbuf_free(phba
, inp
->virt
, inp
->phys
);
521 lpfc_mbuf_free(phba
, bmp
->virt
, bmp
->phys
);
524 spin_lock_irq(phba
->host
->host_lock
);
525 lpfc_sli_release_iocbq(phba
, cmdiocb
);
526 spin_unlock_irq(phba
->host
->host_lock
);
531 lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba
* phba
, struct lpfc_iocbq
* cmdiocb
,
532 struct lpfc_iocbq
* rspiocb
)
534 struct lpfc_sli
*psli
;
535 struct lpfc_dmabuf
*bmp
;
536 struct lpfc_dmabuf
*inp
;
537 struct lpfc_dmabuf
*outp
;
539 struct lpfc_sli_ct_request
*CTrsp
;
542 /* we pass cmdiocb to state machine which needs rspiocb as well */
543 cmdiocb
->context_un
.rsp_iocb
= rspiocb
;
545 inp
= (struct lpfc_dmabuf
*) cmdiocb
->context1
;
546 outp
= (struct lpfc_dmabuf
*) cmdiocb
->context2
;
547 bmp
= (struct lpfc_dmabuf
*) cmdiocb
->context3
;
548 irsp
= &rspiocb
->iocb
;
550 CTrsp
= (struct lpfc_sli_ct_request
*) outp
->virt
;
552 /* RFT request completes status <ulpStatus> CmdRsp <CmdRsp> */
553 lpfc_printf_log(phba
, KERN_INFO
, LOG_DISCOVERY
,
554 "%d:0209 RFT request completes ulpStatus x%x "
555 "CmdRsp x%x\n", phba
->brd_no
, irsp
->ulpStatus
,
556 CTrsp
->CommandResponse
.bits
.CmdRsp
);
558 lpfc_free_ct_rsp(phba
, outp
);
559 lpfc_mbuf_free(phba
, inp
->virt
, inp
->phys
);
560 lpfc_mbuf_free(phba
, bmp
->virt
, bmp
->phys
);
563 spin_lock_irq(phba
->host
->host_lock
);
564 lpfc_sli_release_iocbq(phba
, cmdiocb
);
565 spin_unlock_irq(phba
->host
->host_lock
);
570 lpfc_cmpl_ct_cmd_rnn_id(struct lpfc_hba
* phba
, struct lpfc_iocbq
* cmdiocb
,
571 struct lpfc_iocbq
* rspiocb
)
573 lpfc_cmpl_ct_cmd_rft_id(phba
, cmdiocb
, rspiocb
);
578 lpfc_cmpl_ct_cmd_rsnn_nn(struct lpfc_hba
* phba
, struct lpfc_iocbq
* cmdiocb
,
579 struct lpfc_iocbq
* rspiocb
)
581 lpfc_cmpl_ct_cmd_rft_id(phba
, cmdiocb
, rspiocb
);
586 lpfc_get_hba_sym_node_name(struct lpfc_hba
* phba
, uint8_t * symbp
)
590 lpfc_decode_firmware_rev(phba
, fwrev
, 0);
592 sprintf(symbp
, "Emulex %s FV%s DV%s", phba
->ModelName
,
593 fwrev
, lpfc_release_version
);
600 * Issue Cmd to NameServer
605 lpfc_ns_cmd(struct lpfc_hba
* phba
, struct lpfc_nodelist
* ndlp
, int cmdcode
)
607 struct lpfc_dmabuf
*mp
, *bmp
;
608 struct lpfc_sli_ct_request
*CtReq
;
609 struct ulp_bde64
*bpl
;
610 void (*cmpl
) (struct lpfc_hba
*, struct lpfc_iocbq
*,
611 struct lpfc_iocbq
*) = NULL
;
612 uint32_t rsp_size
= 1024;
614 /* fill in BDEs for command */
615 /* Allocate buffer for command payload */
616 mp
= kmalloc(sizeof (struct lpfc_dmabuf
), GFP_KERNEL
);
620 INIT_LIST_HEAD(&mp
->list
);
621 mp
->virt
= lpfc_mbuf_alloc(phba
, MEM_PRI
, &(mp
->phys
));
625 /* Allocate buffer for Buffer ptr list */
626 bmp
= kmalloc(sizeof (struct lpfc_dmabuf
), GFP_KERNEL
);
628 goto ns_cmd_free_mpvirt
;
630 INIT_LIST_HEAD(&bmp
->list
);
631 bmp
->virt
= lpfc_mbuf_alloc(phba
, MEM_PRI
, &(bmp
->phys
));
633 goto ns_cmd_free_bmp
;
636 lpfc_printf_log(phba
,
639 "%d:0236 NameServer Req Data: x%x x%x x%x\n",
640 phba
->brd_no
, cmdcode
, phba
->fc_flag
,
641 phba
->fc_rscn_id_cnt
);
643 bpl
= (struct ulp_bde64
*) bmp
->virt
;
644 memset(bpl
, 0, sizeof(struct ulp_bde64
));
645 bpl
->addrHigh
= le32_to_cpu( putPaddrHigh(mp
->phys
) );
646 bpl
->addrLow
= le32_to_cpu( putPaddrLow(mp
->phys
) );
647 bpl
->tus
.f
.bdeFlags
= 0;
648 if (cmdcode
== SLI_CTNS_GID_FT
)
649 bpl
->tus
.f
.bdeSize
= GID_REQUEST_SZ
;
650 else if (cmdcode
== SLI_CTNS_RFT_ID
)
651 bpl
->tus
.f
.bdeSize
= RFT_REQUEST_SZ
;
652 else if (cmdcode
== SLI_CTNS_RNN_ID
)
653 bpl
->tus
.f
.bdeSize
= RNN_REQUEST_SZ
;
654 else if (cmdcode
== SLI_CTNS_RSNN_NN
)
655 bpl
->tus
.f
.bdeSize
= RSNN_REQUEST_SZ
;
657 bpl
->tus
.f
.bdeSize
= 0;
658 bpl
->tus
.w
= le32_to_cpu(bpl
->tus
.w
);
660 CtReq
= (struct lpfc_sli_ct_request
*) mp
->virt
;
661 memset(CtReq
, 0, sizeof (struct lpfc_sli_ct_request
));
662 CtReq
->RevisionId
.bits
.Revision
= SLI_CT_REVISION
;
663 CtReq
->RevisionId
.bits
.InId
= 0;
664 CtReq
->FsType
= SLI_CT_DIRECTORY_SERVICE
;
665 CtReq
->FsSubType
= SLI_CT_DIRECTORY_NAME_SERVER
;
666 CtReq
->CommandResponse
.bits
.Size
= 0;
668 case SLI_CTNS_GID_FT
:
669 CtReq
->CommandResponse
.bits
.CmdRsp
=
670 be16_to_cpu(SLI_CTNS_GID_FT
);
671 CtReq
->un
.gid
.Fc4Type
= SLI_CTPT_FCP
;
672 if (phba
->hba_state
< LPFC_HBA_READY
)
673 phba
->hba_state
= LPFC_NS_QRY
;
674 lpfc_set_disctmo(phba
);
675 cmpl
= lpfc_cmpl_ct_cmd_gid_ft
;
676 rsp_size
= FC_MAX_NS_RSP
;
679 case SLI_CTNS_RFT_ID
:
680 CtReq
->CommandResponse
.bits
.CmdRsp
=
681 be16_to_cpu(SLI_CTNS_RFT_ID
);
682 CtReq
->un
.rft
.PortId
= be32_to_cpu(phba
->fc_myDID
);
683 CtReq
->un
.rft
.fcpReg
= 1;
684 cmpl
= lpfc_cmpl_ct_cmd_rft_id
;
687 case SLI_CTNS_RNN_ID
:
688 CtReq
->CommandResponse
.bits
.CmdRsp
=
689 be16_to_cpu(SLI_CTNS_RNN_ID
);
690 CtReq
->un
.rnn
.PortId
= be32_to_cpu(phba
->fc_myDID
);
691 memcpy(CtReq
->un
.rnn
.wwnn
, &phba
->fc_nodename
,
692 sizeof (struct lpfc_name
));
693 cmpl
= lpfc_cmpl_ct_cmd_rnn_id
;
696 case SLI_CTNS_RSNN_NN
:
697 CtReq
->CommandResponse
.bits
.CmdRsp
=
698 be16_to_cpu(SLI_CTNS_RSNN_NN
);
699 memcpy(CtReq
->un
.rsnn
.wwnn
, &phba
->fc_nodename
,
700 sizeof (struct lpfc_name
));
701 lpfc_get_hba_sym_node_name(phba
, CtReq
->un
.rsnn
.symbname
);
702 CtReq
->un
.rsnn
.len
= strlen(CtReq
->un
.rsnn
.symbname
);
703 cmpl
= lpfc_cmpl_ct_cmd_rsnn_nn
;
707 if (!lpfc_ct_cmd(phba
, mp
, bmp
, ndlp
, cmpl
, rsp_size
))
708 /* On success, The cmpl function will free the buffers */
711 lpfc_mbuf_free(phba
, bmp
->virt
, bmp
->phys
);
715 lpfc_mbuf_free(phba
, mp
->virt
, mp
->phys
);
723 lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba
* phba
,
724 struct lpfc_iocbq
* cmdiocb
, struct lpfc_iocbq
* rspiocb
)
726 struct lpfc_dmabuf
*bmp
= cmdiocb
->context3
;
727 struct lpfc_dmabuf
*inp
= cmdiocb
->context1
;
728 struct lpfc_dmabuf
*outp
= cmdiocb
->context2
;
729 struct lpfc_sli_ct_request
*CTrsp
= outp
->virt
;
730 struct lpfc_sli_ct_request
*CTcmd
= inp
->virt
;
731 struct lpfc_nodelist
*ndlp
;
732 uint16_t fdmi_cmd
= CTcmd
->CommandResponse
.bits
.CmdRsp
;
733 uint16_t fdmi_rsp
= CTrsp
->CommandResponse
.bits
.CmdRsp
;
735 ndlp
= lpfc_findnode_did(phba
, NLP_SEARCH_ALL
, FDMI_DID
);
736 if (fdmi_rsp
== be16_to_cpu(SLI_CT_RESPONSE_FS_RJT
)) {
737 /* FDMI rsp failed */
738 lpfc_printf_log(phba
,
741 "%d:0220 FDMI rsp failed Data: x%x\n",
743 be16_to_cpu(fdmi_cmd
));
746 switch (be16_to_cpu(fdmi_cmd
)) {
748 lpfc_fdmi_cmd(phba
, ndlp
, SLI_MGMT_RPA
);
755 lpfc_fdmi_cmd(phba
, ndlp
, SLI_MGMT_DPRT
);
759 lpfc_fdmi_cmd(phba
, ndlp
, SLI_MGMT_RHBA
);
763 lpfc_free_ct_rsp(phba
, outp
);
764 lpfc_mbuf_free(phba
, inp
->virt
, inp
->phys
);
765 lpfc_mbuf_free(phba
, bmp
->virt
, bmp
->phys
);
768 spin_lock_irq(phba
->host
->host_lock
);
769 lpfc_sli_release_iocbq(phba
, cmdiocb
);
770 spin_unlock_irq(phba
->host
->host_lock
);
774 lpfc_fdmi_cmd(struct lpfc_hba
* phba
, struct lpfc_nodelist
* ndlp
, int cmdcode
)
776 struct lpfc_dmabuf
*mp
, *bmp
;
777 struct lpfc_sli_ct_request
*CtReq
;
778 struct ulp_bde64
*bpl
;
782 REG_PORT_ATTRIBUTE
*pab
;
785 void (*cmpl
) (struct lpfc_hba
*, struct lpfc_iocbq
*,
786 struct lpfc_iocbq
*);
789 /* fill in BDEs for command */
790 /* Allocate buffer for command payload */
791 mp
= kmalloc(sizeof (struct lpfc_dmabuf
), GFP_KERNEL
);
795 mp
->virt
= lpfc_mbuf_alloc(phba
, 0, &(mp
->phys
));
797 goto fdmi_cmd_free_mp
;
799 /* Allocate buffer for Buffer ptr list */
800 bmp
= kmalloc(sizeof (struct lpfc_dmabuf
), GFP_KERNEL
);
802 goto fdmi_cmd_free_mpvirt
;
804 bmp
->virt
= lpfc_mbuf_alloc(phba
, 0, &(bmp
->phys
));
806 goto fdmi_cmd_free_bmp
;
808 INIT_LIST_HEAD(&mp
->list
);
809 INIT_LIST_HEAD(&bmp
->list
);
812 lpfc_printf_log(phba
,
815 "%d:0218 FDMI Request Data: x%x x%x x%x\n",
817 phba
->fc_flag
, phba
->hba_state
, cmdcode
);
819 CtReq
= (struct lpfc_sli_ct_request
*) mp
->virt
;
821 memset(CtReq
, 0, sizeof(struct lpfc_sli_ct_request
));
822 CtReq
->RevisionId
.bits
.Revision
= SLI_CT_REVISION
;
823 CtReq
->RevisionId
.bits
.InId
= 0;
825 CtReq
->FsType
= SLI_CT_MANAGEMENT_SERVICE
;
826 CtReq
->FsSubType
= SLI_CT_FDMI_Subtypes
;
832 lpfc_vpd_t
*vp
= &phba
->vpd
;
836 CtReq
->CommandResponse
.bits
.CmdRsp
=
837 be16_to_cpu(SLI_MGMT_RHBA
);
838 CtReq
->CommandResponse
.bits
.Size
= 0;
839 rh
= (REG_HBA
*) & CtReq
->un
.PortID
;
840 memcpy(&rh
->hi
.PortName
, &phba
->fc_sparam
.portName
,
841 sizeof (struct lpfc_name
));
842 /* One entry (port) per adapter */
843 rh
->rpl
.EntryCnt
= be32_to_cpu(1);
844 memcpy(&rh
->rpl
.pe
, &phba
->fc_sparam
.portName
,
845 sizeof (struct lpfc_name
));
847 /* point to the HBA attribute block */
848 size
= 2 * sizeof (struct lpfc_name
) + FOURBYTES
;
849 ab
= (ATTRIBUTE_BLOCK
*) ((uint8_t *) rh
+ size
);
852 /* Point to the beginning of the first HBA attribute
854 /* #1 HBA attribute entry */
856 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) rh
+ size
);
857 ae
->ad
.bits
.AttrType
= be16_to_cpu(NODE_NAME
);
858 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
859 + sizeof (struct lpfc_name
));
860 memcpy(&ae
->un
.NodeName
, &phba
->fc_sparam
.nodeName
,
861 sizeof (struct lpfc_name
));
863 size
+= FOURBYTES
+ sizeof (struct lpfc_name
);
865 /* #2 HBA attribute entry */
866 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) rh
+ size
);
867 ae
->ad
.bits
.AttrType
= be16_to_cpu(MANUFACTURER
);
868 strcpy(ae
->un
.Manufacturer
, "Emulex Corporation");
869 len
= strlen(ae
->un
.Manufacturer
);
870 len
+= (len
& 3) ? (4 - (len
& 3)) : 4;
871 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ len
);
873 size
+= FOURBYTES
+ len
;
875 /* #3 HBA attribute entry */
876 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) rh
+ size
);
877 ae
->ad
.bits
.AttrType
= be16_to_cpu(SERIAL_NUMBER
);
878 strcpy(ae
->un
.SerialNumber
, phba
->SerialNumber
);
879 len
= strlen(ae
->un
.SerialNumber
);
880 len
+= (len
& 3) ? (4 - (len
& 3)) : 4;
881 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ len
);
883 size
+= FOURBYTES
+ len
;
885 /* #4 HBA attribute entry */
886 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) rh
+ size
);
887 ae
->ad
.bits
.AttrType
= be16_to_cpu(MODEL
);
888 strcpy(ae
->un
.Model
, phba
->ModelName
);
889 len
= strlen(ae
->un
.Model
);
890 len
+= (len
& 3) ? (4 - (len
& 3)) : 4;
891 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ len
);
893 size
+= FOURBYTES
+ len
;
895 /* #5 HBA attribute entry */
896 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) rh
+ size
);
897 ae
->ad
.bits
.AttrType
= be16_to_cpu(MODEL_DESCRIPTION
);
898 strcpy(ae
->un
.ModelDescription
, phba
->ModelDesc
);
899 len
= strlen(ae
->un
.ModelDescription
);
900 len
+= (len
& 3) ? (4 - (len
& 3)) : 4;
901 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ len
);
903 size
+= FOURBYTES
+ len
;
905 /* #6 HBA attribute entry */
906 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) rh
+ size
);
907 ae
->ad
.bits
.AttrType
= be16_to_cpu(HARDWARE_VERSION
);
908 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ 8);
909 /* Convert JEDEC ID to ascii for hardware version */
910 incr
= vp
->rev
.biuRev
;
911 for (i
= 0; i
< 8; i
++) {
914 ae
->un
.HardwareVersion
[7 - i
] =
915 (char)((uint8_t) 0x30 +
918 ae
->un
.HardwareVersion
[7 - i
] =
919 (char)((uint8_t) 0x61 +
924 size
+= FOURBYTES
+ 8;
926 /* #7 HBA attribute entry */
927 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) rh
+ size
);
928 ae
->ad
.bits
.AttrType
= be16_to_cpu(DRIVER_VERSION
);
929 strcpy(ae
->un
.DriverVersion
, lpfc_release_version
);
930 len
= strlen(ae
->un
.DriverVersion
);
931 len
+= (len
& 3) ? (4 - (len
& 3)) : 4;
932 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ len
);
934 size
+= FOURBYTES
+ len
;
936 /* #8 HBA attribute entry */
937 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) rh
+ size
);
938 ae
->ad
.bits
.AttrType
= be16_to_cpu(OPTION_ROM_VERSION
);
939 strcpy(ae
->un
.OptionROMVersion
, phba
->OptionROMVersion
);
940 len
= strlen(ae
->un
.OptionROMVersion
);
941 len
+= (len
& 3) ? (4 - (len
& 3)) : 4;
942 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ len
);
944 size
+= FOURBYTES
+ len
;
946 /* #9 HBA attribute entry */
947 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) rh
+ size
);
948 ae
->ad
.bits
.AttrType
= be16_to_cpu(FIRMWARE_VERSION
);
949 lpfc_decode_firmware_rev(phba
, ae
->un
.FirmwareVersion
,
951 len
= strlen(ae
->un
.FirmwareVersion
);
952 len
+= (len
& 3) ? (4 - (len
& 3)) : 4;
953 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ len
);
955 size
+= FOURBYTES
+ len
;
957 /* #10 HBA attribute entry */
958 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) rh
+ size
);
959 ae
->ad
.bits
.AttrType
= be16_to_cpu(OS_NAME_VERSION
);
960 sprintf(ae
->un
.OsNameVersion
, "%s %s %s",
961 system_utsname
.sysname
, system_utsname
.release
,
962 system_utsname
.version
);
963 len
= strlen(ae
->un
.OsNameVersion
);
964 len
+= (len
& 3) ? (4 - (len
& 3)) : 4;
965 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ len
);
967 size
+= FOURBYTES
+ len
;
969 /* #11 HBA attribute entry */
970 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) rh
+ size
);
971 ae
->ad
.bits
.AttrType
= be16_to_cpu(MAX_CT_PAYLOAD_LEN
);
972 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ 4);
973 ae
->un
.MaxCTPayloadLen
= (65 * 4096);
975 size
+= FOURBYTES
+ 4;
977 ab
->EntryCnt
= be32_to_cpu(ab
->EntryCnt
);
979 size
= GID_REQUEST_SZ
- 4 + size
;
986 struct serv_parm
*hsp
;
991 CtReq
->CommandResponse
.bits
.CmdRsp
=
992 be16_to_cpu(SLI_MGMT_RPA
);
993 CtReq
->CommandResponse
.bits
.Size
= 0;
994 pab
= (REG_PORT_ATTRIBUTE
*) & CtReq
->un
.PortID
;
995 size
= sizeof (struct lpfc_name
) + FOURBYTES
;
996 memcpy((uint8_t *) & pab
->PortName
,
997 (uint8_t *) & phba
->fc_sparam
.portName
,
998 sizeof (struct lpfc_name
));
999 pab
->ab
.EntryCnt
= 0;
1001 /* #1 Port attribute entry */
1002 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) pab
+ size
);
1003 ae
->ad
.bits
.AttrType
= be16_to_cpu(SUPPORTED_FC4_TYPES
);
1004 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ 32);
1005 ae
->un
.SupportFC4Types
[2] = 1;
1006 ae
->un
.SupportFC4Types
[7] = 1;
1008 size
+= FOURBYTES
+ 32;
1010 /* #2 Port attribute entry */
1011 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) pab
+ size
);
1012 ae
->ad
.bits
.AttrType
= be16_to_cpu(SUPPORTED_SPEED
);
1013 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ 4);
1015 ae
->un
.SupportSpeed
= 0;
1016 if (phba
->lmt
& LMT_10Gb
)
1017 ae
->un
.SupportSpeed
= HBA_PORTSPEED_10GBIT
;
1018 if (phba
->lmt
& LMT_8Gb
)
1019 ae
->un
.SupportSpeed
|= HBA_PORTSPEED_8GBIT
;
1020 if (phba
->lmt
& LMT_4Gb
)
1021 ae
->un
.SupportSpeed
|= HBA_PORTSPEED_4GBIT
;
1022 if (phba
->lmt
& LMT_2Gb
)
1023 ae
->un
.SupportSpeed
|= HBA_PORTSPEED_2GBIT
;
1024 if (phba
->lmt
& LMT_1Gb
)
1025 ae
->un
.SupportSpeed
|= HBA_PORTSPEED_1GBIT
;
1028 size
+= FOURBYTES
+ 4;
1030 /* #3 Port attribute entry */
1031 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) pab
+ size
);
1032 ae
->ad
.bits
.AttrType
= be16_to_cpu(PORT_SPEED
);
1033 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ 4);
1034 switch(phba
->fc_linkspeed
) {
1036 ae
->un
.PortSpeed
= HBA_PORTSPEED_1GBIT
;
1039 ae
->un
.PortSpeed
= HBA_PORTSPEED_2GBIT
;
1042 ae
->un
.PortSpeed
= HBA_PORTSPEED_4GBIT
;
1046 HBA_PORTSPEED_UNKNOWN
;
1050 size
+= FOURBYTES
+ 4;
1052 /* #4 Port attribute entry */
1053 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) pab
+ size
);
1054 ae
->ad
.bits
.AttrType
= be16_to_cpu(MAX_FRAME_SIZE
);
1055 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ 4);
1056 hsp
= (struct serv_parm
*) & phba
->fc_sparam
;
1057 ae
->un
.MaxFrameSize
=
1058 (((uint32_t) hsp
->cmn
.
1059 bbRcvSizeMsb
) << 8) | (uint32_t) hsp
->cmn
.
1062 size
+= FOURBYTES
+ 4;
1064 /* #5 Port attribute entry */
1065 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) pab
+ size
);
1066 ae
->ad
.bits
.AttrType
= be16_to_cpu(OS_DEVICE_NAME
);
1067 strcpy((char *)ae
->un
.OsDeviceName
, LPFC_DRIVER_NAME
);
1068 len
= strlen((char *)ae
->un
.OsDeviceName
);
1069 len
+= (len
& 3) ? (4 - (len
& 3)) : 4;
1070 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ len
);
1072 size
+= FOURBYTES
+ len
;
1074 if (phba
->cfg_fdmi_on
== 2) {
1075 /* #6 Port attribute entry */
1076 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) pab
+
1078 ae
->ad
.bits
.AttrType
= be16_to_cpu(HOST_NAME
);
1079 sprintf(ae
->un
.HostName
, "%s",
1080 system_utsname
.nodename
);
1081 len
= strlen(ae
->un
.HostName
);
1082 len
+= (len
& 3) ? (4 - (len
& 3)) : 4;
1083 ae
->ad
.bits
.AttrLen
=
1084 be16_to_cpu(FOURBYTES
+ len
);
1086 size
+= FOURBYTES
+ len
;
1089 pab
->ab
.EntryCnt
= be32_to_cpu(pab
->ab
.EntryCnt
);
1091 size
= GID_REQUEST_SZ
- 4 + size
;
1096 CtReq
->CommandResponse
.bits
.CmdRsp
= be16_to_cpu(SLI_MGMT_DHBA
);
1097 CtReq
->CommandResponse
.bits
.Size
= 0;
1098 pe
= (PORT_ENTRY
*) & CtReq
->un
.PortID
;
1099 memcpy((uint8_t *) & pe
->PortName
,
1100 (uint8_t *) & phba
->fc_sparam
.portName
,
1101 sizeof (struct lpfc_name
));
1102 size
= GID_REQUEST_SZ
- 4 + sizeof (struct lpfc_name
);
1106 CtReq
->CommandResponse
.bits
.CmdRsp
= be16_to_cpu(SLI_MGMT_DPRT
);
1107 CtReq
->CommandResponse
.bits
.Size
= 0;
1108 pe
= (PORT_ENTRY
*) & CtReq
->un
.PortID
;
1109 memcpy((uint8_t *) & pe
->PortName
,
1110 (uint8_t *) & phba
->fc_sparam
.portName
,
1111 sizeof (struct lpfc_name
));
1112 size
= GID_REQUEST_SZ
- 4 + sizeof (struct lpfc_name
);
1116 bpl
= (struct ulp_bde64
*) bmp
->virt
;
1117 bpl
->addrHigh
= le32_to_cpu( putPaddrHigh(mp
->phys
) );
1118 bpl
->addrLow
= le32_to_cpu( putPaddrLow(mp
->phys
) );
1119 bpl
->tus
.f
.bdeFlags
= 0;
1120 bpl
->tus
.f
.bdeSize
= size
;
1121 bpl
->tus
.w
= le32_to_cpu(bpl
->tus
.w
);
1123 cmpl
= lpfc_cmpl_ct_cmd_fdmi
;
1125 if (!lpfc_ct_cmd(phba
, mp
, bmp
, ndlp
, cmpl
, FC_MAX_NS_RSP
))
1128 lpfc_mbuf_free(phba
, bmp
->virt
, bmp
->phys
);
1131 fdmi_cmd_free_mpvirt
:
1132 lpfc_mbuf_free(phba
, mp
->virt
, mp
->phys
);
1136 /* Issue FDMI request failed */
1137 lpfc_printf_log(phba
,
1140 "%d:0244 Issue FDMI request failed Data: x%x\n",
1147 lpfc_fdmi_tmo(unsigned long ptr
)
1149 struct lpfc_hba
*phba
= (struct lpfc_hba
*)ptr
;
1150 unsigned long iflag
;
1152 spin_lock_irqsave(phba
->host
->host_lock
, iflag
);
1153 if (!(phba
->work_hba_events
& WORKER_FDMI_TMO
)) {
1154 phba
->work_hba_events
|= WORKER_FDMI_TMO
;
1155 if (phba
->work_wait
)
1156 wake_up(phba
->work_wait
);
1158 spin_unlock_irqrestore(phba
->host
->host_lock
,iflag
);
1162 lpfc_fdmi_tmo_handler(struct lpfc_hba
*phba
)
1164 struct lpfc_nodelist
*ndlp
;
1166 ndlp
= lpfc_findnode_did(phba
, NLP_SEARCH_ALL
, FDMI_DID
);
1168 if (system_utsname
.nodename
[0] != '\0') {
1169 lpfc_fdmi_cmd(phba
, ndlp
, SLI_MGMT_DHBA
);
1171 mod_timer(&phba
->fc_fdmitmo
, jiffies
+ HZ
* 60);
1179 lpfc_decode_firmware_rev(struct lpfc_hba
* phba
, char *fwrevision
, int flag
)
1181 struct lpfc_sli
*psli
= &phba
->sli
;
1182 lpfc_vpd_t
*vp
= &phba
->vpd
;
1183 uint32_t b1
, b2
, b3
, b4
, i
, rev
;
1185 uint32_t *ptr
, str
[4];
1189 if (psli
->sli_flag
& LPFC_SLI2_ACTIVE
)
1190 rev
= vp
->rev
.sli2FwRev
;
1192 rev
= vp
->rev
.sli1FwRev
;
1194 b1
= (rev
& 0x0000f000) >> 12;
1195 b2
= (rev
& 0x00000f00) >> 8;
1196 b3
= (rev
& 0x000000c0) >> 6;
1197 b4
= (rev
& 0x00000030) >> 4;
1213 b4
= (rev
& 0x0000000f);
1215 if (psli
->sli_flag
& LPFC_SLI2_ACTIVE
)
1216 fwname
= vp
->rev
.sli2FwName
;
1218 fwname
= vp
->rev
.sli1FwName
;
1220 for (i
= 0; i
< 16; i
++)
1221 if (fwname
[i
] == 0x20)
1224 ptr
= (uint32_t*)fwname
;
1226 for (i
= 0; i
< 3; i
++)
1227 str
[i
] = be32_to_cpu(*ptr
++);
1231 sprintf(fwrevision
, "%d.%d%d (%s)",
1232 b1
, b2
, b3
, (char *)str
);
1234 sprintf(fwrevision
, "%d.%d%d", b1
,
1238 sprintf(fwrevision
, "%d.%d%d%c%d (%s)",
1242 sprintf(fwrevision
, "%d.%d%d%c%d",
1246 rev
= vp
->rev
.smFwRev
;
1248 b1
= (rev
& 0xff000000) >> 24;
1249 b2
= (rev
& 0x00f00000) >> 20;
1250 b3
= (rev
& 0x000f0000) >> 16;
1251 c
= (rev
& 0x0000ff00) >> 8;
1252 b4
= (rev
& 0x000000ff);
1255 sprintf(fwrevision
, "%d.%d%d%c%d ", b1
,
1258 sprintf(fwrevision
, "%d.%d%d%c%d ", b1
,