Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
0002 /* Copyright (c) 2017-2019 Mellanox Technologies. All rights reserved */
0003 
0004 #ifndef _MLXFW_MFA2_FILE_H
0005 #define _MLXFW_MFA2_FILE_H
0006 
0007 #include <linux/firmware.h>
0008 #include <linux/kernel.h>
0009 
0010 struct mlxfw_mfa2_file {
0011     const struct firmware *fw;
0012     const struct mlxfw_mfa2_tlv *first_dev;
0013     u16 dev_count;
0014     const struct mlxfw_mfa2_tlv *first_component;
0015     u16 component_count;
0016     const void *cb; /* components block */
0017     u32 cb_archive_size; /* size of compressed components block */
0018 };
0019 
0020 static inline bool mlxfw_mfa2_valid_ptr(const struct mlxfw_mfa2_file *mfa2_file,
0021                     const void *ptr)
0022 {
0023     const void *valid_to = mfa2_file->fw->data + mfa2_file->fw->size;
0024     const void *valid_from = mfa2_file->fw->data;
0025 
0026     return ptr > valid_from && ptr < valid_to;
0027 }
0028 
0029 #endif