Merge tag 'sched_ext-for-6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj...
[linux.git] / drivers / net / ethernet / mellanox / mlxfw / mlxfw_mfa2_file.h
blob874c0a2474ae3ba68f3e87aed790a63330616ebc
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;
13 u16 dev_count;
14 const struct mlxfw_mfa2_tlv *first_component;
15 u16 component_count;
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,
21 const void *ptr)
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;
29 #endif