aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa/bfa_cs.h
diff options
context:
space:
mode:
authorMaggie Zhang <xmzhang@brocade.com>2010-12-09 22:12:32 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-12-21 13:32:56 -0500
commitf16a17507b09e10e0cccc4d675ccbfe030d51ef1 (patch)
tree4ead59bd8bfbd06f22dd18040b713fca998e1336 /drivers/scsi/bfa/bfa_cs.h
parentf314878ab95d4802ddde066096f7b30087cea7ba (diff)
[SCSI] bfa: remove all OS wrappers
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>
Diffstat (limited to 'drivers/scsi/bfa/bfa_cs.h')
-rw-r--r--drivers/scsi/bfa/bfa_cs.h51
1 files changed, 49 insertions, 2 deletions
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__ */