Lines Matching refs:desc
62 void ib_pack(const struct ib_field *desc, in ib_pack() argument
70 if (desc[i].size_bits <= 32) { in ib_pack()
76 shift = 32 - desc[i].offset_bits - desc[i].size_bits; in ib_pack()
77 if (desc[i].struct_size_bytes) in ib_pack()
78 val = value_read(desc[i].struct_offset_bytes, in ib_pack()
79 desc[i].struct_size_bytes, in ib_pack()
84 mask = cpu_to_be32(((1ull << desc[i].size_bits) - 1) << shift); in ib_pack()
85 addr = (__be32 *) buf + desc[i].offset_words; in ib_pack()
87 } else if (desc[i].size_bits <= 64) { in ib_pack()
93 shift = 64 - desc[i].offset_bits - desc[i].size_bits; in ib_pack()
94 if (desc[i].struct_size_bytes) in ib_pack()
95 val = value_read(desc[i].struct_offset_bytes, in ib_pack()
96 desc[i].struct_size_bytes, in ib_pack()
101 mask = cpu_to_be64((~0ull >> (64 - desc[i].size_bits)) << shift); in ib_pack()
102 addr = (__be64 *) ((__be32 *) buf + desc[i].offset_words); in ib_pack()
105 if (desc[i].offset_bits % 8 || in ib_pack()
106 desc[i].size_bits % 8) { in ib_pack()
108 desc[i].field_name, desc[i].size_bits); in ib_pack()
111 if (desc[i].struct_size_bytes) in ib_pack()
112 memcpy(buf + desc[i].offset_words * 4 + in ib_pack()
113 desc[i].offset_bits / 8, in ib_pack()
114 structure + desc[i].struct_offset_bytes, in ib_pack()
115 desc[i].size_bits / 8); in ib_pack()
117 memset(buf + desc[i].offset_words * 4 + in ib_pack()
118 desc[i].offset_bits / 8, in ib_pack()
120 desc[i].size_bits / 8); in ib_pack()
148 void ib_unpack(const struct ib_field *desc, in ib_unpack() argument
156 if (!desc[i].struct_size_bytes) in ib_unpack()
159 if (desc[i].size_bits <= 32) { in ib_unpack()
165 shift = 32 - desc[i].offset_bits - desc[i].size_bits; in ib_unpack()
166 mask = ((1ull << desc[i].size_bits) - 1) << shift; in ib_unpack()
167 addr = (__be32 *) buf + desc[i].offset_words; in ib_unpack()
169 value_write(desc[i].struct_offset_bytes, in ib_unpack()
170 desc[i].struct_size_bytes, in ib_unpack()
173 } else if (desc[i].size_bits <= 64) { in ib_unpack()
179 shift = 64 - desc[i].offset_bits - desc[i].size_bits; in ib_unpack()
180 mask = (~0ull >> (64 - desc[i].size_bits)) << shift; in ib_unpack()
181 addr = (__be64 *) buf + desc[i].offset_words; in ib_unpack()
183 value_write(desc[i].struct_offset_bytes, in ib_unpack()
184 desc[i].struct_size_bytes, in ib_unpack()
188 if (desc[i].offset_bits % 8 || in ib_unpack()
189 desc[i].size_bits % 8) { in ib_unpack()
191 desc[i].field_name, desc[i].size_bits); in ib_unpack()
194 memcpy(structure + desc[i].struct_offset_bytes, in ib_unpack()
195 buf + desc[i].offset_words * 4 + in ib_unpack()
196 desc[i].offset_bits / 8, in ib_unpack()
197 desc[i].size_bits / 8); in ib_unpack()