iPXE
Macros | Functions
mcdi.h File Reference

Go to the source code of this file.

Macros

#define DIV_ROUND_UP(n, d)   (((n) + (d) - 1) / (d))
 
#define MCDI_SEQ_MASK   0xf
 
#define MCDI_DECLARE_BUF(_name, _len)   efx_dword_t _name[DIV_ROUND_UP(_len, 4)]
 
#define MCDI_DECLARE_BUF_OUT_OR_ERR(_name, _len)   MCDI_DECLARE_BUF(_name, max_t(size_t, _len, 8))
 
#define _MCDI_PTR(_buf, _offset)   ((u8 *)(_buf) + (_offset))
 
#define MCDI_PTR(_buf, _field)   _MCDI_PTR(_buf, MC_CMD_ ## _field ## _OFST)
 
#define _MCDI_CHECK_ALIGN(_ofst, _align)   ((_ofst) + BUILD_BUG_ON_ZERO((_ofst) & (_align - 1)))
 
#define _MCDI_DWORD(_buf, _field)   ((_buf) + (_MCDI_CHECK_ALIGN(MC_CMD_ ## _field ## _OFST, 4) >> 2))
 
#define MCDI_WORD(_buf, _field)
 
#define MCDI_SET_DWORD(_buf, _field, _value)   EFX_POPULATE_DWORD_1(*_MCDI_DWORD(_buf, _field), EFX_DWORD_0, _value)
 
#define MCDI_DWORD(_buf, _field)   EFX_DWORD_FIELD(*_MCDI_DWORD(_buf, _field), EFX_DWORD_0)
 
#define MCDI_POPULATE_DWORD_1(_buf, _field, _name1, _value1)
 
#define MCDI_POPULATE_DWORD_2(_buf, _field, _name1, _value1, _name2, _value2)
 
#define MCDI_POPULATE_DWORD_3(_buf, _field, _name1, _value1, _name2, _value2, _name3, _value3)
 
#define MCDI_POPULATE_DWORD_4(_buf, _field, _name1, _value1, _name2, _value2, _name3, _value3, _name4, _value4)
 
#define MCDI_POPULATE_DWORD_5(_buf, _field, _name1, _value1, _name2, _value2, _name3, _value3, _name4, _value4, _name5, _value5)
 
#define MCDI_POPULATE_DWORD_6(_buf, _field, _name1, _value1, _name2, _value2, _name3, _value3, _name4, _value4, _name5, _value5, _name6, _value6)
 
#define MCDI_POPULATE_DWORD_7(_buf, _field, _name1, _value1, _name2, _value2, _name3, _value3, _name4, _value4, _name5, _value5, _name6, _value6, _name7, _value7)
 
#define MCDI_SET_QWORD(_buf, _field, _value)
 
#define MCDI_QWORD(_buf, _field)
 
#define MCDI_FIELD(_ptr, _type, _field)
 
#define _MCDI_ARRAY_PTR(_buf, _field, _index, _align)
 
#define MCDI_DECLARE_STRUCT_PTR(_name)   efx_dword_t *_name
 
#define MCDI_ARRAY_STRUCT_PTR(_buf, _field, _index)   ((efx_dword_t *)_MCDI_ARRAY_PTR(_buf, _field, _index, 4))
 
#define MCDI_VAR_ARRAY_LEN(_len, _field)
 
#define MCDI_ARRAY_WORD(_buf, _field, _index)
 
#define _MCDI_ARRAY_DWORD(_buf, _field, _index)
 
#define MCDI_SET_ARRAY_DWORD(_buf, _field, _index, _value)
 
#define MCDI_ARRAY_DWORD(_buf, _field, _index)   EFX_DWORD_FIELD(*_MCDI_ARRAY_DWORD(_buf, _field, _index), EFX_DWORD_0)
 
#define _MCDI_ARRAY_QWORD(_buf, _field, _index)
 
#define MCDI_SET_ARRAY_QWORD(_buf, _field, _index, _value)
 
#define MCDI_ARRAY_FIELD(_buf, _field1, _type, _index, _field2)
 
#define MCDI_EVENT_FIELD(_ev, _field)   EFX_QWORD_FIELD(_ev, MCDI_EVENT_ ## _field)
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 

Macro Definition Documentation

◆ DIV_ROUND_UP

#define DIV_ROUND_UP (   n,
 
)    (((n) + (d) - 1) / (d))

Definition at line 23 of file mcdi.h.

◆ MCDI_SEQ_MASK

#define MCDI_SEQ_MASK   0xf

Definition at line 26 of file mcdi.h.

◆ MCDI_DECLARE_BUF

#define MCDI_DECLARE_BUF (   _name,
  _len 
)    efx_dword_t _name[DIV_ROUND_UP(_len, 4)]

Definition at line 33 of file mcdi.h.

◆ MCDI_DECLARE_BUF_OUT_OR_ERR

#define MCDI_DECLARE_BUF_OUT_OR_ERR (   _name,
  _len 
)    MCDI_DECLARE_BUF(_name, max_t(size_t, _len, 8))

Definition at line 35 of file mcdi.h.

◆ _MCDI_PTR

#define _MCDI_PTR (   _buf,
  _offset 
)    ((u8 *)(_buf) + (_offset))

Definition at line 37 of file mcdi.h.

◆ MCDI_PTR

#define MCDI_PTR (   _buf,
  _field 
)    _MCDI_PTR(_buf, MC_CMD_ ## _field ## _OFST)

Definition at line 39 of file mcdi.h.

◆ _MCDI_CHECK_ALIGN

#define _MCDI_CHECK_ALIGN (   _ofst,
  _align 
)    ((_ofst) + BUILD_BUG_ON_ZERO((_ofst) & (_align - 1)))

Definition at line 41 of file mcdi.h.

◆ _MCDI_DWORD

#define _MCDI_DWORD (   _buf,
  _field 
)    ((_buf) + (_MCDI_CHECK_ALIGN(MC_CMD_ ## _field ## _OFST, 4) >> 2))

Definition at line 43 of file mcdi.h.

◆ MCDI_WORD

#define MCDI_WORD (   _buf,
  _field 
)
Value:
((u16)BUILD_BUG_ON_ZERO(MC_CMD_ ## _field ## _LEN != 2) + \
le16_to_cpu(*(__force const __le16 *)MCDI_PTR(_buf, _field)))
#define u16
Definition: vga.h:20
#define MCDI_PTR(_buf, _field)
Definition: mcdi.h:39
#define BUILD_BUG_ON_ZERO(e)
Definition: efx_common.h:33
uint16_t __le16
Definition: efx_common.h:29
#define __force
Definition: efx_common.h:27

Definition at line 46 of file mcdi.h.

◆ MCDI_SET_DWORD

#define MCDI_SET_DWORD (   _buf,
  _field,
  _value 
)    EFX_POPULATE_DWORD_1(*_MCDI_DWORD(_buf, _field), EFX_DWORD_0, _value)

Definition at line 49 of file mcdi.h.

◆ MCDI_DWORD

#define MCDI_DWORD (   _buf,
  _field 
)    EFX_DWORD_FIELD(*_MCDI_DWORD(_buf, _field), EFX_DWORD_0)

Definition at line 51 of file mcdi.h.

◆ MCDI_POPULATE_DWORD_1

#define MCDI_POPULATE_DWORD_1 (   _buf,
  _field,
  _name1,
  _value1 
)
Value:
MC_CMD_ ## _name1, _value1)
#define _MCDI_DWORD(_buf, _field)
Definition: mcdi.h:43
#define EFX_POPULATE_DWORD_1(dword,...)
Definition: efx_bitfield.h:423

Definition at line 53 of file mcdi.h.

◆ MCDI_POPULATE_DWORD_2

#define MCDI_POPULATE_DWORD_2 (   _buf,
  _field,
  _name1,
  _value1,
  _name2,
  _value2 
)
Value:
MC_CMD_ ## _name1, _value1, \
MC_CMD_ ## _name2, _value2)
#define _MCDI_DWORD(_buf, _field)
Definition: mcdi.h:43
#define EFX_POPULATE_DWORD_2(dword,...)
Definition: efx_bitfield.h:421

Definition at line 56 of file mcdi.h.

◆ MCDI_POPULATE_DWORD_3

#define MCDI_POPULATE_DWORD_3 (   _buf,
  _field,
  _name1,
  _value1,
  _name2,
  _value2,
  _name3,
  _value3 
)
Value:
MC_CMD_ ## _name1, _value1, \
MC_CMD_ ## _name2, _value2, \
MC_CMD_ ## _name3, _value3)
#define _MCDI_DWORD(_buf, _field)
Definition: mcdi.h:43
#define EFX_POPULATE_DWORD_3(dword,...)
Definition: efx_bitfield.h:419

Definition at line 61 of file mcdi.h.

◆ MCDI_POPULATE_DWORD_4

#define MCDI_POPULATE_DWORD_4 (   _buf,
  _field,
  _name1,
  _value1,
  _name2,
  _value2,
  _name3,
  _value3,
  _name4,
  _value4 
)
Value:
MC_CMD_ ## _name1, _value1, \
MC_CMD_ ## _name2, _value2, \
MC_CMD_ ## _name3, _value3, \
MC_CMD_ ## _name4, _value4)
#define _MCDI_DWORD(_buf, _field)
Definition: mcdi.h:43
#define EFX_POPULATE_DWORD_4(dword,...)
Definition: efx_bitfield.h:417

Definition at line 67 of file mcdi.h.

◆ MCDI_POPULATE_DWORD_5

#define MCDI_POPULATE_DWORD_5 (   _buf,
  _field,
  _name1,
  _value1,
  _name2,
  _value2,
  _name3,
  _value3,
  _name4,
  _value4,
  _name5,
  _value5 
)
Value:
MC_CMD_ ## _name1, _value1, \
MC_CMD_ ## _name2, _value2, \
MC_CMD_ ## _name3, _value3, \
MC_CMD_ ## _name4, _value4, \
MC_CMD_ ## _name5, _value5)
#define _MCDI_DWORD(_buf, _field)
Definition: mcdi.h:43
#define EFX_POPULATE_DWORD_5(dword,...)
Definition: efx_bitfield.h:415

Definition at line 75 of file mcdi.h.

◆ MCDI_POPULATE_DWORD_6

#define MCDI_POPULATE_DWORD_6 (   _buf,
  _field,
  _name1,
  _value1,
  _name2,
  _value2,
  _name3,
  _value3,
  _name4,
  _value4,
  _name5,
  _value5,
  _name6,
  _value6 
)
Value:
MC_CMD_ ## _name1, _value1, \
MC_CMD_ ## _name2, _value2, \
MC_CMD_ ## _name3, _value3, \
MC_CMD_ ## _name4, _value4, \
MC_CMD_ ## _name5, _value5, \
MC_CMD_ ## _name6, _value6)
#define _MCDI_DWORD(_buf, _field)
Definition: mcdi.h:43
#define EFX_POPULATE_DWORD_6(dword,...)
Definition: efx_bitfield.h:413

Definition at line 84 of file mcdi.h.

◆ MCDI_POPULATE_DWORD_7

#define MCDI_POPULATE_DWORD_7 (   _buf,
  _field,
  _name1,
  _value1,
  _name2,
  _value2,
  _name3,
  _value3,
  _name4,
  _value4,
  _name5,
  _value5,
  _name6,
  _value6,
  _name7,
  _value7 
)
Value:
MC_CMD_ ## _name1, _value1, \
MC_CMD_ ## _name2, _value2, \
MC_CMD_ ## _name3, _value3, \
MC_CMD_ ## _name4, _value4, \
MC_CMD_ ## _name5, _value5, \
MC_CMD_ ## _name6, _value6, \
MC_CMD_ ## _name7, _value7)
#define _MCDI_DWORD(_buf, _field)
Definition: mcdi.h:43
#define EFX_POPULATE_DWORD_7(dword,...)
Definition: efx_bitfield.h:411

Definition at line 95 of file mcdi.h.

◆ MCDI_SET_QWORD

#define MCDI_SET_QWORD (   _buf,
  _field,
  _value 
)
Value:
do { \
EFX_POPULATE_DWORD_1(_MCDI_DWORD(_buf, _field)[0], \
EFX_DWORD_0, (u32)(_value)); \
EFX_POPULATE_DWORD_1(_MCDI_DWORD(_buf, _field)[1], \
EFX_DWORD_0, (u64)(_value) >> 32); \
} while (0)
#define _MCDI_DWORD(_buf, _field)
Definition: mcdi.h:43
uint64_t u64
Definition: stdint.h:25
uint32_t u32
Definition: stdint.h:23

Definition at line 107 of file mcdi.h.

◆ MCDI_QWORD

#define MCDI_QWORD (   _buf,
  _field 
)
Value:
(EFX_DWORD_FIELD(_MCDI_DWORD(_buf, _field)[0], EFX_DWORD_0) | \
(u64)EFX_DWORD_FIELD(_MCDI_DWORD(_buf, _field)[1], EFX_DWORD_0) << 32)
#define _MCDI_DWORD(_buf, _field)
Definition: mcdi.h:43
uint64_t u64
Definition: stdint.h:25
#define EFX_DWORD_FIELD(dword, field)
Definition: efx_bitfield.h:197

Definition at line 114 of file mcdi.h.

◆ MCDI_FIELD

#define MCDI_FIELD (   _ptr,
  _type,
  _field 
)
Value:
*(efx_dword_t *) \
_MCDI_PTR(_ptr, MC_CMD_ ## _type ## _ ## _field ## _OFST & ~3),\
MC_CMD_ ## _type ## _ ## _field ## _LBN & 0x1f, \
(MC_CMD_ ## _type ## _ ## _field ## _LBN & 0x1f) + \
MC_CMD_ ## _type ## _ ## _field ## _WIDTH - 1)
#define _MCDI_PTR(_buf, _offset)
Definition: mcdi.h:37
#define EFX_EXTRACT_DWORD(dword, low, high)
Definition: efx_bitfield.h:177
A doubleword (4 byte) datatype - little-endian in HW.
Definition: efx_bitfield.h:87

Definition at line 117 of file mcdi.h.

◆ _MCDI_ARRAY_PTR

#define _MCDI_ARRAY_PTR (   _buf,
  _field,
  _index,
  _align 
)
Value:
(_MCDI_PTR(_buf, _MCDI_CHECK_ALIGN(MC_CMD_ ## _field ## _OFST, _align))\
+ (_index) * _MCDI_CHECK_ALIGN(MC_CMD_ ## _field ## _LEN, _align))
#define _MCDI_PTR(_buf, _offset)
Definition: mcdi.h:37
#define _MCDI_CHECK_ALIGN(_ofst, _align)
Definition: mcdi.h:41

Definition at line 125 of file mcdi.h.

◆ MCDI_DECLARE_STRUCT_PTR

#define MCDI_DECLARE_STRUCT_PTR (   _name)    efx_dword_t *_name

Definition at line 128 of file mcdi.h.

◆ MCDI_ARRAY_STRUCT_PTR

#define MCDI_ARRAY_STRUCT_PTR (   _buf,
  _field,
  _index 
)    ((efx_dword_t *)_MCDI_ARRAY_PTR(_buf, _field, _index, 4))

Definition at line 130 of file mcdi.h.

◆ MCDI_VAR_ARRAY_LEN

#define MCDI_VAR_ARRAY_LEN (   _len,
  _field 
)
Value:
min_t(size_t, MC_CMD_ ## _field ## _MAXNUM, \
((_len) - MC_CMD_ ## _field ## _OFST) / MC_CMD_ ## _field ## _LEN)

Definition at line 132 of file mcdi.h.

◆ MCDI_ARRAY_WORD

#define MCDI_ARRAY_WORD (   _buf,
  _field,
  _index 
)
Value:
(BUILD_BUG_ON_ZERO(MC_CMD_ ## _field ## _LEN != 2) + \
le16_to_cpu(*(__force const __le16 *) \
_MCDI_ARRAY_PTR(_buf, _field, _index, 2)))
#define _MCDI_ARRAY_PTR(_buf, _field, _index, _align)
Definition: mcdi.h:125
#define BUILD_BUG_ON_ZERO(e)
Definition: efx_common.h:33
uint16_t __le16
Definition: efx_common.h:29
#define __force
Definition: efx_common.h:27

Definition at line 135 of file mcdi.h.

◆ _MCDI_ARRAY_DWORD

#define _MCDI_ARRAY_DWORD (   _buf,
  _field,
  _index 
)
Value:
(BUILD_BUG_ON_ZERO(MC_CMD_ ## _field ## _LEN != 4) + \
(efx_dword_t *)_MCDI_ARRAY_PTR(_buf, _field, _index, 4))
A doubleword (4 byte) datatype - little-endian in HW.
Definition: efx_bitfield.h:87
#define _MCDI_ARRAY_PTR(_buf, _field, _index, _align)
Definition: mcdi.h:125
#define BUILD_BUG_ON_ZERO(e)
Definition: efx_common.h:33

Definition at line 139 of file mcdi.h.

◆ MCDI_SET_ARRAY_DWORD

#define MCDI_SET_ARRAY_DWORD (   _buf,
  _field,
  _index,
  _value 
)
Value:
EFX_SET_DWORD_FIELD(*_MCDI_ARRAY_DWORD(_buf, _field, _index), \
EFX_DWORD_0, _value)
#define EFX_SET_DWORD_FIELD(dword, field, value)
Definition: efx_bitfield.h:528
#define _MCDI_ARRAY_DWORD(_buf, _field, _index)
Definition: mcdi.h:139

Definition at line 142 of file mcdi.h.

◆ MCDI_ARRAY_DWORD

#define MCDI_ARRAY_DWORD (   _buf,
  _field,
  _index 
)    EFX_DWORD_FIELD(*_MCDI_ARRAY_DWORD(_buf, _field, _index), EFX_DWORD_0)

Definition at line 145 of file mcdi.h.

◆ _MCDI_ARRAY_QWORD

#define _MCDI_ARRAY_QWORD (   _buf,
  _field,
  _index 
)
Value:
(BUILD_BUG_ON_ZERO(MC_CMD_ ## _field ## _LEN != 8) + \
(efx_dword_t *)_MCDI_ARRAY_PTR(_buf, _field, _index, 4))
A doubleword (4 byte) datatype - little-endian in HW.
Definition: efx_bitfield.h:87
#define _MCDI_ARRAY_PTR(_buf, _field, _index, _align)
Definition: mcdi.h:125
#define BUILD_BUG_ON_ZERO(e)
Definition: efx_common.h:33

Definition at line 147 of file mcdi.h.

◆ MCDI_SET_ARRAY_QWORD

#define MCDI_SET_ARRAY_QWORD (   _buf,
  _field,
  _index,
  _value 
)
Value:
do { \
EFX_SET_DWORD_FIELD(_MCDI_ARRAY_QWORD(_buf, _field, _index)[0],\
EFX_DWORD_0, (u32)(_value)); \
EFX_SET_DWORD_FIELD(_MCDI_ARRAY_QWORD(_buf, _field, _index)[1],\
EFX_DWORD_0, (u64)(_value) >> 32); \
} while (0)
uint64_t u64
Definition: stdint.h:25
#define _MCDI_ARRAY_QWORD(_buf, _field, _index)
Definition: mcdi.h:147
uint32_t u32
Definition: stdint.h:23

Definition at line 150 of file mcdi.h.

◆ MCDI_ARRAY_FIELD

#define MCDI_ARRAY_FIELD (   _buf,
  _field1,
  _type,
  _index,
  _field2 
)
Value:
MCDI_FIELD(MCDI_ARRAY_STRUCT_PTR(_buf, _field1, _index), \
_type ## _TYPEDEF, _field2)
#define MCDI_FIELD(_ptr, _type, _field)
Definition: mcdi.h:117
#define MCDI_ARRAY_STRUCT_PTR(_buf, _field, _index)
Definition: mcdi.h:130

Definition at line 157 of file mcdi.h.

◆ MCDI_EVENT_FIELD

#define MCDI_EVENT_FIELD (   _ev,
  _field 
)    EFX_QWORD_FIELD(_ev, MCDI_EVENT_ ## _field)

Definition at line 161 of file mcdi.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )