1 /*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2004-2005 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_device.h>
31 #include <scsi/scsi_host.h>
35 #include "lpfc_disc.h"
36 #include "lpfc_scsi.h"
38 #include "lpfc_logmsg.h"
39 #include "lpfc_crtn.h"
40 #include "lpfc_version.h"
42 #define HBA_PORTSPEED_UNKNOWN 0 /* Unknown - transceiver
43 * incapable of reporting */
44 #define HBA_PORTSPEED_1GBIT 1 /* 1 GBit/sec */
45 #define HBA_PORTSPEED_2GBIT 2 /* 2 GBit/sec */
46 #define HBA_PORTSPEED_4GBIT 8 /* 4 GBit/sec */
47 #define HBA_PORTSPEED_8GBIT 16 /* 8 GBit/sec */
48 #define HBA_PORTSPEED_10GBIT 4 /* 10 GBit/sec */
49 #define HBA_PORTSPEED_NOT_NEGOTIATED 5 /* Speed not established */
54 static char *lpfc_release_version
= LPFC_DRIVER_VERSION
;
60 lpfc_ct_unsol_event(struct lpfc_hba
* phba
,
61 struct lpfc_sli_ring
* pring
, struct lpfc_iocbq
* piocbq
)
64 struct lpfc_iocbq
*next_piocbq
;
65 struct lpfc_dmabuf
*pmbuf
= NULL
;
66 struct lpfc_dmabuf
*matp
, *next_matp
;
67 uint32_t ctx
= 0, size
= 0, cnt
= 0;
68 IOCB_t
*icmd
= &piocbq
->iocb
;
69 IOCB_t
*save_icmd
= icmd
;
71 struct list_head head
;
73 if ((icmd
->ulpStatus
== IOSTAT_LOCAL_REJECT
) &&
74 ((icmd
->un
.ulpWord
[4] & 0xff) == IOERR_RCV_BUFFER_WAITING
)) {
75 /* Not enough posted buffers; Try posting more buffers */
76 phba
->fc_stat
.NoRcvBuf
++;
77 lpfc_post_buffer(phba
, pring
, 0, 1);
81 /* If there are no BDEs associated with this IOCB,
82 * there is nothing to do.
84 if (icmd
->ulpBdeCount
== 0)
87 INIT_LIST_HEAD(&head
);
88 list_add_tail(&head
, &piocbq
->list
);
90 list_for_each_entry_safe(piocbq
, next_piocbq
, &head
, list
) {
93 ctx
= (uint32_t) (icmd
->ulpContext
);
94 if (icmd
->ulpBdeCount
== 0)
97 for (i
= 0; i
< icmd
->ulpBdeCount
; i
++) {
98 matp
= lpfc_sli_ringpostbuf_get(phba
, pring
,
106 /* Insert lpfc log message here */
107 lpfc_post_buffer(phba
, pring
, cnt
, 1);
109 goto ct_unsol_event_exit_piocbq
;
112 /* Typically for Unsolicited CT requests */
115 INIT_LIST_HEAD(&pmbuf
->list
);
117 list_add_tail(&matp
->list
, &pmbuf
->list
);
119 size
+= icmd
->un
.cont64
[i
].tus
.f
.bdeSize
;
123 icmd
->ulpBdeCount
= 0;
126 lpfc_post_buffer(phba
, pring
, cnt
, 1);
127 if (save_icmd
->ulpStatus
) {
131 ct_unsol_event_exit_piocbq
:
133 list_for_each_entry_safe(matp
, next_matp
, &pmbuf
->list
, list
) {
134 lpfc_mbuf_free(phba
, matp
->virt
, matp
->phys
);
135 list_del(&matp
->list
);
138 lpfc_mbuf_free(phba
, pmbuf
->virt
, pmbuf
->phys
);
145 lpfc_free_ct_rsp(struct lpfc_hba
* phba
, struct lpfc_dmabuf
* mlist
)
147 struct lpfc_dmabuf
*mlast
, *next_mlast
;
149 list_for_each_entry_safe(mlast
, next_mlast
, &mlist
->list
, list
) {
150 lpfc_mbuf_free(phba
, mlast
->virt
, mlast
->phys
);
151 list_del(&mlast
->list
);
154 lpfc_mbuf_free(phba
, mlist
->virt
, mlist
->phys
);
159 static struct lpfc_dmabuf
*
160 lpfc_alloc_ct_rsp(struct lpfc_hba
* phba
, int cmdcode
, struct ulp_bde64
* bpl
,
161 uint32_t size
, int *entries
)
163 struct lpfc_dmabuf
*mlist
= NULL
;
164 struct lpfc_dmabuf
*mp
;
167 /* We get chucks of FCELSSIZE */
168 cnt
= size
> FCELSSIZE
? FCELSSIZE
: size
;
171 /* Allocate buffer for rsp payload */
172 mp
= kmalloc(sizeof(struct lpfc_dmabuf
), GFP_KERNEL
);
175 lpfc_free_ct_rsp(phba
, mlist
);
179 INIT_LIST_HEAD(&mp
->list
);
181 if (cmdcode
== be16_to_cpu(SLI_CTNS_GID_FT
))
182 mp
->virt
= lpfc_mbuf_alloc(phba
, MEM_PRI
, &(mp
->phys
));
184 mp
->virt
= lpfc_mbuf_alloc(phba
, 0, &(mp
->phys
));
188 lpfc_free_ct_rsp(phba
, mlist
);
192 /* Queue it to a linked list */
196 list_add_tail(&mp
->list
, &mlist
->list
);
198 bpl
->tus
.f
.bdeFlags
= BUFF_USE_RCV
;
199 /* build buffer ptr list for IOCB */
200 bpl
->addrLow
= le32_to_cpu( putPaddrLow(mp
->phys
) );
201 bpl
->addrHigh
= le32_to_cpu( putPaddrHigh(mp
->phys
) );
202 bpl
->tus
.f
.bdeSize
= (uint16_t) cnt
;
203 bpl
->tus
.w
= le32_to_cpu(bpl
->tus
.w
);
215 lpfc_gen_req(struct lpfc_hba
*phba
, struct lpfc_dmabuf
*bmp
,
216 struct lpfc_dmabuf
*inp
, struct lpfc_dmabuf
*outp
,
217 void (*cmpl
) (struct lpfc_hba
*, struct lpfc_iocbq
*,
218 struct lpfc_iocbq
*),
219 struct lpfc_nodelist
*ndlp
, uint32_t usr_flg
, uint32_t num_entry
,
223 struct lpfc_sli
*psli
= &phba
->sli
;
224 struct lpfc_sli_ring
*pring
= &psli
->ring
[LPFC_ELS_RING
];
225 struct list_head
*lpfc_iocb_list
= &phba
->lpfc_iocb_list
;
227 struct lpfc_iocbq
*geniocb
= NULL
;
229 /* Allocate buffer for command iocb */
230 spin_lock_irq(phba
->host
->host_lock
);
231 list_remove_head(lpfc_iocb_list
, geniocb
, struct lpfc_iocbq
, list
);
232 spin_unlock_irq(phba
->host
->host_lock
);
236 memset(geniocb
, 0, sizeof (struct lpfc_iocbq
));
238 icmd
= &geniocb
->iocb
;
239 icmd
->un
.genreq64
.bdl
.ulpIoTag32
= 0;
240 icmd
->un
.genreq64
.bdl
.addrHigh
= putPaddrHigh(bmp
->phys
);
241 icmd
->un
.genreq64
.bdl
.addrLow
= putPaddrLow(bmp
->phys
);
242 icmd
->un
.genreq64
.bdl
.bdeFlags
= BUFF_TYPE_BDL
;
243 icmd
->un
.genreq64
.bdl
.bdeSize
= (num_entry
* sizeof (struct ulp_bde64
));
246 geniocb
->context3
= NULL
;
248 geniocb
->context3
= (uint8_t *) bmp
;
250 /* Save for completion so we can release these resources */
251 geniocb
->context1
= (uint8_t *) inp
;
252 geniocb
->context2
= (uint8_t *) outp
;
254 /* Fill in payload, bp points to frame payload */
255 icmd
->ulpCommand
= CMD_GEN_REQUEST64_CR
;
257 /* Fill in rest of iocb */
258 icmd
->un
.genreq64
.w5
.hcsw
.Fctl
= (SI
| LA
);
259 icmd
->un
.genreq64
.w5
.hcsw
.Dfctl
= 0;
260 icmd
->un
.genreq64
.w5
.hcsw
.Rctl
= FC_UNSOL_CTL
;
261 icmd
->un
.genreq64
.w5
.hcsw
.Type
= FC_COMMON_TRANSPORT_ULP
;
264 tmo
= (2 * phba
->fc_ratov
) + 1;
265 icmd
->ulpTimeout
= tmo
;
266 icmd
->ulpBdeCount
= 1;
268 icmd
->ulpClass
= CLASS3
;
269 icmd
->ulpContext
= ndlp
->nlp_rpi
;
271 /* Issue GEN REQ IOCB for NPORT <did> */
272 lpfc_printf_log(phba
, KERN_INFO
, LOG_ELS
,
273 "%d:0119 Issue GEN REQ IOCB for NPORT x%x "
274 "Data: x%x x%x\n", phba
->brd_no
, icmd
->un
.ulpWord
[5],
275 icmd
->ulpIoTag
, phba
->hba_state
);
276 geniocb
->iocb_cmpl
= cmpl
;
277 geniocb
->drvrTimeout
= icmd
->ulpTimeout
+ LPFC_DRVR_TIMEOUT
;
278 spin_lock_irq(phba
->host
->host_lock
);
279 if (lpfc_sli_issue_iocb(phba
, pring
, geniocb
, 0) == IOCB_ERROR
) {
280 list_add_tail(&geniocb
->list
, lpfc_iocb_list
);
281 spin_unlock_irq(phba
->host
->host_lock
);
284 spin_unlock_irq(phba
->host
->host_lock
);
290 lpfc_ct_cmd(struct lpfc_hba
*phba
, struct lpfc_dmabuf
*inmp
,
291 struct lpfc_dmabuf
*bmp
, struct lpfc_nodelist
*ndlp
,
292 void (*cmpl
) (struct lpfc_hba
*, struct lpfc_iocbq
*,
293 struct lpfc_iocbq
*),
296 struct ulp_bde64
*bpl
= (struct ulp_bde64
*) bmp
->virt
;
297 struct lpfc_dmabuf
*outmp
;
299 int cmdcode
= ((struct lpfc_sli_ct_request
*) inmp
->virt
)->
300 CommandResponse
.bits
.CmdRsp
;
302 bpl
++; /* Skip past ct request */
304 /* Put buffer(s) for ct rsp in bpl */
305 outmp
= lpfc_alloc_ct_rsp(phba
, cmdcode
, bpl
, rsp_size
, &cnt
);
309 status
= lpfc_gen_req(phba
, bmp
, inmp
, outmp
, cmpl
, ndlp
, 0,
312 lpfc_free_ct_rsp(phba
, outmp
);
319 lpfc_ns_rsp(struct lpfc_hba
* phba
, struct lpfc_dmabuf
* mp
, uint32_t Size
)
321 struct lpfc_sli_ct_request
*Response
=
322 (struct lpfc_sli_ct_request
*) mp
->virt
;
323 struct lpfc_nodelist
*ndlp
= NULL
;
324 struct lpfc_dmabuf
*mlast
, *next_mp
;
325 uint32_t *ctptr
= (uint32_t *) & Response
->un
.gid
.PortType
;
329 struct list_head head
;
331 lpfc_set_disctmo(phba
);
333 Cnt
= Size
> FCELSSIZE
? FCELSSIZE
: Size
;
335 list_add_tail(&head
, &mp
->list
);
336 list_for_each_entry_safe(mp
, next_mp
, &head
, list
) {
342 ctptr
= (uint32_t *) mlast
->virt
;
344 Cnt
-= 16; /* subtract length of CT header */
346 /* Loop through entire NameServer list of DIDs */
349 /* Get next DID from NameServer List */
351 Did
= ((be32_to_cpu(CTentry
)) & Mask_DID
);
354 if (Did
!= phba
->fc_myDID
) {
355 /* Check for rscn processing or not */
356 ndlp
= lpfc_setup_disc_node(phba
, Did
);
358 /* Mark all node table entries that are in the
362 lpfc_printf_log(phba
, KERN_INFO
, LOG_DISCOVERY
,
363 "%d:0238 Process x%x NameServer"
364 " Rsp Data: x%x x%x x%x\n",
368 phba
->fc_rscn_id_cnt
);
371 lpfc_printf_log(phba
,
374 "%d:0239 Skip x%x NameServer "
375 "Rsp Data: x%x x%x x%x\n",
377 Did
, Size
, phba
->fc_flag
,
378 phba
->fc_rscn_id_cnt
);
381 if (CTentry
& (be32_to_cpu(SLI_CT_LAST_ENTRY
)))
383 Cnt
-= sizeof (uint32_t);
392 /* Here we are finished in the case RSCN */
393 if (phba
->hba_state
== LPFC_HBA_READY
) {
394 lpfc_els_flush_rscn(phba
);
395 spin_lock_irq(phba
->host
->host_lock
);
396 phba
->fc_flag
|= FC_RSCN_MODE
; /* we are still in RSCN mode */
397 spin_unlock_irq(phba
->host
->host_lock
);
406 lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba
* phba
, struct lpfc_iocbq
* cmdiocb
,
407 struct lpfc_iocbq
* rspiocb
)
410 struct lpfc_sli
*psli
;
411 struct lpfc_dmabuf
*bmp
;
412 struct lpfc_dmabuf
*inp
;
413 struct lpfc_dmabuf
*outp
;
414 struct lpfc_nodelist
*ndlp
;
415 struct lpfc_sli_ct_request
*CTrsp
;
418 /* we pass cmdiocb to state machine which needs rspiocb as well */
419 cmdiocb
->context_un
.rsp_iocb
= rspiocb
;
421 inp
= (struct lpfc_dmabuf
*) cmdiocb
->context1
;
422 outp
= (struct lpfc_dmabuf
*) cmdiocb
->context2
;
423 bmp
= (struct lpfc_dmabuf
*) cmdiocb
->context3
;
425 irsp
= &rspiocb
->iocb
;
426 if (irsp
->ulpStatus
) {
427 if ((irsp
->ulpStatus
== IOSTAT_LOCAL_REJECT
) &&
428 ((irsp
->un
.ulpWord
[4] == IOERR_SLI_DOWN
) ||
429 (irsp
->un
.ulpWord
[4] == IOERR_SLI_ABORTED
))) {
433 /* Check for retry */
434 if (phba
->fc_ns_retry
< LPFC_MAX_NS_RETRY
) {
436 /* CT command is being retried */
438 lpfc_findnode_did(phba
, NLP_SEARCH_UNMAPPED
,
441 if (lpfc_ns_cmd(phba
, ndlp
, SLI_CTNS_GID_FT
) ==
448 /* Good status, continue checking */
449 CTrsp
= (struct lpfc_sli_ct_request
*) outp
->virt
;
450 if (CTrsp
->CommandResponse
.bits
.CmdRsp
==
451 be16_to_cpu(SLI_CT_RESPONSE_FS_ACC
)) {
452 lpfc_ns_rsp(phba
, outp
,
453 (uint32_t) (irsp
->un
.genreq64
.bdl
.bdeSize
));
454 } else if (CTrsp
->CommandResponse
.bits
.CmdRsp
==
455 be16_to_cpu(SLI_CT_RESPONSE_FS_RJT
)) {
456 /* NameServer Rsp Error */
457 lpfc_printf_log(phba
, KERN_INFO
, LOG_DISCOVERY
,
458 "%d:0240 NameServer Rsp Error "
459 "Data: x%x x%x x%x x%x\n",
461 CTrsp
->CommandResponse
.bits
.CmdRsp
,
462 (uint32_t) CTrsp
->ReasonCode
,
463 (uint32_t) CTrsp
->Explanation
,
466 /* NameServer Rsp Error */
467 lpfc_printf_log(phba
,
470 "%d:0241 NameServer Rsp Error "
471 "Data: x%x x%x x%x x%x\n",
473 CTrsp
->CommandResponse
.bits
.CmdRsp
,
474 (uint32_t) CTrsp
->ReasonCode
,
475 (uint32_t) CTrsp
->Explanation
,
479 /* Link up / RSCN discovery */
480 lpfc_disc_start(phba
);
482 lpfc_free_ct_rsp(phba
, outp
);
483 lpfc_mbuf_free(phba
, inp
->virt
, inp
->phys
);
484 lpfc_mbuf_free(phba
, bmp
->virt
, bmp
->phys
);
487 spin_lock_irq(phba
->host
->host_lock
);
488 list_add_tail(&cmdiocb
->list
, &phba
->lpfc_iocb_list
);
489 spin_unlock_irq(phba
->host
->host_lock
);
494 lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba
* phba
, struct lpfc_iocbq
* cmdiocb
,
495 struct lpfc_iocbq
* rspiocb
)
497 struct lpfc_sli
*psli
;
498 struct lpfc_dmabuf
*bmp
;
499 struct lpfc_dmabuf
*inp
;
500 struct lpfc_dmabuf
*outp
;
502 struct lpfc_sli_ct_request
*CTrsp
;
505 /* we pass cmdiocb to state machine which needs rspiocb as well */
506 cmdiocb
->context_un
.rsp_iocb
= rspiocb
;
508 inp
= (struct lpfc_dmabuf
*) cmdiocb
->context1
;
509 outp
= (struct lpfc_dmabuf
*) cmdiocb
->context2
;
510 bmp
= (struct lpfc_dmabuf
*) cmdiocb
->context3
;
511 irsp
= &rspiocb
->iocb
;
513 CTrsp
= (struct lpfc_sli_ct_request
*) outp
->virt
;
515 /* RFT request completes status <ulpStatus> CmdRsp <CmdRsp> */
516 lpfc_printf_log(phba
, KERN_INFO
, LOG_DISCOVERY
,
517 "%d:0209 RFT request completes ulpStatus x%x "
518 "CmdRsp x%x\n", phba
->brd_no
, irsp
->ulpStatus
,
519 CTrsp
->CommandResponse
.bits
.CmdRsp
);
521 lpfc_free_ct_rsp(phba
, outp
);
522 lpfc_mbuf_free(phba
, inp
->virt
, inp
->phys
);
523 lpfc_mbuf_free(phba
, bmp
->virt
, bmp
->phys
);
526 spin_lock_irq(phba
->host
->host_lock
);
527 list_add_tail(&cmdiocb
->list
, &phba
->lpfc_iocb_list
);
528 spin_unlock_irq(phba
->host
->host_lock
);
533 lpfc_cmpl_ct_cmd_rnn_id(struct lpfc_hba
* phba
, struct lpfc_iocbq
* cmdiocb
,
534 struct lpfc_iocbq
* rspiocb
)
536 lpfc_cmpl_ct_cmd_rft_id(phba
, cmdiocb
, rspiocb
);
541 lpfc_cmpl_ct_cmd_rsnn_nn(struct lpfc_hba
* phba
, struct lpfc_iocbq
* cmdiocb
,
542 struct lpfc_iocbq
* rspiocb
)
544 lpfc_cmpl_ct_cmd_rft_id(phba
, cmdiocb
, rspiocb
);
549 lpfc_get_hba_sym_node_name(struct lpfc_hba
* phba
, uint8_t * symbp
)
553 lpfc_decode_firmware_rev(phba
, fwrev
, 0);
556 sprintf(symbp
, "Emulex %s Port %s FV%s DV%s", phba
->ModelName
,
557 phba
->Port
, fwrev
, lpfc_release_version
);
559 sprintf(symbp
, "Emulex %s FV%s DV%s", phba
->ModelName
,
560 fwrev
, lpfc_release_version
);
567 * Issue Cmd to NameServer
572 lpfc_ns_cmd(struct lpfc_hba
* phba
, struct lpfc_nodelist
* ndlp
, int cmdcode
)
574 struct lpfc_dmabuf
*mp
, *bmp
;
575 struct lpfc_sli_ct_request
*CtReq
;
576 struct ulp_bde64
*bpl
;
577 void (*cmpl
) (struct lpfc_hba
*, struct lpfc_iocbq
*,
578 struct lpfc_iocbq
*) = NULL
;
579 uint32_t rsp_size
= 1024;
581 /* fill in BDEs for command */
582 /* Allocate buffer for command payload */
583 mp
= kmalloc(sizeof (struct lpfc_dmabuf
), GFP_KERNEL
);
587 INIT_LIST_HEAD(&mp
->list
);
588 mp
->virt
= lpfc_mbuf_alloc(phba
, MEM_PRI
, &(mp
->phys
));
592 /* Allocate buffer for Buffer ptr list */
593 bmp
= kmalloc(sizeof (struct lpfc_dmabuf
), GFP_KERNEL
);
595 goto ns_cmd_free_mpvirt
;
597 INIT_LIST_HEAD(&bmp
->list
);
598 bmp
->virt
= lpfc_mbuf_alloc(phba
, MEM_PRI
, &(bmp
->phys
));
600 goto ns_cmd_free_bmp
;
603 lpfc_printf_log(phba
,
606 "%d:0236 NameServer Req Data: x%x x%x x%x\n",
607 phba
->brd_no
, cmdcode
, phba
->fc_flag
,
608 phba
->fc_rscn_id_cnt
);
610 bpl
= (struct ulp_bde64
*) bmp
->virt
;
611 memset(bpl
, 0, sizeof(struct ulp_bde64
));
612 bpl
->addrHigh
= le32_to_cpu( putPaddrHigh(mp
->phys
) );
613 bpl
->addrLow
= le32_to_cpu( putPaddrLow(mp
->phys
) );
614 bpl
->tus
.f
.bdeFlags
= 0;
615 if (cmdcode
== SLI_CTNS_GID_FT
)
616 bpl
->tus
.f
.bdeSize
= GID_REQUEST_SZ
;
617 else if (cmdcode
== SLI_CTNS_RFT_ID
)
618 bpl
->tus
.f
.bdeSize
= RFT_REQUEST_SZ
;
619 else if (cmdcode
== SLI_CTNS_RNN_ID
)
620 bpl
->tus
.f
.bdeSize
= RNN_REQUEST_SZ
;
621 else if (cmdcode
== SLI_CTNS_RSNN_NN
)
622 bpl
->tus
.f
.bdeSize
= RSNN_REQUEST_SZ
;
624 bpl
->tus
.f
.bdeSize
= 0;
625 bpl
->tus
.w
= le32_to_cpu(bpl
->tus
.w
);
627 CtReq
= (struct lpfc_sli_ct_request
*) mp
->virt
;
628 memset(CtReq
, 0, sizeof (struct lpfc_sli_ct_request
));
629 CtReq
->RevisionId
.bits
.Revision
= SLI_CT_REVISION
;
630 CtReq
->RevisionId
.bits
.InId
= 0;
631 CtReq
->FsType
= SLI_CT_DIRECTORY_SERVICE
;
632 CtReq
->FsSubType
= SLI_CT_DIRECTORY_NAME_SERVER
;
633 CtReq
->CommandResponse
.bits
.Size
= 0;
635 case SLI_CTNS_GID_FT
:
636 CtReq
->CommandResponse
.bits
.CmdRsp
=
637 be16_to_cpu(SLI_CTNS_GID_FT
);
638 CtReq
->un
.gid
.Fc4Type
= SLI_CTPT_FCP
;
639 if (phba
->hba_state
< LPFC_HBA_READY
)
640 phba
->hba_state
= LPFC_NS_QRY
;
641 lpfc_set_disctmo(phba
);
642 cmpl
= lpfc_cmpl_ct_cmd_gid_ft
;
643 rsp_size
= FC_MAX_NS_RSP
;
646 case SLI_CTNS_RFT_ID
:
647 CtReq
->CommandResponse
.bits
.CmdRsp
=
648 be16_to_cpu(SLI_CTNS_RFT_ID
);
649 CtReq
->un
.rft
.PortId
= be32_to_cpu(phba
->fc_myDID
);
650 CtReq
->un
.rft
.fcpReg
= 1;
651 cmpl
= lpfc_cmpl_ct_cmd_rft_id
;
654 case SLI_CTNS_RNN_ID
:
655 CtReq
->CommandResponse
.bits
.CmdRsp
=
656 be16_to_cpu(SLI_CTNS_RNN_ID
);
657 CtReq
->un
.rnn
.PortId
= be32_to_cpu(phba
->fc_myDID
);
658 memcpy(CtReq
->un
.rnn
.wwnn
, &phba
->fc_nodename
,
659 sizeof (struct lpfc_name
));
660 cmpl
= lpfc_cmpl_ct_cmd_rnn_id
;
663 case SLI_CTNS_RSNN_NN
:
664 CtReq
->CommandResponse
.bits
.CmdRsp
=
665 be16_to_cpu(SLI_CTNS_RSNN_NN
);
666 memcpy(CtReq
->un
.rsnn
.wwnn
, &phba
->fc_nodename
,
667 sizeof (struct lpfc_name
));
668 lpfc_get_hba_sym_node_name(phba
, CtReq
->un
.rsnn
.symbname
);
669 CtReq
->un
.rsnn
.len
= strlen(CtReq
->un
.rsnn
.symbname
);
670 cmpl
= lpfc_cmpl_ct_cmd_rsnn_nn
;
674 if (!lpfc_ct_cmd(phba
, mp
, bmp
, ndlp
, cmpl
, rsp_size
))
675 /* On success, The cmpl function will free the buffers */
678 lpfc_mbuf_free(phba
, bmp
->virt
, bmp
->phys
);
682 lpfc_mbuf_free(phba
, mp
->virt
, mp
->phys
);
690 lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba
* phba
,
691 struct lpfc_iocbq
* cmdiocb
, struct lpfc_iocbq
* rspiocb
)
693 struct lpfc_dmabuf
*bmp
= cmdiocb
->context3
;
694 struct lpfc_dmabuf
*inp
= cmdiocb
->context1
;
695 struct lpfc_dmabuf
*outp
= cmdiocb
->context2
;
696 struct lpfc_sli_ct_request
*CTrsp
= outp
->virt
;
697 struct lpfc_sli_ct_request
*CTcmd
= inp
->virt
;
698 struct lpfc_nodelist
*ndlp
;
699 uint16_t fdmi_cmd
= CTcmd
->CommandResponse
.bits
.CmdRsp
;
700 uint16_t fdmi_rsp
= CTrsp
->CommandResponse
.bits
.CmdRsp
;
702 ndlp
= lpfc_findnode_did(phba
, NLP_SEARCH_ALL
, FDMI_DID
);
703 if (fdmi_rsp
== be16_to_cpu(SLI_CT_RESPONSE_FS_RJT
)) {
704 /* FDMI rsp failed */
705 lpfc_printf_log(phba
,
708 "%d:0220 FDMI rsp failed Data: x%x\n",
710 be16_to_cpu(fdmi_cmd
));
713 switch (be16_to_cpu(fdmi_cmd
)) {
715 lpfc_fdmi_cmd(phba
, ndlp
, SLI_MGMT_RPA
);
722 lpfc_fdmi_cmd(phba
, ndlp
, SLI_MGMT_DPRT
);
726 lpfc_fdmi_cmd(phba
, ndlp
, SLI_MGMT_RHBA
);
730 lpfc_free_ct_rsp(phba
, outp
);
731 lpfc_mbuf_free(phba
, inp
->virt
, inp
->phys
);
732 lpfc_mbuf_free(phba
, bmp
->virt
, bmp
->phys
);
735 spin_lock_irq(phba
->host
->host_lock
);
736 list_add_tail(&cmdiocb
->list
, &phba
->lpfc_iocb_list
);
737 spin_unlock_irq(phba
->host
->host_lock
);
741 lpfc_fdmi_cmd(struct lpfc_hba
* phba
, struct lpfc_nodelist
* ndlp
, int cmdcode
)
743 struct lpfc_dmabuf
*mp
, *bmp
;
744 struct lpfc_sli_ct_request
*CtReq
;
745 struct ulp_bde64
*bpl
;
749 REG_PORT_ATTRIBUTE
*pab
;
752 void (*cmpl
) (struct lpfc_hba
*, struct lpfc_iocbq
*,
753 struct lpfc_iocbq
*);
756 /* fill in BDEs for command */
757 /* Allocate buffer for command payload */
758 mp
= kmalloc(sizeof (struct lpfc_dmabuf
), GFP_KERNEL
);
762 mp
->virt
= lpfc_mbuf_alloc(phba
, 0, &(mp
->phys
));
764 goto fdmi_cmd_free_mp
;
766 /* Allocate buffer for Buffer ptr list */
767 bmp
= kmalloc(sizeof (struct lpfc_dmabuf
), GFP_KERNEL
);
769 goto fdmi_cmd_free_mpvirt
;
771 bmp
->virt
= lpfc_mbuf_alloc(phba
, 0, &(bmp
->phys
));
773 goto fdmi_cmd_free_bmp
;
775 INIT_LIST_HEAD(&mp
->list
);
776 INIT_LIST_HEAD(&bmp
->list
);
779 lpfc_printf_log(phba
,
782 "%d:0218 FDMI Request Data: x%x x%x x%x\n",
784 phba
->fc_flag
, phba
->hba_state
, cmdcode
);
786 CtReq
= (struct lpfc_sli_ct_request
*) mp
->virt
;
788 memset(CtReq
, 0, sizeof(struct lpfc_sli_ct_request
));
789 CtReq
->RevisionId
.bits
.Revision
= SLI_CT_REVISION
;
790 CtReq
->RevisionId
.bits
.InId
= 0;
792 CtReq
->FsType
= SLI_CT_MANAGEMENT_SERVICE
;
793 CtReq
->FsSubType
= SLI_CT_FDMI_Subtypes
;
799 lpfc_vpd_t
*vp
= &phba
->vpd
;
803 CtReq
->CommandResponse
.bits
.CmdRsp
=
804 be16_to_cpu(SLI_MGMT_RHBA
);
805 CtReq
->CommandResponse
.bits
.Size
= 0;
806 rh
= (REG_HBA
*) & CtReq
->un
.PortID
;
807 memcpy(&rh
->hi
.PortName
, &phba
->fc_sparam
.portName
,
808 sizeof (struct lpfc_name
));
809 /* One entry (port) per adapter */
810 rh
->rpl
.EntryCnt
= be32_to_cpu(1);
811 memcpy(&rh
->rpl
.pe
, &phba
->fc_sparam
.portName
,
812 sizeof (struct lpfc_name
));
814 /* point to the HBA attribute block */
815 size
= 2 * sizeof (struct lpfc_name
) + FOURBYTES
;
816 ab
= (ATTRIBUTE_BLOCK
*) ((uint8_t *) rh
+ size
);
819 /* Point to the beginning of the first HBA attribute
821 /* #1 HBA attribute entry */
823 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) rh
+ size
);
824 ae
->ad
.bits
.AttrType
= be16_to_cpu(NODE_NAME
);
825 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
826 + sizeof (struct lpfc_name
));
827 memcpy(&ae
->un
.NodeName
, &phba
->fc_sparam
.nodeName
,
828 sizeof (struct lpfc_name
));
830 size
+= FOURBYTES
+ sizeof (struct lpfc_name
);
832 /* #2 HBA attribute entry */
833 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) rh
+ size
);
834 ae
->ad
.bits
.AttrType
= be16_to_cpu(MANUFACTURER
);
835 strcpy(ae
->un
.Manufacturer
, "Emulex Corporation");
836 len
= strlen(ae
->un
.Manufacturer
);
837 len
+= (len
& 3) ? (4 - (len
& 3)) : 4;
838 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ len
);
840 size
+= FOURBYTES
+ len
;
842 /* #3 HBA attribute entry */
843 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) rh
+ size
);
844 ae
->ad
.bits
.AttrType
= be16_to_cpu(SERIAL_NUMBER
);
845 strcpy(ae
->un
.SerialNumber
, phba
->SerialNumber
);
846 len
= strlen(ae
->un
.SerialNumber
);
847 len
+= (len
& 3) ? (4 - (len
& 3)) : 4;
848 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ len
);
850 size
+= FOURBYTES
+ len
;
852 /* #4 HBA attribute entry */
853 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) rh
+ size
);
854 ae
->ad
.bits
.AttrType
= be16_to_cpu(MODEL
);
855 strcpy(ae
->un
.Model
, phba
->ModelName
);
856 len
= strlen(ae
->un
.Model
);
857 len
+= (len
& 3) ? (4 - (len
& 3)) : 4;
858 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ len
);
860 size
+= FOURBYTES
+ len
;
862 /* #5 HBA attribute entry */
863 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) rh
+ size
);
864 ae
->ad
.bits
.AttrType
= be16_to_cpu(MODEL_DESCRIPTION
);
865 strcpy(ae
->un
.ModelDescription
, phba
->ModelDesc
);
866 len
= strlen(ae
->un
.ModelDescription
);
867 len
+= (len
& 3) ? (4 - (len
& 3)) : 4;
868 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ len
);
870 size
+= FOURBYTES
+ len
;
872 /* #6 HBA attribute entry */
873 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) rh
+ size
);
874 ae
->ad
.bits
.AttrType
= be16_to_cpu(HARDWARE_VERSION
);
875 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ 8);
876 /* Convert JEDEC ID to ascii for hardware version */
877 incr
= vp
->rev
.biuRev
;
878 for (i
= 0; i
< 8; i
++) {
881 ae
->un
.HardwareVersion
[7 - i
] =
882 (char)((uint8_t) 0x30 +
885 ae
->un
.HardwareVersion
[7 - i
] =
886 (char)((uint8_t) 0x61 +
891 size
+= FOURBYTES
+ 8;
893 /* #7 HBA attribute entry */
894 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) rh
+ size
);
895 ae
->ad
.bits
.AttrType
= be16_to_cpu(DRIVER_VERSION
);
896 strcpy(ae
->un
.DriverVersion
, lpfc_release_version
);
897 len
= strlen(ae
->un
.DriverVersion
);
898 len
+= (len
& 3) ? (4 - (len
& 3)) : 4;
899 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ len
);
901 size
+= FOURBYTES
+ len
;
903 /* #8 HBA attribute entry */
904 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) rh
+ size
);
905 ae
->ad
.bits
.AttrType
= be16_to_cpu(OPTION_ROM_VERSION
);
906 strcpy(ae
->un
.OptionROMVersion
, phba
->OptionROMVersion
);
907 len
= strlen(ae
->un
.OptionROMVersion
);
908 len
+= (len
& 3) ? (4 - (len
& 3)) : 4;
909 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ len
);
911 size
+= FOURBYTES
+ len
;
913 /* #9 HBA attribute entry */
914 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) rh
+ size
);
915 ae
->ad
.bits
.AttrType
= be16_to_cpu(FIRMWARE_VERSION
);
916 lpfc_decode_firmware_rev(phba
, ae
->un
.FirmwareVersion
,
918 len
= strlen(ae
->un
.FirmwareVersion
);
919 len
+= (len
& 3) ? (4 - (len
& 3)) : 4;
920 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ len
);
922 size
+= FOURBYTES
+ len
;
924 /* #10 HBA attribute entry */
925 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) rh
+ size
);
926 ae
->ad
.bits
.AttrType
= be16_to_cpu(OS_NAME_VERSION
);
927 sprintf(ae
->un
.OsNameVersion
, "%s %s %s",
928 system_utsname
.sysname
, system_utsname
.release
,
929 system_utsname
.version
);
930 len
= strlen(ae
->un
.OsNameVersion
);
931 len
+= (len
& 3) ? (4 - (len
& 3)) : 4;
932 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ len
);
934 size
+= FOURBYTES
+ len
;
936 /* #11 HBA attribute entry */
937 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) rh
+ size
);
938 ae
->ad
.bits
.AttrType
= be16_to_cpu(MAX_CT_PAYLOAD_LEN
);
939 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ 4);
940 ae
->un
.MaxCTPayloadLen
= (65 * 4096);
942 size
+= FOURBYTES
+ 4;
944 ab
->EntryCnt
= be32_to_cpu(ab
->EntryCnt
);
946 size
= GID_REQUEST_SZ
- 4 + size
;
953 struct serv_parm
*hsp
;
958 CtReq
->CommandResponse
.bits
.CmdRsp
=
959 be16_to_cpu(SLI_MGMT_RPA
);
960 CtReq
->CommandResponse
.bits
.Size
= 0;
961 pab
= (REG_PORT_ATTRIBUTE
*) & CtReq
->un
.PortID
;
962 size
= sizeof (struct lpfc_name
) + FOURBYTES
;
963 memcpy((uint8_t *) & pab
->PortName
,
964 (uint8_t *) & phba
->fc_sparam
.portName
,
965 sizeof (struct lpfc_name
));
966 pab
->ab
.EntryCnt
= 0;
968 /* #1 Port attribute entry */
969 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) pab
+ size
);
970 ae
->ad
.bits
.AttrType
= be16_to_cpu(SUPPORTED_FC4_TYPES
);
971 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ 32);
972 ae
->un
.SupportFC4Types
[2] = 1;
973 ae
->un
.SupportFC4Types
[7] = 1;
975 size
+= FOURBYTES
+ 32;
977 /* #2 Port attribute entry */
978 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) pab
+ size
);
979 ae
->ad
.bits
.AttrType
= be16_to_cpu(SUPPORTED_SPEED
);
980 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ 4);
981 if (FC_JEDEC_ID(vp
->rev
.biuRev
) == VIPER_JEDEC_ID
)
982 ae
->un
.SupportSpeed
= HBA_PORTSPEED_10GBIT
;
983 else if (FC_JEDEC_ID(vp
->rev
.biuRev
) == HELIOS_JEDEC_ID
)
984 ae
->un
.SupportSpeed
= HBA_PORTSPEED_4GBIT
;
985 else if ((FC_JEDEC_ID(vp
->rev
.biuRev
) ==
987 || (FC_JEDEC_ID(vp
->rev
.biuRev
) ==
989 || (FC_JEDEC_ID(vp
->rev
.biuRev
) ==
991 ae
->un
.SupportSpeed
= HBA_PORTSPEED_2GBIT
;
993 ae
->un
.SupportSpeed
= HBA_PORTSPEED_1GBIT
;
995 size
+= FOURBYTES
+ 4;
997 /* #3 Port attribute entry */
998 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) pab
+ size
);
999 ae
->ad
.bits
.AttrType
= be16_to_cpu(PORT_SPEED
);
1000 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ 4);
1001 switch(phba
->fc_linkspeed
) {
1003 ae
->un
.PortSpeed
= HBA_PORTSPEED_1GBIT
;
1006 ae
->un
.PortSpeed
= HBA_PORTSPEED_2GBIT
;
1009 ae
->un
.PortSpeed
= HBA_PORTSPEED_4GBIT
;
1013 HBA_PORTSPEED_UNKNOWN
;
1017 size
+= FOURBYTES
+ 4;
1019 /* #4 Port attribute entry */
1020 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) pab
+ size
);
1021 ae
->ad
.bits
.AttrType
= be16_to_cpu(MAX_FRAME_SIZE
);
1022 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ 4);
1023 hsp
= (struct serv_parm
*) & phba
->fc_sparam
;
1024 ae
->un
.MaxFrameSize
=
1025 (((uint32_t) hsp
->cmn
.
1026 bbRcvSizeMsb
) << 8) | (uint32_t) hsp
->cmn
.
1029 size
+= FOURBYTES
+ 4;
1031 /* #5 Port attribute entry */
1032 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) pab
+ size
);
1033 ae
->ad
.bits
.AttrType
= be16_to_cpu(OS_DEVICE_NAME
);
1034 strcpy((char *)ae
->un
.OsDeviceName
, LPFC_DRIVER_NAME
);
1035 len
= strlen((char *)ae
->un
.OsDeviceName
);
1036 len
+= (len
& 3) ? (4 - (len
& 3)) : 4;
1037 ae
->ad
.bits
.AttrLen
= be16_to_cpu(FOURBYTES
+ len
);
1039 size
+= FOURBYTES
+ len
;
1041 if (phba
->cfg_fdmi_on
== 2) {
1042 /* #6 Port attribute entry */
1043 ae
= (ATTRIBUTE_ENTRY
*) ((uint8_t *) pab
+
1045 ae
->ad
.bits
.AttrType
= be16_to_cpu(HOST_NAME
);
1046 sprintf(ae
->un
.HostName
, "%s",
1047 system_utsname
.nodename
);
1048 len
= strlen(ae
->un
.HostName
);
1049 len
+= (len
& 3) ? (4 - (len
& 3)) : 4;
1050 ae
->ad
.bits
.AttrLen
=
1051 be16_to_cpu(FOURBYTES
+ len
);
1053 size
+= FOURBYTES
+ len
;
1056 pab
->ab
.EntryCnt
= be32_to_cpu(pab
->ab
.EntryCnt
);
1058 size
= GID_REQUEST_SZ
- 4 + size
;
1063 CtReq
->CommandResponse
.bits
.CmdRsp
= be16_to_cpu(SLI_MGMT_DHBA
);
1064 CtReq
->CommandResponse
.bits
.Size
= 0;
1065 pe
= (PORT_ENTRY
*) & CtReq
->un
.PortID
;
1066 memcpy((uint8_t *) & pe
->PortName
,
1067 (uint8_t *) & phba
->fc_sparam
.portName
,
1068 sizeof (struct lpfc_name
));
1069 size
= GID_REQUEST_SZ
- 4 + sizeof (struct lpfc_name
);
1073 CtReq
->CommandResponse
.bits
.CmdRsp
= be16_to_cpu(SLI_MGMT_DPRT
);
1074 CtReq
->CommandResponse
.bits
.Size
= 0;
1075 pe
= (PORT_ENTRY
*) & CtReq
->un
.PortID
;
1076 memcpy((uint8_t *) & pe
->PortName
,
1077 (uint8_t *) & phba
->fc_sparam
.portName
,
1078 sizeof (struct lpfc_name
));
1079 size
= GID_REQUEST_SZ
- 4 + sizeof (struct lpfc_name
);
1083 bpl
= (struct ulp_bde64
*) bmp
->virt
;
1084 bpl
->addrHigh
= le32_to_cpu( putPaddrHigh(mp
->phys
) );
1085 bpl
->addrLow
= le32_to_cpu( putPaddrLow(mp
->phys
) );
1086 bpl
->tus
.f
.bdeFlags
= 0;
1087 bpl
->tus
.f
.bdeSize
= size
;
1088 bpl
->tus
.w
= le32_to_cpu(bpl
->tus
.w
);
1090 cmpl
= lpfc_cmpl_ct_cmd_fdmi
;
1092 if (!lpfc_ct_cmd(phba
, mp
, bmp
, ndlp
, cmpl
, FC_MAX_NS_RSP
))
1095 lpfc_mbuf_free(phba
, bmp
->virt
, bmp
->phys
);
1098 fdmi_cmd_free_mpvirt
:
1099 lpfc_mbuf_free(phba
, mp
->virt
, mp
->phys
);
1103 /* Issue FDMI request failed */
1104 lpfc_printf_log(phba
,
1107 "%d:0244 Issue FDMI request failed Data: x%x\n",
1114 lpfc_fdmi_tmo(unsigned long ptr
)
1116 struct lpfc_hba
*phba
= (struct lpfc_hba
*)ptr
;
1117 unsigned long iflag
;
1119 spin_lock_irqsave(phba
->host
->host_lock
, iflag
);
1120 if (!(phba
->work_hba_events
& WORKER_FDMI_TMO
)) {
1121 phba
->work_hba_events
|= WORKER_FDMI_TMO
;
1122 if (phba
->work_wait
)
1123 wake_up(phba
->work_wait
);
1125 spin_unlock_irqrestore(phba
->host
->host_lock
,iflag
);
1129 lpfc_fdmi_tmo_handler(struct lpfc_hba
*phba
)
1131 struct lpfc_nodelist
*ndlp
;
1133 spin_lock_irq(phba
->host
->host_lock
);
1134 if (!(phba
->work_hba_events
& WORKER_FDMI_TMO
)) {
1135 spin_unlock_irq(phba
->host
->host_lock
);
1138 ndlp
= lpfc_findnode_did(phba
, NLP_SEARCH_ALL
, FDMI_DID
);
1140 if (system_utsname
.nodename
[0] != '\0') {
1141 lpfc_fdmi_cmd(phba
, ndlp
, SLI_MGMT_DHBA
);
1143 mod_timer(&phba
->fc_fdmitmo
, jiffies
+ HZ
* 60);
1146 spin_unlock_irq(phba
->host
->host_lock
);
1152 lpfc_decode_firmware_rev(struct lpfc_hba
* phba
, char *fwrevision
, int flag
)
1154 struct lpfc_sli
*psli
= &phba
->sli
;
1155 lpfc_vpd_t
*vp
= &phba
->vpd
;
1156 uint32_t b1
, b2
, b3
, b4
, i
, rev
;
1158 uint32_t *ptr
, str
[4];
1162 if (psli
->sli_flag
& LPFC_SLI2_ACTIVE
)
1163 rev
= vp
->rev
.sli2FwRev
;
1165 rev
= vp
->rev
.sli1FwRev
;
1167 b1
= (rev
& 0x0000f000) >> 12;
1168 b2
= (rev
& 0x00000f00) >> 8;
1169 b3
= (rev
& 0x000000c0) >> 6;
1170 b4
= (rev
& 0x00000030) >> 4;
1186 b4
= (rev
& 0x0000000f);
1188 if (psli
->sli_flag
& LPFC_SLI2_ACTIVE
)
1189 fwname
= vp
->rev
.sli2FwName
;
1191 fwname
= vp
->rev
.sli1FwName
;
1193 for (i
= 0; i
< 16; i
++)
1194 if (fwname
[i
] == 0x20)
1197 ptr
= (uint32_t*)fwname
;
1199 for (i
= 0; i
< 3; i
++)
1200 str
[i
] = be32_to_cpu(*ptr
++);
1204 sprintf(fwrevision
, "%d.%d%d (%s)",
1205 b1
, b2
, b3
, (char *)str
);
1207 sprintf(fwrevision
, "%d.%d%d", b1
,
1211 sprintf(fwrevision
, "%d.%d%d%c%d (%s)",
1215 sprintf(fwrevision
, "%d.%d%d%c%d",
1219 rev
= vp
->rev
.smFwRev
;
1221 b1
= (rev
& 0xff000000) >> 24;
1222 b2
= (rev
& 0x00f00000) >> 20;
1223 b3
= (rev
& 0x000f0000) >> 16;
1224 c
= (rev
& 0x0000ff00) >> 8;
1225 b4
= (rev
& 0x000000ff);
1228 sprintf(fwrevision
, "%d.%d%d%c%d ", b1
,
1231 sprintf(fwrevision
, "%d.%d%d%c%d ", b1
,