Lines Matching refs:mfa2_file

95 mlxfw_mfa2_tlv_multi_validate(const struct mlxfw_mfa2_file *mfa2_file,  in mlxfw_mfa2_tlv_multi_validate()  argument
102 mlxfw_mfa2_tlv_multi_foreach(mfa2_file, tlv, idx, multi) { in mlxfw_mfa2_tlv_multi_validate()
112 mlxfw_mfa2_file_dev_validate(const struct mlxfw_mfa2_file *mfa2_file, in mlxfw_mfa2_file_dev_validate() argument
126 multi = mlxfw_mfa2_tlv_multi_get(mfa2_file, dev_tlv); in mlxfw_mfa2_file_dev_validate()
132 if (!mlxfw_mfa2_tlv_multi_validate(mfa2_file, multi)) in mlxfw_mfa2_file_dev_validate()
136 tlv = mlxfw_mfa2_tlv_multi_child_find(mfa2_file, multi, in mlxfw_mfa2_file_dev_validate()
143 psid = mlxfw_mfa2_tlv_psid_get(mfa2_file, tlv); in mlxfw_mfa2_file_dev_validate()
153 err = mlxfw_mfa2_tlv_multi_child_count(mfa2_file, multi, in mlxfw_mfa2_file_dev_validate()
165 tlv = mlxfw_mfa2_tlv_multi_child_find(mfa2_file, multi, in mlxfw_mfa2_file_dev_validate()
171 cptr = mlxfw_mfa2_tlv_component_ptr_get(mfa2_file, tlv); in mlxfw_mfa2_file_dev_validate()
185 mlxfw_mfa2_file_comp_validate(const struct mlxfw_mfa2_file *mfa2_file, in mlxfw_mfa2_file_comp_validate() argument
195 multi = mlxfw_mfa2_tlv_multi_get(mfa2_file, comp_tlv); in mlxfw_mfa2_file_comp_validate()
201 if (!mlxfw_mfa2_tlv_multi_validate(mfa2_file, multi)) in mlxfw_mfa2_file_comp_validate()
205 tlv = mlxfw_mfa2_tlv_multi_child(mfa2_file, multi); in mlxfw_mfa2_file_comp_validate()
211 cdesc = mlxfw_mfa2_tlv_component_descriptor_get(mfa2_file, tlv); in mlxfw_mfa2_file_comp_validate()
225 static bool mlxfw_mfa2_file_validate(const struct mlxfw_mfa2_file *mfa2_file) in mlxfw_mfa2_file_validate() argument
233 mlxfw_mfa2_tlv_foreach(mfa2_file, tlv, idx, mfa2_file->first_dev, in mlxfw_mfa2_file_validate()
234 mfa2_file->dev_count) { in mlxfw_mfa2_file_validate()
241 if (!mlxfw_mfa2_file_dev_validate(mfa2_file, tlv, idx)) in mlxfw_mfa2_file_validate()
246 mlxfw_mfa2_tlv_foreach(mfa2_file, tlv, idx, mfa2_file->first_component, in mlxfw_mfa2_file_validate()
247 mfa2_file->component_count) { in mlxfw_mfa2_file_validate()
254 if (!mlxfw_mfa2_file_comp_validate(mfa2_file, tlv, idx)) in mlxfw_mfa2_file_validate()
266 struct mlxfw_mfa2_file *mfa2_file; in mlxfw_mfa2_file_init() local
270 mfa2_file = kzalloc(sizeof(*mfa2_file), GFP_KERNEL); in mlxfw_mfa2_file_init()
271 if (!mfa2_file) in mlxfw_mfa2_file_init()
274 mfa2_file->fw = fw; in mlxfw_mfa2_file_init()
276 first_tlv = mlxfw_mfa2_tlv_get(mfa2_file, first_tlv_ptr); in mlxfw_mfa2_file_init()
282 multi = mlxfw_mfa2_tlv_multi_get(mfa2_file, first_tlv); in mlxfw_mfa2_file_init()
288 multi_child = mlxfw_mfa2_tlv_multi_child(mfa2_file, multi); in mlxfw_mfa2_file_init()
292 pd = mlxfw_mfa2_tlv_package_descriptor_get(mfa2_file, multi_child); in mlxfw_mfa2_file_init()
298 mfa2_file->first_dev = mlxfw_mfa2_tlv_next(mfa2_file, first_tlv); in mlxfw_mfa2_file_init()
299 if (!mfa2_file->first_dev) { in mlxfw_mfa2_file_init()
304 mfa2_file->dev_count = be16_to_cpu(pd->num_devices); in mlxfw_mfa2_file_init()
305 mfa2_file->first_component = mlxfw_mfa2_tlv_advance(mfa2_file, in mlxfw_mfa2_file_init()
306 mfa2_file->first_dev, in mlxfw_mfa2_file_init()
307 mfa2_file->dev_count); in mlxfw_mfa2_file_init()
308 mfa2_file->component_count = be16_to_cpu(pd->num_components); in mlxfw_mfa2_file_init()
309 mfa2_file->cb = fw->data + NLA_ALIGN(be32_to_cpu(pd->cb_offset)); in mlxfw_mfa2_file_init()
310 if (!mlxfw_mfa2_valid_ptr(mfa2_file, mfa2_file->cb)) { in mlxfw_mfa2_file_init()
314 mfa2_file->cb_archive_size = be32_to_cpu(pd->cb_archive_size); in mlxfw_mfa2_file_init()
315 cb_top_ptr = mfa2_file->cb + mfa2_file->cb_archive_size - 1; in mlxfw_mfa2_file_init()
316 if (!mlxfw_mfa2_valid_ptr(mfa2_file, cb_top_ptr)) { in mlxfw_mfa2_file_init()
321 if (!mlxfw_mfa2_file_validate(mfa2_file)) in mlxfw_mfa2_file_init()
323 return mfa2_file; in mlxfw_mfa2_file_init()
325 kfree(mfa2_file); in mlxfw_mfa2_file_init()
330 mlxfw_mfa2_tlv_dev_get(const struct mlxfw_mfa2_file *mfa2_file, in mlxfw_mfa2_tlv_dev_get() argument
340 mlxfw_mfa2_tlv_foreach(mfa2_file, dev_tlv, idx, mfa2_file->first_dev, in mlxfw_mfa2_tlv_dev_get()
341 mfa2_file->dev_count) { in mlxfw_mfa2_tlv_dev_get()
345 dev_multi = mlxfw_mfa2_tlv_multi_get(mfa2_file, dev_tlv); in mlxfw_mfa2_tlv_dev_get()
350 tlv = mlxfw_mfa2_tlv_multi_child_find(mfa2_file, dev_multi, in mlxfw_mfa2_tlv_dev_get()
357 tlv_psid = mlxfw_mfa2_tlv_psid_get(mfa2_file, tlv); in mlxfw_mfa2_tlv_dev_get()
368 int mlxfw_mfa2_file_component_count(const struct mlxfw_mfa2_file *mfa2_file, in mlxfw_mfa2_file_component_count() argument
376 dev_multi = mlxfw_mfa2_tlv_dev_get(mfa2_file, psid, psid_size); in mlxfw_mfa2_file_component_count()
380 err = mlxfw_mfa2_tlv_multi_child_count(mfa2_file, dev_multi, in mlxfw_mfa2_file_component_count()
425 static int mlxfw_mfa2_file_cb_offset_xz(const struct mlxfw_mfa2_file *mfa2_file, in mlxfw_mfa2_file_cb_offset_xz() argument
438 dec_buf.in_size = mfa2_file->cb_archive_size; in mlxfw_mfa2_file_cb_offset_xz()
439 dec_buf.in = mfa2_file->cb; in mlxfw_mfa2_file_cb_offset_xz()
471 mlxfw_mfa2_file_component_tlv_get(const struct mlxfw_mfa2_file *mfa2_file, in mlxfw_mfa2_file_component_tlv_get() argument
478 if (comp_index > mfa2_file->component_count) in mlxfw_mfa2_file_component_tlv_get()
481 comp_tlv = mlxfw_mfa2_tlv_advance(mfa2_file, mfa2_file->first_component, in mlxfw_mfa2_file_component_tlv_get()
486 multi = mlxfw_mfa2_tlv_multi_get(mfa2_file, comp_tlv); in mlxfw_mfa2_file_component_tlv_get()
490 multi_child = mlxfw_mfa2_tlv_multi_child(mfa2_file, multi); in mlxfw_mfa2_file_component_tlv_get()
494 return mlxfw_mfa2_tlv_component_descriptor_get(mfa2_file, multi_child); in mlxfw_mfa2_file_component_tlv_get()
503 mlxfw_mfa2_file_component_find(const struct mlxfw_mfa2_file *mfa2_file, in mlxfw_mfa2_file_component_find() argument
512 dev_multi = mlxfw_mfa2_tlv_dev_get(mfa2_file, psid, psid_size); in mlxfw_mfa2_file_component_find()
516 cptr_tlv = mlxfw_mfa2_tlv_multi_child_find(mfa2_file, dev_multi, in mlxfw_mfa2_file_component_find()
522 cptr = mlxfw_mfa2_tlv_component_ptr_get(mfa2_file, cptr_tlv); in mlxfw_mfa2_file_component_find()
527 return mlxfw_mfa2_file_component_tlv_get(mfa2_file, comp_idx); in mlxfw_mfa2_file_component_find()
531 mlxfw_mfa2_file_component_get(const struct mlxfw_mfa2_file *mfa2_file, in mlxfw_mfa2_file_component_get() argument
542 comp = mlxfw_mfa2_file_component_find(mfa2_file, psid, psid_size, in mlxfw_mfa2_file_component_get()
557 err = mlxfw_mfa2_file_cb_offset_xz(mfa2_file, cb_offset, comp_buf_size, in mlxfw_mfa2_file_component_get()
586 void mlxfw_mfa2_file_fini(struct mlxfw_mfa2_file *mfa2_file) in mlxfw_mfa2_file_fini() argument
588 kfree(mfa2_file); in mlxfw_mfa2_file_fini()