Skip to content

Commit

Permalink
[SCSI] bfa: remove all OS wrappers
Browse files Browse the repository at this point in the history
Remove OS wrapper functions/macros, and as a result remove bfa_os_inc.h.

Signed-off-by: Maggie Zhang <xmzhang@brocade.com>
Signed-off-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
  • Loading branch information
Maggie Zhang authored and James Bottomley committed Dec 21, 2010
1 parent f314878 commit f16a175
Show file tree
Hide file tree
Showing 28 changed files with 210 additions and 304 deletions.
2 changes: 1 addition & 1 deletion drivers/scsi/bfa/bfa.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#ifndef __BFA_H__
#define __BFA_H__

#include "bfa_os_inc.h"
#include "bfad_drv.h"
#include "bfa_cs.h"
#include "bfa_plog.h"
#include "bfa_defs_svc.h"
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/bfa/bfa_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
* General Public License for more details.
*/

#include "bfad_drv.h"
#include "bfa_modules.h"
#include "bfi_ctreg.h"
#include "bfad_drv.h"

BFA_TRC_FILE(HAL, CORE);

Expand Down
51 changes: 49 additions & 2 deletions drivers/scsi/bfa/bfa_cs.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#ifndef __BFA_CS_H__
#define __BFA_CS_H__

#include "bfa_os_inc.h"
#include "bfad_drv.h"

/*
* BFA TRC
Expand All @@ -32,12 +32,20 @@
#define BFA_TRC_MAX (4 * 1024)
#endif

#define BFA_TRC_TS(_trcm) \
({ \
struct timeval tv; \
\
do_gettimeofday(&tv); \
(tv.tv_sec*1000000+tv.tv_usec); \
})

#ifndef BFA_TRC_TS
#define BFA_TRC_TS(_trcm) ((_trcm)->ticks++)
#endif

struct bfa_trc_s {
#ifdef __BIGENDIAN
#ifdef __BIG_ENDIAN
u16 fileno;
u16 line;
#else
Expand Down Expand Up @@ -361,4 +369,43 @@ bfa_wc_wait(struct bfa_wc_s *wc)
bfa_wc_down(wc);
}

static inline void
wwn2str(char *wwn_str, u64 wwn)
{
union {
u64 wwn;
u8 byte[8];
} w;

w.wwn = wwn;
sprintf(wwn_str, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", w.byte[0],
w.byte[1], w.byte[2], w.byte[3], w.byte[4], w.byte[5],
w.byte[6], w.byte[7]);
}

static inline void
fcid2str(char *fcid_str, u32 fcid)
{
union {
u32 fcid;
u8 byte[4];
} f;

f.fcid = fcid;
sprintf(fcid_str, "%02x:%02x:%02x", f.byte[1], f.byte[2], f.byte[3]);
}

#define bfa_swap_3b(_x) \
((((_x) & 0xff) << 16) | \
((_x) & 0x00ff00) | \
(((_x) & 0xff0000) >> 16))

#ifndef __BIG_ENDIAN
#define bfa_hton3b(_x) bfa_swap_3b(_x)
#else
#define bfa_hton3b(_x) (_x)
#endif

#define bfa_ntoh3b(_x) bfa_hton3b(_x)

#endif /* __BFA_CS_H__ */
2 changes: 1 addition & 1 deletion drivers/scsi/bfa/bfa_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#define __BFA_DEFS_H__

#include "bfa_fc.h"
#include "bfa_os_inc.h"
#include "bfad_drv.h"

#define BFA_MFG_SERIALNUM_SIZE 11
#define STRSZ(_n) (((_n) + 4) & ~3)
Expand Down
24 changes: 12 additions & 12 deletions drivers/scsi/bfa/bfa_fc.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifndef __BFA_FC_H__
#define __BFA_FC_H__

#include "bfa_os_inc.h"
#include "bfad_drv.h"

typedef u64 wwn_t;

Expand Down Expand Up @@ -62,7 +62,7 @@ struct scsi_cdb_s {
* Fibre Channel Header Structure (FCHS) definition
*/
struct fchs_s {
#ifdef __BIGENDIAN
#ifdef __BIG_ENDIAN
u32 routing:4; /* routing bits */
u32 cat_info:4; /* category info */
#else
Expand Down Expand Up @@ -317,7 +317,7 @@ struct fc_plogi_csp_s {
u8 verlo; /* FC-PH low version */
__be16 bbcred; /* BB_Credit */

#ifdef __BIGENDIAN
#ifdef __BIG_ENDIAN
u8 ciro:1, /* continuously increasing RO */
rro:1, /* random relative offset */
npiv_supp:1, /* NPIV supported */
Expand Down Expand Up @@ -367,7 +367,7 @@ struct fc_plogi_csp_s {
* FC-PH-x. Figure 78. pg. 318.
*/
struct fc_plogi_clp_s {
#ifdef __BIGENDIAN
#ifdef __BIG_ENDIAN
u32 class_valid:1;
u32 intermix:1; /* class intermix supported if set =1.
* valid only for class1. Reserved for
Expand Down Expand Up @@ -532,7 +532,7 @@ struct fc_rsi_s {
*/
struct fc_prli_params_s {
u32 reserved:16;
#ifdef __BIGENDIAN
#ifdef __BIG_ENDIAN
u32 reserved1:5;
u32 rec_support:1;
u32 task_retry_id:1;
Expand Down Expand Up @@ -574,7 +574,7 @@ enum {
struct fc_prli_params_page_s {
u32 type:8;
u32 codext:8;
#ifdef __BIGENDIAN
#ifdef __BIG_ENDIAN
u32 origprocasv:1;
u32 rsppav:1;
u32 imagepair:1;
Expand Down Expand Up @@ -610,7 +610,7 @@ struct fc_prli_s {
struct fc_prlo_params_page_s {
u32 type:8;
u32 type_ext:8;
#ifdef __BIGENDIAN
#ifdef __BIG_ENDIAN
u32 opa_valid:1; /* originator process associator
* valid
*/
Expand Down Expand Up @@ -646,7 +646,7 @@ struct fc_prlo_acc_params_page_s {
u32 type:8;
u32 type_ext:8;

#ifdef __BIGENDIAN
#ifdef __BIG_ENDIAN
u32 opa_valid:1; /* originator process associator
* valid
*/
Expand Down Expand Up @@ -803,7 +803,7 @@ struct fc_tprlo_params_page_s {
u32 type:8;
u32 type_ext:8;

#ifdef __BIGENDIAN
#ifdef __BIG_ENDIAN
u32 opa_valid:1;
u32 rpa_valid:1;
u32 tpo_nport_valid:1;
Expand Down Expand Up @@ -1177,7 +1177,7 @@ struct fc_srr_s {
struct fcp_cmnd_s {
struct scsi_lun lun; /* 64-bit LU number */
u8 crn; /* command reference number */
#ifdef __BIGENDIAN
#ifdef __BIG_ENDIAN
u8 resvd:1,
priority:4, /* FCP-3: SAM-3 priority */
taskattr:3; /* scsi task attribute */
Expand All @@ -1187,7 +1187,7 @@ struct fcp_cmnd_s {
resvd:1;
#endif
u8 tm_flags; /* task management flags */
#ifdef __BIGENDIAN
#ifdef __BIG_ENDIAN
u8 addl_cdb_len:6, /* additional CDB length words */
iodir:2; /* read/write FCP_DATA IUs */
#else
Expand Down Expand Up @@ -1273,7 +1273,7 @@ struct fcp_rspinfo_s {
struct fcp_resp_s {
u32 reserved[2]; /* 2 words reserved */
u16 reserved2;
#ifdef __BIGENDIAN
#ifdef __BIG_ENDIAN
u8 reserved3:3;
u8 fcp_conf_req:1; /* FCP_CONF is requested */
u8 resid_flags:2; /* underflow/overflow */
Expand Down
Loading

0 comments on commit f16a175

Please sign in to comment.