| .. | .. |
|---|
| 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. */ |
|---|
| 33 | 3 | |
|---|
| 34 | 4 | #ifndef NSP_NSP_H |
|---|
| 35 | 5 | #define NSP_NSP_H 1 |
|---|
| .. | .. |
|---|
| 50 | 20 | int nfp_nsp_load_fw(struct nfp_nsp *state, const struct firmware *fw); |
|---|
| 51 | 21 | int nfp_nsp_write_flash(struct nfp_nsp *state, const struct firmware *fw); |
|---|
| 52 | 22 | 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); |
|---|
| 53 | 32 | |
|---|
| 54 | 33 | static inline bool nfp_nsp_has_mac_reinit(struct nfp_nsp *state) |
|---|
| 55 | 34 | { |
|---|
| 56 | 35 | 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; |
|---|
| 57 | 66 | } |
|---|
| 58 | 67 | |
|---|
| 59 | 68 | enum nfp_eth_interface { |
|---|
| .. | .. |
|---|
| 62 | 71 | NFP_INTERFACE_SFPP = 10, |
|---|
| 63 | 72 | NFP_INTERFACE_SFP28 = 28, |
|---|
| 64 | 73 | NFP_INTERFACE_QSFP = 40, |
|---|
| 74 | + NFP_INTERFACE_RJ45 = 45, |
|---|
| 65 | 75 | NFP_INTERFACE_CXP = 100, |
|---|
| 66 | 76 | NFP_INTERFACE_QSFP28 = 112, |
|---|
| 67 | 77 | }; |
|---|
| .. | .. |
|---|
| 91 | 101 | #define NFP_FEC_BASER BIT(NFP_FEC_BASER_BIT) |
|---|
| 92 | 102 | #define NFP_FEC_REED_SOLOMON BIT(NFP_FEC_REED_SOLOMON_BIT) |
|---|
| 93 | 103 | #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" |
|---|
| 94 | 119 | |
|---|
| 95 | 120 | /** |
|---|
| 96 | 121 | * struct nfp_eth_table - ETH table information |
|---|
| .. | .. |
|---|
| 158 | 183 | bool is_split; |
|---|
| 159 | 184 | |
|---|
| 160 | 185 | unsigned int fec_modes_supported; |
|---|
| 161 | | - } ports[0]; |
|---|
| 186 | + } ports[]; |
|---|
| 162 | 187 | }; |
|---|
| 163 | 188 | |
|---|
| 164 | 189 | struct nfp_eth_table *nfp_eth_read_ports(struct nfp_cpp *cpp); |
|---|
| .. | .. |
|---|
| 226 | 251 | int nfp_hwmon_read_sensor(struct nfp_cpp *cpp, enum nfp_nsp_sensor_id id, |
|---|
| 227 | 252 | long *val); |
|---|
| 228 | 253 | |
|---|
| 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); |
|---|
| 229 | 269 | #endif |
|---|