iPXE
|
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... | |
Typedefs | |
typedef union efx_dword | efx_dword_t |
A doubleword (4 byte) datatype - little-endian in HW. More... | |
typedef union efx_qword | efx_qword_t |
A quadword (8 byte) datatype - little-endian in HW. More... | |
typedef union efx_oword | efx_oword_t |
An octword (eight-word, so 16 byte) datatype - little-endian in HW. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
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 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 | ) |
Definition at line 71 of file efx_bitfield.h.
#define EFX_MASK32 | ( | width | ) |
Definition at line 82 of file efx_bitfield.h.
#define EFX_DWORD_FMT "%08x" |
Definition at line 107 of file efx_bitfield.h.
#define EFX_QWORD_FMT "%08x:%08x" |
Definition at line 108 of file efx_bitfield.h.
#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.
#define EFX_QWORD_VAL | ( | qword | ) |
Definition at line 112 of file efx_bitfield.h.
#define EFX_OWORD_VAL | ( | oword | ) |
Definition at line 115 of file efx_bitfield.h.
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.
Definition at line 156 of file efx_bitfield.h.
Definition at line 161 of file efx_bitfield.h.
Definition at line 165 of file efx_bitfield.h.
Definition at line 172 of file efx_bitfield.h.
Definition at line 177 of file efx_bitfield.h.
#define EFX_OWORD_FIELD64 | ( | oword, | |
field | |||
) |
Definition at line 181 of file efx_bitfield.h.
#define EFX_QWORD_FIELD64 | ( | qword, | |
field | |||
) |
Definition at line 185 of file efx_bitfield.h.
#define EFX_OWORD_FIELD32 | ( | oword, | |
field | |||
) |
Definition at line 189 of file efx_bitfield.h.
#define EFX_QWORD_FIELD32 | ( | qword, | |
field | |||
) |
Definition at line 193 of file efx_bitfield.h.
#define EFX_DWORD_FIELD | ( | dword, | |
field | |||
) |
Definition at line 197 of file efx_bitfield.h.
Definition at line 201 of file efx_bitfield.h.
Definition at line 204 of file efx_bitfield.h.
#define EFX_OWORD_IS_ZERO32 | ( | oword | ) |
Definition at line 207 of file efx_bitfield.h.
Definition at line 211 of file efx_bitfield.h.
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.
Definition at line 220 of file efx_bitfield.h.
#define EFX_OWORD_IS_ALL_ONES32 | ( | oword | ) |
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.
Definition at line 230 of file efx_bitfield.h.
#define EFX_OWORD_FIELD EFX_OWORD_FIELD32 |
Definition at line 241 of file efx_bitfield.h.
#define EFX_QWORD_FIELD EFX_QWORD_FIELD32 |
Definition at line 242 of file efx_bitfield.h.
#define EFX_OWORD_IS_ZERO EFX_OWORD_IS_ZERO32 |
Definition at line 243 of file efx_bitfield.h.
#define EFX_QWORD_IS_ZERO EFX_QWORD_IS_ZERO32 |
Definition at line 244 of file efx_bitfield.h.
#define EFX_OWORD_IS_ALL_ONES EFX_OWORD_IS_ALL_ONES32 |
Definition at line 245 of file efx_bitfield.h.
#define EFX_QWORD_IS_ALL_ONES EFX_QWORD_IS_ALL_ONES32 |
Definition at line 246 of file efx_bitfield.h.
Definition at line 255 of file efx_bitfield.h.
Definition at line 261 of file efx_bitfield.h.
Definition at line 267 of file efx_bitfield.h.
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 | |||
) |
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, | |
... | |||
) |
Definition at line 316 of file efx_bitfield.h.
#define EFX_POPULATE_QWORD64 | ( | qword, | |
... | |||
) |
Definition at line 321 of file efx_bitfield.h.
#define EFX_POPULATE_OWORD32 | ( | oword, | |
... | |||
) |
Definition at line 325 of file efx_bitfield.h.
#define EFX_POPULATE_QWORD32 | ( | qword, | |
... | |||
) |
Definition at line 332 of file efx_bitfield.h.
#define EFX_POPULATE_DWORD | ( | dword, | |
... | |||
) |
Definition at line 337 of file efx_bitfield.h.
#define EFX_POPULATE_OWORD EFX_POPULATE_OWORD32 |
Definition at line 345 of file efx_bitfield.h.
#define EFX_POPULATE_QWORD EFX_POPULATE_QWORD32 |
Definition at line 346 of file efx_bitfield.h.
#define EFX_POPULATE_OWORD_10 EFX_POPULATE_OWORD |
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 | ) |
Definition at line 371 of file efx_bitfield.h.
#define EFX_POPULATE_QWORD_10 EFX_POPULATE_QWORD |
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.
#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.
#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 | ) |
Definition at line 400 of file efx_bitfield.h.
#define EFX_POPULATE_DWORD_10 EFX_POPULATE_DWORD |
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.
#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.
#define EFX_POPULATE_DWORD_1 | ( | dword, | |
... | |||
) | EFX_POPULATE_DWORD_2(dword, EFX_DUMMY_FIELD, 0, __VA_ARGS__) |
Definition at line 423 of file efx_bitfield.h.
#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 | ) |
Definition at line 435 of file efx_bitfield.h.
#define EFX_AND_OWORD | ( | oword, | |
from, | |||
mask | |||
) |
Definition at line 440 of file efx_bitfield.h.
Definition at line 446 of file efx_bitfield.h.
#define EFX_OR_OWORD | ( | oword, | |
from, | |||
mask | |||
) |
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.
Definition at line 467 of file efx_bitfield.h.
Definition at line 476 of file efx_bitfield.h.
Definition at line 482 of file efx_bitfield.h.
Definition at line 497 of file efx_bitfield.h.
Definition at line 506 of file efx_bitfield.h.
#define EFX_SET_OWORD_FIELD64 | ( | oword, | |
field, | |||
value | |||
) |
Definition at line 512 of file efx_bitfield.h.
#define EFX_SET_QWORD_FIELD64 | ( | qword, | |
field, | |||
value | |||
) |
Definition at line 516 of file efx_bitfield.h.
#define EFX_SET_OWORD_FIELD32 | ( | oword, | |
field, | |||
value | |||
) |
Definition at line 520 of file efx_bitfield.h.
#define EFX_SET_QWORD_FIELD32 | ( | qword, | |
field, | |||
value | |||
) |
Definition at line 524 of file efx_bitfield.h.
Definition at line 528 of file efx_bitfield.h.
#define EFX_SET_OWORD_FIELD EFX_SET_OWORD_FIELD32 |
Definition at line 538 of file efx_bitfield.h.
#define EFX_SET_QWORD_FIELD EFX_SET_QWORD_FIELD32 |
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, | |||
d | |||
) |
Definition at line 551 of file efx_bitfield.h.
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.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |