iPXE
pseudobit.h File Reference

Pseudo-bit structures. More...

#include <stdint.h>
#include <byteswap.h>

Go to the source code of this file.

Macros

#define PSEUDO_BIT_STRUCT(_structure)
 Wrapper structure for pseudo_bit_t structures.
#define PSEUDO_BIT_STRUCT_TYPE(_ptr)
 Get pseudo_bit_t structure type from wrapper structure pointer.
#define BIT_OFFSET(_ptr, _field)
 Bit offset of a field within a pseudo_bit_t structure.
#define BIT_WIDTH(_ptr, _field)
 Bit width of a field within a pseudo_bit_t structure.
#define QWORD_OFFSET(_ptr, _field)
 Qword offset of a field within a pseudo_bit_t structure.
#define QWORD_BIT_OFFSET(_ptr, _index, _field)
 Qword bit offset of a field within a pseudo_bit_t structure.
#define QWORD_BIT_SHIFT(_ptr, _index, _field)
 Qword bit shift for a field within a pseudo_bit_t structure.
#define BIT_MASK(_ptr, _field)
 Bit mask for a field within a pseudo_bit_t structure.
#define BIT_ASSEMBLE_1(_ptr, _index, _field, _value)
#define BIT_ASSEMBLE_2(_ptr, _index, _field, _value, ...)
#define BIT_ASSEMBLE_3(_ptr, _index, _field, _value, ...)
#define BIT_ASSEMBLE_4(_ptr, _index, _field, _value, ...)
#define BIT_ASSEMBLE_5(_ptr, _index, _field, _value, ...)
#define BIT_ASSEMBLE_6(_ptr, _index, _field, _value, ...)
#define BIT_ASSEMBLE_7(_ptr, _index, _field, _value, ...)
#define BIT_MASK_1(_ptr, _index, _field)
#define BIT_MASK_2(_ptr, _index, _field, ...)
#define BIT_MASK_3(_ptr, _index, _field, ...)
#define BIT_MASK_4(_ptr, _index, _field, ...)
#define BIT_MASK_5(_ptr, _index, _field, ...)
#define BIT_MASK_6(_ptr, _index, _field, ...)
#define BIT_MASK_7(_ptr, _index, _field, ...)
#define BIT_FILL(_ptr, _index, _assembled)
#define BIT_FILL_1(_ptr, _field1, ...)
#define BIT_FILL_2(_ptr, _field1, ...)
#define BIT_FILL_3(_ptr, _field1, ...)
#define BIT_FILL_4(_ptr, _field1, ...)
#define BIT_FILL_5(_ptr, _field1, ...)
#define BIT_FILL_6(_ptr, _field1, ...)
#define BIT_QWORD_PTR(_ptr, _field)
#define BIT_GET64(_ptr, _field)
 Extract value of named field.
#define BIT_GET(_ptr, _field)
 Extract value of named field (for fields up to the size of a long)
#define BIT_SET(_ptr, _field, _value)

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)

Detailed Description

Pseudo-bit structures.

Definition in file pseudobit.h.

Macro Definition Documentation

◆ PSEUDO_BIT_STRUCT

#define PSEUDO_BIT_STRUCT ( _structure)
Value:
union { \
uint8_t bytes[ sizeof ( _structure ) / 8 ]; \
uint32_t dwords[ sizeof ( _structure ) / 32 ]; \
uint64_t qwords[ sizeof ( _structure ) / 64 ]; \
_structure *dummy[0]; \
} __attribute__ (( packed )) u
unsigned int uint32_t
Definition stdint.h:12
unsigned long long uint64_t
Definition stdint.h:13
unsigned char uint8_t
Definition stdint.h:10
union @104331263140136355135267063077374276003064103115 u
uint8_t bytes[64]
Definition ib_mad.h:5
#define __attribute__(x)
Definition compiler.h:10

Wrapper structure for pseudo_bit_t structures.

This structure provides a wrapper around pseudo_bit_t structures. It has the correct size, and also encapsulates type information about the underlying pseudo_bit_t-based structure, which allows the BIT_FILL() etc. macros to work without requiring explicit type information.

Definition at line 70 of file pseudobit.h.

70#define PSEUDO_BIT_STRUCT( _structure ) \
71 union { \
72 uint8_t bytes[ sizeof ( _structure ) / 8 ]; \
73 uint32_t dwords[ sizeof ( _structure ) / 32 ]; \
74 uint64_t qwords[ sizeof ( _structure ) / 64 ]; \
75 _structure *dummy[0]; \
76 } __attribute__ (( packed )) u

◆ PSEUDO_BIT_STRUCT_TYPE

#define PSEUDO_BIT_STRUCT_TYPE ( _ptr)
Value:
typeof ( *((_ptr)->u.dummy[0]) )
typeof(acpi_finder=acpi_find)
ACPI table finder.
Definition acpi.c:48

Get pseudo_bit_t structure type from wrapper structure pointer.

Definition at line 79 of file pseudobit.h.

79#define PSEUDO_BIT_STRUCT_TYPE( _ptr ) \
80 typeof ( *((_ptr)->u.dummy[0]) )

◆ BIT_OFFSET

#define BIT_OFFSET ( _ptr,
_field )
Value:
offsetof ( PSEUDO_BIT_STRUCT_TYPE ( _ptr ), _field )
#define PSEUDO_BIT_STRUCT_TYPE(_ptr)
Get pseudo_bit_t structure type from wrapper structure pointer.
Definition pseudobit.h:79
#define offsetof(type, field)
Get offset of a field within a structure.
Definition stddef.h:25

Bit offset of a field within a pseudo_bit_t structure.

Definition at line 83 of file pseudobit.h.

83#define BIT_OFFSET( _ptr, _field ) \
84 offsetof ( PSEUDO_BIT_STRUCT_TYPE ( _ptr ), _field )

◆ BIT_WIDTH

#define BIT_WIDTH ( _ptr,
_field )
Value:
sizeof ( ( ( PSEUDO_BIT_STRUCT_TYPE ( _ptr ) * ) NULL )->_field )
#define NULL
NULL pointer (VOID *)
Definition Base.h:322

Bit width of a field within a pseudo_bit_t structure.

Definition at line 87 of file pseudobit.h.

87#define BIT_WIDTH( _ptr, _field ) \
88 sizeof ( ( ( PSEUDO_BIT_STRUCT_TYPE ( _ptr ) * ) NULL )->_field )

◆ QWORD_OFFSET

#define QWORD_OFFSET ( _ptr,
_field )
Value:
( BIT_OFFSET ( _ptr, _field ) / 64 )
#define BIT_OFFSET(_ptr, _field)
Bit offset of a field within a pseudo_bit_t structure.
Definition pseudobit.h:83

Qword offset of a field within a pseudo_bit_t structure.

Definition at line 91 of file pseudobit.h.

91#define QWORD_OFFSET( _ptr, _field ) \
92 ( BIT_OFFSET ( _ptr, _field ) / 64 )

◆ QWORD_BIT_OFFSET

#define QWORD_BIT_OFFSET ( _ptr,
_index,
_field )
Value:
( BIT_OFFSET ( _ptr, _field ) - ( 64 * (_index) ) )

Qword bit offset of a field within a pseudo_bit_t structure.

Definition at line 95 of file pseudobit.h.

95#define QWORD_BIT_OFFSET( _ptr, _index, _field ) \
96 ( BIT_OFFSET ( _ptr, _field ) - ( 64 * (_index) ) )

◆ QWORD_BIT_SHIFT

#define QWORD_BIT_SHIFT ( _ptr,
_index,
_field )
Value:
QWORD_SHIFT ( QWORD_BIT_OFFSET ( _ptr, _index, _field ), \
BIT_WIDTH ( _ptr, _field ) )
#define BIT_WIDTH(_ptr, _field)
Bit width of a field within a pseudo_bit_t structure.
Definition pseudobit.h:87
#define QWORD_BIT_OFFSET(_ptr, _index, _field)
Qword bit offset of a field within a pseudo_bit_t structure.
Definition pseudobit.h:95

Qword bit shift for a field within a pseudo_bit_t structure.

Definition at line 99 of file pseudobit.h.

99#define QWORD_BIT_SHIFT( _ptr, _index, _field ) \
100 QWORD_SHIFT ( QWORD_BIT_OFFSET ( _ptr, _index, _field ), \
101 BIT_WIDTH ( _ptr, _field ) )

◆ BIT_MASK

#define BIT_MASK ( _ptr,
_field )
Value:
( ( ~( ( uint64_t ) 0 ) ) >> \
( 64 - BIT_WIDTH ( _ptr, _field ) ) )

Bit mask for a field within a pseudo_bit_t structure.

Definition at line 104 of file pseudobit.h.

104#define BIT_MASK( _ptr, _field ) \
105 ( ( ~( ( uint64_t ) 0 ) ) >> \
106 ( 64 - BIT_WIDTH ( _ptr, _field ) ) )

◆ BIT_ASSEMBLE_1

#define BIT_ASSEMBLE_1 ( _ptr,
_index,
_field,
_value )
Value:
( ( ( uint64_t) (_value) ) << \
QWORD_BIT_SHIFT ( _ptr, _index, _field ) )

Definition at line 113 of file pseudobit.h.

113#define BIT_ASSEMBLE_1( _ptr, _index, _field, _value ) \
114 ( ( ( uint64_t) (_value) ) << \
115 QWORD_BIT_SHIFT ( _ptr, _index, _field ) )

◆ BIT_ASSEMBLE_2

#define BIT_ASSEMBLE_2 ( _ptr,
_index,
_field,
_value,
... )
Value:
( BIT_ASSEMBLE_1 ( _ptr, _index, _field, _value ) | \
BIT_ASSEMBLE_1 ( _ptr, _index, __VA_ARGS__ ) )
#define BIT_ASSEMBLE_1(_ptr, _index, _field, _value)
Definition pseudobit.h:113

Definition at line 117 of file pseudobit.h.

117#define BIT_ASSEMBLE_2( _ptr, _index, _field, _value, ... ) \
118 ( BIT_ASSEMBLE_1 ( _ptr, _index, _field, _value ) | \
119 BIT_ASSEMBLE_1 ( _ptr, _index, __VA_ARGS__ ) )

◆ BIT_ASSEMBLE_3

#define BIT_ASSEMBLE_3 ( _ptr,
_index,
_field,
_value,
... )
Value:
( BIT_ASSEMBLE_1 ( _ptr, _index, _field, _value ) | \
BIT_ASSEMBLE_2 ( _ptr, _index, __VA_ARGS__ ) )

Definition at line 121 of file pseudobit.h.

121#define BIT_ASSEMBLE_3( _ptr, _index, _field, _value, ... ) \
122 ( BIT_ASSEMBLE_1 ( _ptr, _index, _field, _value ) | \
123 BIT_ASSEMBLE_2 ( _ptr, _index, __VA_ARGS__ ) )

◆ BIT_ASSEMBLE_4

#define BIT_ASSEMBLE_4 ( _ptr,
_index,
_field,
_value,
... )
Value:
( BIT_ASSEMBLE_1 ( _ptr, _index, _field, _value ) | \
BIT_ASSEMBLE_3 ( _ptr, _index, __VA_ARGS__ ) )

Definition at line 125 of file pseudobit.h.

125#define BIT_ASSEMBLE_4( _ptr, _index, _field, _value, ... ) \
126 ( BIT_ASSEMBLE_1 ( _ptr, _index, _field, _value ) | \
127 BIT_ASSEMBLE_3 ( _ptr, _index, __VA_ARGS__ ) )

◆ BIT_ASSEMBLE_5

#define BIT_ASSEMBLE_5 ( _ptr,
_index,
_field,
_value,
... )
Value:
( BIT_ASSEMBLE_1 ( _ptr, _index, _field, _value ) | \
BIT_ASSEMBLE_4 ( _ptr, _index, __VA_ARGS__ ) )

Definition at line 129 of file pseudobit.h.

129#define BIT_ASSEMBLE_5( _ptr, _index, _field, _value, ... ) \
130 ( BIT_ASSEMBLE_1 ( _ptr, _index, _field, _value ) | \
131 BIT_ASSEMBLE_4 ( _ptr, _index, __VA_ARGS__ ) )

◆ BIT_ASSEMBLE_6

#define BIT_ASSEMBLE_6 ( _ptr,
_index,
_field,
_value,
... )
Value:
( BIT_ASSEMBLE_1 ( _ptr, _index, _field, _value ) | \
BIT_ASSEMBLE_5 ( _ptr, _index, __VA_ARGS__ ) )

Definition at line 133 of file pseudobit.h.

133#define BIT_ASSEMBLE_6( _ptr, _index, _field, _value, ... ) \
134 ( BIT_ASSEMBLE_1 ( _ptr, _index, _field, _value ) | \
135 BIT_ASSEMBLE_5 ( _ptr, _index, __VA_ARGS__ ) )

◆ BIT_ASSEMBLE_7

#define BIT_ASSEMBLE_7 ( _ptr,
_index,
_field,
_value,
... )
Value:
( BIT_ASSEMBLE_1 ( _ptr, _index, _field, _value ) | \
BIT_ASSEMBLE_6 ( _ptr, _index, __VA_ARGS__ ) )

Definition at line 137 of file pseudobit.h.

137#define BIT_ASSEMBLE_7( _ptr, _index, _field, _value, ... ) \
138 ( BIT_ASSEMBLE_1 ( _ptr, _index, _field, _value ) | \
139 BIT_ASSEMBLE_6 ( _ptr, _index, __VA_ARGS__ ) )

◆ BIT_MASK_1

#define BIT_MASK_1 ( _ptr,
_index,
_field )
Value:
( BIT_MASK ( _ptr, _field ) << \
QWORD_BIT_SHIFT ( _ptr, _index, _field ) )
#define BIT_MASK(_ptr, _field)
Bit mask for a field within a pseudo_bit_t structure.
Definition pseudobit.h:104

Definition at line 146 of file pseudobit.h.

146#define BIT_MASK_1( _ptr, _index, _field ) \
147 ( BIT_MASK ( _ptr, _field ) << \
148 QWORD_BIT_SHIFT ( _ptr, _index, _field ) )

◆ BIT_MASK_2

#define BIT_MASK_2 ( _ptr,
_index,
_field,
... )
Value:
( BIT_MASK_1 ( _ptr, _index, _field ) | \
BIT_MASK_1 ( _ptr, _index, __VA_ARGS__ ) )
#define BIT_MASK_1(_ptr, _index, _field)
Definition pseudobit.h:146

Definition at line 150 of file pseudobit.h.

150#define BIT_MASK_2( _ptr, _index, _field, ... ) \
151 ( BIT_MASK_1 ( _ptr, _index, _field ) | \
152 BIT_MASK_1 ( _ptr, _index, __VA_ARGS__ ) )

◆ BIT_MASK_3

#define BIT_MASK_3 ( _ptr,
_index,
_field,
... )
Value:
( BIT_MASK_1 ( _ptr, _index, _field ) | \
BIT_MASK_2 ( _ptr, _index, __VA_ARGS__ ) )

Definition at line 154 of file pseudobit.h.

154#define BIT_MASK_3( _ptr, _index, _field, ... ) \
155 ( BIT_MASK_1 ( _ptr, _index, _field ) | \
156 BIT_MASK_2 ( _ptr, _index, __VA_ARGS__ ) )

◆ BIT_MASK_4

#define BIT_MASK_4 ( _ptr,
_index,
_field,
... )
Value:
( BIT_MASK_1 ( _ptr, _index, _field ) | \
BIT_MASK_3 ( _ptr, _index, __VA_ARGS__ ) )

Definition at line 158 of file pseudobit.h.

158#define BIT_MASK_4( _ptr, _index, _field, ... ) \
159 ( BIT_MASK_1 ( _ptr, _index, _field ) | \
160 BIT_MASK_3 ( _ptr, _index, __VA_ARGS__ ) )

◆ BIT_MASK_5

#define BIT_MASK_5 ( _ptr,
_index,
_field,
... )
Value:
( BIT_MASK_1 ( _ptr, _index, _field ) | \
BIT_MASK_4 ( _ptr, _index, __VA_ARGS__ ) )

Definition at line 162 of file pseudobit.h.

162#define BIT_MASK_5( _ptr, _index, _field, ... ) \
163 ( BIT_MASK_1 ( _ptr, _index, _field ) | \
164 BIT_MASK_4 ( _ptr, _index, __VA_ARGS__ ) )

◆ BIT_MASK_6

#define BIT_MASK_6 ( _ptr,
_index,
_field,
... )
Value:
( BIT_MASK_1 ( _ptr, _index, _field ) | \
BIT_MASK_5 ( _ptr, _index, __VA_ARGS__ ) )

Definition at line 166 of file pseudobit.h.

166#define BIT_MASK_6( _ptr, _index, _field, ... ) \
167 ( BIT_MASK_1 ( _ptr, _index, _field ) | \
168 BIT_MASK_5 ( _ptr, _index, __VA_ARGS__ ) )

◆ BIT_MASK_7

#define BIT_MASK_7 ( _ptr,
_index,
_field,
... )
Value:
( BIT_MASK_1 ( _ptr, _index, _field ) | \
BIT_MASK_6 ( _ptr, _index, __VA_ARGS__ ) )

Definition at line 170 of file pseudobit.h.

170#define BIT_MASK_7( _ptr, _index, _field, ... ) \
171 ( BIT_MASK_1 ( _ptr, _index, _field ) | \
172 BIT_MASK_6 ( _ptr, _index, __VA_ARGS__ ) )

◆ BIT_FILL

#define BIT_FILL ( _ptr,
_index,
_assembled )
Value:
do { \
uint64_t *__ptr = &(_ptr)->u.qwords[(_index)]; \
uint64_t __assembled = (_assembled); \
*__ptr = cpu_to_BIT64 ( __assembled ); \
} while ( 0 )

Definition at line 179 of file pseudobit.h.

179#define BIT_FILL( _ptr, _index, _assembled ) do { \
180 uint64_t *__ptr = &(_ptr)->u.qwords[(_index)]; \
181 uint64_t __assembled = (_assembled); \
182 *__ptr = cpu_to_BIT64 ( __assembled ); \
183 } while ( 0 )

◆ BIT_FILL_1

#define BIT_FILL_1 ( _ptr,
_field1,
... )
Value:
BIT_FILL ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
BIT_ASSEMBLE_1 ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
_field1, __VA_ARGS__ ) )
#define QWORD_OFFSET(_ptr, _field)
Qword offset of a field within a pseudo_bit_t structure.
Definition pseudobit.h:91
#define BIT_FILL(_ptr, _index, _assembled)
Definition pseudobit.h:179

Definition at line 185 of file pseudobit.h.

185#define BIT_FILL_1( _ptr, _field1, ... ) \
186 BIT_FILL ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
187 BIT_ASSEMBLE_1 ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
188 _field1, __VA_ARGS__ ) )

Referenced by linda_create_recv_wq(), linda_ib_epb_release(), linda_ib_epb_request(), linda_init_recv(), linda_init_send(), linda_poll_eq(), linda_post_recv(), qib7322_create_recv_wq(), qib7322_init_recv(), qib7322_init_send(), qib7322_post_recv(), and qib7322_reset().

◆ BIT_FILL_2

#define BIT_FILL_2 ( _ptr,
_field1,
... )
Value:
BIT_FILL ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
BIT_ASSEMBLE_2 ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
_field1, __VA_ARGS__ ) )
#define BIT_ASSEMBLE_2(_ptr, _index, _field, _value,...)
Definition pseudobit.h:117

Definition at line 190 of file pseudobit.h.

190#define BIT_FILL_2( _ptr, _field1, ... ) \
191 BIT_FILL ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
192 BIT_ASSEMBLE_2 ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
193 _field1, __VA_ARGS__ ) )

Referenced by linda_init_send(), linda_poll_recv_wq(), linda_post_recv(), linda_post_send(), qib7322_ahb_read(), qib7322_ahb_request(), qib7322_init_recv(), qib7322_poll_recv_wq(), and qib7322_post_recv().

◆ BIT_FILL_3

#define BIT_FILL_3 ( _ptr,
_field1,
... )
Value:
BIT_FILL ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
BIT_ASSEMBLE_3 ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
_field1, __VA_ARGS__ ) )
#define BIT_ASSEMBLE_3(_ptr, _index, _field, _value,...)
Definition pseudobit.h:121

Definition at line 195 of file pseudobit.h.

195#define BIT_FILL_3( _ptr, _field1, ... ) \
196 BIT_FILL ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
197 BIT_ASSEMBLE_3 ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
198 _field1, __VA_ARGS__ ) )

Referenced by linda_ib_epb_read(), linda_init_recv(), qib7322_ahb_write(), qib7322_init_recv(), and qib7322_post_send().

◆ BIT_FILL_4

#define BIT_FILL_4 ( _ptr,
_field1,
... )
Value:
BIT_FILL ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
BIT_ASSEMBLE_4 ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
_field1, __VA_ARGS__ ) )
#define BIT_ASSEMBLE_4(_ptr, _index, _field, _value,...)
Definition pseudobit.h:125

Definition at line 200 of file pseudobit.h.

200#define BIT_FILL_4( _ptr, _field1, ... ) \
201 BIT_FILL ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
202 BIT_ASSEMBLE_4 ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
203 _field1, __VA_ARGS__ ) )

Referenced by linda_ib_epb_write().

◆ BIT_FILL_5

#define BIT_FILL_5 ( _ptr,
_field1,
... )
Value:
BIT_FILL ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
BIT_ASSEMBLE_5 ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
_field1, __VA_ARGS__ ) )
#define BIT_ASSEMBLE_5(_ptr, _index, _field, _value,...)
Definition pseudobit.h:129

Definition at line 205 of file pseudobit.h.

205#define BIT_FILL_5( _ptr, _field1, ... ) \
206 BIT_FILL ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
207 BIT_ASSEMBLE_5 ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
208 _field1, __VA_ARGS__ ) )

Referenced by qib7322_init_ib_serdes().

◆ BIT_FILL_6

#define BIT_FILL_6 ( _ptr,
_field1,
... )
Value:
BIT_FILL ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
BIT_ASSEMBLE_6 ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
_field1, __VA_ARGS__ ) )
#define BIT_ASSEMBLE_6(_ptr, _index, _field, _value,...)
Definition pseudobit.h:133

Definition at line 210 of file pseudobit.h.

210#define BIT_FILL_6( _ptr, _field1, ... ) \
211 BIT_FILL ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
212 BIT_ASSEMBLE_6 ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
213 _field1, __VA_ARGS__ ) )

Referenced by linda_init_ib_serdes(), and qib7322_init_recv().

◆ BIT_QWORD_PTR

#define BIT_QWORD_PTR ( _ptr,
_field )
Value:
( { \
unsigned int __index = QWORD_OFFSET ( _ptr, _field ); \
uint64_t *__ptr = &(_ptr)->u.qwords[__index]; \
__ptr; \
} )

Definition at line 215 of file pseudobit.h.

215#define BIT_QWORD_PTR( _ptr, _field ) \
216 ( { \
217 unsigned int __index = QWORD_OFFSET ( _ptr, _field ); \
218 uint64_t *__ptr = &(_ptr)->u.qwords[__index]; \
219 __ptr; \
220 } )

◆ BIT_GET64

#define BIT_GET64 ( _ptr,
_field )
Value:
( { \
unsigned int __index = QWORD_OFFSET ( _ptr, _field ); \
uint64_t *__ptr = &(_ptr)->u.qwords[__index]; \
uint64_t __value = BIT64_to_cpu ( *__ptr ); \
__value >>= \
QWORD_BIT_SHIFT ( _ptr, __index, _field ); \
__value &= BIT_MASK ( _ptr, _field ); \
__value; \
} )

Extract value of named field.

Definition at line 223 of file pseudobit.h.

223#define BIT_GET64( _ptr, _field ) \
224 ( { \
225 unsigned int __index = QWORD_OFFSET ( _ptr, _field ); \
226 uint64_t *__ptr = &(_ptr)->u.qwords[__index]; \
227 uint64_t __value = BIT64_to_cpu ( *__ptr ); \
228 __value >>= \
229 QWORD_BIT_SHIFT ( _ptr, __index, _field ); \
230 __value &= BIT_MASK ( _ptr, _field ); \
231 __value; \
232 } )

◆ BIT_GET

◆ BIT_SET

#define BIT_SET ( _ptr,
_field,
_value )
Value:
do { \
unsigned int __index = QWORD_OFFSET ( _ptr, _field ); \
uint64_t *__ptr = &(_ptr)->u.qwords[__index]; \
unsigned int __shift = \
QWORD_BIT_SHIFT ( _ptr, __index, _field ); \
uint64_t __value = (_value); \
*__ptr &= cpu_to_BIT64 ( ~( BIT_MASK ( _ptr, _field ) << \
__shift ) ); \
*__ptr |= cpu_to_BIT64 ( __value << __shift ); \
} while ( 0 )

Definition at line 238 of file pseudobit.h.

238#define BIT_SET( _ptr, _field, _value ) do { \
239 unsigned int __index = QWORD_OFFSET ( _ptr, _field ); \
240 uint64_t *__ptr = &(_ptr)->u.qwords[__index]; \
241 unsigned int __shift = \
242 QWORD_BIT_SHIFT ( _ptr, __index, _field ); \
243 uint64_t __value = (_value); \
244 *__ptr &= cpu_to_BIT64 ( ~( BIT_MASK ( _ptr, _field ) << \
245 __shift ) ); \
246 *__ptr |= cpu_to_BIT64 ( __value << __shift ); \
247 } while ( 0 )

Referenced by linda_close(), linda_create_recv_wq(), linda_destroy_recv_wq(), linda_i2c_write_bit(), linda_init_ib_serdes(), linda_link_state_changed(), linda_open(), linda_set_port_info(), linda_trim_ib(), qib7322_close(), qib7322_create_recv_wq(), qib7322_destroy_recv_wq(), qib7322_i2c_write_bit(), qib7322_init_ib_serdes(), qib7322_link_state_changed(), qib7322_open(), and qib7322_set_port_info().

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )