svn commit: r280580 - stable/10/sys/dev/sfxge/common
Andrew Rybchenko
arybchik at FreeBSD.org
Wed Mar 25 13:02:34 UTC 2015
Author: arybchik
Date: Wed Mar 25 13:02:33 2015
New Revision: 280580
URL: https://svnweb.freebsd.org/changeset/base/280580
Log:
MFC: 279175
sfxge: using bus_space_*_stream_* API for better portability
Host-bus byte order translation is not requred.
Submitted by: Artem V. Andreev <Artem.Andreev at oktetlabs.ru>
Sponsored by: Solarflare Communications, Inc.
Approved by: gnn (mentor)
Modified:
stable/10/sys/dev/sfxge/common/efsys.h
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/dev/sfxge/common/efsys.h
==============================================================================
--- stable/10/sys/dev/sfxge/common/efsys.h Wed Mar 25 13:01:51 2015 (r280579)
+++ stable/10/sys/dev/sfxge/common/efsys.h Wed Mar 25 13:02:33 2015 (r280580)
@@ -94,6 +94,15 @@ extern "C" {
#define ISP2(x) (((x) & ((x) - 1)) == 0)
#endif
+#if defined(__x86_64__)
+#if !defined(bus_space_read_stream_8)
+#define bus_space_read_stream_8(t, h, o) \
+ bus_space_read_8((t), (h), (o))
+#define bus_space_write_stream_8(t, h, o, v) \
+ bus_space_write_8((t), (h), (o), (v))
+#endif
+#endif
+
#define ENOTACTIVE EINVAL
/* Memory type to use on FreeBSD */
@@ -641,8 +650,9 @@ typedef struct efsys_bar_s {
if (_lock) \
SFXGE_BAR_LOCK(_esbp); \
\
- (_edp)->ed_u32[0] = bus_space_read_4((_esbp)->esb_tag, \
- (_esbp)->esb_handle, (_offset)); \
+ (_edp)->ed_u32[0] = bus_space_read_stream_4( \
+ (_esbp)->esb_tag, (_esbp)->esb_handle, \
+ (_offset)); \
\
EFSYS_PROBE2(bar_readd, unsigned int, (_offset), \
uint32_t, (_edp)->ed_u32[0]); \
@@ -662,8 +672,9 @@ typedef struct efsys_bar_s {
\
SFXGE_BAR_LOCK(_esbp); \
\
- (_eqp)->eq_u64[0] = bus_space_read_8((_esbp)->esb_tag, \
- (_esbp)->esb_handle, (_offset)); \
+ (_eqp)->eq_u64[0] = bus_space_read_stream_8( \
+ (_esbp)->esb_tag, (_esbp)->esb_handle, \
+ (_offset)); \
\
EFSYS_PROBE3(bar_readq, unsigned int, (_offset), \
uint32_t, (_eqp)->eq_u32[1], \
@@ -683,10 +694,12 @@ typedef struct efsys_bar_s {
if (_lock) \
SFXGE_BAR_LOCK(_esbp); \
\
- (_eop)->eo_u64[0] = bus_space_read_8((_esbp)->esb_tag, \
- (_esbp)->esb_handle, (_offset)); \
- (_eop)->eo_u64[1] = bus_space_read_8((_esbp)->esb_tag, \
- (_esbp)->esb_handle, (_offset+8)); \
+ (_eop)->eo_u64[0] = bus_space_read_stream_8( \
+ (_esbp)->esb_tag, (_esbp)->esb_handle, \
+ (_offset)); \
+ (_eop)->eo_u64[1] = bus_space_read_stream_8( \
+ (_esbp)->esb_tag, (_esbp)->esb_handle, \
+ (_offset) + 8); \
\
EFSYS_PROBE5(bar_reado, unsigned int, (_offset), \
uint32_t, (_eop)->eo_u32[3], \
@@ -709,10 +722,12 @@ typedef struct efsys_bar_s {
\
SFXGE_BAR_LOCK(_esbp); \
\
- (_eqp)->eq_u32[0] = bus_space_read_4((_esbp)->esb_tag, \
- (_esbp)->esb_handle, (_offset)); \
- (_eqp)->eq_u32[1] = bus_space_read_4((_esbp)->esb_tag, \
- (_esbp)->esb_handle, (_offset+4)); \
+ (_eqp)->eq_u32[0] = bus_space_read_stream_4( \
+ (_esbp)->esb_tag, (_esbp)->esb_handle, \
+ (_offset)); \
+ (_eqp)->eq_u32[1] = bus_space_read_stream_4( \
+ (_esbp)->esb_tag, (_esbp)->esb_handle, \
+ (_offset) + 4); \
\
EFSYS_PROBE3(bar_readq, unsigned int, (_offset), \
uint32_t, (_eqp)->eq_u32[1], \
@@ -732,14 +747,18 @@ typedef struct efsys_bar_s {
if (_lock) \
SFXGE_BAR_LOCK(_esbp); \
\
- (_eop)->eo_u32[0] = bus_space_read_4((_esbp)->esb_tag, \
- (_esbp)->esb_handle, (_offset)); \
- (_eop)->eo_u32[1] = bus_space_read_4((_esbp)->esb_tag, \
- (_esbp)->esb_handle, (_offset+4)); \
- (_eop)->eo_u32[2] = bus_space_read_4((_esbp)->esb_tag, \
- (_esbp)->esb_handle, (_offset+8)); \
- (_eop)->eo_u32[3] = bus_space_read_4((_esbp)->esb_tag, \
- (_esbp)->esb_handle, (_offset+12)); \
+ (_eop)->eo_u32[0] = bus_space_read_stream_4( \
+ (_esbp)->esb_tag, (_esbp)->esb_handle, \
+ (_offset)); \
+ (_eop)->eo_u32[1] = bus_space_read_stream_4( \
+ (_esbp)->esb_tag, (_esbp)->esb_handle, \
+ (_offset) + 4); \
+ (_eop)->eo_u32[2] = bus_space_read_stream_4( \
+ (_esbp)->esb_tag, (_esbp)->esb_handle, \
+ (_offset) + 8); \
+ (_eop)->eo_u32[3] = bus_space_read_stream_4( \
+ (_esbp)->esb_tag, (_esbp)->esb_handle, \
+ (_offset) + 12); \
\
EFSYS_PROBE5(bar_reado, unsigned int, (_offset), \
uint32_t, (_eop)->eo_u32[3], \
@@ -767,7 +786,8 @@ typedef struct efsys_bar_s {
EFSYS_PROBE2(bar_writed, unsigned int, (_offset), \
uint32_t, (_edp)->ed_u32[0]); \
\
- bus_space_write_4((_esbp)->esb_tag, (_esbp)->esb_handle,\
+ bus_space_write_stream_4((_esbp)->esb_tag, \
+ (_esbp)->esb_handle, \
(_offset), (_edp)->ed_u32[0]); \
\
_NOTE(CONSTANTCONDITION) \
@@ -789,7 +809,8 @@ typedef struct efsys_bar_s {
uint32_t, (_eqp)->eq_u32[1], \
uint32_t, (_eqp)->eq_u32[0]); \
\
- bus_space_write_8((_esbp)->esb_tag, (_esbp)->esb_handle,\
+ bus_space_write_stream_8((_esbp)->esb_tag, \
+ (_esbp)->esb_handle, \
(_offset), (_eqp)->eq_u64[0]); \
\
SFXGE_BAR_UNLOCK(_esbp); \
@@ -808,10 +829,12 @@ typedef struct efsys_bar_s {
uint32_t, (_eqp)->eq_u32[1], \
uint32_t, (_eqp)->eq_u32[0]); \
\
- bus_space_write_4((_esbp)->esb_tag, (_esbp)->esb_handle,\
+ bus_space_write_stream_4((_esbp)->esb_tag, \
+ (_esbp)->esb_handle, \
(_offset), (_eqp)->eq_u32[0]); \
- bus_space_write_4((_esbp)->esb_tag, (_esbp)->esb_handle,\
- (_offset+4), (_eqp)->eq_u32[1]); \
+ bus_space_write_stream_4((_esbp)->esb_tag, \
+ (_esbp)->esb_handle, \
+ (_offset) + 4, (_eqp)->eq_u32[1]); \
\
SFXGE_BAR_UNLOCK(_esbp); \
_NOTE(CONSTANTCONDITION) \
@@ -835,10 +858,12 @@ typedef struct efsys_bar_s {
uint32_t, (_eop)->eo_u32[1], \
uint32_t, (_eop)->eo_u32[0]); \
\
- bus_space_write_8((_esbp)->esb_tag, (_esbp)->esb_handle,\
+ bus_space_write_stream_8((_esbp)->esb_tag, \
+ (_esbp)->esb_handle, \
(_offset), (_eop)->eo_u64[0]); \
- bus_space_write_8((_esbp)->esb_tag, (_esbp)->esb_handle,\
- (_offset+8), (_eop)->eo_u64[1]); \
+ bus_space_write_stream_8((_esbp)->esb_tag, \
+ (_esbp)->esb_handle, \
+ (_offset) + 8, (_eop)->eo_u64[1]); \
\
_NOTE(CONSTANTCONDITION) \
if (_lock) \
@@ -863,14 +888,18 @@ typedef struct efsys_bar_s {
uint32_t, (_eop)->eo_u32[1], \
uint32_t, (_eop)->eo_u32[0]); \
\
- bus_space_write_4((_esbp)->esb_tag, (_esbp)->esb_handle,\
+ bus_space_write_stream_4((_esbp)->esb_tag, \
+ (_esbp)->esb_handle, \
(_offset), (_eop)->eo_u32[0]); \
- bus_space_write_4((_esbp)->esb_tag, (_esbp)->esb_handle,\
- (_offset+4), (_eop)->eo_u32[1]); \
- bus_space_write_4((_esbp)->esb_tag, (_esbp)->esb_handle,\
- (_offset+8), (_eop)->eo_u32[2]); \
- bus_space_write_4((_esbp)->esb_tag, (_esbp)->esb_handle,\
- (_offset+12), (_eop)->eo_u32[3]); \
+ bus_space_write_stream_4((_esbp)->esb_tag, \
+ (_esbp)->esb_handle, \
+ (_offset) + 4, (_eop)->eo_u32[1]); \
+ bus_space_write_stream_4((_esbp)->esb_tag, \
+ (_esbp)->esb_handle, \
+ (_offset) + 8, (_eop)->eo_u32[2]); \
+ bus_space_write_stream_4((_esbp)->esb_tag, \
+ (_esbp)->esb_handle, \
+ (_offset) + 12, (_eop)->eo_u32[3]); \
\
_NOTE(CONSTANTCONDITION) \
if (_lock) \
More information about the svn-src-stable-10
mailing list