iPXE
Data Structures | Defines | Typedefs | Functions
efx_bitfield.h File Reference

Efx bitfield access. More...

#include <byteswap.h>

Go to the source code of this file.

Data Structures

union  efx_dword
 A doubleword (4 byte) datatype - little-endian in HW. More...
union  efx_qword
 A quadword (8 byte) datatype - little-endian in HW. More...
union  efx_oword
 An octword (eight-word, so 16 byte) datatype - little-endian in HW. More...

Defines

#define EFX_DUMMY_FIELD_LBN   0
#define EFX_DUMMY_FIELD_WIDTH   0
#define EFX_WORD_0_LBN   0
#define EFX_WORD_0_WIDTH   16
#define EFX_WORD_1_LBN   16
#define EFX_WORD_1_WIDTH   16
#define EFX_DWORD_0_LBN   0
#define EFX_DWORD_0_WIDTH   32
#define EFX_DWORD_1_LBN   32
#define EFX_DWORD_1_WIDTH   32
#define EFX_DWORD_2_LBN   64
#define EFX_DWORD_2_WIDTH   32
#define EFX_DWORD_3_LBN   96
#define EFX_DWORD_3_WIDTH   32
#define EFX_QWORD_0_LBN   0
#define EFX_QWORD_0_WIDTH   64
#define EFX_VAL(field, attribute)   field ## _ ## attribute
#define EFX_LOW_BIT(field)   EFX_VAL(field, LBN)
#define EFX_WIDTH(field)   EFX_VAL(field, WIDTH)
#define EFX_HIGH_BIT(field)   (EFX_LOW_BIT(field) + EFX_WIDTH(field) - 1)
#define EFX_MASK64(width)
#define EFX_MASK32(width)
#define EFX_DWORD_FMT   "%08x"
#define EFX_QWORD_FMT   "%08x:%08x"
#define EFX_OWORD_FMT   "%08x:%08x:%08x:%08x"
#define EFX_DWORD_VAL(dword)   ((unsigned int) le32_to_cpu((dword).u32[0]))
#define EFX_QWORD_VAL(qword)
#define EFX_OWORD_VAL(oword)
#define EFX_EXTRACT_NATIVE(native_element, min, max, low, high)
#define EFX_EXTRACT64(element, min, max, low, high)   EFX_EXTRACT_NATIVE(le64_to_cpu(element), min, max, low, high)
#define EFX_EXTRACT32(element, min, max, low, high)   EFX_EXTRACT_NATIVE(le32_to_cpu(element), min, max, low, high)
#define EFX_EXTRACT_OWORD64(oword, low, high)
#define EFX_EXTRACT_QWORD64(qword, low, high)
#define EFX_EXTRACT_OWORD32(oword, low, high)
#define EFX_EXTRACT_QWORD32(qword, low, high)
#define EFX_EXTRACT_DWORD(dword, low, high)
#define EFX_OWORD_FIELD64(oword, field)
#define EFX_QWORD_FIELD64(qword, field)
#define EFX_OWORD_FIELD32(oword, field)
#define EFX_QWORD_FIELD32(qword, field)
#define EFX_DWORD_FIELD(dword, field)
#define EFX_OWORD_IS_ZERO64(oword)   (((oword).u64[0] | (oword).u64[1]) == (__force __le64) 0)
#define EFX_QWORD_IS_ZERO64(qword)   (((qword).u64[0]) == (__force __le64) 0)
#define EFX_OWORD_IS_ZERO32(oword)
#define EFX_QWORD_IS_ZERO32(qword)   (((qword).u32[0] | (qword).u32[1]) == (__force __le32) 0)
#define EFX_DWORD_IS_ZERO(dword)   (((dword).u32[0]) == (__force __le32) 0)
#define EFX_OWORD_IS_ALL_ONES64(oword)   (((oword).u64[0] & (oword).u64[1]) == ~((__force __le64) 0))
#define EFX_QWORD_IS_ALL_ONES64(qword)   ((qword).u64[0] == ~((__force __le64) 0))
#define EFX_OWORD_IS_ALL_ONES32(oword)
#define EFX_QWORD_IS_ALL_ONES32(qword)   (((qword).u32[0] & (qword).u32[1]) == ~((__force __le32) 0))
#define EFX_DWORD_IS_ALL_ONES(dword)   ((dword).u32[0] == ~((__force __le32) 0))
#define EFX_OWORD_FIELD   EFX_OWORD_FIELD32
#define EFX_QWORD_FIELD   EFX_QWORD_FIELD32
#define EFX_OWORD_IS_ZERO   EFX_OWORD_IS_ZERO32
#define EFX_QWORD_IS_ZERO   EFX_QWORD_IS_ZERO32
#define EFX_OWORD_IS_ALL_ONES   EFX_OWORD_IS_ALL_ONES32
#define EFX_QWORD_IS_ALL_ONES   EFX_QWORD_IS_ALL_ONES32
#define EFX_INSERT_NATIVE64(min, max, low, high, value)
#define EFX_INSERT_NATIVE32(min, max, low, high, value)
#define EFX_INSERT_NATIVE(min, max, low, high, value)
#define EFX_INSERT_FIELD_NATIVE(min, max, field, value)
#define EFX_INSERT_FIELDS_NATIVE(min, max,field1, value1,field2, value2,field3, value3,field4, value4,field5, value5,field6, value6,field7, value7,field8, value8,field9, value9,field10, value10)
#define EFX_INSERT_FIELDS64(...)   cpu_to_le64(EFX_INSERT_FIELDS_NATIVE(__VA_ARGS__))
#define EFX_INSERT_FIELDS32(...)   cpu_to_le32(EFX_INSERT_FIELDS_NATIVE(__VA_ARGS__))
#define EFX_POPULATE_OWORD64(oword,...)
#define EFX_POPULATE_QWORD64(qword,...)
#define EFX_POPULATE_OWORD32(oword,...)
#define EFX_POPULATE_QWORD32(qword,...)
#define EFX_POPULATE_DWORD(dword,...)
#define EFX_POPULATE_OWORD   EFX_POPULATE_OWORD32
#define EFX_POPULATE_QWORD   EFX_POPULATE_QWORD32
#define EFX_POPULATE_OWORD_10   EFX_POPULATE_OWORD
#define EFX_POPULATE_OWORD_9(oword,...)   EFX_POPULATE_OWORD_10(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_POPULATE_OWORD_8(oword,...)   EFX_POPULATE_OWORD_9(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_POPULATE_OWORD_7(oword,...)   EFX_POPULATE_OWORD_8(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_POPULATE_OWORD_6(oword,...)   EFX_POPULATE_OWORD_7(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_POPULATE_OWORD_5(oword,...)   EFX_POPULATE_OWORD_6(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_POPULATE_OWORD_4(oword,...)   EFX_POPULATE_OWORD_5(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_POPULATE_OWORD_3(oword,...)   EFX_POPULATE_OWORD_4(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_POPULATE_OWORD_2(oword,...)   EFX_POPULATE_OWORD_3(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_POPULATE_OWORD_1(oword,...)   EFX_POPULATE_OWORD_2(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_ZERO_OWORD(oword)   EFX_POPULATE_OWORD_1(oword, EFX_DUMMY_FIELD, 0)
#define EFX_SET_OWORD(oword)
#define EFX_POPULATE_QWORD_10   EFX_POPULATE_QWORD
#define EFX_POPULATE_QWORD_9(qword,...)   EFX_POPULATE_QWORD_10(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_POPULATE_QWORD_8(qword,...)   EFX_POPULATE_QWORD_9(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_POPULATE_QWORD_7(qword,...)   EFX_POPULATE_QWORD_8(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_POPULATE_QWORD_6(qword,...)   EFX_POPULATE_QWORD_7(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_POPULATE_QWORD_5(qword,...)   EFX_POPULATE_QWORD_6(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_POPULATE_QWORD_4(qword,...)   EFX_POPULATE_QWORD_5(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_POPULATE_QWORD_3(qword,...)   EFX_POPULATE_QWORD_4(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_POPULATE_QWORD_2(qword,...)   EFX_POPULATE_QWORD_3(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_POPULATE_QWORD_1(qword,...)   EFX_POPULATE_QWORD_2(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_ZERO_QWORD(qword)   EFX_POPULATE_QWORD_1(qword, EFX_DUMMY_FIELD, 0)
#define EFX_SET_QWORD(qword)
#define EFX_POPULATE_DWORD_10   EFX_POPULATE_DWORD
#define EFX_POPULATE_DWORD_9(dword,...)   EFX_POPULATE_DWORD_10(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_POPULATE_DWORD_8(dword,...)   EFX_POPULATE_DWORD_9(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_POPULATE_DWORD_7(dword,...)   EFX_POPULATE_DWORD_8(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_POPULATE_DWORD_6(dword,...)   EFX_POPULATE_DWORD_7(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_POPULATE_DWORD_5(dword,...)   EFX_POPULATE_DWORD_6(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_POPULATE_DWORD_4(dword,...)   EFX_POPULATE_DWORD_5(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_POPULATE_DWORD_3(dword,...)   EFX_POPULATE_DWORD_4(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_POPULATE_DWORD_2(dword,...)   EFX_POPULATE_DWORD_3(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_POPULATE_DWORD_1(dword,...)   EFX_POPULATE_DWORD_2(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_ZERO_DWORD(dword)   EFX_POPULATE_DWORD_1(dword, EFX_DUMMY_FIELD, 0)
#define EFX_SET_DWORD(dword)   EFX_POPULATE_DWORD_1(dword, EFX_DWORD_0, 0xffffffff)
#define EFX_INVERT_OWORD(oword)
#define EFX_AND_OWORD(oword, from, mask)
#define EFX_AND_QWORD(qword, from, mask)   (qword).u64[0] = (from).u64[0] & (mask).u64[0]
#define EFX_OR_OWORD(oword, from, mask)
#define EFX_INSERT64(min, max, low, high, value)   cpu_to_le64(EFX_INSERT_NATIVE(min, max, low, high, value))
#define EFX_INSERT32(min, max, low, high, value)   cpu_to_le32(EFX_INSERT_NATIVE(min, max, low, high, value))
#define EFX_INPLACE_MASK64(min, max, low, high)   EFX_INSERT64(min, max, low, high, EFX_MASK64((high) + 1 - (low)))
#define EFX_INPLACE_MASK32(min, max, low, high)   EFX_INSERT32(min, max, low, high, EFX_MASK32((high) + 1 - (low)))
#define EFX_SET_OWORD64(oword, low, high, value)
#define EFX_SET_QWORD64(qword, low, high, value)
#define EFX_SET_OWORD32(oword, low, high, value)
#define EFX_SET_QWORD32(qword, low, high, value)
#define EFX_SET_DWORD32(dword, low, high, value)
#define EFX_SET_OWORD_FIELD64(oword, field, value)
#define EFX_SET_QWORD_FIELD64(qword, field, value)
#define EFX_SET_OWORD_FIELD32(oword, field, value)
#define EFX_SET_QWORD_FIELD32(qword, field, value)
#define EFX_SET_DWORD_FIELD(dword, field, value)
#define EFX_SET_OWORD_FIELD   EFX_SET_OWORD_FIELD32
#define EFX_SET_QWORD_FIELD   EFX_SET_QWORD_FIELD32
#define DMA_ADDR_T_WIDTH   (8 * sizeof(dma_addr_t))
#define EFX_DMA_TYPE_WIDTH(width)   (((width) < DMA_ADDR_T_WIDTH) ? (width) : DMA_ADDR_T_WIDTH)
#define EFX_OWORD32(a, b, c, d)

Typedefs

typedef union efx_dword efx_dword_t
 A doubleword (4 byte) datatype - little-endian in HW.
typedef union efx_qword efx_qword_t
 A quadword (8 byte) datatype - little-endian in HW.
typedef union efx_oword efx_oword_t
 An octword (eight-word, so 16 byte) datatype - little-endian in HW.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)

Detailed Description

Efx bitfield access.

Efx NICs make extensive use of bitfields up to 128 bits wide. Since there is no native 128-bit datatype on most systems, and since 64-bit datatypes are inefficient on 32-bit systems and vice versa, we wrap accesses in a way that uses the most efficient datatype.

The NICs are PCI devices and therefore little-endian. Since most of the quantities that we deal with are DMAed to/from host memory, we define our datatypes (efx_oword_t, efx_qword_t and efx_dword_t) to be little-endian.

Definition in file efx_bitfield.h.


Define Documentation

#define EFX_DUMMY_FIELD_LBN   0

Definition at line 40 of file efx_bitfield.h.

#define EFX_DUMMY_FIELD_WIDTH   0

Definition at line 41 of file efx_bitfield.h.

#define EFX_WORD_0_LBN   0

Definition at line 42 of file efx_bitfield.h.

#define EFX_WORD_0_WIDTH   16

Definition at line 43 of file efx_bitfield.h.

#define EFX_WORD_1_LBN   16

Definition at line 44 of file efx_bitfield.h.

#define EFX_WORD_1_WIDTH   16

Definition at line 45 of file efx_bitfield.h.

#define EFX_DWORD_0_LBN   0

Definition at line 46 of file efx_bitfield.h.

#define EFX_DWORD_0_WIDTH   32

Definition at line 47 of file efx_bitfield.h.

#define EFX_DWORD_1_LBN   32

Definition at line 48 of file efx_bitfield.h.

#define EFX_DWORD_1_WIDTH   32

Definition at line 49 of file efx_bitfield.h.

#define EFX_DWORD_2_LBN   64

Definition at line 50 of file efx_bitfield.h.

#define EFX_DWORD_2_WIDTH   32

Definition at line 51 of file efx_bitfield.h.

#define EFX_DWORD_3_LBN   96

Definition at line 52 of file efx_bitfield.h.

#define EFX_DWORD_3_WIDTH   32

Definition at line 53 of file efx_bitfield.h.

#define EFX_QWORD_0_LBN   0

Definition at line 54 of file efx_bitfield.h.

#define EFX_QWORD_0_WIDTH   64

Definition at line 55 of file efx_bitfield.h.

#define EFX_VAL (   field,
  attribute 
)    field ## _ ## attribute

Definition at line 58 of file efx_bitfield.h.

#define EFX_LOW_BIT (   field)    EFX_VAL(field, LBN)

Definition at line 60 of file efx_bitfield.h.

#define EFX_WIDTH (   field)    EFX_VAL(field, WIDTH)

Definition at line 62 of file efx_bitfield.h.

#define EFX_HIGH_BIT (   field)    (EFX_LOW_BIT(field) + EFX_WIDTH(field) - 1)

Definition at line 64 of file efx_bitfield.h.

#define EFX_MASK64 (   width)
Value:
((width) == 64 ? ~((u64) 0) :           \
         (((((u64) 1) << (width))) - 1))

Definition at line 71 of file efx_bitfield.h.

#define EFX_MASK32 (   width)
Value:
((width) == 32 ? ~((u32) 0) :           \
         (((((u32) 1) << (width))) - 1))

Definition at line 82 of file efx_bitfield.h.

#define EFX_DWORD_FMT   "%08x"

Definition at line 107 of file efx_bitfield.h.

Referenced by efx_readl(), and efx_writel().

#define EFX_QWORD_FMT   "%08x:%08x"

Definition at line 108 of file efx_bitfield.h.

Referenced by efx_hunt_poll().

#define EFX_OWORD_FMT   "%08x:%08x:%08x:%08x"

Definition at line 109 of file efx_bitfield.h.

#define EFX_DWORD_VAL (   dword)    ((unsigned int) le32_to_cpu((dword).u32[0]))

Definition at line 110 of file efx_bitfield.h.

Referenced by efx_readl(), and efx_writel().

#define EFX_QWORD_VAL (   qword)
Value:
((unsigned int) le32_to_cpu((qword).u32[1])),   \
        ((unsigned int) le32_to_cpu((qword).u32[0]))

Definition at line 112 of file efx_bitfield.h.

Referenced by efx_hunt_poll().

#define EFX_OWORD_VAL (   oword)
Value:
((unsigned int) le32_to_cpu((oword).u32[3])),   \
        ((unsigned int) le32_to_cpu((oword).u32[2])),   \
        ((unsigned int) le32_to_cpu((oword).u32[1])),   \
        ((unsigned int) le32_to_cpu((oword).u32[0]))

Definition at line 115 of file efx_bitfield.h.

#define EFX_EXTRACT_NATIVE (   native_element,
  min,
  max,
  low,
  high 
)
Value:
((low) > (max) || (high) < (min) ? 0 :                          \
         (low) > (min) ?                                                \
         (native_element) >> ((low) - (min)) :                          \
         (native_element) << ((min) - (low)))

Definition at line 136 of file efx_bitfield.h.

#define EFX_EXTRACT64 (   element,
  min,
  max,
  low,
  high 
)    EFX_EXTRACT_NATIVE(le64_to_cpu(element), min, max, low, high)

Definition at line 146 of file efx_bitfield.h.

#define EFX_EXTRACT32 (   element,
  min,
  max,
  low,
  high 
)    EFX_EXTRACT_NATIVE(le32_to_cpu(element), min, max, low, high)

Definition at line 153 of file efx_bitfield.h.

#define EFX_EXTRACT_OWORD64 (   oword,
  low,
  high 
)
Value:
((EFX_EXTRACT64((oword).u64[0], 0, 63, low, high) |             \
          EFX_EXTRACT64((oword).u64[1], 64, 127, low, high)) &          \
         EFX_MASK64((high) + 1 - (low)))

Definition at line 156 of file efx_bitfield.h.

#define EFX_EXTRACT_QWORD64 (   qword,
  low,
  high 
)
Value:
(EFX_EXTRACT64((qword).u64[0], 0, 63, low, high) &              \
         EFX_MASK64((high) + 1 - (low)))

Definition at line 161 of file efx_bitfield.h.

#define EFX_EXTRACT_OWORD32 (   oword,
  low,
  high 
)
Value:
((EFX_EXTRACT32((oword).u32[0], 0, 31, low, high) |             \
          EFX_EXTRACT32((oword).u32[1], 32, 63, low, high) |            \
          EFX_EXTRACT32((oword).u32[2], 64, 95, low, high) |            \
          EFX_EXTRACT32((oword).u32[3], 96, 127, low, high)) &          \
         EFX_MASK32((high) + 1 - (low)))

Definition at line 165 of file efx_bitfield.h.

#define EFX_EXTRACT_QWORD32 (   qword,
  low,
  high 
)
Value:
((EFX_EXTRACT32((qword).u32[0], 0, 31, low, high) |             \
          EFX_EXTRACT32((qword).u32[1], 32, 63, low, high)) &           \
         EFX_MASK32((high) + 1 - (low)))

Definition at line 172 of file efx_bitfield.h.

#define EFX_EXTRACT_DWORD (   dword,
  low,
  high 
)
Value:
(EFX_EXTRACT32((dword).u32[0], 0, 31, low, high) &      \
         EFX_MASK32((high) + 1 - (low)))

Definition at line 177 of file efx_bitfield.h.

#define EFX_OWORD_FIELD64 (   oword,
  field 
)
Value:
EFX_EXTRACT_OWORD64(oword, EFX_LOW_BIT(field),          \
                            EFX_HIGH_BIT(field))

Definition at line 181 of file efx_bitfield.h.

#define EFX_QWORD_FIELD64 (   qword,
  field 
)
Value:
EFX_EXTRACT_QWORD64(qword, EFX_LOW_BIT(field),          \
                            EFX_HIGH_BIT(field))

Definition at line 185 of file efx_bitfield.h.

#define EFX_OWORD_FIELD32 (   oword,
  field 
)
Value:
EFX_EXTRACT_OWORD32(oword, EFX_LOW_BIT(field),          \
                            EFX_HIGH_BIT(field))

Definition at line 189 of file efx_bitfield.h.

#define EFX_QWORD_FIELD32 (   qword,
  field 
)
Value:
EFX_EXTRACT_QWORD32(qword, EFX_LOW_BIT(field),          \
                            EFX_HIGH_BIT(field))

Definition at line 193 of file efx_bitfield.h.

#define EFX_DWORD_FIELD (   dword,
  field 
)
Value:

Definition at line 197 of file efx_bitfield.h.

Referenced by hunt_mcdi_request_poll().

#define EFX_OWORD_IS_ZERO64 (   oword)    (((oword).u64[0] | (oword).u64[1]) == (__force __le64) 0)

Definition at line 201 of file efx_bitfield.h.

#define EFX_QWORD_IS_ZERO64 (   qword)    (((qword).u64[0]) == (__force __le64) 0)

Definition at line 204 of file efx_bitfield.h.

#define EFX_OWORD_IS_ZERO32 (   oword)
Value:
(((oword).u32[0] | (oword).u32[1] | (oword).u32[2] | (oword).u32[3]) \
         == (__force __le32) 0)

Definition at line 207 of file efx_bitfield.h.

#define EFX_QWORD_IS_ZERO32 (   qword)    (((qword).u32[0] | (qword).u32[1]) == (__force __le32) 0)

Definition at line 211 of file efx_bitfield.h.

#define EFX_DWORD_IS_ZERO (   dword)    (((dword).u32[0]) == (__force __le32) 0)

Definition at line 214 of file efx_bitfield.h.

#define EFX_OWORD_IS_ALL_ONES64 (   oword)    (((oword).u64[0] & (oword).u64[1]) == ~((__force __le64) 0))

Definition at line 217 of file efx_bitfield.h.

#define EFX_QWORD_IS_ALL_ONES64 (   qword)    ((qword).u64[0] == ~((__force __le64) 0))

Definition at line 220 of file efx_bitfield.h.

#define EFX_OWORD_IS_ALL_ONES32 (   oword)
Value:
(((oword).u32[0] & (oword).u32[1] & (oword).u32[2] & (oword).u32[3]) \
         == ~((__force __le32) 0))

Definition at line 223 of file efx_bitfield.h.

#define EFX_QWORD_IS_ALL_ONES32 (   qword)    (((qword).u32[0] & (qword).u32[1]) == ~((__force __le32) 0))

Definition at line 227 of file efx_bitfield.h.

#define EFX_DWORD_IS_ALL_ONES (   dword)    ((dword).u32[0] == ~((__force __le32) 0))

Definition at line 230 of file efx_bitfield.h.

Referenced by efx_hunt_event_present().

Definition at line 241 of file efx_bitfield.h.

Definition at line 242 of file efx_bitfield.h.

Referenced by efx_hunt_handle_event().

Definition at line 243 of file efx_bitfield.h.

Definition at line 244 of file efx_bitfield.h.

Definition at line 245 of file efx_bitfield.h.

Definition at line 246 of file efx_bitfield.h.

#define EFX_INSERT_NATIVE64 (   min,
  max,
  low,
  high,
  value 
)
Value:
(((low > max) || (high < min)) ? 0 :                    \
         ((low > min) ?                                         \
          (((u64) (value)) << (low - min)) :            \
          (((u64) (value)) >> (min - low))))

Definition at line 255 of file efx_bitfield.h.

#define EFX_INSERT_NATIVE32 (   min,
  max,
  low,
  high,
  value 
)
Value:
(((low > max) || (high < min)) ? 0 :                    \
         ((low > min) ?                                         \
          (((u32) (value)) << (low - min)) :            \
          (((u32) (value)) >> (min - low))))

Definition at line 261 of file efx_bitfield.h.

#define EFX_INSERT_NATIVE (   min,
  max,
  low,
  high,
  value 
)
Value:
((((max - min) >= 32) || ((high - low) >= 32)) ?        \
         EFX_INSERT_NATIVE64(min, max, low, high, value) :      \
         EFX_INSERT_NATIVE32(min, max, low, high, value))

Definition at line 267 of file efx_bitfield.h.

#define EFX_INSERT_FIELD_NATIVE (   min,
  max,
  field,
  value 
)
Value:

Definition at line 278 of file efx_bitfield.h.

#define EFX_INSERT_FIELDS_NATIVE (   min,
  max,
  field1,
  value1,
  field2,
  value2,
  field3,
  value3,
  field4,
  value4,
  field5,
  value5,
  field6,
  value6,
  field7,
  value7,
  field8,
  value8,
  field9,
  value9,
  field10,
  value10 
)
Value:
(EFX_INSERT_FIELD_NATIVE((min), (max), field1, (value1)) |      \
         EFX_INSERT_FIELD_NATIVE((min), (max), field2, (value2)) |      \
         EFX_INSERT_FIELD_NATIVE((min), (max), field3, (value3)) |      \
         EFX_INSERT_FIELD_NATIVE((min), (max), field4, (value4)) |      \
         EFX_INSERT_FIELD_NATIVE((min), (max), field5, (value5)) |      \
         EFX_INSERT_FIELD_NATIVE((min), (max), field6, (value6)) |      \
         EFX_INSERT_FIELD_NATIVE((min), (max), field7, (value7)) |      \
         EFX_INSERT_FIELD_NATIVE((min), (max), field8, (value8)) |      \
         EFX_INSERT_FIELD_NATIVE((min), (max), field9, (value9)) |      \
         EFX_INSERT_FIELD_NATIVE((min), (max), field10, (value10)))

Definition at line 288 of file efx_bitfield.h.

#define EFX_INSERT_FIELDS64 (   ...)    cpu_to_le64(EFX_INSERT_FIELDS_NATIVE(__VA_ARGS__))

Definition at line 310 of file efx_bitfield.h.

#define EFX_INSERT_FIELDS32 (   ...)    cpu_to_le32(EFX_INSERT_FIELDS_NATIVE(__VA_ARGS__))

Definition at line 313 of file efx_bitfield.h.

#define EFX_POPULATE_OWORD64 (   oword,
  ... 
)
Value:
do {                            \
        (oword).u64[0] = EFX_INSERT_FIELDS64(0, 63, __VA_ARGS__);       \
        (oword).u64[1] = EFX_INSERT_FIELDS64(64, 127, __VA_ARGS__);     \
        } while (0)

Definition at line 316 of file efx_bitfield.h.

#define EFX_POPULATE_QWORD64 (   qword,
  ... 
)
Value:
do {                            \
        (qword).u64[0] = EFX_INSERT_FIELDS64(0, 63, __VA_ARGS__);       \
        } while (0)

Definition at line 321 of file efx_bitfield.h.

#define EFX_POPULATE_OWORD32 (   oword,
  ... 
)
Value:
do {                            \
        (oword).u32[0] = EFX_INSERT_FIELDS32(0, 31, __VA_ARGS__);       \
        (oword).u32[1] = EFX_INSERT_FIELDS32(32, 63, __VA_ARGS__);      \
        (oword).u32[2] = EFX_INSERT_FIELDS32(64, 95, __VA_ARGS__);      \
        (oword).u32[3] = EFX_INSERT_FIELDS32(96, 127, __VA_ARGS__);     \
        } while (0)

Definition at line 325 of file efx_bitfield.h.

#define EFX_POPULATE_QWORD32 (   qword,
  ... 
)
Value:
do {                            \
        (qword).u32[0] = EFX_INSERT_FIELDS32(0, 31, __VA_ARGS__);       \
        (qword).u32[1] = EFX_INSERT_FIELDS32(32, 63, __VA_ARGS__);      \
        } while (0)

Definition at line 332 of file efx_bitfield.h.

#define EFX_POPULATE_DWORD (   dword,
  ... 
)
Value:
do {                            \
        (dword).u32[0] = EFX_INSERT_FIELDS32(0, 31, __VA_ARGS__);       \
        } while (0)

Definition at line 337 of file efx_bitfield.h.

Definition at line 345 of file efx_bitfield.h.

Definition at line 346 of file efx_bitfield.h.

Definition at line 350 of file efx_bitfield.h.

#define EFX_POPULATE_OWORD_9 (   oword,
  ... 
)    EFX_POPULATE_OWORD_10(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 351 of file efx_bitfield.h.

#define EFX_POPULATE_OWORD_8 (   oword,
  ... 
)    EFX_POPULATE_OWORD_9(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 353 of file efx_bitfield.h.

#define EFX_POPULATE_OWORD_7 (   oword,
  ... 
)    EFX_POPULATE_OWORD_8(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 355 of file efx_bitfield.h.

#define EFX_POPULATE_OWORD_6 (   oword,
  ... 
)    EFX_POPULATE_OWORD_7(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 357 of file efx_bitfield.h.

#define EFX_POPULATE_OWORD_5 (   oword,
  ... 
)    EFX_POPULATE_OWORD_6(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 359 of file efx_bitfield.h.

#define EFX_POPULATE_OWORD_4 (   oword,
  ... 
)    EFX_POPULATE_OWORD_5(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 361 of file efx_bitfield.h.

#define EFX_POPULATE_OWORD_3 (   oword,
  ... 
)    EFX_POPULATE_OWORD_4(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 363 of file efx_bitfield.h.

#define EFX_POPULATE_OWORD_2 (   oword,
  ... 
)    EFX_POPULATE_OWORD_3(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 365 of file efx_bitfield.h.

#define EFX_POPULATE_OWORD_1 (   oword,
  ... 
)    EFX_POPULATE_OWORD_2(oword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 367 of file efx_bitfield.h.

#define EFX_ZERO_OWORD (   oword)    EFX_POPULATE_OWORD_1(oword, EFX_DUMMY_FIELD, 0)

Definition at line 369 of file efx_bitfield.h.

#define EFX_SET_OWORD (   oword)
Value:
EFX_POPULATE_OWORD_4(oword, \
                             EFX_DWORD_0, 0xffffffff, \
                             EFX_DWORD_1, 0xffffffff, \
                             EFX_DWORD_2, 0xffffffff, \
                             EFX_DWORD_3, 0xffffffff)

Definition at line 371 of file efx_bitfield.h.

Definition at line 379 of file efx_bitfield.h.

#define EFX_POPULATE_QWORD_9 (   qword,
  ... 
)    EFX_POPULATE_QWORD_10(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 380 of file efx_bitfield.h.

#define EFX_POPULATE_QWORD_8 (   qword,
  ... 
)    EFX_POPULATE_QWORD_9(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 382 of file efx_bitfield.h.

#define EFX_POPULATE_QWORD_7 (   qword,
  ... 
)    EFX_POPULATE_QWORD_8(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 384 of file efx_bitfield.h.

#define EFX_POPULATE_QWORD_6 (   qword,
  ... 
)    EFX_POPULATE_QWORD_7(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 386 of file efx_bitfield.h.

#define EFX_POPULATE_QWORD_5 (   qword,
  ... 
)    EFX_POPULATE_QWORD_6(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 388 of file efx_bitfield.h.

#define EFX_POPULATE_QWORD_4 (   qword,
  ... 
)    EFX_POPULATE_QWORD_5(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 390 of file efx_bitfield.h.

Referenced by efx_hunt_build_tx_desc().

#define EFX_POPULATE_QWORD_3 (   qword,
  ... 
)    EFX_POPULATE_QWORD_4(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 392 of file efx_bitfield.h.

#define EFX_POPULATE_QWORD_2 (   qword,
  ... 
)    EFX_POPULATE_QWORD_3(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 394 of file efx_bitfield.h.

Referenced by efx_hunt_build_rx_desc(), hunt_ev_init(), hunt_rx_init(), and hunt_tx_init().

#define EFX_POPULATE_QWORD_1 (   qword,
  ... 
)    EFX_POPULATE_QWORD_2(qword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 396 of file efx_bitfield.h.

#define EFX_ZERO_QWORD (   qword)    EFX_POPULATE_QWORD_1(qword, EFX_DUMMY_FIELD, 0)

Definition at line 398 of file efx_bitfield.h.

#define EFX_SET_QWORD (   qword)
Value:
EFX_POPULATE_QWORD_2(qword, \
                             EFX_DWORD_0, 0xffffffff, \
                             EFX_DWORD_1, 0xffffffff)

Definition at line 400 of file efx_bitfield.h.

Referenced by efx_hunt_poll().

Definition at line 406 of file efx_bitfield.h.

#define EFX_POPULATE_DWORD_9 (   dword,
  ... 
)    EFX_POPULATE_DWORD_10(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 407 of file efx_bitfield.h.

#define EFX_POPULATE_DWORD_8 (   dword,
  ... 
)    EFX_POPULATE_DWORD_9(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 409 of file efx_bitfield.h.

#define EFX_POPULATE_DWORD_7 (   dword,
  ... 
)    EFX_POPULATE_DWORD_8(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 411 of file efx_bitfield.h.

Referenced by hunt_mcdi_copyin().

#define EFX_POPULATE_DWORD_6 (   dword,
  ... 
)    EFX_POPULATE_DWORD_7(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 413 of file efx_bitfield.h.

#define EFX_POPULATE_DWORD_5 (   dword,
  ... 
)    EFX_POPULATE_DWORD_6(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 415 of file efx_bitfield.h.

#define EFX_POPULATE_DWORD_4 (   dword,
  ... 
)    EFX_POPULATE_DWORD_5(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 417 of file efx_bitfield.h.

#define EFX_POPULATE_DWORD_3 (   dword,
  ... 
)    EFX_POPULATE_DWORD_4(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 419 of file efx_bitfield.h.

#define EFX_POPULATE_DWORD_2 (   dword,
  ... 
)    EFX_POPULATE_DWORD_3(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)

Definition at line 421 of file efx_bitfield.h.

Referenced by efx_hunt_evq_read_ack(), efx_hunt_open(), and hunt_mcdi_copyin().

#define EFX_POPULATE_DWORD_1 (   dword,
  ... 
)    EFX_POPULATE_DWORD_2(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__)
#define EFX_ZERO_DWORD (   dword)    EFX_POPULATE_DWORD_1(dword, EFX_DUMMY_FIELD, 0)

Definition at line 425 of file efx_bitfield.h.

#define EFX_SET_DWORD (   dword)    EFX_POPULATE_DWORD_1(dword, EFX_DWORD_0, 0xffffffff)

Definition at line 427 of file efx_bitfield.h.

#define EFX_INVERT_OWORD (   oword)
Value:
do {            \
        (oword).u64[0] = ~((oword).u64[0]);     \
        (oword).u64[1] = ~((oword).u64[1]);     \
        } while (0)

Definition at line 435 of file efx_bitfield.h.

#define EFX_AND_OWORD (   oword,
  from,
  mask 
)
Value:
do {                                                    \
                (oword).u64[0] = (from).u64[0] & (mask).u64[0]; \
                (oword).u64[1] = (from).u64[1] & (mask).u64[1]; \
        } while (0)

Definition at line 440 of file efx_bitfield.h.

#define EFX_AND_QWORD (   qword,
  from,
  mask 
)    (qword).u64[0] = (from).u64[0] & (mask).u64[0]

Definition at line 446 of file efx_bitfield.h.

#define EFX_OR_OWORD (   oword,
  from,
  mask 
)
Value:
do {                                                    \
                (oword).u64[0] = (from).u64[0] | (mask).u64[0]; \
                (oword).u64[1] = (from).u64[1] | (mask).u64[1]; \
        } while (0)

Definition at line 449 of file efx_bitfield.h.

#define EFX_INSERT64 (   min,
  max,
  low,
  high,
  value 
)    cpu_to_le64(EFX_INSERT_NATIVE(min, max, low, high, value))

Definition at line 455 of file efx_bitfield.h.

#define EFX_INSERT32 (   min,
  max,
  low,
  high,
  value 
)    cpu_to_le32(EFX_INSERT_NATIVE(min, max, low, high, value))

Definition at line 458 of file efx_bitfield.h.

#define EFX_INPLACE_MASK64 (   min,
  max,
  low,
  high 
)    EFX_INSERT64(min, max, low, high, EFX_MASK64((high) + 1 - (low)))

Definition at line 461 of file efx_bitfield.h.

#define EFX_INPLACE_MASK32 (   min,
  max,
  low,
  high 
)    EFX_INSERT32(min, max, low, high, EFX_MASK32((high) + 1 - (low)))

Definition at line 464 of file efx_bitfield.h.

#define EFX_SET_OWORD64 (   oword,
  low,
  high,
  value 
)
Value:
do {                    \
        (oword).u64[0] = (((oword).u64[0]                               \
                           & ~EFX_INPLACE_MASK64(0,  63, low, high))    \
                          | EFX_INSERT64(0,  63, low, high, value));    \
        (oword).u64[1] = (((oword).u64[1]                               \
                           & ~EFX_INPLACE_MASK64(64, 127, low, high))   \
                          | EFX_INSERT64(64, 127, low, high, value));   \
        } while (0)

Definition at line 467 of file efx_bitfield.h.

#define EFX_SET_QWORD64 (   qword,
  low,
  high,
  value 
)
Value:
do {                    \
        (qword).u64[0] = (((qword).u64[0]                               \
                           & ~EFX_INPLACE_MASK64(0, 63, low, high))     \
                          | EFX_INSERT64(0, 63, low, high, value));     \
        } while (0)

Definition at line 476 of file efx_bitfield.h.

#define EFX_SET_OWORD32 (   oword,
  low,
  high,
  value 
)
Value:
do {                    \
        (oword).u32[0] = (((oword).u32[0]                               \
                           & ~EFX_INPLACE_MASK32(0, 31, low, high))     \
                          | EFX_INSERT32(0, 31, low, high, value));     \
        (oword).u32[1] = (((oword).u32[1]                               \
                           & ~EFX_INPLACE_MASK32(32, 63, low, high))    \
                          | EFX_INSERT32(32, 63, low, high, value));    \
        (oword).u32[2] = (((oword).u32[2]                               \
                           & ~EFX_INPLACE_MASK32(64, 95, low, high))    \
                          | EFX_INSERT32(64, 95, low, high, value));    \
        (oword).u32[3] = (((oword).u32[3]                               \
                           & ~EFX_INPLACE_MASK32(96, 127, low, high))   \
                          | EFX_INSERT32(96, 127, low, high, value));   \
        } while (0)

Definition at line 482 of file efx_bitfield.h.

#define EFX_SET_QWORD32 (   qword,
  low,
  high,
  value 
)
Value:
do {                    \
        (qword).u32[0] = (((qword).u32[0]                               \
                           & ~EFX_INPLACE_MASK32(0, 31, low, high))     \
                          | EFX_INSERT32(0, 31, low, high, value));     \
        (qword).u32[1] = (((qword).u32[1]                               \
                           & ~EFX_INPLACE_MASK32(32, 63, low, high))    \
                          | EFX_INSERT32(32, 63, low, high, value));    \
        } while (0)

Definition at line 497 of file efx_bitfield.h.

#define EFX_SET_DWORD32 (   dword,
  low,
  high,
  value 
)
Value:
do {                    \
        (dword).u32[0] = (((dword).u32[0]                               \
                           & ~EFX_INPLACE_MASK32(0, 31, low, high))     \
                          | EFX_INSERT32(0, 31, low, high, value));     \
        } while (0)

Definition at line 506 of file efx_bitfield.h.

#define EFX_SET_OWORD_FIELD64 (   oword,
  field,
  value 
)
Value:
EFX_SET_OWORD64(oword, EFX_LOW_BIT(field),                      \
                         EFX_HIGH_BIT(field), value)

Definition at line 512 of file efx_bitfield.h.

#define EFX_SET_QWORD_FIELD64 (   qword,
  field,
  value 
)
Value:
EFX_SET_QWORD64(qword, EFX_LOW_BIT(field),                      \
                         EFX_HIGH_BIT(field), value)

Definition at line 516 of file efx_bitfield.h.

#define EFX_SET_OWORD_FIELD32 (   oword,
  field,
  value 
)
Value:
EFX_SET_OWORD32(oword, EFX_LOW_BIT(field),                      \
                         EFX_HIGH_BIT(field), value)

Definition at line 520 of file efx_bitfield.h.

#define EFX_SET_QWORD_FIELD32 (   qword,
  field,
  value 
)
Value:
EFX_SET_QWORD32(qword, EFX_LOW_BIT(field),                      \
                         EFX_HIGH_BIT(field), value)

Definition at line 524 of file efx_bitfield.h.

#define EFX_SET_DWORD_FIELD (   dword,
  field,
  value 
)
Value:

Definition at line 528 of file efx_bitfield.h.

Definition at line 538 of file efx_bitfield.h.

Definition at line 539 of file efx_bitfield.h.

#define DMA_ADDR_T_WIDTH   (8 * sizeof(dma_addr_t))

Definition at line 545 of file efx_bitfield.h.

#define EFX_DMA_TYPE_WIDTH (   width)    (((width) < DMA_ADDR_T_WIDTH) ? (width) : DMA_ADDR_T_WIDTH)

Definition at line 546 of file efx_bitfield.h.

#define EFX_OWORD32 (   a,
  b,
  c,
 
)
Value:
{ .u32 = { cpu_to_le32(a), cpu_to_le32(b),      \
                   cpu_to_le32(c), cpu_to_le32(d) } }

Definition at line 551 of file efx_bitfield.h.


Typedef Documentation

typedef union efx_dword efx_dword_t

A doubleword (4 byte) datatype - little-endian in HW.

typedef union efx_qword efx_qword_t

A quadword (8 byte) datatype - little-endian in HW.

typedef union efx_oword efx_oword_t

An octword (eight-word, so 16 byte) datatype - little-endian in HW.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )