Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
0002 /* Copyright (C) 2015-2018 Netronome Systems, Inc. */
0003 
0004 /*
0005  * nfp_nffw.h
0006  * Authors: Jason McMullan <jason.mcmullan@netronome.com>
0007  *          Francois H. Theron <francois.theron@netronome.com>
0008  */
0009 
0010 #ifndef NFP_NFFW_H
0011 #define NFP_NFFW_H
0012 
0013 /* Implemented in nfp_nffw.c */
0014 
0015 struct nfp_nffw_info;
0016 
0017 struct nfp_nffw_info *nfp_nffw_info_open(struct nfp_cpp *cpp);
0018 void nfp_nffw_info_close(struct nfp_nffw_info *state);
0019 int nfp_nffw_info_mip_first(struct nfp_nffw_info *state, u32 *cpp_id, u64 *off);
0020 
0021 /* Implemented in nfp_mip.c */
0022 
0023 struct nfp_mip;
0024 
0025 const struct nfp_mip *nfp_mip_open(struct nfp_cpp *cpp);
0026 void nfp_mip_close(const struct nfp_mip *mip);
0027 
0028 const char *nfp_mip_name(const struct nfp_mip *mip);
0029 void nfp_mip_symtab(const struct nfp_mip *mip, u32 *addr, u32 *size);
0030 void nfp_mip_strtab(const struct nfp_mip *mip, u32 *addr, u32 *size);
0031 
0032 /* Implemented in nfp_rtsym.c */
0033 
0034 enum nfp_rtsym_type {
0035     NFP_RTSYM_TYPE_NONE = 0,
0036     NFP_RTSYM_TYPE_OBJECT   = 1,
0037     NFP_RTSYM_TYPE_FUNCTION = 2,
0038     NFP_RTSYM_TYPE_ABS  = 3,
0039 };
0040 
0041 #define NFP_RTSYM_TARGET_NONE       0
0042 #define NFP_RTSYM_TARGET_LMEM       -1
0043 #define NFP_RTSYM_TARGET_EMU_CACHE  -7
0044 
0045 /**
0046  * struct nfp_rtsym - RTSYM descriptor
0047  * @name:   Symbol name
0048  * @addr:   Address in the domain/target's address space
0049  * @size:   Size (in bytes) of the symbol
0050  * @type:   NFP_RTSYM_TYPE_* of the symbol
0051  * @target: CPP Target identifier, or NFP_RTSYM_TARGET_*
0052  * @domain: CPP Target Domain (island)
0053  */
0054 struct nfp_rtsym {
0055     const char *name;
0056     u64 addr;
0057     u64 size;
0058     enum nfp_rtsym_type type;
0059     int target;
0060     int domain;
0061 };
0062 
0063 struct nfp_rtsym_table;
0064 
0065 struct nfp_rtsym_table *nfp_rtsym_table_read(struct nfp_cpp *cpp);
0066 struct nfp_rtsym_table *
0067 __nfp_rtsym_table_read(struct nfp_cpp *cpp, const struct nfp_mip *mip);
0068 int nfp_rtsym_count(struct nfp_rtsym_table *rtbl);
0069 const struct nfp_rtsym *nfp_rtsym_get(struct nfp_rtsym_table *rtbl, int idx);
0070 const struct nfp_rtsym *
0071 nfp_rtsym_lookup(struct nfp_rtsym_table *rtbl, const char *name);
0072 
0073 u64 nfp_rtsym_size(const struct nfp_rtsym *rtsym);
0074 int __nfp_rtsym_read(struct nfp_cpp *cpp, const struct nfp_rtsym *sym,
0075              u8 action, u8 token, u64 off, void *buf, size_t len);
0076 int nfp_rtsym_read(struct nfp_cpp *cpp, const struct nfp_rtsym *sym, u64 off,
0077            void *buf, size_t len);
0078 int __nfp_rtsym_readl(struct nfp_cpp *cpp, const struct nfp_rtsym *sym,
0079               u8 action, u8 token, u64 off, u32 *value);
0080 int nfp_rtsym_readl(struct nfp_cpp *cpp, const struct nfp_rtsym *sym, u64 off,
0081             u32 *value);
0082 int __nfp_rtsym_readq(struct nfp_cpp *cpp, const struct nfp_rtsym *sym,
0083               u8 action, u8 token, u64 off, u64 *value);
0084 int nfp_rtsym_readq(struct nfp_cpp *cpp, const struct nfp_rtsym *sym, u64 off,
0085             u64 *value);
0086 int __nfp_rtsym_write(struct nfp_cpp *cpp, const struct nfp_rtsym *sym,
0087               u8 action, u8 token, u64 off, void *buf, size_t len);
0088 int nfp_rtsym_write(struct nfp_cpp *cpp, const struct nfp_rtsym *sym, u64 off,
0089             void *buf, size_t len);
0090 int __nfp_rtsym_writel(struct nfp_cpp *cpp, const struct nfp_rtsym *sym,
0091                u8 action, u8 token, u64 off, u32 value);
0092 int nfp_rtsym_writel(struct nfp_cpp *cpp, const struct nfp_rtsym *sym, u64 off,
0093              u32 value);
0094 int __nfp_rtsym_writeq(struct nfp_cpp *cpp, const struct nfp_rtsym *sym,
0095                u8 action, u8 token, u64 off, u64 value);
0096 int nfp_rtsym_writeq(struct nfp_cpp *cpp, const struct nfp_rtsym *sym, u64 off,
0097              u64 value);
0098 
0099 u64 nfp_rtsym_read_le(struct nfp_rtsym_table *rtbl, const char *name,
0100               int *error);
0101 int nfp_rtsym_write_le(struct nfp_rtsym_table *rtbl, const char *name,
0102                u64 value);
0103 u8 __iomem *
0104 nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name, const char *id,
0105           unsigned int min_size, struct nfp_cpp_area **area);
0106 
0107 #endif /* NFP_NFFW_H */