aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/bfa/bfa.h2
-rw-r--r--drivers/scsi/bfa/bfa_core.c2
-rw-r--r--drivers/scsi/bfa/bfa_cs.h51
-rw-r--r--drivers/scsi/bfa/bfa_defs.h2
-rw-r--r--drivers/scsi/bfa/bfa_fc.h24
-rw-r--r--drivers/scsi/bfa/bfa_fcbuild.c58
-rw-r--r--drivers/scsi/bfa/bfa_fcbuild.h2
-rw-r--r--drivers/scsi/bfa/bfa_fcpim.c24
-rw-r--r--drivers/scsi/bfa/bfa_fcs.c8
-rw-r--r--drivers/scsi/bfa/bfa_fcs.h2
-rw-r--r--drivers/scsi/bfa/bfa_fcs_fcpim.c2
-rw-r--r--drivers/scsi/bfa/bfa_fcs_lport.c12
-rw-r--r--drivers/scsi/bfa/bfa_fcs_rport.c2
-rw-r--r--drivers/scsi/bfa/bfa_hw_cb.c1
-rw-r--r--drivers/scsi/bfa/bfa_hw_ct.c1
-rw-r--r--drivers/scsi/bfa/bfa_ioc.c6
-rw-r--r--drivers/scsi/bfa/bfa_ioc.h8
-rw-r--r--drivers/scsi/bfa/bfa_ioc_cb.c1
-rw-r--r--drivers/scsi/bfa/bfa_ioc_ct.c1
-rw-r--r--drivers/scsi/bfa/bfa_os_inc.h143
-rw-r--r--drivers/scsi/bfa/bfa_port.c15
-rw-r--r--drivers/scsi/bfa/bfa_svc.c35
-rw-r--r--drivers/scsi/bfa/bfad.c9
-rw-r--r--drivers/scsi/bfa/bfad_attr.c10
-rw-r--r--drivers/scsi/bfa/bfad_drv.h37
-rw-r--r--drivers/scsi/bfa/bfad_im.c38
-rw-r--r--drivers/scsi/bfa/bfad_im.h16
-rw-r--r--drivers/scsi/bfa/bfi.h2
28 files changed, 210 insertions, 304 deletions
diff --git a/drivers/scsi/bfa/bfa.h b/drivers/scsi/bfa/bfa.h
index 8f17186a8dfe..cabc6b92b25d 100644
--- a/drivers/scsi/bfa/bfa.h
+++ b/drivers/scsi/bfa/bfa.h
@@ -17,7 +17,7 @@
17#ifndef __BFA_H__ 17#ifndef __BFA_H__
18#define __BFA_H__ 18#define __BFA_H__
19 19
20#include "bfa_os_inc.h" 20#include "bfad_drv.h"
21#include "bfa_cs.h" 21#include "bfa_cs.h"
22#include "bfa_plog.h" 22#include "bfa_plog.h"
23#include "bfa_defs_svc.h" 23#include "bfa_defs_svc.h"
diff --git a/drivers/scsi/bfa/bfa_core.c b/drivers/scsi/bfa/bfa_core.c
index d417864227ce..02a5e04e365f 100644
--- a/drivers/scsi/bfa/bfa_core.c
+++ b/drivers/scsi/bfa/bfa_core.c
@@ -15,9 +15,9 @@
15 * General Public License for more details. 15 * General Public License for more details.
16 */ 16 */
17 17
18#include "bfad_drv.h"
18#include "bfa_modules.h" 19#include "bfa_modules.h"
19#include "bfi_ctreg.h" 20#include "bfi_ctreg.h"
20#include "bfad_drv.h"
21 21
22BFA_TRC_FILE(HAL, CORE); 22BFA_TRC_FILE(HAL, CORE);
23 23
diff --git a/drivers/scsi/bfa/bfa_cs.h b/drivers/scsi/bfa/bfa_cs.h
index 99f242b9aa31..493009d880a8 100644
--- a/drivers/scsi/bfa/bfa_cs.h
+++ b/drivers/scsi/bfa/bfa_cs.h
@@ -22,7 +22,7 @@
22#ifndef __BFA_CS_H__ 22#ifndef __BFA_CS_H__
23#define __BFA_CS_H__ 23#define __BFA_CS_H__
24 24
25#include "bfa_os_inc.h" 25#include "bfad_drv.h"
26 26
27/* 27/*
28 * BFA TRC 28 * BFA TRC
@@ -32,12 +32,20 @@
32#define BFA_TRC_MAX (4 * 1024) 32#define BFA_TRC_MAX (4 * 1024)
33#endif 33#endif
34 34
35#define BFA_TRC_TS(_trcm) \
36 ({ \
37 struct timeval tv; \
38 \
39 do_gettimeofday(&tv); \
40 (tv.tv_sec*1000000+tv.tv_usec); \
41 })
42
35#ifndef BFA_TRC_TS 43#ifndef BFA_TRC_TS
36#define BFA_TRC_TS(_trcm) ((_trcm)->ticks++) 44#define BFA_TRC_TS(_trcm) ((_trcm)->ticks++)
37#endif 45#endif
38 46
39struct bfa_trc_s { 47struct bfa_trc_s {
40#ifdef __BIGENDIAN 48#ifdef __BIG_ENDIAN
41 u16 fileno; 49 u16 fileno;
42 u16 line; 50 u16 line;
43#else 51#else
@@ -361,4 +369,43 @@ bfa_wc_wait(struct bfa_wc_s *wc)
361 bfa_wc_down(wc); 369 bfa_wc_down(wc);
362} 370}
363 371
372static inline void
373wwn2str(char *wwn_str, u64 wwn)
374{
375 union {
376 u64 wwn;
377 u8 byte[8];
378 } w;
379
380 w.wwn = wwn;
381 sprintf(wwn_str, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", w.byte[0],
382 w.byte[1], w.byte[2], w.byte[3], w.byte[4], w.byte[5],
383 w.byte[6], w.byte[7]);
384}
385
386static inline void
387fcid2str(char *fcid_str, u32 fcid)
388{
389 union {
390 u32 fcid;
391 u8 byte[4];
392 } f;
393
394 f.fcid = fcid;
395 sprintf(fcid_str, "%02x:%02x:%02x", f.byte[1], f.byte[2], f.byte[3]);
396}
397
398#define bfa_swap_3b(_x) \
399 ((((_x) & 0xff) << 16) | \
400 ((_x) & 0x00ff00) | \
401 (((_x) & 0xff0000) >> 16))
402
403#ifndef __BIG_ENDIAN
404#define bfa_hton3b(_x) bfa_swap_3b(_x)
405#else
406#define bfa_hton3b(_x) (_x)
407#endif
408
409#define bfa_ntoh3b(_x) bfa_hton3b(_x)
410
364#endif /* __BFA_CS_H__ */ 411#endif /* __BFA_CS_H__ */
diff --git a/drivers/scsi/bfa/bfa_defs.h b/drivers/scsi/bfa/bfa_defs.h
index 07b57c4208c1..d85f93aea465 100644
--- a/drivers/scsi/bfa/bfa_defs.h
+++ b/drivers/scsi/bfa/bfa_defs.h
@@ -19,7 +19,7 @@
19#define __BFA_DEFS_H__ 19#define __BFA_DEFS_H__
20 20
21#include "bfa_fc.h" 21#include "bfa_fc.h"
22#include "bfa_os_inc.h" 22#include "bfad_drv.h"
23 23
24#define BFA_MFG_SERIALNUM_SIZE 11 24#define BFA_MFG_SERIALNUM_SIZE 11
25#define STRSZ(_n) (((_n) + 4) & ~3) 25#define STRSZ(_n) (((_n) + 4) & ~3)
diff --git a/drivers/scsi/bfa/bfa_fc.h b/drivers/scsi/bfa/bfa_fc.h
index 104a17f70b55..0d04ba9574f9 100644
--- a/drivers/scsi/bfa/bfa_fc.h
+++ b/drivers/scsi/bfa/bfa_fc.h
@@ -18,7 +18,7 @@
18#ifndef __BFA_FC_H__ 18#ifndef __BFA_FC_H__
19#define __BFA_FC_H__ 19#define __BFA_FC_H__
20 20
21#include "bfa_os_inc.h" 21#include "bfad_drv.h"
22 22
23typedef u64 wwn_t; 23typedef u64 wwn_t;
24 24
@@ -62,7 +62,7 @@ struct scsi_cdb_s {
62 * Fibre Channel Header Structure (FCHS) definition 62 * Fibre Channel Header Structure (FCHS) definition
63 */ 63 */
64struct fchs_s { 64struct fchs_s {
65#ifdef __BIGENDIAN 65#ifdef __BIG_ENDIAN
66 u32 routing:4; /* routing bits */ 66 u32 routing:4; /* routing bits */
67 u32 cat_info:4; /* category info */ 67 u32 cat_info:4; /* category info */
68#else 68#else
@@ -317,7 +317,7 @@ struct fc_plogi_csp_s {
317 u8 verlo; /* FC-PH low version */ 317 u8 verlo; /* FC-PH low version */
318 __be16 bbcred; /* BB_Credit */ 318 __be16 bbcred; /* BB_Credit */
319 319
320#ifdef __BIGENDIAN 320#ifdef __BIG_ENDIAN
321 u8 ciro:1, /* continuously increasing RO */ 321 u8 ciro:1, /* continuously increasing RO */
322 rro:1, /* random relative offset */ 322 rro:1, /* random relative offset */
323 npiv_supp:1, /* NPIV supported */ 323 npiv_supp:1, /* NPIV supported */
@@ -367,7 +367,7 @@ struct fc_plogi_csp_s {
367 * FC-PH-x. Figure 78. pg. 318. 367 * FC-PH-x. Figure 78. pg. 318.
368 */ 368 */
369struct fc_plogi_clp_s { 369struct fc_plogi_clp_s {
370#ifdef __BIGENDIAN 370#ifdef __BIG_ENDIAN
371 u32 class_valid:1; 371 u32 class_valid:1;
372 u32 intermix:1; /* class intermix supported if set =1. 372 u32 intermix:1; /* class intermix supported if set =1.
373 * valid only for class1. Reserved for 373 * valid only for class1. Reserved for
@@ -532,7 +532,7 @@ struct fc_rsi_s {
532 */ 532 */
533struct fc_prli_params_s { 533struct fc_prli_params_s {
534 u32 reserved:16; 534 u32 reserved:16;
535#ifdef __BIGENDIAN 535#ifdef __BIG_ENDIAN
536 u32 reserved1:5; 536 u32 reserved1:5;
537 u32 rec_support:1; 537 u32 rec_support:1;
538 u32 task_retry_id:1; 538 u32 task_retry_id:1;
@@ -574,7 +574,7 @@ enum {
574struct fc_prli_params_page_s { 574struct fc_prli_params_page_s {
575 u32 type:8; 575 u32 type:8;
576 u32 codext:8; 576 u32 codext:8;
577#ifdef __BIGENDIAN 577#ifdef __BIG_ENDIAN
578 u32 origprocasv:1; 578 u32 origprocasv:1;
579 u32 rsppav:1; 579 u32 rsppav:1;
580 u32 imagepair:1; 580 u32 imagepair:1;
@@ -610,7 +610,7 @@ struct fc_prli_s {
610struct fc_prlo_params_page_s { 610struct fc_prlo_params_page_s {
611 u32 type:8; 611 u32 type:8;
612 u32 type_ext:8; 612 u32 type_ext:8;
613#ifdef __BIGENDIAN 613#ifdef __BIG_ENDIAN
614 u32 opa_valid:1; /* originator process associator 614 u32 opa_valid:1; /* originator process associator
615 * valid 615 * valid
616 */ 616 */
@@ -646,7 +646,7 @@ struct fc_prlo_acc_params_page_s {
646 u32 type:8; 646 u32 type:8;
647 u32 type_ext:8; 647 u32 type_ext:8;
648 648
649#ifdef __BIGENDIAN 649#ifdef __BIG_ENDIAN
650 u32 opa_valid:1; /* originator process associator 650 u32 opa_valid:1; /* originator process associator
651 * valid 651 * valid
652 */ 652 */
@@ -803,7 +803,7 @@ struct fc_tprlo_params_page_s {
803u32 type:8; 803u32 type:8;
804u32 type_ext:8; 804u32 type_ext:8;
805 805
806#ifdef __BIGENDIAN 806#ifdef __BIG_ENDIAN
807 u32 opa_valid:1; 807 u32 opa_valid:1;
808 u32 rpa_valid:1; 808 u32 rpa_valid:1;
809 u32 tpo_nport_valid:1; 809 u32 tpo_nport_valid:1;
@@ -1177,7 +1177,7 @@ struct fc_srr_s {
1177struct fcp_cmnd_s { 1177struct fcp_cmnd_s {
1178 struct scsi_lun lun; /* 64-bit LU number */ 1178 struct scsi_lun lun; /* 64-bit LU number */
1179 u8 crn; /* command reference number */ 1179 u8 crn; /* command reference number */
1180#ifdef __BIGENDIAN 1180#ifdef __BIG_ENDIAN
1181 u8 resvd:1, 1181 u8 resvd:1,
1182 priority:4, /* FCP-3: SAM-3 priority */ 1182 priority:4, /* FCP-3: SAM-3 priority */
1183 taskattr:3; /* scsi task attribute */ 1183 taskattr:3; /* scsi task attribute */
@@ -1187,7 +1187,7 @@ struct fcp_cmnd_s {
1187 resvd:1; 1187 resvd:1;
1188#endif 1188#endif
1189 u8 tm_flags; /* task management flags */ 1189 u8 tm_flags; /* task management flags */
1190#ifdef __BIGENDIAN 1190#ifdef __BIG_ENDIAN
1191 u8 addl_cdb_len:6, /* additional CDB length words */ 1191 u8 addl_cdb_len:6, /* additional CDB length words */
1192 iodir:2; /* read/write FCP_DATA IUs */ 1192 iodir:2; /* read/write FCP_DATA IUs */
1193#else 1193#else
@@ -1273,7 +1273,7 @@ struct fcp_rspinfo_s {
1273struct fcp_resp_s { 1273struct fcp_resp_s {
1274 u32 reserved[2]; /* 2 words reserved */ 1274 u32 reserved[2]; /* 2 words reserved */
1275 u16 reserved2; 1275 u16 reserved2;
1276#ifdef __BIGENDIAN 1276#ifdef __BIG_ENDIAN
1277 u8 reserved3:3; 1277 u8 reserved3:3;
1278 u8 fcp_conf_req:1; /* FCP_CONF is requested */ 1278 u8 fcp_conf_req:1; /* FCP_CONF is requested */
1279 u8 resid_flags:2; /* underflow/overflow */ 1279 u8 resid_flags:2; /* underflow/overflow */
diff --git a/drivers/scsi/bfa/bfa_fcbuild.c b/drivers/scsi/bfa/bfa_fcbuild.c
index 322b11e10d67..1ca5af75dd37 100644
--- a/drivers/scsi/bfa/bfa_fcbuild.c
+++ b/drivers/scsi/bfa/bfa_fcbuild.c
@@ -18,7 +18,7 @@
18 * fcbuild.c - FC link service frame building and parsing routines 18 * fcbuild.c - FC link service frame building and parsing routines
19 */ 19 */
20 20
21#include "bfa_os_inc.h" 21#include "bfad_drv.h"
22#include "bfa_fcbuild.h" 22#include "bfa_fcbuild.h"
23 23
24/* 24/*
@@ -48,7 +48,7 @@ fcbuild_init(void)
48 fc_els_req_tmpl.cat_info = FC_CAT_LD_REQUEST; 48 fc_els_req_tmpl.cat_info = FC_CAT_LD_REQUEST;
49 fc_els_req_tmpl.type = FC_TYPE_ELS; 49 fc_els_req_tmpl.type = FC_TYPE_ELS;
50 fc_els_req_tmpl.f_ctl = 50 fc_els_req_tmpl.f_ctl =
51 bfa_os_hton3b(FCTL_SEQ_INI | FCTL_FS_EXCH | FCTL_END_SEQ | 51 bfa_hton3b(FCTL_SEQ_INI | FCTL_FS_EXCH | FCTL_END_SEQ |
52 FCTL_SI_XFER); 52 FCTL_SI_XFER);
53 fc_els_req_tmpl.rx_id = FC_RXID_ANY; 53 fc_els_req_tmpl.rx_id = FC_RXID_ANY;
54 54
@@ -59,7 +59,7 @@ fcbuild_init(void)
59 fc_els_rsp_tmpl.cat_info = FC_CAT_LD_REPLY; 59 fc_els_rsp_tmpl.cat_info = FC_CAT_LD_REPLY;
60 fc_els_rsp_tmpl.type = FC_TYPE_ELS; 60 fc_els_rsp_tmpl.type = FC_TYPE_ELS;
61 fc_els_rsp_tmpl.f_ctl = 61 fc_els_rsp_tmpl.f_ctl =
62 bfa_os_hton3b(FCTL_EC_RESP | FCTL_SEQ_INI | FCTL_LS_EXCH | 62 bfa_hton3b(FCTL_EC_RESP | FCTL_SEQ_INI | FCTL_LS_EXCH |
63 FCTL_END_SEQ | FCTL_SI_XFER); 63 FCTL_END_SEQ | FCTL_SI_XFER);
64 fc_els_rsp_tmpl.rx_id = FC_RXID_ANY; 64 fc_els_rsp_tmpl.rx_id = FC_RXID_ANY;
65 65
@@ -68,7 +68,7 @@ fcbuild_init(void)
68 */ 68 */
69 fc_bls_req_tmpl.routing = FC_RTG_BASIC_LINK; 69 fc_bls_req_tmpl.routing = FC_RTG_BASIC_LINK;
70 fc_bls_req_tmpl.type = FC_TYPE_BLS; 70 fc_bls_req_tmpl.type = FC_TYPE_BLS;
71 fc_bls_req_tmpl.f_ctl = bfa_os_hton3b(FCTL_END_SEQ | FCTL_SI_XFER); 71 fc_bls_req_tmpl.f_ctl = bfa_hton3b(FCTL_END_SEQ | FCTL_SI_XFER);
72 fc_bls_req_tmpl.rx_id = FC_RXID_ANY; 72 fc_bls_req_tmpl.rx_id = FC_RXID_ANY;
73 73
74 /* 74 /*
@@ -78,7 +78,7 @@ fcbuild_init(void)
78 fc_bls_rsp_tmpl.cat_info = FC_CAT_BA_ACC; 78 fc_bls_rsp_tmpl.cat_info = FC_CAT_BA_ACC;
79 fc_bls_rsp_tmpl.type = FC_TYPE_BLS; 79 fc_bls_rsp_tmpl.type = FC_TYPE_BLS;
80 fc_bls_rsp_tmpl.f_ctl = 80 fc_bls_rsp_tmpl.f_ctl =
81 bfa_os_hton3b(FCTL_EC_RESP | FCTL_SEQ_INI | FCTL_LS_EXCH | 81 bfa_hton3b(FCTL_EC_RESP | FCTL_SEQ_INI | FCTL_LS_EXCH |
82 FCTL_END_SEQ | FCTL_SI_XFER); 82 FCTL_END_SEQ | FCTL_SI_XFER);
83 fc_bls_rsp_tmpl.rx_id = FC_RXID_ANY; 83 fc_bls_rsp_tmpl.rx_id = FC_RXID_ANY;
84 84
@@ -129,7 +129,7 @@ fcbuild_init(void)
129 fcp_fchs_tmpl.cat_info = FC_CAT_UNSOLICIT_CMD; 129 fcp_fchs_tmpl.cat_info = FC_CAT_UNSOLICIT_CMD;
130 fcp_fchs_tmpl.type = FC_TYPE_FCP; 130 fcp_fchs_tmpl.type = FC_TYPE_FCP;
131 fcp_fchs_tmpl.f_ctl = 131 fcp_fchs_tmpl.f_ctl =
132 bfa_os_hton3b(FCTL_FS_EXCH | FCTL_END_SEQ | FCTL_SI_XFER); 132 bfa_hton3b(FCTL_FS_EXCH | FCTL_END_SEQ | FCTL_SI_XFER);
133 fcp_fchs_tmpl.seq_id = 1; 133 fcp_fchs_tmpl.seq_id = 1;
134 fcp_fchs_tmpl.rx_id = FC_RXID_ANY; 134 fcp_fchs_tmpl.rx_id = FC_RXID_ANY;
135} 135}
@@ -143,7 +143,7 @@ fc_gs_fchdr_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u32 ox_id)
143 fchs->cat_info = FC_CAT_UNSOLICIT_CTRL; 143 fchs->cat_info = FC_CAT_UNSOLICIT_CTRL;
144 fchs->type = FC_TYPE_SERVICES; 144 fchs->type = FC_TYPE_SERVICES;
145 fchs->f_ctl = 145 fchs->f_ctl =
146 bfa_os_hton3b(FCTL_SEQ_INI | FCTL_FS_EXCH | FCTL_END_SEQ | 146 bfa_hton3b(FCTL_SEQ_INI | FCTL_FS_EXCH | FCTL_END_SEQ |
147 FCTL_SI_XFER); 147 FCTL_SI_XFER);
148 fchs->rx_id = FC_RXID_ANY; 148 fchs->rx_id = FC_RXID_ANY;
149 fchs->d_id = (d_id); 149 fchs->d_id = (d_id);
@@ -232,7 +232,7 @@ fc_flogi_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id,
232 u16 ox_id, wwn_t port_name, wwn_t node_name, u16 pdu_size, 232 u16 ox_id, wwn_t port_name, wwn_t node_name, u16 pdu_size,
233 u8 set_npiv, u8 set_auth, u16 local_bb_credits) 233 u8 set_npiv, u8 set_auth, u16 local_bb_credits)
234{ 234{
235 u32 d_id = bfa_os_hton3b(FC_FABRIC_PORT); 235 u32 d_id = bfa_hton3b(FC_FABRIC_PORT);
236 __be32 *vvl_info; 236 __be32 *vvl_info;
237 237
238 memcpy(flogi, &plogi_tmpl, sizeof(struct fc_logi_s)); 238 memcpy(flogi, &plogi_tmpl, sizeof(struct fc_logi_s));
@@ -289,7 +289,7 @@ u16
289fc_fdisc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id, 289fc_fdisc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id,
290 u16 ox_id, wwn_t port_name, wwn_t node_name, u16 pdu_size) 290 u16 ox_id, wwn_t port_name, wwn_t node_name, u16 pdu_size)
291{ 291{
292 u32 d_id = bfa_os_hton3b(FC_FABRIC_PORT); 292 u32 d_id = bfa_hton3b(FC_FABRIC_PORT);
293 293
294 memcpy(flogi, &plogi_tmpl, sizeof(struct fc_logi_s)); 294 memcpy(flogi, &plogi_tmpl, sizeof(struct fc_logi_s));
295 295
@@ -770,10 +770,10 @@ u16
770fc_rpsc2_build(struct fchs_s *fchs, struct fc_rpsc2_cmd_s *rpsc2, u32 d_id, 770fc_rpsc2_build(struct fchs_s *fchs, struct fc_rpsc2_cmd_s *rpsc2, u32 d_id,
771 u32 s_id, u32 *pid_list, u16 npids) 771 u32 s_id, u32 *pid_list, u16 npids)
772{ 772{
773 u32 dctlr_id = FC_DOMAIN_CTRLR(bfa_os_hton3b(d_id)); 773 u32 dctlr_id = FC_DOMAIN_CTRLR(bfa_hton3b(d_id));
774 int i = 0; 774 int i = 0;
775 775
776 fc_els_req_build(fchs, bfa_os_hton3b(dctlr_id), s_id, 0); 776 fc_els_req_build(fchs, bfa_hton3b(dctlr_id), s_id, 0);
777 777
778 memset(rpsc2, 0, sizeof(struct fc_rpsc2_cmd_s)); 778 memset(rpsc2, 0, sizeof(struct fc_rpsc2_cmd_s));
779 779
@@ -1045,7 +1045,7 @@ fc_gidpn_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1045{ 1045{
1046 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; 1046 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld;
1047 struct fcgs_gidpn_req_s *gidpn = (struct fcgs_gidpn_req_s *)(cthdr + 1); 1047 struct fcgs_gidpn_req_s *gidpn = (struct fcgs_gidpn_req_s *)(cthdr + 1);
1048 u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); 1048 u32 d_id = bfa_hton3b(FC_NAME_SERVER);
1049 1049
1050 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); 1050 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id);
1051 fc_gs_cthdr_build(cthdr, s_id, GS_GID_PN); 1051 fc_gs_cthdr_build(cthdr, s_id, GS_GID_PN);
@@ -1061,7 +1061,7 @@ fc_gpnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1061{ 1061{
1062 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; 1062 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld;
1063 fcgs_gpnid_req_t *gpnid = (fcgs_gpnid_req_t *) (cthdr + 1); 1063 fcgs_gpnid_req_t *gpnid = (fcgs_gpnid_req_t *) (cthdr + 1);
1064 u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); 1064 u32 d_id = bfa_hton3b(FC_NAME_SERVER);
1065 1065
1066 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); 1066 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id);
1067 fc_gs_cthdr_build(cthdr, s_id, GS_GPN_ID); 1067 fc_gs_cthdr_build(cthdr, s_id, GS_GPN_ID);
@@ -1077,7 +1077,7 @@ fc_gnnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1077{ 1077{
1078 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; 1078 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld;
1079 fcgs_gnnid_req_t *gnnid = (fcgs_gnnid_req_t *) (cthdr + 1); 1079 fcgs_gnnid_req_t *gnnid = (fcgs_gnnid_req_t *) (cthdr + 1);
1080 u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); 1080 u32 d_id = bfa_hton3b(FC_NAME_SERVER);
1081 1081
1082 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); 1082 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id);
1083 fc_gs_cthdr_build(cthdr, s_id, GS_GNN_ID); 1083 fc_gs_cthdr_build(cthdr, s_id, GS_GNN_ID);
@@ -1104,7 +1104,7 @@ u16
1104fc_scr_build(struct fchs_s *fchs, struct fc_scr_s *scr, 1104fc_scr_build(struct fchs_s *fchs, struct fc_scr_s *scr,
1105 u8 set_br_reg, u32 s_id, u16 ox_id) 1105 u8 set_br_reg, u32 s_id, u16 ox_id)
1106{ 1106{
1107 u32 d_id = bfa_os_hton3b(FC_FABRIC_CONTROLLER); 1107 u32 d_id = bfa_hton3b(FC_FABRIC_CONTROLLER);
1108 1108
1109 fc_els_req_build(fchs, d_id, s_id, ox_id); 1109 fc_els_req_build(fchs, d_id, s_id, ox_id);
1110 1110
@@ -1121,7 +1121,7 @@ u16
1121fc_rscn_build(struct fchs_s *fchs, struct fc_rscn_pl_s *rscn, 1121fc_rscn_build(struct fchs_s *fchs, struct fc_rscn_pl_s *rscn,
1122 u32 s_id, u16 ox_id) 1122 u32 s_id, u16 ox_id)
1123{ 1123{
1124 u32 d_id = bfa_os_hton3b(FC_FABRIC_CONTROLLER); 1124 u32 d_id = bfa_hton3b(FC_FABRIC_CONTROLLER);
1125 u16 payldlen; 1125 u16 payldlen;
1126 1126
1127 fc_els_req_build(fchs, d_id, s_id, ox_id); 1127 fc_els_req_build(fchs, d_id, s_id, ox_id);
@@ -1143,7 +1143,7 @@ fc_rftid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1143{ 1143{
1144 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; 1144 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld;
1145 struct fcgs_rftid_req_s *rftid = (struct fcgs_rftid_req_s *)(cthdr + 1); 1145 struct fcgs_rftid_req_s *rftid = (struct fcgs_rftid_req_s *)(cthdr + 1);
1146 u32 type_value, d_id = bfa_os_hton3b(FC_NAME_SERVER); 1146 u32 type_value, d_id = bfa_hton3b(FC_NAME_SERVER);
1147 u8 index; 1147 u8 index;
1148 1148
1149 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); 1149 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id);
@@ -1167,7 +1167,7 @@ fc_rftid_build_sol(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1167{ 1167{
1168 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; 1168 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld;
1169 struct fcgs_rftid_req_s *rftid = (struct fcgs_rftid_req_s *)(cthdr + 1); 1169 struct fcgs_rftid_req_s *rftid = (struct fcgs_rftid_req_s *)(cthdr + 1);
1170 u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); 1170 u32 d_id = bfa_hton3b(FC_NAME_SERVER);
1171 1171
1172 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); 1172 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id);
1173 fc_gs_cthdr_build(cthdr, s_id, GS_RFT_ID); 1173 fc_gs_cthdr_build(cthdr, s_id, GS_RFT_ID);
@@ -1187,7 +1187,7 @@ fc_rffid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1187{ 1187{
1188 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; 1188 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld;
1189 struct fcgs_rffid_req_s *rffid = (struct fcgs_rffid_req_s *)(cthdr + 1); 1189 struct fcgs_rffid_req_s *rffid = (struct fcgs_rffid_req_s *)(cthdr + 1);
1190 u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); 1190 u32 d_id = bfa_hton3b(FC_NAME_SERVER);
1191 1191
1192 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); 1192 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id);
1193 fc_gs_cthdr_build(cthdr, s_id, GS_RFF_ID); 1193 fc_gs_cthdr_build(cthdr, s_id, GS_RFF_ID);
@@ -1209,7 +1209,7 @@ fc_rspnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
1209 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; 1209 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld;
1210 struct fcgs_rspnid_req_s *rspnid = 1210 struct fcgs_rspnid_req_s *rspnid =
1211 (struct fcgs_rspnid_req_s *)(cthdr + 1); 1211 (struct fcgs_rspnid_req_s *)(cthdr + 1);
1212 u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); 1212 u32 d_id = bfa_hton3b(FC_NAME_SERVER);
1213 1213
1214 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); 1214 fc_gs_fchdr_build(fchs, d_id, s_id, ox_id);
1215 fc_gs_cthdr_build(cthdr, s_id, GS_RSPN_ID); 1215 fc_gs_cthdr_build(cthdr, s_id, GS_RSPN_ID);
@@ -1229,7 +1229,7 @@ fc_gid_ft_build(struct fchs_s *fchs, void *pyld, u32 s_id, u8 fc4_type)
1229 1229
1230 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; 1230 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld;
1231 struct fcgs_gidft_req_s *gidft = (struct fcgs_gidft_req_s *)(cthdr + 1); 1231 struct fcgs_gidft_req_s *gidft = (struct fcgs_gidft_req_s *)(cthdr + 1);
1232 u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); 1232 u32 d_id = bfa_hton3b(FC_NAME_SERVER);
1233 1233
1234 fc_gs_fchdr_build(fchs, d_id, s_id, 0); 1234 fc_gs_fchdr_build(fchs, d_id, s_id, 0);
1235 1235
@@ -1249,7 +1249,7 @@ fc_rpnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id,
1249{ 1249{
1250 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; 1250 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld;
1251 struct fcgs_rpnid_req_s *rpnid = (struct fcgs_rpnid_req_s *)(cthdr + 1); 1251 struct fcgs_rpnid_req_s *rpnid = (struct fcgs_rpnid_req_s *)(cthdr + 1);
1252 u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); 1252 u32 d_id = bfa_hton3b(FC_NAME_SERVER);
1253 1253
1254 fc_gs_fchdr_build(fchs, d_id, s_id, 0); 1254 fc_gs_fchdr_build(fchs, d_id, s_id, 0);
1255 fc_gs_cthdr_build(cthdr, s_id, GS_RPN_ID); 1255 fc_gs_cthdr_build(cthdr, s_id, GS_RPN_ID);
@@ -1267,7 +1267,7 @@ fc_rnnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id,
1267{ 1267{
1268 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; 1268 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld;
1269 struct fcgs_rnnid_req_s *rnnid = (struct fcgs_rnnid_req_s *)(cthdr + 1); 1269 struct fcgs_rnnid_req_s *rnnid = (struct fcgs_rnnid_req_s *)(cthdr + 1);
1270 u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); 1270 u32 d_id = bfa_hton3b(FC_NAME_SERVER);
1271 1271
1272 fc_gs_fchdr_build(fchs, d_id, s_id, 0); 1272 fc_gs_fchdr_build(fchs, d_id, s_id, 0);
1273 fc_gs_cthdr_build(cthdr, s_id, GS_RNN_ID); 1273 fc_gs_cthdr_build(cthdr, s_id, GS_RNN_ID);
@@ -1286,7 +1286,7 @@ fc_rcsid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id,
1286 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; 1286 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld;
1287 struct fcgs_rcsid_req_s *rcsid = 1287 struct fcgs_rcsid_req_s *rcsid =
1288 (struct fcgs_rcsid_req_s *) (cthdr + 1); 1288 (struct fcgs_rcsid_req_s *) (cthdr + 1);
1289 u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); 1289 u32 d_id = bfa_hton3b(FC_NAME_SERVER);
1290 1290
1291 fc_gs_fchdr_build(fchs, d_id, s_id, 0); 1291 fc_gs_fchdr_build(fchs, d_id, s_id, 0);
1292 fc_gs_cthdr_build(cthdr, s_id, GS_RCS_ID); 1292 fc_gs_cthdr_build(cthdr, s_id, GS_RCS_ID);
@@ -1304,7 +1304,7 @@ fc_rptid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id,
1304{ 1304{
1305 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; 1305 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld;
1306 struct fcgs_rptid_req_s *rptid = (struct fcgs_rptid_req_s *)(cthdr + 1); 1306 struct fcgs_rptid_req_s *rptid = (struct fcgs_rptid_req_s *)(cthdr + 1);
1307 u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); 1307 u32 d_id = bfa_hton3b(FC_NAME_SERVER);
1308 1308
1309 fc_gs_fchdr_build(fchs, d_id, s_id, 0); 1309 fc_gs_fchdr_build(fchs, d_id, s_id, 0);
1310 fc_gs_cthdr_build(cthdr, s_id, GS_RPT_ID); 1310 fc_gs_cthdr_build(cthdr, s_id, GS_RPT_ID);
@@ -1321,7 +1321,7 @@ fc_ganxt_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id)
1321{ 1321{
1322 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; 1322 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld;
1323 struct fcgs_ganxt_req_s *ganxt = (struct fcgs_ganxt_req_s *)(cthdr + 1); 1323 struct fcgs_ganxt_req_s *ganxt = (struct fcgs_ganxt_req_s *)(cthdr + 1);
1324 u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); 1324 u32 d_id = bfa_hton3b(FC_NAME_SERVER);
1325 1325
1326 fc_gs_fchdr_build(fchs, d_id, s_id, 0); 1326 fc_gs_fchdr_build(fchs, d_id, s_id, 0);
1327 fc_gs_cthdr_build(cthdr, s_id, GS_GA_NXT); 1327 fc_gs_cthdr_build(cthdr, s_id, GS_GA_NXT);
@@ -1341,7 +1341,7 @@ fc_fdmi_reqhdr_build(struct fchs_s *fchs, void *pyld, u32 s_id,
1341{ 1341{
1342 1342
1343 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; 1343 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld;
1344 u32 d_id = bfa_os_hton3b(FC_MGMT_SERVER); 1344 u32 d_id = bfa_hton3b(FC_MGMT_SERVER);
1345 1345
1346 fc_gs_fchdr_build(fchs, d_id, s_id, 0); 1346 fc_gs_fchdr_build(fchs, d_id, s_id, 0);
1347 fc_gs_fdmi_cthdr_build(cthdr, s_id, cmd_code); 1347 fc_gs_fdmi_cthdr_build(cthdr, s_id, cmd_code);
@@ -1377,7 +1377,7 @@ fc_gmal_req_build(struct fchs_s *fchs, void *pyld, u32 s_id, wwn_t wwn)
1377{ 1377{
1378 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; 1378 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld;
1379 fcgs_gmal_req_t *gmal = (fcgs_gmal_req_t *) (cthdr + 1); 1379 fcgs_gmal_req_t *gmal = (fcgs_gmal_req_t *) (cthdr + 1);
1380 u32 d_id = bfa_os_hton3b(FC_MGMT_SERVER); 1380 u32 d_id = bfa_hton3b(FC_MGMT_SERVER);
1381 1381
1382 fc_gs_fchdr_build(fchs, d_id, s_id, 0); 1382 fc_gs_fchdr_build(fchs, d_id, s_id, 0);
1383 fc_gs_ms_cthdr_build(cthdr, s_id, GS_FC_GMAL_CMD, 1383 fc_gs_ms_cthdr_build(cthdr, s_id, GS_FC_GMAL_CMD,
@@ -1397,7 +1397,7 @@ fc_gfn_req_build(struct fchs_s *fchs, void *pyld, u32 s_id, wwn_t wwn)
1397{ 1397{
1398 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; 1398 struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld;
1399 fcgs_gfn_req_t *gfn = (fcgs_gfn_req_t *) (cthdr + 1); 1399 fcgs_gfn_req_t *gfn = (fcgs_gfn_req_t *) (cthdr + 1);
1400 u32 d_id = bfa_os_hton3b(FC_MGMT_SERVER); 1400 u32 d_id = bfa_hton3b(FC_MGMT_SERVER);
1401 1401
1402 fc_gs_fchdr_build(fchs, d_id, s_id, 0); 1402 fc_gs_fchdr_build(fchs, d_id, s_id, 0);
1403 fc_gs_ms_cthdr_build(cthdr, s_id, GS_FC_GFN_CMD, 1403 fc_gs_ms_cthdr_build(cthdr, s_id, GS_FC_GFN_CMD,
diff --git a/drivers/scsi/bfa/bfa_fcbuild.h b/drivers/scsi/bfa/bfa_fcbuild.h
index 1737e08e1c01..ece51ec7620b 100644
--- a/drivers/scsi/bfa/bfa_fcbuild.h
+++ b/drivers/scsi/bfa/bfa_fcbuild.h
@@ -21,7 +21,7 @@
21#ifndef __FCBUILD_H__ 21#ifndef __FCBUILD_H__
22#define __FCBUILD_H__ 22#define __FCBUILD_H__
23 23
24#include "bfa_os_inc.h" 24#include "bfad_drv.h"
25#include "bfa_fc.h" 25#include "bfa_fc.h"
26#include "bfa_defs_fcs.h" 26#include "bfa_defs_fcs.h"
27 27
diff --git a/drivers/scsi/bfa/bfa_fcpim.c b/drivers/scsi/bfa/bfa_fcpim.c
index 455c4f4e1d3b..506f1d326e5b 100644
--- a/drivers/scsi/bfa/bfa_fcpim.c
+++ b/drivers/scsi/bfa/bfa_fcpim.c
@@ -15,8 +15,8 @@
15 * General Public License for more details. 15 * General Public License for more details.
16 */ 16 */
17 17
18#include "bfad_drv.h"
18#include "bfa_modules.h" 19#include "bfa_modules.h"
19#include "bfa_os_inc.h"
20 20
21BFA_TRC_FILE(HAL, FCPIM); 21BFA_TRC_FILE(HAL, FCPIM);
22BFA_MODULE(fcpim); 22BFA_MODULE(fcpim);
@@ -1560,24 +1560,6 @@ bfa_itnim_hold_io(struct bfa_itnim_s *itnim)
1560 bfa_sm_cmp_state(itnim, bfa_itnim_sm_iocdisable)); 1560 bfa_sm_cmp_state(itnim, bfa_itnim_sm_iocdisable));
1561} 1561}
1562 1562
1563bfa_status_t
1564bfa_itnim_get_ioprofile(struct bfa_itnim_s *itnim,
1565 struct bfa_itnim_ioprofile_s *ioprofile)
1566{
1567 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(itnim->bfa);
1568 if (!fcpim->io_profile)
1569 return BFA_STATUS_IOPROFILE_OFF;
1570
1571 itnim->ioprofile.index = BFA_IOBUCKET_MAX;
1572 itnim->ioprofile.io_profile_start_time =
1573 bfa_io_profile_start_time(itnim->bfa);
1574 itnim->ioprofile.clock_res_mul = bfa_io_lat_clock_res_mul;
1575 itnim->ioprofile.clock_res_div = bfa_io_lat_clock_res_div;
1576 *ioprofile = itnim->ioprofile;
1577
1578 return BFA_STATUS_OK;
1579}
1580
1581void 1563void
1582bfa_itnim_clear_stats(struct bfa_itnim_s *itnim) 1564bfa_itnim_clear_stats(struct bfa_itnim_s *itnim)
1583{ 1565{
@@ -2352,7 +2334,7 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim)
2352 scsi_for_each_sg(cmnd, sg, ioim->nsges, i) { 2334 scsi_for_each_sg(cmnd, sg, ioim->nsges, i) {
2353 if (i == 0) { 2335 if (i == 0) {
2354 /* build inline IO SG element */ 2336 /* build inline IO SG element */
2355 addr = bfa_os_sgaddr(sg_dma_address(sg)); 2337 addr = bfa_sgaddr_le(sg_dma_address(sg));
2356 sge->sga = *(union bfi_addr_u *) &addr; 2338 sge->sga = *(union bfi_addr_u *) &addr;
2357 pgdlen = sg_dma_len(sg); 2339 pgdlen = sg_dma_len(sg);
2358 sge->sg_len = pgdlen; 2340 sge->sg_len = pgdlen;
@@ -2364,7 +2346,7 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim)
2364 if (sge_id == 0) 2346 if (sge_id == 0)
2365 sgpge = sgpg->sgpg->sges; 2347 sgpge = sgpg->sgpg->sges;
2366 2348
2367 addr = bfa_os_sgaddr(sg_dma_address(sg)); 2349 addr = bfa_sgaddr_le(sg_dma_address(sg));
2368 sgpge->sga = *(union bfi_addr_u *) &addr; 2350 sgpge->sga = *(union bfi_addr_u *) &addr;
2369 sgpge->sg_len = sg_dma_len(sg); 2351 sgpge->sg_len = sg_dma_len(sg);
2370 pgcumsz += sgpge->sg_len; 2352 pgcumsz += sgpge->sg_len;
diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c
index 141215c51635..e3a41b88a11b 100644
--- a/drivers/scsi/bfa/bfa_fcs.c
+++ b/drivers/scsi/bfa/bfa_fcs.c
@@ -19,9 +19,9 @@
19 * bfa_fcs.c BFA FCS main 19 * bfa_fcs.c BFA FCS main
20 */ 20 */
21 21
22#include "bfad_drv.h"
22#include "bfa_fcs.h" 23#include "bfa_fcs.h"
23#include "bfa_fcbuild.h" 24#include "bfa_fcbuild.h"
24#include "bfad_drv.h"
25 25
26BFA_TRC_FILE(FCS, FCS); 26BFA_TRC_FILE(FCS, FCS);
27 27
@@ -1097,7 +1097,7 @@ bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, struct fchs_s *fchs,
1097 * external loopback cable is in place. Our own FLOGI frames are 1097 * external loopback cable is in place. Our own FLOGI frames are
1098 * sometimes looped back when switch port gets temporarily bypassed. 1098 * sometimes looped back when switch port gets temporarily bypassed.
1099 */ 1099 */
1100 if ((pid == bfa_os_ntoh3b(FC_FABRIC_PORT)) && 1100 if ((pid == bfa_ntoh3b(FC_FABRIC_PORT)) &&
1101 (els_cmd->els_code == FC_ELS_FLOGI) && 1101 (els_cmd->els_code == FC_ELS_FLOGI) &&
1102 (flogi->port_name == bfa_fcs_lport_get_pwwn(&fabric->bport))) { 1102 (flogi->port_name == bfa_fcs_lport_get_pwwn(&fabric->bport))) {
1103 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LOOPBACK); 1103 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LOOPBACK);
@@ -1107,7 +1107,7 @@ bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, struct fchs_s *fchs,
1107 /* 1107 /*
1108 * FLOGI/EVFP exchanges should be consumed by base fabric. 1108 * FLOGI/EVFP exchanges should be consumed by base fabric.
1109 */ 1109 */
1110 if (fchs->d_id == bfa_os_hton3b(FC_FABRIC_PORT)) { 1110 if (fchs->d_id == bfa_hton3b(FC_FABRIC_PORT)) {
1111 bfa_trc(fabric->fcs, pid); 1111 bfa_trc(fabric->fcs, pid);
1112 bfa_fcs_fabric_process_uf(fabric, fchs, len); 1112 bfa_fcs_fabric_process_uf(fabric, fchs, len);
1113 return; 1113 return;
@@ -1220,7 +1220,7 @@ bfa_fcs_fabric_send_flogi_acc(struct bfa_fcs_fabric_s *fabric)
1220 return; 1220 return;
1221 1221
1222 reqlen = fc_flogi_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), 1222 reqlen = fc_flogi_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp),
1223 bfa_os_hton3b(FC_FABRIC_PORT), 1223 bfa_hton3b(FC_FABRIC_PORT),
1224 n2n_port->reply_oxid, pcfg->pwwn, 1224 n2n_port->reply_oxid, pcfg->pwwn,
1225 pcfg->nwwn, 1225 pcfg->nwwn,
1226 bfa_fcport_get_maxfrsize(bfa), 1226 bfa_fcport_get_maxfrsize(bfa),
diff --git a/drivers/scsi/bfa/bfa_fcs.h b/drivers/scsi/bfa/bfa_fcs.h
index e7977ee32992..f0e652b50994 100644
--- a/drivers/scsi/bfa/bfa_fcs.h
+++ b/drivers/scsi/bfa/bfa_fcs.h
@@ -61,7 +61,7 @@ struct bfa_fcs_s;
61#define N2N_LOCAL_PID 0x010000 61#define N2N_LOCAL_PID 0x010000
62#define N2N_REMOTE_PID 0x020000 62#define N2N_REMOTE_PID 0x020000
63#define BFA_FCS_RETRY_TIMEOUT 2000 63#define BFA_FCS_RETRY_TIMEOUT 2000
64#define BFA_FCS_PID_IS_WKA(pid) ((bfa_os_ntoh3b(pid) > 0xFFF000) ? 1 : 0) 64#define BFA_FCS_PID_IS_WKA(pid) ((bfa_ntoh3b(pid) > 0xFFF000) ? 1 : 0)
65 65
66 66
67 67
diff --git a/drivers/scsi/bfa/bfa_fcs_fcpim.c b/drivers/scsi/bfa/bfa_fcs_fcpim.c
index 82ac2798c545..5736ef8c592f 100644
--- a/drivers/scsi/bfa/bfa_fcs_fcpim.c
+++ b/drivers/scsi/bfa/bfa_fcs_fcpim.c
@@ -19,9 +19,9 @@
19 * fcpim.c - FCP initiator mode i-t nexus state machine 19 * fcpim.c - FCP initiator mode i-t nexus state machine
20 */ 20 */
21 21
22#include "bfad_drv.h"
22#include "bfa_fcs.h" 23#include "bfa_fcs.h"
23#include "bfa_fcbuild.h" 24#include "bfa_fcbuild.h"
24#include "bfad_drv.h"
25#include "bfad_im.h" 25#include "bfad_im.h"
26 26
27BFA_TRC_FILE(FCS, FCPIM); 27BFA_TRC_FILE(FCS, FCPIM);
diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c
index 6e9151fecb74..7a2cf7713a95 100644
--- a/drivers/scsi/bfa/bfa_fcs_lport.c
+++ b/drivers/scsi/bfa/bfa_fcs_lport.c
@@ -15,10 +15,10 @@
15 * General Public License for more details. 15 * General Public License for more details.
16 */ 16 */
17 17
18#include "bfad_drv.h"
18#include "bfa_fcs.h" 19#include "bfa_fcs.h"
19#include "bfa_fcbuild.h" 20#include "bfa_fcbuild.h"
20#include "bfa_fc.h" 21#include "bfa_fc.h"
21#include "bfad_drv.h"
22 22
23BFA_TRC_FILE(FCS, PORT); 23BFA_TRC_FILE(FCS, PORT);
24 24
@@ -2818,7 +2818,7 @@ bfa_fcs_lport_ms_send_plogi(void *ms_cbarg, struct bfa_fcxp_s *fcxp_alloced)
2818 ms->fcxp = fcxp; 2818 ms->fcxp = fcxp;
2819 2819
2820 len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), 2820 len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp),
2821 bfa_os_hton3b(FC_MGMT_SERVER), 2821 bfa_hton3b(FC_MGMT_SERVER),
2822 bfa_fcs_lport_get_fcid(port), 0, 2822 bfa_fcs_lport_get_fcid(port), 0,
2823 port->port_cfg.pwwn, port->port_cfg.nwwn, 2823 port->port_cfg.pwwn, port->port_cfg.nwwn,
2824 bfa_fcport_get_maxfrsize(port->fcs->bfa)); 2824 bfa_fcport_get_maxfrsize(port->fcs->bfa));
@@ -3575,7 +3575,7 @@ fcxp = fcxp_alloced ? fcxp_alloced : bfa_fcs_fcxp_alloc(port->fcs);
3575 ns->fcxp = fcxp; 3575 ns->fcxp = fcxp;
3576 3576
3577 len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), 3577 len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp),
3578 bfa_os_hton3b(FC_NAME_SERVER), 3578 bfa_hton3b(FC_NAME_SERVER),
3579 bfa_fcs_lport_get_fcid(port), 0, 3579 bfa_fcs_lport_get_fcid(port), 0,
3580 port->port_cfg.pwwn, port->port_cfg.nwwn, 3580 port->port_cfg.pwwn, port->port_cfg.nwwn,
3581 bfa_fcport_get_maxfrsize(port->fcs->bfa)); 3581 bfa_fcport_get_maxfrsize(port->fcs->bfa));
@@ -4654,7 +4654,7 @@ bfa_fcs_lport_get_rport(struct bfa_fcs_lport_s *port, wwn_t wwn, int index,
4654 4654
4655 while ((qe != qh) && (i < nrports)) { 4655 while ((qe != qh) && (i < nrports)) {
4656 rport = (struct bfa_fcs_rport_s *) qe; 4656 rport = (struct bfa_fcs_rport_s *) qe;
4657 if (bfa_os_ntoh3b(rport->pid) > 0xFFF000) { 4657 if (bfa_ntoh3b(rport->pid) > 0xFFF000) {
4658 qe = bfa_q_next(qe); 4658 qe = bfa_q_next(qe);
4659 bfa_trc(fcs, (u32) rport->pwwn); 4659 bfa_trc(fcs, (u32) rport->pwwn);
4660 bfa_trc(fcs, rport->pid); 4660 bfa_trc(fcs, rport->pid);
@@ -4702,7 +4702,7 @@ bfa_fcs_lport_get_rports(struct bfa_fcs_lport_s *port,
4702 4702
4703 while ((qe != qh) && (i < *nrports)) { 4703 while ((qe != qh) && (i < *nrports)) {
4704 rport = (struct bfa_fcs_rport_s *) qe; 4704 rport = (struct bfa_fcs_rport_s *) qe;
4705 if (bfa_os_ntoh3b(rport->pid) > 0xFFF000) { 4705 if (bfa_ntoh3b(rport->pid) > 0xFFF000) {
4706 qe = bfa_q_next(qe); 4706 qe = bfa_q_next(qe);
4707 bfa_trc(fcs, (u32) rport->pwwn); 4707 bfa_trc(fcs, (u32) rport->pwwn);
4708 bfa_trc(fcs, rport->pid); 4708 bfa_trc(fcs, rport->pid);
@@ -4753,7 +4753,7 @@ bfa_fcs_lport_get_rport_max_speed(bfa_fcs_lport_t *port)
4753 4753
4754 while (qe != qh) { 4754 while (qe != qh) {
4755 rport = (struct bfa_fcs_rport_s *) qe; 4755 rport = (struct bfa_fcs_rport_s *) qe;
4756 if ((bfa_os_ntoh3b(rport->pid) > 0xFFF000) || 4756 if ((bfa_ntoh3b(rport->pid) > 0xFFF000) ||
4757 (bfa_fcs_rport_get_state(rport) == 4757 (bfa_fcs_rport_get_state(rport) ==
4758 BFA_RPORT_OFFLINE)) { 4758 BFA_RPORT_OFFLINE)) {
4759 qe = bfa_q_next(qe); 4759 qe = bfa_q_next(qe);
diff --git a/drivers/scsi/bfa/bfa_fcs_rport.c b/drivers/scsi/bfa/bfa_fcs_rport.c
index 2089d686fa5d..fbfcac7615b5 100644
--- a/drivers/scsi/bfa/bfa_fcs_rport.c
+++ b/drivers/scsi/bfa/bfa_fcs_rport.c
@@ -19,9 +19,9 @@
19 * rport.c Remote port implementation. 19 * rport.c Remote port implementation.
20 */ 20 */
21 21
22#include "bfad_drv.h"
22#include "bfa_fcs.h" 23#include "bfa_fcs.h"
23#include "bfa_fcbuild.h" 24#include "bfa_fcbuild.h"
24#include "bfad_drv.h"
25 25
26BFA_TRC_FILE(FCS, RPORT); 26BFA_TRC_FILE(FCS, RPORT);
27 27
diff --git a/drivers/scsi/bfa/bfa_hw_cb.c b/drivers/scsi/bfa/bfa_hw_cb.c
index d8464ae60070..1fa15edabcdd 100644
--- a/drivers/scsi/bfa/bfa_hw_cb.c
+++ b/drivers/scsi/bfa/bfa_hw_cb.c
@@ -15,6 +15,7 @@
15 * General Public License for more details. 15 * General Public License for more details.
16 */ 16 */
17 17
18#include "bfad_drv.h"
18#include "bfa_modules.h" 19#include "bfa_modules.h"
19#include "bfi_cbreg.h" 20#include "bfi_cbreg.h"
20 21
diff --git a/drivers/scsi/bfa/bfa_hw_ct.c b/drivers/scsi/bfa/bfa_hw_ct.c
index b0efbc713ffe..68077c4c4d55 100644
--- a/drivers/scsi/bfa/bfa_hw_ct.c
+++ b/drivers/scsi/bfa/bfa_hw_ct.c
@@ -15,6 +15,7 @@
15 * General Public License for more details. 15 * General Public License for more details.
16 */ 16 */
17 17
18#include "bfad_drv.h"
18#include "bfa_modules.h" 19#include "bfa_modules.h"
19#include "bfi_ctreg.h" 20#include "bfi_ctreg.h"
20 21
diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c
index a8f745420f32..cd532444ffd9 100644
--- a/drivers/scsi/bfa/bfa_ioc.c
+++ b/drivers/scsi/bfa/bfa_ioc.c
@@ -15,11 +15,11 @@
15 * General Public License for more details. 15 * General Public License for more details.
16 */ 16 */
17 17
18#include "bfad_drv.h"
18#include "bfa_ioc.h" 19#include "bfa_ioc.h"
19#include "bfi_ctreg.h" 20#include "bfi_ctreg.h"
20#include "bfa_defs.h" 21#include "bfa_defs.h"
21#include "bfa_defs_svc.h" 22#include "bfa_defs_svc.h"
22#include "bfad_drv.h"
23 23
24BFA_TRC_FILE(CNA, IOC); 24BFA_TRC_FILE(CNA, IOC);
25 25
@@ -1428,12 +1428,12 @@ static void
1428bfa_ioc_send_enable(struct bfa_ioc_s *ioc) 1428bfa_ioc_send_enable(struct bfa_ioc_s *ioc)
1429{ 1429{
1430 struct bfi_ioc_ctrl_req_s enable_req; 1430 struct bfi_ioc_ctrl_req_s enable_req;
1431 struct bfa_timeval_s tv; 1431 struct timeval tv;
1432 1432
1433 bfi_h2i_set(enable_req.mh, BFI_MC_IOC, BFI_IOC_H2I_ENABLE_REQ, 1433 bfi_h2i_set(enable_req.mh, BFI_MC_IOC, BFI_IOC_H2I_ENABLE_REQ,
1434 bfa_ioc_portid(ioc)); 1434 bfa_ioc_portid(ioc));
1435 enable_req.ioc_class = ioc->ioc_mc; 1435 enable_req.ioc_class = ioc->ioc_mc;
1436 bfa_os_gettimeofday(&tv); 1436 do_gettimeofday(&tv);
1437 enable_req.tv_sec = be32_to_cpu(tv.tv_sec); 1437 enable_req.tv_sec = be32_to_cpu(tv.tv_sec);
1438 bfa_ioc_mbox_send(ioc, &enable_req, sizeof(struct bfi_ioc_ctrl_req_s)); 1438 bfa_ioc_mbox_send(ioc, &enable_req, sizeof(struct bfi_ioc_ctrl_req_s));
1439} 1439}
diff --git a/drivers/scsi/bfa/bfa_ioc.h b/drivers/scsi/bfa/bfa_ioc.h
index 3c5bdd1c0c7f..62153f283216 100644
--- a/drivers/scsi/bfa/bfa_ioc.h
+++ b/drivers/scsi/bfa/bfa_ioc.h
@@ -18,7 +18,7 @@
18#ifndef __BFA_IOC_H__ 18#ifndef __BFA_IOC_H__
19#define __BFA_IOC_H__ 19#define __BFA_IOC_H__
20 20
21#include "bfa_os_inc.h" 21#include "bfad_drv.h"
22#include "bfa_cs.h" 22#include "bfa_cs.h"
23#include "bfi.h" 23#include "bfi.h"
24 24
@@ -74,7 +74,7 @@ struct bfa_sge_s {
74#define bfa_swap_words(_x) ( \ 74#define bfa_swap_words(_x) ( \
75 ((_x) << 32) | ((_x) >> 32)) 75 ((_x) << 32) | ((_x) >> 32))
76 76
77#ifdef __BIGENDIAN 77#ifdef __BIG_ENDIAN
78#define bfa_sge_to_be(_x) 78#define bfa_sge_to_be(_x)
79#define bfa_sge_to_le(_x) bfa_sge_word_swap(_x) 79#define bfa_sge_to_le(_x) bfa_sge_word_swap(_x)
80#define bfa_sgaddr_le(_x) bfa_swap_words(_x) 80#define bfa_sgaddr_le(_x) bfa_swap_words(_x)
@@ -120,7 +120,7 @@ static inline void
120__bfa_dma_addr_set(union bfi_addr_u *dma_addr, u64 pa) 120__bfa_dma_addr_set(union bfi_addr_u *dma_addr, u64 pa)
121{ 121{
122 dma_addr->a32.addr_lo = (__be32) pa; 122 dma_addr->a32.addr_lo = (__be32) pa;
123 dma_addr->a32.addr_hi = (__be32) (bfa_os_u32(pa)); 123 dma_addr->a32.addr_hi = (__be32) (pa >> 32);
124} 124}
125 125
126 126
@@ -130,7 +130,7 @@ static inline void
130__bfa_dma_be_addr_set(union bfi_addr_u *dma_addr, u64 pa) 130__bfa_dma_be_addr_set(union bfi_addr_u *dma_addr, u64 pa)
131{ 131{
132 dma_addr->a32.addr_lo = cpu_to_be32(pa); 132 dma_addr->a32.addr_lo = cpu_to_be32(pa);
133 dma_addr->a32.addr_hi = cpu_to_be32(bfa_os_u32(pa)); 133 dma_addr->a32.addr_hi = cpu_to_be32(pa >> 32);
134} 134}
135 135
136struct bfa_ioc_regs_s { 136struct bfa_ioc_regs_s {
diff --git a/drivers/scsi/bfa/bfa_ioc_cb.c b/drivers/scsi/bfa/bfa_ioc_cb.c
index e9c8554e356e..a0e05da9df51 100644
--- a/drivers/scsi/bfa/bfa_ioc_cb.c
+++ b/drivers/scsi/bfa/bfa_ioc_cb.c
@@ -15,6 +15,7 @@
15 * General Public License for more details. 15 * General Public License for more details.
16 */ 16 */
17 17
18#include "bfad_drv.h"
18#include "bfa_ioc.h" 19#include "bfa_ioc.h"
19#include "bfi_cbreg.h" 20#include "bfi_cbreg.h"
20#include "bfa_defs.h" 21#include "bfa_defs.h"
diff --git a/drivers/scsi/bfa/bfa_ioc_ct.c b/drivers/scsi/bfa/bfa_ioc_ct.c
index 45d0ddc88c52..25a5d3c339c8 100644
--- a/drivers/scsi/bfa/bfa_ioc_ct.c
+++ b/drivers/scsi/bfa/bfa_ioc_ct.c
@@ -15,6 +15,7 @@
15 * General Public License for more details. 15 * General Public License for more details.
16 */ 16 */
17 17
18#include "bfad_drv.h"
18#include "bfa_ioc.h" 19#include "bfa_ioc.h"
19#include "bfi_ctreg.h" 20#include "bfi_ctreg.h"
20#include "bfa_defs.h" 21#include "bfa_defs.h"
diff --git a/drivers/scsi/bfa/bfa_os_inc.h b/drivers/scsi/bfa/bfa_os_inc.h
deleted file mode 100644
index 65df62ef437f..000000000000
--- a/drivers/scsi/bfa/bfa_os_inc.h
+++ /dev/null
@@ -1,143 +0,0 @@
1/*
2 * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
3 * All rights reserved
4 * www.brocade.com
5 *
6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License (GPL) Version 2 as
10 * published by the Free Software Foundation
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 */
17
18#ifndef __BFA_OS_INC_H__
19#define __BFA_OS_INC_H__
20
21#include <linux/types.h>
22#include <linux/version.h>
23#include <linux/pci.h>
24#include <linux/dma-mapping.h>
25#include <linux/idr.h>
26#include <linux/interrupt.h>
27#include <linux/cdev.h>
28#include <linux/fs.h>
29#include <linux/delay.h>
30#include <linux/vmalloc.h>
31#include <linux/workqueue.h>
32#include <linux/bitops.h>
33#include <scsi/scsi.h>
34#include <scsi/scsi_host.h>
35#include <scsi/scsi_tcq.h>
36#include <scsi/scsi_transport_fc.h>
37#include <scsi/scsi_transport.h>
38
39#ifdef __BIG_ENDIAN
40#define __BIGENDIAN
41#endif
42
43static inline u64 bfa_os_get_log_time(void)
44{
45 u64 system_time = 0;
46 struct timeval tv;
47 do_gettimeofday(&tv);
48
49 /* We are interested in seconds only. */
50 system_time = tv.tv_sec;
51 return system_time;
52}
53
54#define bfa_io_lat_clock_res_div HZ
55#define bfa_io_lat_clock_res_mul 1000
56
57#define BFA_LOG(level, bfad, mask, fmt, arg...) \
58do { \
59 if (((mask) == 4) || (level[1] <= '4')) \
60 dev_printk(level, &((bfad)->pcidev)->dev, fmt, ##arg); \
61} while (0)
62
63#define bfa_swap_3b(_x) \
64 ((((_x) & 0xff) << 16) | \
65 ((_x) & 0x00ff00) | \
66 (((_x) & 0xff0000) >> 16))
67
68#define bfa_os_swap_sgaddr(_x) ((u64)( \
69 (((u64)(_x) & (u64)0x00000000000000ffull) << 32) | \
70 (((u64)(_x) & (u64)0x000000000000ff00ull) << 32) | \
71 (((u64)(_x) & (u64)0x0000000000ff0000ull) << 32) | \
72 (((u64)(_x) & (u64)0x00000000ff000000ull) << 32) | \
73 (((u64)(_x) & (u64)0x000000ff00000000ull) >> 32) | \
74 (((u64)(_x) & (u64)0x0000ff0000000000ull) >> 32) | \
75 (((u64)(_x) & (u64)0x00ff000000000000ull) >> 32) | \
76 (((u64)(_x) & (u64)0xff00000000000000ull) >> 32)))
77
78#ifndef __BIGENDIAN
79#define bfa_os_hton3b(_x) bfa_swap_3b(_x)
80#define bfa_os_sgaddr(_x) (_x)
81#else
82#define bfa_os_hton3b(_x) (_x)
83#define bfa_os_sgaddr(_x) bfa_os_swap_sgaddr(_x)
84#endif
85
86#define bfa_os_ntoh3b(_x) bfa_os_hton3b(_x)
87#define bfa_os_u32(__pa64) ((__pa64) >> 32)
88
89#define BFA_TRC_TS(_trcm) \
90 ({ \
91 struct timeval tv; \
92 \
93 do_gettimeofday(&tv); \
94 (tv.tv_sec*1000000+tv.tv_usec); \
95 })
96
97#define boolean_t int
98
99/*
100 * For current time stamp, OS API will fill-in
101 */
102struct bfa_timeval_s {
103 u32 tv_sec; /* seconds */
104 u32 tv_usec; /* microseconds */
105};
106
107static inline void
108bfa_os_gettimeofday(struct bfa_timeval_s *tv)
109{
110 struct timeval tmp_tv;
111
112 do_gettimeofday(&tmp_tv);
113 tv->tv_sec = (u32) tmp_tv.tv_sec;
114 tv->tv_usec = (u32) tmp_tv.tv_usec;
115}
116
117static inline void
118wwn2str(char *wwn_str, u64 wwn)
119{
120 union {
121 u64 wwn;
122 u8 byte[8];
123 } w;
124
125 w.wwn = wwn;
126 sprintf(wwn_str, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", w.byte[0],
127 w.byte[1], w.byte[2], w.byte[3], w.byte[4], w.byte[5],
128 w.byte[6], w.byte[7]);
129}
130
131static inline void
132fcid2str(char *fcid_str, u32 fcid)
133{
134 union {
135 u32 fcid;
136 u8 byte[4];
137 } f;
138
139 f.fcid = fcid;
140 sprintf(fcid_str, "%02x:%02x:%02x", f.byte[1], f.byte[2], f.byte[3]);
141}
142
143#endif /* __BFA_OS_INC_H__ */
diff --git a/drivers/scsi/bfa/bfa_port.c b/drivers/scsi/bfa/bfa_port.c
index 76efb9a5c324..45b3486cca9c 100644
--- a/drivers/scsi/bfa/bfa_port.c
+++ b/drivers/scsi/bfa/bfa_port.c
@@ -15,6 +15,7 @@
15 * General Public License for more details. 15 * General Public License for more details.
16 */ 16 */
17 17
18#include "bfad_drv.h"
18#include "bfa_defs_svc.h" 19#include "bfa_defs_svc.h"
19#include "bfa_port.h" 20#include "bfa_port.h"
20#include "bfi.h" 21#include "bfi.h"
@@ -36,7 +37,7 @@ bfa_port_stats_swap(struct bfa_port_s *port, union bfa_port_stats_u *stats)
36 i += 2) { 37 i += 2) {
37 t0 = dip[i]; 38 t0 = dip[i];
38 t1 = dip[i + 1]; 39 t1 = dip[i + 1];
39#ifdef __BIGENDIAN 40#ifdef __BIG_ENDIAN
40 dip[i] = be32_to_cpu(t0); 41 dip[i] = be32_to_cpu(t0);
41 dip[i + 1] = be32_to_cpu(t1); 42 dip[i + 1] = be32_to_cpu(t1);
42#else 43#else
@@ -96,13 +97,13 @@ bfa_port_get_stats_isr(struct bfa_port_s *port, bfa_status_t status)
96 port->stats_busy = BFA_FALSE; 97 port->stats_busy = BFA_FALSE;
97 98
98 if (status == BFA_STATUS_OK) { 99 if (status == BFA_STATUS_OK) {
99 struct bfa_timeval_s tv; 100 struct timeval tv;
100 101
101 memcpy(port->stats, port->stats_dma.kva, 102 memcpy(port->stats, port->stats_dma.kva,
102 sizeof(union bfa_port_stats_u)); 103 sizeof(union bfa_port_stats_u));
103 bfa_port_stats_swap(port, port->stats); 104 bfa_port_stats_swap(port, port->stats);
104 105
105 bfa_os_gettimeofday(&tv); 106 do_gettimeofday(&tv);
106 port->stats->fc.secs_reset = tv.tv_sec - port->stats_reset_time; 107 port->stats->fc.secs_reset = tv.tv_sec - port->stats_reset_time;
107 } 108 }
108 109
@@ -124,7 +125,7 @@ bfa_port_get_stats_isr(struct bfa_port_s *port, bfa_status_t status)
124static void 125static void
125bfa_port_clear_stats_isr(struct bfa_port_s *port, bfa_status_t status) 126bfa_port_clear_stats_isr(struct bfa_port_s *port, bfa_status_t status)
126{ 127{
127 struct bfa_timeval_s tv; 128 struct timeval tv;
128 129
129 port->stats_status = status; 130 port->stats_status = status;
130 port->stats_busy = BFA_FALSE; 131 port->stats_busy = BFA_FALSE;
@@ -132,7 +133,7 @@ bfa_port_clear_stats_isr(struct bfa_port_s *port, bfa_status_t status)
132 /* 133 /*
133 * re-initialize time stamp for stats reset 134 * re-initialize time stamp for stats reset
134 */ 135 */
135 bfa_os_gettimeofday(&tv); 136 do_gettimeofday(&tv);
136 port->stats_reset_time = tv.tv_sec; 137 port->stats_reset_time = tv.tv_sec;
137 138
138 if (port->stats_cbfn) { 139 if (port->stats_cbfn) {
@@ -432,7 +433,7 @@ void
432bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc, 433bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc,
433 void *dev, struct bfa_trc_mod_s *trcmod) 434 void *dev, struct bfa_trc_mod_s *trcmod)
434{ 435{
435 struct bfa_timeval_s tv; 436 struct timeval tv;
436 437
437 bfa_assert(port); 438 bfa_assert(port);
438 439
@@ -452,7 +453,7 @@ bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc,
452 /* 453 /*
453 * initialize time stamp for stats reset 454 * initialize time stamp for stats reset
454 */ 455 */
455 bfa_os_gettimeofday(&tv); 456 do_gettimeofday(&tv);
456 port->stats_reset_time = tv.tv_sec; 457 port->stats_reset_time = tv.tv_sec;
457 458
458 bfa_trc(port, 0); 459 bfa_trc(port, 0);
diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c
index c9192869c0fe..1d5432b42a90 100644
--- a/drivers/scsi/bfa/bfa_svc.c
+++ b/drivers/scsi/bfa/bfa_svc.c
@@ -15,11 +15,10 @@
15 * General Public License for more details. 15 * General Public License for more details.
16 */ 16 */
17 17
18#include "bfa_os_inc.h" 18#include "bfad_drv.h"
19#include "bfa_plog.h" 19#include "bfa_plog.h"
20#include "bfa_cs.h" 20#include "bfa_cs.h"
21#include "bfa_modules.h" 21#include "bfa_modules.h"
22#include "bfad_drv.h"
23 22
24BFA_TRC_FILE(HAL, FCXP); 23BFA_TRC_FILE(HAL, FCXP);
25BFA_MODULE(fcxp); 24BFA_MODULE(fcxp);
@@ -286,6 +285,18 @@ plkd_validate_logrec(struct bfa_plog_rec_s *pl_rec)
286 return 0; 285 return 0;
287} 286}
288 287
288static u64
289bfa_get_log_time(void)
290{
291 u64 system_time = 0;
292 struct timeval tv;
293 do_gettimeofday(&tv);
294
295 /* We are interested in seconds only. */
296 system_time = tv.tv_sec;
297 return system_time;
298}
299
289static void 300static void
290bfa_plog_add(struct bfa_plog_s *plog, struct bfa_plog_rec_s *pl_rec) 301bfa_plog_add(struct bfa_plog_s *plog, struct bfa_plog_rec_s *pl_rec)
291{ 302{
@@ -306,7 +317,7 @@ bfa_plog_add(struct bfa_plog_s *plog, struct bfa_plog_rec_s *pl_rec)
306 317
307 memcpy(pl_recp, pl_rec, sizeof(struct bfa_plog_rec_s)); 318 memcpy(pl_recp, pl_rec, sizeof(struct bfa_plog_rec_s));
308 319
309 pl_recp->tv = bfa_os_get_log_time(); 320 pl_recp->tv = bfa_get_log_time();
310 BFA_PL_LOG_REC_INCR(plog->tail); 321 BFA_PL_LOG_REC_INCR(plog->tail);
311 322
312 if (plog->head == plog->tail) 323 if (plog->head == plog->tail)
@@ -2728,7 +2739,7 @@ bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
2728 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); 2739 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
2729 struct bfa_port_cfg_s *port_cfg = &fcport->cfg; 2740 struct bfa_port_cfg_s *port_cfg = &fcport->cfg;
2730 struct bfa_fcport_ln_s *ln = &fcport->ln; 2741 struct bfa_fcport_ln_s *ln = &fcport->ln;
2731 struct bfa_timeval_s tv; 2742 struct timeval tv;
2732 2743
2733 memset(fcport, 0, sizeof(struct bfa_fcport_s)); 2744 memset(fcport, 0, sizeof(struct bfa_fcport_s));
2734 fcport->bfa = bfa; 2745 fcport->bfa = bfa;
@@ -2742,7 +2753,7 @@ bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
2742 /* 2753 /*
2743 * initialize time stamp for stats reset 2754 * initialize time stamp for stats reset
2744 */ 2755 */
2745 bfa_os_gettimeofday(&tv); 2756 do_gettimeofday(&tv);
2746 fcport->stats_reset_time = tv.tv_sec; 2757 fcport->stats_reset_time = tv.tv_sec;
2747 2758
2748 /* 2759 /*
@@ -2967,7 +2978,7 @@ bfa_fcport_fcoe_stats_swap(struct bfa_fcoe_stats_s *d,
2967 2978
2968 for (i = 0; i < ((sizeof(struct bfa_fcoe_stats_s))/sizeof(u32)); 2979 for (i = 0; i < ((sizeof(struct bfa_fcoe_stats_s))/sizeof(u32));
2969 i = i + 2) { 2980 i = i + 2) {
2970#ifdef __BIGENDIAN 2981#ifdef __BIG_ENDIAN
2971 dip[i] = be32_to_cpu(sip[i]); 2982 dip[i] = be32_to_cpu(sip[i]);
2972 dip[i + 1] = be32_to_cpu(sip[i + 1]); 2983 dip[i + 1] = be32_to_cpu(sip[i + 1]);
2973#else 2984#else
@@ -2984,7 +2995,7 @@ __bfa_cb_fcport_stats_get(void *cbarg, bfa_boolean_t complete)
2984 2995
2985 if (complete) { 2996 if (complete) {
2986 if (fcport->stats_status == BFA_STATUS_OK) { 2997 if (fcport->stats_status == BFA_STATUS_OK) {
2987 struct bfa_timeval_s tv; 2998 struct timeval tv;
2988 2999
2989 /* Swap FC QoS or FCoE stats */ 3000 /* Swap FC QoS or FCoE stats */
2990 if (bfa_ioc_get_fcmode(&fcport->bfa->ioc)) { 3001 if (bfa_ioc_get_fcmode(&fcport->bfa->ioc)) {
@@ -2996,7 +3007,7 @@ __bfa_cb_fcport_stats_get(void *cbarg, bfa_boolean_t complete)
2996 &fcport->stats_ret->fcoe, 3007 &fcport->stats_ret->fcoe,
2997 &fcport->stats->fcoe); 3008 &fcport->stats->fcoe);
2998 3009
2999 bfa_os_gettimeofday(&tv); 3010 do_gettimeofday(&tv);
3000 fcport->stats_ret->fcoe.secs_reset = 3011 fcport->stats_ret->fcoe.secs_reset =
3001 tv.tv_sec - fcport->stats_reset_time; 3012 tv.tv_sec - fcport->stats_reset_time;
3002 } 3013 }
@@ -3055,12 +3066,12 @@ __bfa_cb_fcport_stats_clr(void *cbarg, bfa_boolean_t complete)
3055 struct bfa_fcport_s *fcport = cbarg; 3066 struct bfa_fcport_s *fcport = cbarg;
3056 3067
3057 if (complete) { 3068 if (complete) {
3058 struct bfa_timeval_s tv; 3069 struct timeval tv;
3059 3070
3060 /* 3071 /*
3061 * re-initialize time stamp for stats reset 3072 * re-initialize time stamp for stats reset
3062 */ 3073 */
3063 bfa_os_gettimeofday(&tv); 3074 do_gettimeofday(&tv);
3064 fcport->stats_reset_time = tv.tv_sec; 3075 fcport->stats_reset_time = tv.tv_sec;
3065 3076
3066 fcport->stats_cbfn(fcport->stats_cbarg, fcport->stats_status); 3077 fcport->stats_cbfn(fcport->stats_cbarg, fcport->stats_status);
@@ -4931,10 +4942,6 @@ bfa_uf_start(struct bfa_s *bfa)
4931} 4942}
4932 4943
4933/* 4944/*
4934 * hal_uf_api
4935 */
4936
4937/*
4938 * Register handler for all unsolicted recieve frames. 4945 * Register handler for all unsolicted recieve frames.
4939 * 4946 *
4940 * @param[in] bfa BFA instance 4947 * @param[in] bfa BFA instance
diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c
index 2bc786212521..c80540e576cd 100644
--- a/drivers/scsi/bfa/bfad.c
+++ b/drivers/scsi/bfa/bfad.c
@@ -32,7 +32,6 @@
32#include "bfad_drv.h" 32#include "bfad_drv.h"
33#include "bfad_im.h" 33#include "bfad_im.h"
34#include "bfa_fcs.h" 34#include "bfa_fcs.h"
35#include "bfa_os_inc.h"
36#include "bfa_defs.h" 35#include "bfa_defs.h"
37#include "bfa.h" 36#include "bfa.h"
38 37
@@ -1102,15 +1101,15 @@ bfad_start_ops(struct bfad_s *bfad) {
1102 1101
1103 /* 1102 /*
1104 * If bfa_linkup_delay is set to -1 default; try to retrive the 1103 * If bfa_linkup_delay is set to -1 default; try to retrive the
1105 * value using the bfad_os_get_linkup_delay(); else use the 1104 * value using the bfad_get_linkup_delay(); else use the
1106 * passed in module param value as the bfa_linkup_delay. 1105 * passed in module param value as the bfa_linkup_delay.
1107 */ 1106 */
1108 if (bfa_linkup_delay < 0) { 1107 if (bfa_linkup_delay < 0) {
1109 bfa_linkup_delay = bfad_os_get_linkup_delay(bfad); 1108 bfa_linkup_delay = bfad_get_linkup_delay(bfad);
1110 bfad_os_rport_online_wait(bfad); 1109 bfad_rport_online_wait(bfad);
1111 bfa_linkup_delay = -1; 1110 bfa_linkup_delay = -1;
1112 } else 1111 } else
1113 bfad_os_rport_online_wait(bfad); 1112 bfad_rport_online_wait(bfad);
1114 1113
1115 BFA_LOG(KERN_INFO, bfad, bfa_log_level, "bfa device claimed\n"); 1114 BFA_LOG(KERN_INFO, bfad, bfa_log_level, "bfa device claimed\n");
1116 1115
diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c
index d727f055bd8a..a94ea4235433 100644
--- a/drivers/scsi/bfa/bfad_attr.c
+++ b/drivers/scsi/bfa/bfad_attr.c
@@ -40,7 +40,7 @@ bfad_im_get_starget_port_id(struct scsi_target *starget)
40 bfad = im_port->bfad; 40 bfad = im_port->bfad;
41 spin_lock_irqsave(&bfad->bfad_lock, flags); 41 spin_lock_irqsave(&bfad->bfad_lock, flags);
42 42
43 itnim = bfad_os_get_itnim(im_port, starget->id); 43 itnim = bfad_get_itnim(im_port, starget->id);
44 if (itnim) 44 if (itnim)
45 fc_id = bfa_fcs_itnim_get_fcid(&itnim->fcs_itnim); 45 fc_id = bfa_fcs_itnim_get_fcid(&itnim->fcs_itnim);
46 46
@@ -66,7 +66,7 @@ bfad_im_get_starget_node_name(struct scsi_target *starget)
66 bfad = im_port->bfad; 66 bfad = im_port->bfad;
67 spin_lock_irqsave(&bfad->bfad_lock, flags); 67 spin_lock_irqsave(&bfad->bfad_lock, flags);
68 68
69 itnim = bfad_os_get_itnim(im_port, starget->id); 69 itnim = bfad_get_itnim(im_port, starget->id);
70 if (itnim) 70 if (itnim)
71 node_name = bfa_fcs_itnim_get_nwwn(&itnim->fcs_itnim); 71 node_name = bfa_fcs_itnim_get_nwwn(&itnim->fcs_itnim);
72 72
@@ -92,7 +92,7 @@ bfad_im_get_starget_port_name(struct scsi_target *starget)
92 bfad = im_port->bfad; 92 bfad = im_port->bfad;
93 spin_lock_irqsave(&bfad->bfad_lock, flags); 93 spin_lock_irqsave(&bfad->bfad_lock, flags);
94 94
95 itnim = bfad_os_get_itnim(im_port, starget->id); 95 itnim = bfad_get_itnim(im_port, starget->id);
96 if (itnim) 96 if (itnim)
97 port_name = bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim); 97 port_name = bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim);
98 98
@@ -111,7 +111,7 @@ bfad_im_get_host_port_id(struct Scsi_Host *shost)
111 struct bfad_port_s *port = im_port->port; 111 struct bfad_port_s *port = im_port->port;
112 112
113 fc_host_port_id(shost) = 113 fc_host_port_id(shost) =
114 bfa_os_hton3b(bfa_fcs_lport_get_fcid(port->fcs_port)); 114 bfa_hton3b(bfa_fcs_lport_get_fcid(port->fcs_port));
115} 115}
116 116
117/* 117/*
@@ -487,7 +487,7 @@ bfad_im_vport_delete(struct fc_vport *fc_vport)
487 wait_for_completion(vport->comp_del); 487 wait_for_completion(vport->comp_del);
488 488
489free_scsi_host: 489free_scsi_host:
490 bfad_os_scsi_host_free(bfad, im_port); 490 bfad_scsi_host_free(bfad, im_port);
491 491
492 kfree(vport); 492 kfree(vport);
493 493
diff --git a/drivers/scsi/bfa/bfad_drv.h b/drivers/scsi/bfa/bfad_drv.h
index b9bcb0b99b8a..24b6ab18f89d 100644
--- a/drivers/scsi/bfa/bfad_drv.h
+++ b/drivers/scsi/bfa/bfad_drv.h
@@ -26,7 +26,23 @@
26#ifndef __BFAD_DRV_H__ 26#ifndef __BFAD_DRV_H__
27#define __BFAD_DRV_H__ 27#define __BFAD_DRV_H__
28 28
29#include "bfa_os_inc.h" 29#include <linux/types.h>
30#include <linux/version.h>
31#include <linux/pci.h>
32#include <linux/dma-mapping.h>
33#include <linux/idr.h>
34#include <linux/interrupt.h>
35#include <linux/cdev.h>
36#include <linux/fs.h>
37#include <linux/delay.h>
38#include <linux/vmalloc.h>
39#include <linux/workqueue.h>
40#include <linux/bitops.h>
41#include <scsi/scsi.h>
42#include <scsi/scsi_host.h>
43#include <scsi/scsi_tcq.h>
44#include <scsi/scsi_transport_fc.h>
45#include <scsi/scsi_transport.h>
30 46
31#include "bfa_modules.h" 47#include "bfa_modules.h"
32#include "bfa_fcs.h" 48#include "bfa_fcs.h"
@@ -272,19 +288,12 @@ do { \
272} while (0) 288} while (0)
273 289
274 290
275#define list_remove_head(list, entry, type, member) \ 291#define BFA_LOG(level, bfad, mask, fmt, arg...) \
276do { \ 292do { \
277 entry = NULL; \ 293 if (((mask) == 4) || (level[1] <= '4')) \
278 if (!list_empty(list)) { \ 294 dev_printk(level, &((bfad)->pcidev)->dev, fmt, ##arg); \
279 entry = list_entry((list)->next, type, member); \
280 list_del_init(&entry->member); \
281 } \
282} while (0) 295} while (0)
283 296
284#define list_get_first(list, type, member) \
285((list_empty(list)) ? NULL : \
286 list_entry((list)->next, type, member))
287
288bfa_status_t bfad_vport_create(struct bfad_s *bfad, u16 vf_id, 297bfa_status_t bfad_vport_create(struct bfad_s *bfad, u16 vf_id,
289 struct bfa_lport_cfg_s *port_cfg, 298 struct bfa_lport_cfg_s *port_cfg,
290 struct device *dev); 299 struct device *dev);
@@ -316,8 +325,8 @@ void bfad_debugfs_exit(struct bfad_port_s *port);
316 325
317void bfad_pci_remove(struct pci_dev *pdev); 326void bfad_pci_remove(struct pci_dev *pdev);
318int bfad_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid); 327int bfad_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid);
319void bfad_os_rport_online_wait(struct bfad_s *bfad); 328void bfad_rport_online_wait(struct bfad_s *bfad);
320int bfad_os_get_linkup_delay(struct bfad_s *bfad); 329int bfad_get_linkup_delay(struct bfad_s *bfad);
321int bfad_install_msix_handler(struct bfad_s *bfad); 330int bfad_install_msix_handler(struct bfad_s *bfad);
322 331
323extern struct idr bfad_im_port_index; 332extern struct idr bfad_im_port_index;
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c
index d10adcbf24b3..7b0f9725bbc9 100644
--- a/drivers/scsi/bfa/bfad_im.c
+++ b/drivers/scsi/bfa/bfad_im.c
@@ -92,10 +92,10 @@ bfa_cb_ioim_done(void *drv, struct bfad_ioim_s *dio,
92 if (!cmnd->result && itnim && 92 if (!cmnd->result && itnim &&
93 (bfa_lun_queue_depth > cmnd->device->queue_depth)) { 93 (bfa_lun_queue_depth > cmnd->device->queue_depth)) {
94 /* Queue depth adjustment for good status completion */ 94 /* Queue depth adjustment for good status completion */
95 bfad_os_ramp_up_qdepth(itnim, cmnd->device); 95 bfad_ramp_up_qdepth(itnim, cmnd->device);
96 } else if (cmnd->result == SAM_STAT_TASK_SET_FULL && itnim) { 96 } else if (cmnd->result == SAM_STAT_TASK_SET_FULL && itnim) {
97 /* qfull handling */ 97 /* qfull handling */
98 bfad_os_handle_qfull(itnim, cmnd->device); 98 bfad_handle_qfull(itnim, cmnd->device);
99 } 99 }
100 } 100 }
101 101
@@ -123,7 +123,7 @@ bfa_cb_ioim_good_comp(void *drv, struct bfad_ioim_s *dio)
123 if (itnim_data) { 123 if (itnim_data) {
124 itnim = itnim_data->itnim; 124 itnim = itnim_data->itnim;
125 if (itnim) 125 if (itnim)
126 bfad_os_ramp_up_qdepth(itnim, cmnd->device); 126 bfad_ramp_up_qdepth(itnim, cmnd->device);
127 } 127 }
128 } 128 }
129 129
@@ -366,7 +366,7 @@ bfad_im_reset_bus_handler(struct scsi_cmnd *cmnd)
366 366
367 spin_lock_irqsave(&bfad->bfad_lock, flags); 367 spin_lock_irqsave(&bfad->bfad_lock, flags);
368 for (i = 0; i < MAX_FCP_TARGET; i++) { 368 for (i = 0; i < MAX_FCP_TARGET; i++) {
369 itnim = bfad_os_get_itnim(im_port, i); 369 itnim = bfad_get_itnim(im_port, i);
370 if (itnim) { 370 if (itnim) {
371 cmnd->SCp.ptr = (char *)&wq; 371 cmnd->SCp.ptr = (char *)&wq;
372 rc = bfad_im_target_reset_send(bfad, cmnd, itnim); 372 rc = bfad_im_target_reset_send(bfad, cmnd, itnim);
@@ -547,7 +547,7 @@ bfad_im_scsi_host_alloc(struct bfad_s *bfad, struct bfad_im_port_s *im_port,
547 547
548 mutex_unlock(&bfad_mutex); 548 mutex_unlock(&bfad_mutex);
549 549
550 im_port->shost = bfad_os_scsi_host_alloc(im_port, bfad); 550 im_port->shost = bfad_scsi_host_alloc(im_port, bfad);
551 if (!im_port->shost) { 551 if (!im_port->shost) {
552 error = 1; 552 error = 1;
553 goto out_free_idr; 553 goto out_free_idr;
@@ -573,7 +573,7 @@ bfad_im_scsi_host_alloc(struct bfad_s *bfad, struct bfad_im_port_s *im_port,
573 } 573 }
574 574
575 /* setup host fixed attribute if the lk supports */ 575 /* setup host fixed attribute if the lk supports */
576 bfad_os_fc_host_init(im_port); 576 bfad_fc_host_init(im_port);
577 577
578 return 0; 578 return 0;
579 579
@@ -684,7 +684,7 @@ bfad_im_probe(struct bfad_s *bfad)
684 bfad->im = im; 684 bfad->im = im;
685 im->bfad = bfad; 685 im->bfad = bfad;
686 686
687 if (bfad_os_thread_workq(bfad) != BFA_STATUS_OK) { 687 if (bfad_thread_workq(bfad) != BFA_STATUS_OK) {
688 kfree(im); 688 kfree(im);
689 rc = BFA_STATUS_FAILED; 689 rc = BFA_STATUS_FAILED;
690 } 690 }
@@ -697,14 +697,14 @@ void
697bfad_im_probe_undo(struct bfad_s *bfad) 697bfad_im_probe_undo(struct bfad_s *bfad)
698{ 698{
699 if (bfad->im) { 699 if (bfad->im) {
700 bfad_os_destroy_workq(bfad->im); 700 bfad_destroy_workq(bfad->im);
701 kfree(bfad->im); 701 kfree(bfad->im);
702 bfad->im = NULL; 702 bfad->im = NULL;
703 } 703 }
704} 704}
705 705
706struct Scsi_Host * 706struct Scsi_Host *
707bfad_os_scsi_host_alloc(struct bfad_im_port_s *im_port, struct bfad_s *bfad) 707bfad_scsi_host_alloc(struct bfad_im_port_s *im_port, struct bfad_s *bfad)
708{ 708{
709 struct scsi_host_template *sht; 709 struct scsi_host_template *sht;
710 710
@@ -719,7 +719,7 @@ bfad_os_scsi_host_alloc(struct bfad_im_port_s *im_port, struct bfad_s *bfad)
719} 719}
720 720
721void 721void
722bfad_os_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port) 722bfad_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port)
723{ 723{
724 if (!(im_port->flags & BFAD_PORT_DELETE)) 724 if (!(im_port->flags & BFAD_PORT_DELETE))
725 flush_workqueue(bfad->im->drv_workq); 725 flush_workqueue(bfad->im->drv_workq);
@@ -729,7 +729,7 @@ bfad_os_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port)
729} 729}
730 730
731void 731void
732bfad_os_destroy_workq(struct bfad_im_s *im) 732bfad_destroy_workq(struct bfad_im_s *im)
733{ 733{
734 if (im && im->drv_workq) { 734 if (im && im->drv_workq) {
735 flush_workqueue(im->drv_workq); 735 flush_workqueue(im->drv_workq);
@@ -739,7 +739,7 @@ bfad_os_destroy_workq(struct bfad_im_s *im)
739} 739}
740 740
741bfa_status_t 741bfa_status_t
742bfad_os_thread_workq(struct bfad_s *bfad) 742bfad_thread_workq(struct bfad_s *bfad)
743{ 743{
744 struct bfad_im_s *im = bfad->im; 744 struct bfad_im_s *im = bfad->im;
745 745
@@ -843,7 +843,7 @@ bfad_im_module_exit(void)
843} 843}
844 844
845void 845void
846bfad_os_ramp_up_qdepth(struct bfad_itnim_s *itnim, struct scsi_device *sdev) 846bfad_ramp_up_qdepth(struct bfad_itnim_s *itnim, struct scsi_device *sdev)
847{ 847{
848 struct scsi_device *tmp_sdev; 848 struct scsi_device *tmp_sdev;
849 849
@@ -871,7 +871,7 @@ bfad_os_ramp_up_qdepth(struct bfad_itnim_s *itnim, struct scsi_device *sdev)
871} 871}
872 872
873void 873void
874bfad_os_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev) 874bfad_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev)
875{ 875{
876 struct scsi_device *tmp_sdev; 876 struct scsi_device *tmp_sdev;
877 877
@@ -885,7 +885,7 @@ bfad_os_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev)
885} 885}
886 886
887struct bfad_itnim_s * 887struct bfad_itnim_s *
888bfad_os_get_itnim(struct bfad_im_port_s *im_port, int id) 888bfad_get_itnim(struct bfad_im_port_s *im_port, int id)
889{ 889{
890 struct bfad_itnim_s *itnim = NULL; 890 struct bfad_itnim_s *itnim = NULL;
891 891
@@ -946,7 +946,7 @@ bfad_im_supported_speeds(struct bfa_s *bfa)
946} 946}
947 947
948void 948void
949bfad_os_fc_host_init(struct bfad_im_port_s *im_port) 949bfad_fc_host_init(struct bfad_im_port_s *im_port)
950{ 950{
951 struct Scsi_Host *host = im_port->shost; 951 struct Scsi_Host *host = im_port->shost;
952 struct bfad_s *bfad = im_port->bfad; 952 struct bfad_s *bfad = im_port->bfad;
@@ -990,7 +990,7 @@ bfad_im_fc_rport_add(struct bfad_im_port_s *im_port, struct bfad_itnim_s *itnim)
990 rport_ids.port_name = 990 rport_ids.port_name =
991 cpu_to_be64(bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim)); 991 cpu_to_be64(bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim));
992 rport_ids.port_id = 992 rport_ids.port_id =
993 bfa_os_hton3b(bfa_fcs_itnim_get_fcid(&itnim->fcs_itnim)); 993 bfa_hton3b(bfa_fcs_itnim_get_fcid(&itnim->fcs_itnim));
994 rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; 994 rport_ids.roles = FC_RPORT_ROLE_UNKNOWN;
995 995
996 itnim->fc_rport = fc_rport = 996 itnim->fc_rport = fc_rport =
@@ -1192,7 +1192,7 @@ out_fail_cmd:
1192static DEF_SCSI_QCMD(bfad_im_queuecommand) 1192static DEF_SCSI_QCMD(bfad_im_queuecommand)
1193 1193
1194void 1194void
1195bfad_os_rport_online_wait(struct bfad_s *bfad) 1195bfad_rport_online_wait(struct bfad_s *bfad)
1196{ 1196{
1197 int i; 1197 int i;
1198 int rport_delay = 10; 1198 int rport_delay = 10;
@@ -1220,7 +1220,7 @@ bfad_os_rport_online_wait(struct bfad_s *bfad)
1220} 1220}
1221 1221
1222int 1222int
1223bfad_os_get_linkup_delay(struct bfad_s *bfad) 1223bfad_get_linkup_delay(struct bfad_s *bfad)
1224{ 1224{
1225 u8 nwwns = 0; 1225 u8 nwwns = 0;
1226 wwn_t wwns[BFA_PREBOOT_BOOTLUN_MAX]; 1226 wwn_t wwns[BFA_PREBOOT_BOOTLUN_MAX];
diff --git a/drivers/scsi/bfa/bfad_im.h b/drivers/scsi/bfa/bfad_im.h
index b038c0e08921..bfee63b16fa9 100644
--- a/drivers/scsi/bfa/bfad_im.h
+++ b/drivers/scsi/bfa/bfad_im.h
@@ -117,17 +117,17 @@ struct bfad_im_s {
117 char drv_workq_name[KOBJ_NAME_LEN]; 117 char drv_workq_name[KOBJ_NAME_LEN];
118}; 118};
119 119
120struct Scsi_Host *bfad_os_scsi_host_alloc(struct bfad_im_port_s *im_port, 120struct Scsi_Host *bfad_scsi_host_alloc(struct bfad_im_port_s *im_port,
121 struct bfad_s *); 121 struct bfad_s *);
122bfa_status_t bfad_os_thread_workq(struct bfad_s *bfad); 122bfa_status_t bfad_thread_workq(struct bfad_s *bfad);
123void bfad_os_destroy_workq(struct bfad_im_s *im); 123void bfad_destroy_workq(struct bfad_im_s *im);
124void bfad_os_fc_host_init(struct bfad_im_port_s *im_port); 124void bfad_fc_host_init(struct bfad_im_port_s *im_port);
125void bfad_os_scsi_host_free(struct bfad_s *bfad, 125void bfad_scsi_host_free(struct bfad_s *bfad,
126 struct bfad_im_port_s *im_port); 126 struct bfad_im_port_s *im_port);
127void bfad_os_ramp_up_qdepth(struct bfad_itnim_s *itnim, 127void bfad_ramp_up_qdepth(struct bfad_itnim_s *itnim,
128 struct scsi_device *sdev); 128 struct scsi_device *sdev);
129void bfad_os_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev); 129void bfad_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev);
130struct bfad_itnim_s *bfad_os_get_itnim(struct bfad_im_port_s *im_port, int id); 130struct bfad_itnim_s *bfad_get_itnim(struct bfad_im_port_s *im_port, int id);
131 131
132extern struct scsi_host_template bfad_im_scsi_host_template; 132extern struct scsi_host_template bfad_im_scsi_host_template;
133extern struct scsi_host_template bfad_im_vport_template; 133extern struct scsi_host_template bfad_im_vport_template;
diff --git a/drivers/scsi/bfa/bfi.h b/drivers/scsi/bfa/bfi.h
index e19448427042..72b69a0c3b51 100644
--- a/drivers/scsi/bfa/bfi.h
+++ b/drivers/scsi/bfa/bfi.h
@@ -104,7 +104,7 @@ union bfi_addr_u {
104 * Scatter Gather Element 104 * Scatter Gather Element
105 */ 105 */
106struct bfi_sge_s { 106struct bfi_sge_s {
107#ifdef __BIGENDIAN 107#ifdef __BIG_ENDIAN
108 u32 flags:2, 108 u32 flags:2,
109 rsvd:2, 109 rsvd:2,
110 sg_len:28; 110 sg_len:28;