nfp_nffw.h (3786B)
1/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ 2/* Copyright (C) 2015-2018 Netronome Systems, Inc. */ 3 4/* 5 * nfp_nffw.h 6 * Authors: Jason McMullan <jason.mcmullan@netronome.com> 7 * Francois H. Theron <francois.theron@netronome.com> 8 */ 9 10#ifndef NFP_NFFW_H 11#define NFP_NFFW_H 12 13/* Implemented in nfp_nffw.c */ 14 15struct nfp_nffw_info; 16 17struct nfp_nffw_info *nfp_nffw_info_open(struct nfp_cpp *cpp); 18void nfp_nffw_info_close(struct nfp_nffw_info *state); 19int nfp_nffw_info_mip_first(struct nfp_nffw_info *state, u32 *cpp_id, u64 *off); 20 21/* Implemented in nfp_mip.c */ 22 23struct nfp_mip; 24 25const struct nfp_mip *nfp_mip_open(struct nfp_cpp *cpp); 26void nfp_mip_close(const struct nfp_mip *mip); 27 28const char *nfp_mip_name(const struct nfp_mip *mip); 29void nfp_mip_symtab(const struct nfp_mip *mip, u32 *addr, u32 *size); 30void nfp_mip_strtab(const struct nfp_mip *mip, u32 *addr, u32 *size); 31 32/* Implemented in nfp_rtsym.c */ 33 34enum nfp_rtsym_type { 35 NFP_RTSYM_TYPE_NONE = 0, 36 NFP_RTSYM_TYPE_OBJECT = 1, 37 NFP_RTSYM_TYPE_FUNCTION = 2, 38 NFP_RTSYM_TYPE_ABS = 3, 39}; 40 41#define NFP_RTSYM_TARGET_NONE 0 42#define NFP_RTSYM_TARGET_LMEM -1 43#define NFP_RTSYM_TARGET_EMU_CACHE -7 44 45/** 46 * struct nfp_rtsym - RTSYM descriptor 47 * @name: Symbol name 48 * @addr: Address in the domain/target's address space 49 * @size: Size (in bytes) of the symbol 50 * @type: NFP_RTSYM_TYPE_* of the symbol 51 * @target: CPP Target identifier, or NFP_RTSYM_TARGET_* 52 * @domain: CPP Target Domain (island) 53 */ 54struct nfp_rtsym { 55 const char *name; 56 u64 addr; 57 u64 size; 58 enum nfp_rtsym_type type; 59 int target; 60 int domain; 61}; 62 63struct nfp_rtsym_table; 64 65struct nfp_rtsym_table *nfp_rtsym_table_read(struct nfp_cpp *cpp); 66struct nfp_rtsym_table * 67__nfp_rtsym_table_read(struct nfp_cpp *cpp, const struct nfp_mip *mip); 68int nfp_rtsym_count(struct nfp_rtsym_table *rtbl); 69const struct nfp_rtsym *nfp_rtsym_get(struct nfp_rtsym_table *rtbl, int idx); 70const struct nfp_rtsym * 71nfp_rtsym_lookup(struct nfp_rtsym_table *rtbl, const char *name); 72 73u64 nfp_rtsym_size(const struct nfp_rtsym *rtsym); 74int __nfp_rtsym_read(struct nfp_cpp *cpp, const struct nfp_rtsym *sym, 75 u8 action, u8 token, u64 off, void *buf, size_t len); 76int nfp_rtsym_read(struct nfp_cpp *cpp, const struct nfp_rtsym *sym, u64 off, 77 void *buf, size_t len); 78int __nfp_rtsym_readl(struct nfp_cpp *cpp, const struct nfp_rtsym *sym, 79 u8 action, u8 token, u64 off, u32 *value); 80int nfp_rtsym_readl(struct nfp_cpp *cpp, const struct nfp_rtsym *sym, u64 off, 81 u32 *value); 82int __nfp_rtsym_readq(struct nfp_cpp *cpp, const struct nfp_rtsym *sym, 83 u8 action, u8 token, u64 off, u64 *value); 84int nfp_rtsym_readq(struct nfp_cpp *cpp, const struct nfp_rtsym *sym, u64 off, 85 u64 *value); 86int __nfp_rtsym_write(struct nfp_cpp *cpp, const struct nfp_rtsym *sym, 87 u8 action, u8 token, u64 off, void *buf, size_t len); 88int nfp_rtsym_write(struct nfp_cpp *cpp, const struct nfp_rtsym *sym, u64 off, 89 void *buf, size_t len); 90int __nfp_rtsym_writel(struct nfp_cpp *cpp, const struct nfp_rtsym *sym, 91 u8 action, u8 token, u64 off, u32 value); 92int nfp_rtsym_writel(struct nfp_cpp *cpp, const struct nfp_rtsym *sym, u64 off, 93 u32 value); 94int __nfp_rtsym_writeq(struct nfp_cpp *cpp, const struct nfp_rtsym *sym, 95 u8 action, u8 token, u64 off, u64 value); 96int nfp_rtsym_writeq(struct nfp_cpp *cpp, const struct nfp_rtsym *sym, u64 off, 97 u64 value); 98 99u64 nfp_rtsym_read_le(struct nfp_rtsym_table *rtbl, const char *name, 100 int *error); 101int nfp_rtsym_write_le(struct nfp_rtsym_table *rtbl, const char *name, 102 u64 value); 103u8 __iomem * 104nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name, const char *id, 105 unsigned int min_size, struct nfp_cpp_area **area); 106 107#endif /* NFP_NFFW_H */