iPXE
Defines | Functions
mcdi.h File Reference

Go to the source code of this file.

Defines

#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)

Define Documentation

#define MCDI_SEQ_MASK   0xf

Definition at line 26 of file mcdi.h.

Referenced by hunt_mcdi_copyin(), and hunt_mcdi_request_poll().

#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))

Definition at line 35 of file mcdi.h.

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

Definition at line 37 of file mcdi.h.

#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)))

Definition at line 41 of file mcdi.h.

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

Definition at line 43 of file mcdi.h.

#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)))

Definition at line 46 of file mcdi.h.

#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 
)
Value:
EFX_POPULATE_DWORD_1(*_MCDI_DWORD(_buf, _field),                \
                             MC_CMD_ ## _name1, _value1)

Definition at line 53 of file mcdi.h.

Referenced by hunt_reset(), and hunt_rx_filter_insert().

#define MCDI_POPULATE_DWORD_2 (   _buf,
  _field,
  _name1,
  _value1,
  _name2,
  _value2 
)
Value:
EFX_POPULATE_DWORD_2(*_MCDI_DWORD(_buf, _field),                \
                             MC_CMD_ ## _name1, _value1,                \
                             MC_CMD_ ## _name2, _value2)

Definition at line 56 of file mcdi.h.

#define MCDI_POPULATE_DWORD_3 (   _buf,
  _field,
  _name1,
  _value1,
  _name2,
  _value2,
  _name3,
  _value3 
)
Value:
EFX_POPULATE_DWORD_3(*_MCDI_DWORD(_buf, _field),                \
                             MC_CMD_ ## _name1, _value1,                \
                             MC_CMD_ ## _name2, _value2,                \
                             MC_CMD_ ## _name3, _value3)

Definition at line 61 of file mcdi.h.

#define MCDI_POPULATE_DWORD_4 (   _buf,
  _field,
  _name1,
  _value1,
  _name2,
  _value2,
  _name3,
  _value3,
  _name4,
  _value4 
)
Value:
EFX_POPULATE_DWORD_4(*_MCDI_DWORD(_buf, _field),                \
                             MC_CMD_ ## _name1, _value1,                \
                             MC_CMD_ ## _name2, _value2,                \
                             MC_CMD_ ## _name3, _value3,                \
                             MC_CMD_ ## _name4, _value4)

Definition at line 67 of file mcdi.h.

#define MCDI_POPULATE_DWORD_5 (   _buf,
  _field,
  _name1,
  _value1,
  _name2,
  _value2,
  _name3,
  _value3,
  _name4,
  _value4,
  _name5,
  _value5 
)
Value:
EFX_POPULATE_DWORD_5(*_MCDI_DWORD(_buf, _field),                \
                             MC_CMD_ ## _name1, _value1,                \
                             MC_CMD_ ## _name2, _value2,                \
                             MC_CMD_ ## _name3, _value3,                \
                             MC_CMD_ ## _name4, _value4,                \
                             MC_CMD_ ## _name5, _value5)

Definition at line 75 of file mcdi.h.

Referenced by hunt_rx_init().

#define MCDI_POPULATE_DWORD_6 (   _buf,
  _field,
  _name1,
  _value1,
  _name2,
  _value2,
  _name3,
  _value3,
  _name4,
  _value4,
  _name5,
  _value5,
  _name6,
  _value6 
)
Value:
EFX_POPULATE_DWORD_6(*_MCDI_DWORD(_buf, _field),                \
                             MC_CMD_ ## _name1, _value1,                \
                             MC_CMD_ ## _name2, _value2,                \
                             MC_CMD_ ## _name3, _value3,                \
                             MC_CMD_ ## _name4, _value4,                \
                             MC_CMD_ ## _name5, _value5,                \
                             MC_CMD_ ## _name6, _value6)

Definition at line 84 of file mcdi.h.

Referenced by hunt_ev_init(), and hunt_tx_init().

#define MCDI_POPULATE_DWORD_7 (   _buf,
  _field,
  _name1,
  _value1,
  _name2,
  _value2,
  _name3,
  _value3,
  _name4,
  _value4,
  _name5,
  _value5,
  _name6,
  _value6,
  _name7,
  _value7 
)
Value:
EFX_POPULATE_DWORD_7(*_MCDI_DWORD(_buf, _field),                \
                             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)

Definition at line 95 of file mcdi.h.

#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)

Definition at line 107 of file mcdi.h.

Referenced by hunt_rx_filter_remove().

#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)

Definition at line 114 of file mcdi.h.

Referenced by hunt_rx_filter_insert().

#define MCDI_FIELD (   _ptr,
  _type,
  _field 
)
Value:
EFX_EXTRACT_DWORD(                                              \
                *(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)

Definition at line 117 of file mcdi.h.

#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))

Definition at line 125 of file mcdi.h.

#define MCDI_DECLARE_STRUCT_PTR (   _name)    efx_dword_t *_name

Definition at line 128 of file mcdi.h.

#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.

#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.

#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)))

Definition at line 135 of file mcdi.h.

#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))

Definition at line 139 of file mcdi.h.

#define MCDI_SET_ARRAY_DWORD (   _buf,
  _field,
  _index,
  _value 
)
Value:
EFX_SET_DWORD_FIELD(*_MCDI_ARRAY_DWORD(_buf, _field, _index),   \
                            EFX_DWORD_0, _value)

Definition at line 142 of file mcdi.h.

#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.

#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))

Definition at line 147 of file mcdi.h.

#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)

Definition at line 150 of file mcdi.h.

#define MCDI_ARRAY_FIELD (   _buf,
  _field1,
  _type,
  _index,
  _field2 
)
Value:
MCDI_FIELD(MCDI_ARRAY_STRUCT_PTR(_buf, _field1, _index),        \
                   _type ## _TYPEDEF, _field2)

Definition at line 157 of file mcdi.h.

#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 ( GPL2_OR_LATER_OR_UBDL  )