Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
0002 /* Copyright (C) 2015-2017 Netronome Systems, Inc. */
0003 
0004 #ifndef NFP6000_NFP6000_H
0005 #define NFP6000_NFP6000_H
0006 
0007 #include <linux/errno.h>
0008 #include <linux/types.h>
0009 
0010 /* CPP Target IDs */
0011 #define NFP_CPP_TARGET_INVALID          0
0012 #define NFP_CPP_TARGET_NBI              1
0013 #define NFP_CPP_TARGET_QDR              2
0014 #define NFP_CPP_TARGET_ILA              6
0015 #define NFP_CPP_TARGET_MU               7
0016 #define NFP_CPP_TARGET_PCIE             9
0017 #define NFP_CPP_TARGET_ARM              10
0018 #define NFP_CPP_TARGET_CRYPTO           12
0019 #define NFP_CPP_TARGET_ISLAND_XPB       14      /* Shared with CAP */
0020 #define NFP_CPP_TARGET_ISLAND_CAP       14      /* Shared with XPB */
0021 #define NFP_CPP_TARGET_CT_XPB           14
0022 #define NFP_CPP_TARGET_LOCAL_SCRATCH    15
0023 #define NFP_CPP_TARGET_CLS              NFP_CPP_TARGET_LOCAL_SCRATCH
0024 
0025 #define NFP_ISL_EMEM0           24
0026 
0027 #define NFP_MU_ADDR_ACCESS_TYPE_MASK    3ULL
0028 #define NFP_MU_ADDR_ACCESS_TYPE_DIRECT  2ULL
0029 
0030 #define PUSHPULL(_pull, _push)      ((_pull) << 4 | (_push) << 0)
0031 #define PUSH_WIDTH(_pushpull)       pushpull_width((_pushpull) >> 0)
0032 #define PULL_WIDTH(_pushpull)       pushpull_width((_pushpull) >> 4)
0033 
0034 static inline int pushpull_width(int pp)
0035 {
0036     pp &= 0xf;
0037 
0038     if (pp == 0)
0039         return -EINVAL;
0040     return 2 << pp;
0041 }
0042 
0043 static inline int nfp_cppat_mu_locality_lsb(int mode, bool addr40)
0044 {
0045     switch (mode) {
0046     case 0 ... 3:
0047         return addr40 ? 38 : 30;
0048     default:
0049         return -EINVAL;
0050     }
0051 }
0052 
0053 int nfp_target_pushpull(u32 cpp_id, u64 address);
0054 int nfp_target_cpp(u32 cpp_island_id, u64 cpp_island_address,
0055            u32 *cpp_target_id, u64 *cpp_target_address,
0056            const u32 *imb_table);
0057 
0058 #endif /* NFP6000_NFP6000_H */