1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
2 /* Copyright (c) 2017-2019 Mellanox Technologies. All rights reserved */
4 #ifndef _MLXFW_MFA2_FILE_H
5 #define _MLXFW_MFA2_FILE_H
7 #include <linux/firmware.h>
8 #include <linux/kernel.h>
10 struct mlxfw_mfa2_file
{
11 const struct firmware
*fw
;
12 const struct mlxfw_mfa2_tlv
*first_dev
;
14 const struct mlxfw_mfa2_tlv
*first_component
;
16 const void *cb
; /* components block */
17 u32 cb_archive_size
; /* size of compressed components block */
20 static inline bool mlxfw_mfa2_valid_ptr(const struct mlxfw_mfa2_file
*mfa2_file
,
23 const void *valid_to
= mfa2_file
->fw
->data
+ mfa2_file
->fw
->size
;
24 const void *valid_from
= mfa2_file
->fw
->data
;
26 return ptr
> valid_from
&& ptr
< valid_to
;