1/* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2018 Netronome Systems, Inc. 3 * All rights reserved. 4 */ 5 6#ifndef __NFP_RTSYM_H__ 7#define __NFP_RTSYM_H__ 8 9#define NFP_RTSYM_TYPE_NONE 0 10#define NFP_RTSYM_TYPE_OBJECT 1 11#define NFP_RTSYM_TYPE_FUNCTION 2 12#define NFP_RTSYM_TYPE_ABS 3 13 14#define NFP_RTSYM_TARGET_NONE 0 15#define NFP_RTSYM_TARGET_LMEM -1 16#define NFP_RTSYM_TARGET_EMU_CACHE -7 17 18/* 19 * Structure describing a run-time NFP symbol. 20 * 21 * The memory target of the symbol is generally the CPP target number and can be 22 * used directly by the nfp_cpp API calls. However, in some cases (i.e., for 23 * local memory or control store) the target is encoded using a negative number. 24 * 25 * When the target type can not be used to fully describe the location of a 26 * symbol the domain field is used to further specify the location (i.e., the 27 * specific ME or island number). 28 * 29 * For ME target resources, 'domain' is an MEID. 30 * For Island target resources, 'domain' is an island ID, with the one exception 31 * of "sram" symbols for backward compatibility, which are viewed as global. 32 */ 33struct nfp_rtsym { 34 const char *name; 35 uint64_t addr; 36 uint64_t size; 37 int type; 38 int target; 39 int domain; 40}; 41 42struct nfp_rtsym_table; 43 44struct nfp_rtsym_table *nfp_rtsym_table_read(struct nfp_cpp *cpp); 45 46struct nfp_rtsym_table * 47__nfp_rtsym_table_read(struct nfp_cpp *cpp, const struct nfp_mip *mip); 48 49int nfp_rtsym_count(struct nfp_rtsym_table *rtbl); 50 51const struct nfp_rtsym *nfp_rtsym_get(struct nfp_rtsym_table *rtbl, int idx); 52 53const struct nfp_rtsym * 54nfp_rtsym_lookup(struct nfp_rtsym_table *rtbl, const char *name); 55 56uint64_t nfp_rtsym_read_le(struct nfp_rtsym_table *rtbl, const char *name, 57 int *error); 58uint8_t * 59nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name, 60 unsigned int min_size, struct nfp_cpp_area **area); 61#endif 62