]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nffw.h
Merge tag 'mlx5-updates-2017-06-27' of git://git.kernel.org/pub/scm/linux/kernel...
[mirror_ubuntu-artful-kernel.git] / drivers / net / ethernet / netronome / nfp / nfpcore / nfp_nffw.h
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 */
33
34 /*
35 * nfp_nffw.h
36 * Authors: Jason McMullan <jason.mcmullan@netronome.com>
37 * Francois H. Theron <francois.theron@netronome.com>
38 */
39
40 #ifndef NFP_NFFW_H
41 #define NFP_NFFW_H
42
43 /* Implemented in nfp_nffw.c */
44
45 struct nfp_nffw_info;
46
47 struct nfp_nffw_info *nfp_nffw_info_open(struct nfp_cpp *cpp);
48 void nfp_nffw_info_close(struct nfp_nffw_info *state);
49 int nfp_nffw_info_mip_first(struct nfp_nffw_info *state, u32 *cpp_id, u64 *off);
50
51 /* Implemented in nfp_mip.c */
52
53 struct nfp_mip;
54
55 const struct nfp_mip *nfp_mip_open(struct nfp_cpp *cpp);
56 void nfp_mip_close(const struct nfp_mip *mip);
57
58 const char *nfp_mip_name(const struct nfp_mip *mip);
59 void nfp_mip_symtab(const struct nfp_mip *mip, u32 *addr, u32 *size);
60 void nfp_mip_strtab(const struct nfp_mip *mip, u32 *addr, u32 *size);
61
62 /* Implemented in nfp_rtsym.c */
63
64 #define NFP_RTSYM_TYPE_NONE 0
65 #define NFP_RTSYM_TYPE_OBJECT 1
66 #define NFP_RTSYM_TYPE_FUNCTION 2
67 #define NFP_RTSYM_TYPE_ABS 3
68
69 #define NFP_RTSYM_TARGET_NONE 0
70 #define NFP_RTSYM_TARGET_LMEM -1
71 #define NFP_RTSYM_TARGET_EMU_CACHE -7
72
73 /**
74 * struct nfp_rtsym - RTSYM descriptor
75 * @name: Symbol name
76 * @addr: Address in the domain/target's address space
77 * @size: Size (in bytes) of the symbol
78 * @type: NFP_RTSYM_TYPE_* of the symbol
79 * @target: CPP Target identifier, or NFP_RTSYM_TARGET_*
80 * @domain: CPP Target Domain (island)
81 */
82 struct nfp_rtsym {
83 const char *name;
84 u64 addr;
85 u64 size;
86 int type;
87 int target;
88 int domain;
89 };
90
91 struct nfp_rtsym_table;
92
93 struct nfp_rtsym_table *nfp_rtsym_table_read(struct nfp_cpp *cpp);
94 struct nfp_rtsym_table *
95 __nfp_rtsym_table_read(struct nfp_cpp *cpp, const struct nfp_mip *mip);
96 int nfp_rtsym_count(struct nfp_rtsym_table *rtbl);
97 const struct nfp_rtsym *nfp_rtsym_get(struct nfp_rtsym_table *rtbl, int idx);
98 const struct nfp_rtsym *
99 nfp_rtsym_lookup(struct nfp_rtsym_table *rtbl, const char *name);
100
101 u64 nfp_rtsym_read_le(struct nfp_rtsym_table *rtbl, const char *name,
102 int *error);
103 u8 __iomem *
104 nfp_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 */