| .. | .. |
|---|
| 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 | /* |
|---|
| 35 | 5 | * nfp_nffw.c |
|---|
| .. | .. |
|---|
| 154 | 124 | u64 mip_off_hi = le32_to_cpu(fi->loaded__mu_da__mip_off_hi); |
|---|
| 155 | 125 | |
|---|
| 156 | 126 | return (mip_off_hi & 0xFF) << 32 | le32_to_cpu(fi->mip_offset_lo); |
|---|
| 157 | | -} |
|---|
| 158 | | - |
|---|
| 159 | | -#define NFP_IMB_TGTADDRESSMODECFG_MODE_of(_x) (((_x) >> 13) & 0x7) |
|---|
| 160 | | -#define NFP_IMB_TGTADDRESSMODECFG_ADDRMODE BIT(12) |
|---|
| 161 | | -#define NFP_IMB_TGTADDRESSMODECFG_ADDRMODE_32_BIT 0 |
|---|
| 162 | | -#define NFP_IMB_TGTADDRESSMODECFG_ADDRMODE_40_BIT BIT(12) |
|---|
| 163 | | - |
|---|
| 164 | | -static int nfp_mip_mu_locality_lsb(struct nfp_cpp *cpp) |
|---|
| 165 | | -{ |
|---|
| 166 | | - unsigned int mode, addr40; |
|---|
| 167 | | - u32 xpbaddr, imbcppat; |
|---|
| 168 | | - int err; |
|---|
| 169 | | - |
|---|
| 170 | | - /* Hardcoded XPB IMB Base, island 0 */ |
|---|
| 171 | | - xpbaddr = 0x000a0000 + NFP_CPP_TARGET_MU * 4; |
|---|
| 172 | | - err = nfp_xpb_readl(cpp, xpbaddr, &imbcppat); |
|---|
| 173 | | - if (err < 0) |
|---|
| 174 | | - return err; |
|---|
| 175 | | - |
|---|
| 176 | | - mode = NFP_IMB_TGTADDRESSMODECFG_MODE_of(imbcppat); |
|---|
| 177 | | - addr40 = !!(imbcppat & NFP_IMB_TGTADDRESSMODECFG_ADDRMODE); |
|---|
| 178 | | - |
|---|
| 179 | | - return nfp_cppat_mu_locality_lsb(mode, addr40); |
|---|
| 180 | 127 | } |
|---|
| 181 | 128 | |
|---|
| 182 | 129 | static unsigned int |
|---|
| .. | .. |
|---|
| 304 | 251 | *off = nffw_fwinfo_mip_offset_get(fwinfo); |
|---|
| 305 | 252 | |
|---|
| 306 | 253 | if (nffw_fwinfo_mip_mu_da_get(fwinfo)) { |
|---|
| 307 | | - int locality_off; |
|---|
| 308 | | - |
|---|
| 309 | | - if (NFP_CPP_ID_TARGET_of(*cpp_id) != NFP_CPP_TARGET_MU) |
|---|
| 310 | | - return 0; |
|---|
| 311 | | - |
|---|
| 312 | | - locality_off = nfp_mip_mu_locality_lsb(state->cpp); |
|---|
| 313 | | - if (locality_off < 0) |
|---|
| 314 | | - return locality_off; |
|---|
| 254 | + int locality_off = nfp_cpp_mu_locality_lsb(state->cpp); |
|---|
| 315 | 255 | |
|---|
| 316 | 256 | *off &= ~(NFP_MU_ADDR_ACCESS_TYPE_MASK << locality_off); |
|---|
| 317 | 257 | *off |= NFP_MU_ADDR_ACCESS_TYPE_DIRECT << locality_off; |
|---|