mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-21 11:13:30 +00:00
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)
This commit is contained in:
parent
24422f5d39
commit
d9ff48ab2c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=279175
@ -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) \
|
||||
|
Loading…
Reference in New Issue
Block a user