hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp.h
....@@ -1,35 +1,5 @@
1
-/*
2
- * Copyright (C) 2015-2017 Netronome Systems, Inc.
3
- *
4
- * This software is dual licensed under the GNU General License Version 2,
5
- * June 1991 as shown in the file COPYING in the top-level directory of this
6
- * source tree or the BSD 2-Clause License provided below. You have the
7
- * option to license this software under the complete terms of either license.
8
- *
9
- * The BSD 2-Clause License:
10
- *
11
- * Redistribution and use in source and binary forms, with or
12
- * without modification, are permitted provided that the following
13
- * conditions are met:
14
- *
15
- * 1. Redistributions of source code must retain the above
16
- * copyright notice, this list of conditions and the following
17
- * disclaimer.
18
- *
19
- * 2. Redistributions in binary form must reproduce the above
20
- * copyright notice, this list of conditions and the following
21
- * disclaimer in the documentation and/or other materials
22
- * provided with the distribution.
23
- *
24
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
- * SOFTWARE.
32
- */
1
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
2
+/* Copyright (C) 2015-2018 Netronome Systems, Inc. */
333
344 #ifndef NSP_NSP_H
355 #define NSP_NSP_H 1
....@@ -50,10 +20,49 @@
5020 int nfp_nsp_load_fw(struct nfp_nsp *state, const struct firmware *fw);
5121 int nfp_nsp_write_flash(struct nfp_nsp *state, const struct firmware *fw);
5222 int nfp_nsp_mac_reinit(struct nfp_nsp *state);
23
+int nfp_nsp_load_stored_fw(struct nfp_nsp *state);
24
+int nfp_nsp_hwinfo_lookup(struct nfp_nsp *state, void *buf, unsigned int size);
25
+int nfp_nsp_hwinfo_lookup_optional(struct nfp_nsp *state, void *buf,
26
+ unsigned int size, const char *default_val);
27
+int nfp_nsp_hwinfo_set(struct nfp_nsp *state, void *buf, unsigned int size);
28
+int nfp_nsp_fw_loaded(struct nfp_nsp *state);
29
+int nfp_nsp_read_module_eeprom(struct nfp_nsp *state, int eth_index,
30
+ unsigned int offset, void *data,
31
+ unsigned int len, unsigned int *read_len);
5332
5433 static inline bool nfp_nsp_has_mac_reinit(struct nfp_nsp *state)
5534 {
5635 return nfp_nsp_get_abi_ver_minor(state) > 20;
36
+}
37
+
38
+static inline bool nfp_nsp_has_stored_fw_load(struct nfp_nsp *state)
39
+{
40
+ return nfp_nsp_get_abi_ver_minor(state) > 23;
41
+}
42
+
43
+static inline bool nfp_nsp_has_hwinfo_lookup(struct nfp_nsp *state)
44
+{
45
+ return nfp_nsp_get_abi_ver_minor(state) > 24;
46
+}
47
+
48
+static inline bool nfp_nsp_has_hwinfo_set(struct nfp_nsp *state)
49
+{
50
+ return nfp_nsp_get_abi_ver_minor(state) > 25;
51
+}
52
+
53
+static inline bool nfp_nsp_has_fw_loaded(struct nfp_nsp *state)
54
+{
55
+ return nfp_nsp_get_abi_ver_minor(state) > 25;
56
+}
57
+
58
+static inline bool nfp_nsp_has_versions(struct nfp_nsp *state)
59
+{
60
+ return nfp_nsp_get_abi_ver_minor(state) > 27;
61
+}
62
+
63
+static inline bool nfp_nsp_has_read_module_eeprom(struct nfp_nsp *state)
64
+{
65
+ return nfp_nsp_get_abi_ver_minor(state) > 28;
5766 }
5867
5968 enum nfp_eth_interface {
....@@ -62,6 +71,7 @@
6271 NFP_INTERFACE_SFPP = 10,
6372 NFP_INTERFACE_SFP28 = 28,
6473 NFP_INTERFACE_QSFP = 40,
74
+ NFP_INTERFACE_RJ45 = 45,
6575 NFP_INTERFACE_CXP = 100,
6676 NFP_INTERFACE_QSFP28 = 112,
6777 };
....@@ -91,6 +101,21 @@
91101 #define NFP_FEC_BASER BIT(NFP_FEC_BASER_BIT)
92102 #define NFP_FEC_REED_SOLOMON BIT(NFP_FEC_REED_SOLOMON_BIT)
93103 #define NFP_FEC_DISABLED BIT(NFP_FEC_DISABLED_BIT)
104
+
105
+/* Defines the valid values of the 'abi_drv_reset' hwinfo key */
106
+#define NFP_NSP_DRV_RESET_DISK 0
107
+#define NFP_NSP_DRV_RESET_ALWAYS 1
108
+#define NFP_NSP_DRV_RESET_NEVER 2
109
+#define NFP_NSP_DRV_RESET_DEFAULT "0"
110
+
111
+/* Defines the valid values of the 'app_fw_from_flash' hwinfo key */
112
+#define NFP_NSP_APP_FW_LOAD_DISK 0
113
+#define NFP_NSP_APP_FW_LOAD_FLASH 1
114
+#define NFP_NSP_APP_FW_LOAD_PREF 2
115
+#define NFP_NSP_APP_FW_LOAD_DEFAULT "2"
116
+
117
+/* Define the default value for the 'abi_drv_load_ifc' key */
118
+#define NFP_NSP_DRV_LOAD_IFC_DEFAULT "0x10ff"
94119
95120 /**
96121 * struct nfp_eth_table - ETH table information
....@@ -158,7 +183,7 @@
158183 bool is_split;
159184
160185 unsigned int fec_modes_supported;
161
- } ports[0];
186
+ } ports[];
162187 };
163188
164189 struct nfp_eth_table *nfp_eth_read_ports(struct nfp_cpp *cpp);
....@@ -226,4 +251,19 @@
226251 int nfp_hwmon_read_sensor(struct nfp_cpp *cpp, enum nfp_nsp_sensor_id id,
227252 long *val);
228253
254
+#define NFP_NSP_VERSION_BUFSZ 1024 /* reasonable size, not in the ABI */
255
+
256
+enum nfp_nsp_versions {
257
+ NFP_VERSIONS_BSP,
258
+ NFP_VERSIONS_CPLD,
259
+ NFP_VERSIONS_APP,
260
+ NFP_VERSIONS_BUNDLE,
261
+ NFP_VERSIONS_UNDI,
262
+ NFP_VERSIONS_NCSI,
263
+ NFP_VERSIONS_CFGR,
264
+};
265
+
266
+int nfp_nsp_versions(struct nfp_nsp *state, void *buf, unsigned int size);
267
+const char *nfp_nsp_versions_get(enum nfp_nsp_versions id, bool flash,
268
+ const u8 *buf, unsigned int size);
229269 #endif