1/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
2/* Copyright (c) 2017-2019 Mellanox Technologies. All rights reserved */
3
4#ifndef _MLXFW_MFA2_FORMAT_H
5#define _MLXFW_MFA2_FORMAT_H
6
7#include "mlxfw_mfa2_file.h"
8#include "mlxfw_mfa2_tlv.h"
9
10enum mlxfw_mfa2_tlv_type {
11 MLXFW_MFA2_TLV_MULTI_PART = 0x01,
12 MLXFW_MFA2_TLV_PACKAGE_DESCRIPTOR = 0x02,
13 MLXFW_MFA2_TLV_COMPONENT_DESCRIPTOR = 0x04,
14 MLXFW_MFA2_TLV_COMPONENT_PTR = 0x22,
15 MLXFW_MFA2_TLV_PSID = 0x2A,
16};
17
18enum mlxfw_mfa2_compression_type {
19 MLXFW_MFA2_COMPRESSION_TYPE_NONE,
20 MLXFW_MFA2_COMPRESSION_TYPE_XZ,
21};
22
23struct mlxfw_mfa2_tlv_package_descriptor {
24 __be16 num_components;
25 __be16 num_devices;
26 __be32 cb_offset;
27 __be32 cb_archive_size;
28 __be32 cb_size_h;
29 __be32 cb_size_l;
30 u8 padding[3];
31 u8 cv_compression;
32 __be32 user_data_offset;
33} __packed;
34
35MLXFW_MFA2_TLV(package_descriptor, struct mlxfw_mfa2_tlv_package_descriptor,
36 MLXFW_MFA2_TLV_PACKAGE_DESCRIPTOR);
37
38struct mlxfw_mfa2_tlv_multi {
39 __be16 num_extensions;
40 __be16 total_len;
41} __packed;
42
43MLXFW_MFA2_TLV(multi, struct mlxfw_mfa2_tlv_multi,
44 MLXFW_MFA2_TLV_MULTI_PART);
45
46struct mlxfw_mfa2_tlv_psid {
47 DECLARE_FLEX_ARRAY(u8, psid);
48} __packed;
49
50MLXFW_MFA2_TLV_VARSIZE(psid, struct mlxfw_mfa2_tlv_psid,
51 MLXFW_MFA2_TLV_PSID);
52
53struct mlxfw_mfa2_tlv_component_ptr {
54 __be16 storage_id;
55 __be16 component_index;
56 __be32 storage_address;
57} __packed;
58
59MLXFW_MFA2_TLV(component_ptr, struct mlxfw_mfa2_tlv_component_ptr,
60 MLXFW_MFA2_TLV_COMPONENT_PTR);
61
62struct mlxfw_mfa2_tlv_component_descriptor {
63 __be16 pldm_classification;
64 __be16 identifier;
65 __be32 cb_offset_h;
66 __be32 cb_offset_l;
67 __be32 size;
68} __packed;
69
70MLXFW_MFA2_TLV(component_descriptor, struct mlxfw_mfa2_tlv_component_descriptor,
71 MLXFW_MFA2_TLV_COMPONENT_DESCRIPTOR);
72
73#endif
74

source code of linux/drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_format.h