xref: /dpdk/drivers/net/nfp/nfpcore/nfp_cpp.h (revision 1fbe51cd9c3ad28f157cb0366147781d08e1cc4a)
1c7e9729dSAlejandro Lucero /* SPDX-License-Identifier: BSD-3-Clause
2c7e9729dSAlejandro Lucero  * Copyright(c) 2018 Netronome Systems, Inc.
3c7e9729dSAlejandro Lucero  * All rights reserved.
4c7e9729dSAlejandro Lucero  */
5c7e9729dSAlejandro Lucero 
6c7e9729dSAlejandro Lucero #ifndef __NFP_CPP_H__
7c7e9729dSAlejandro Lucero #define __NFP_CPP_H__
8c7e9729dSAlejandro Lucero 
9df96fd0dSBruce Richardson #include <ethdev_pci.h>
10ebf2ed72SAlejandro Lucero 
116d03aa61SChaoyong He /* NFP CPP handle */
12ff627b74SChaoyong He struct nfp_cpp;
13c7e9729dSAlejandro Lucero 
146d03aa61SChaoyong He /* NFP CPP device area handle */
15ff627b74SChaoyong He struct nfp_cpp_area;
16ff627b74SChaoyong He 
17ff627b74SChaoyong He #define NFP_SERIAL_LEN        6
18c7e9729dSAlejandro Lucero 
19fec10f21SChaoyong He #define NFP_CPP_NUM_TARGETS             16
20fec10f21SChaoyong He 
21*1fbe51cdSChaoyong He #define PCI_64BIT_BAR_COUNT             3
22*1fbe51cdSChaoyong He 
23c7e9729dSAlejandro Lucero /*
24c7e9729dSAlejandro Lucero  * NFP CPP operations structure
25c7e9729dSAlejandro Lucero  */
26c7e9729dSAlejandro Lucero struct nfp_cpp_operations {
27c7e9729dSAlejandro Lucero 	/* Size of priv area in struct nfp_cpp_area */
28c7e9729dSAlejandro Lucero 	size_t area_priv_size;
29c7e9729dSAlejandro Lucero 
30c7e9729dSAlejandro Lucero 	/* Instance an NFP CPP */
31*1fbe51cdSChaoyong He 	int (*init)(struct nfp_cpp *cpp);
32c7e9729dSAlejandro Lucero 
33c7e9729dSAlejandro Lucero 	/*
34c7e9729dSAlejandro Lucero 	 * Free the bus.
35c7e9729dSAlejandro Lucero 	 * Called only once, during nfp_cpp_unregister()
36c7e9729dSAlejandro Lucero 	 */
37c7e9729dSAlejandro Lucero 	void (*free)(struct nfp_cpp *cpp);
38c7e9729dSAlejandro Lucero 
39fec10f21SChaoyong He 	int (*get_interface)(struct rte_pci_device *dev,
40fec10f21SChaoyong He 			uint16_t *interface);
41fec10f21SChaoyong He 
42fec10f21SChaoyong He 	int (*get_serial)(struct rte_pci_device *dev,
43fec10f21SChaoyong He 			uint8_t *serial,
44fec10f21SChaoyong He 			size_t length);
45fec10f21SChaoyong He 
46c7e9729dSAlejandro Lucero 	/*
47c7e9729dSAlejandro Lucero 	 * Initialize a new NFP CPP area
48c7e9729dSAlejandro Lucero 	 * NOTE: This is _not_ serialized
49c7e9729dSAlejandro Lucero 	 */
50c7e9729dSAlejandro Lucero 	int (*area_init)(struct nfp_cpp_area *area,
51c7e9729dSAlejandro Lucero 			uint32_t dest,
52c69debceSChaoyong He 			uint64_t address,
53c69debceSChaoyong He 			size_t size);
54c7e9729dSAlejandro Lucero 	/*
55c7e9729dSAlejandro Lucero 	 * Clean up a NFP CPP area before it is freed
56c7e9729dSAlejandro Lucero 	 * NOTE: This is _not_ serialized
57c7e9729dSAlejandro Lucero 	 */
58c7e9729dSAlejandro Lucero 	void (*area_cleanup)(struct nfp_cpp_area *area);
59c7e9729dSAlejandro Lucero 
60c7e9729dSAlejandro Lucero 	/*
61c7e9729dSAlejandro Lucero 	 * Acquire resources for a NFP CPP area
62c7e9729dSAlejandro Lucero 	 * Serialized
63c7e9729dSAlejandro Lucero 	 */
64c7e9729dSAlejandro Lucero 	int (*area_acquire)(struct nfp_cpp_area *area);
65f842b01aSChaoyong He 
66c7e9729dSAlejandro Lucero 	/*
67c7e9729dSAlejandro Lucero 	 * Release resources for a NFP CPP area
68c7e9729dSAlejandro Lucero 	 * Serialized
69c7e9729dSAlejandro Lucero 	 */
70c7e9729dSAlejandro Lucero 	void (*area_release)(struct nfp_cpp_area *area);
71f842b01aSChaoyong He 
72c7e9729dSAlejandro Lucero 	/*
73c7e9729dSAlejandro Lucero 	 * Return a void IO pointer to a NFP CPP area
74c7e9729dSAlejandro Lucero 	 * NOTE: This is _not_ serialized
75c7e9729dSAlejandro Lucero 	 */
76c7e9729dSAlejandro Lucero 	void *(*area_iomem)(struct nfp_cpp_area *area);
77c7e9729dSAlejandro Lucero 
78c7e9729dSAlejandro Lucero 	/*
79c7e9729dSAlejandro Lucero 	 * Perform a read from a NFP CPP area
80c7e9729dSAlejandro Lucero 	 * Serialized
81c7e9729dSAlejandro Lucero 	 */
82c7e9729dSAlejandro Lucero 	int (*area_read)(struct nfp_cpp_area *area,
83c7e9729dSAlejandro Lucero 			void *kernel_vaddr,
84c69debceSChaoyong He 			uint32_t offset,
85c69debceSChaoyong He 			size_t length);
86c7e9729dSAlejandro Lucero 	/*
87c7e9729dSAlejandro Lucero 	 * Perform a write to a NFP CPP area
88c7e9729dSAlejandro Lucero 	 * Serialized
89c7e9729dSAlejandro Lucero 	 */
90c7e9729dSAlejandro Lucero 	int (*area_write)(struct nfp_cpp_area *area,
91c7e9729dSAlejandro Lucero 			const void *kernel_vaddr,
92c69debceSChaoyong He 			uint32_t offset,
93c69debceSChaoyong He 			size_t length);
94c7e9729dSAlejandro Lucero };
95c7e9729dSAlejandro Lucero 
96c7e9729dSAlejandro Lucero /*
97f507cf29SChaoyong He  * Wildcard indicating a CPP read or write action
98f507cf29SChaoyong He  *
99f507cf29SChaoyong He  * The action used will be either read or write depending on whether a read or
100f507cf29SChaoyong He  * write instruction/call is performed on the NFP_CPP_ID.  It is recommended that
101f507cf29SChaoyong He  * the RW action is used even if all actions to be performed on a NFP_CPP_ID are
102f507cf29SChaoyong He  * known to be only reads or writes. Doing so will in many cases save NFP CPP
103f507cf29SChaoyong He  * internal software resources.
104f507cf29SChaoyong He  */
105f507cf29SChaoyong He #define NFP_CPP_ACTION_RW 32
106f507cf29SChaoyong He 
107f507cf29SChaoyong He #define NFP_CPP_TARGET_ID_MASK 0x1f
108f507cf29SChaoyong He 
1096d03aa61SChaoyong He /**
110f507cf29SChaoyong He  * Pack target, token, and action into a CPP ID.
111f507cf29SChaoyong He  *
112f507cf29SChaoyong He  * Create a 32-bit CPP identifier representing the access to be made.
113f507cf29SChaoyong He  * These identifiers are used as parameters to other NFP CPP functions.
114f507cf29SChaoyong He  * Some CPP devices may allow wildcard identifiers to be specified.
115f507cf29SChaoyong He  *
1166d03aa61SChaoyong He  * @param target
1176d03aa61SChaoyong He  *   NFP CPP target id
1186d03aa61SChaoyong He  * @param action
1196d03aa61SChaoyong He  *   NFP CPP action id
1206d03aa61SChaoyong He  * @param token
1216d03aa61SChaoyong He  *   NFP CPP token id
122f507cf29SChaoyong He  *
1236d03aa61SChaoyong He  * @return
1246d03aa61SChaoyong He  *   NFP CPP ID
125f507cf29SChaoyong He  */
126f507cf29SChaoyong He #define NFP_CPP_ID(target, action, token)                               \
127f507cf29SChaoyong He 		((((target) & 0x7f) << 24) | (((token) & 0xff) << 16) | \
128f507cf29SChaoyong He 		(((action) & 0xff) << 8))
129f507cf29SChaoyong He 
1306d03aa61SChaoyong He /**
131f507cf29SChaoyong He  * Pack target, token, action, and island into a CPP ID.
132f507cf29SChaoyong He  *
133f507cf29SChaoyong He  * Create a 32-bit CPP identifier representing the access to be made.
134f507cf29SChaoyong He  * These identifiers are used as parameters to other NFP CPP functions.
135f507cf29SChaoyong He  * Some CPP devices may allow wildcard identifiers to be specified.
136f507cf29SChaoyong He  *
1376d03aa61SChaoyong He  * @param target
1386d03aa61SChaoyong He  *   NFP CPP target id
1396d03aa61SChaoyong He  * @param action
1406d03aa61SChaoyong He  *   NFP CPP action id
1416d03aa61SChaoyong He  * @param token
1426d03aa61SChaoyong He  *   NFP CPP token id
1436d03aa61SChaoyong He  * @param island
1446d03aa61SChaoyong He  *   NFP CPP island id
1456d03aa61SChaoyong He  *
1466d03aa61SChaoyong He  * @return
1476d03aa61SChaoyong He  *   NFP CPP ID
148f507cf29SChaoyong He  */
149f507cf29SChaoyong He #define NFP_CPP_ISLAND_ID(target, action, token, island)                \
150f507cf29SChaoyong He 		((((target) & 0x7f) << 24) | (((token) & 0xff) << 16) | \
151f507cf29SChaoyong He 		(((action) & 0xff) << 8) | (((island) & 0xff) << 0))
152f507cf29SChaoyong He 
153f507cf29SChaoyong He /**
154f507cf29SChaoyong He  * Return the NFP CPP target of a NFP CPP ID
155f507cf29SChaoyong He  *
1566d03aa61SChaoyong He  * @param id
1576d03aa61SChaoyong He  *   NFP CPP ID
1586d03aa61SChaoyong He  *
1596d03aa61SChaoyong He  * @return
1606d03aa61SChaoyong He  *   NFP CPP target
161f507cf29SChaoyong He  */
162f507cf29SChaoyong He static inline uint8_t
NFP_CPP_ID_TARGET_of(uint32_t id)163f507cf29SChaoyong He NFP_CPP_ID_TARGET_of(uint32_t id)
164f507cf29SChaoyong He {
165f507cf29SChaoyong He 	return (id >> 24) & NFP_CPP_TARGET_ID_MASK;
166f507cf29SChaoyong He }
167f507cf29SChaoyong He 
1686d03aa61SChaoyong He /**
169f507cf29SChaoyong He  * Return the NFP CPP token of a NFP CPP ID
170f507cf29SChaoyong He  *
1716d03aa61SChaoyong He  * @param id
1726d03aa61SChaoyong He  *   NFP CPP ID
1736d03aa61SChaoyong He  *
1746d03aa61SChaoyong He  * @return
1756d03aa61SChaoyong He  *   NFP CPP token
176f507cf29SChaoyong He  */
177f507cf29SChaoyong He static inline uint8_t
NFP_CPP_ID_TOKEN_of(uint32_t id)178f507cf29SChaoyong He NFP_CPP_ID_TOKEN_of(uint32_t id)
179f507cf29SChaoyong He {
180f507cf29SChaoyong He 	return (id >> 16) & 0xff;
181f507cf29SChaoyong He }
182f507cf29SChaoyong He 
1836d03aa61SChaoyong He /**
184f507cf29SChaoyong He  * Return the NFP CPP action of a NFP CPP ID
185f507cf29SChaoyong He  *
1866d03aa61SChaoyong He  * @param id
1876d03aa61SChaoyong He  *   NFP CPP ID
1886d03aa61SChaoyong He  *
1896d03aa61SChaoyong He  * @return
1906d03aa61SChaoyong He  *   NFP CPP action
191f507cf29SChaoyong He  */
192f507cf29SChaoyong He static inline uint8_t
NFP_CPP_ID_ACTION_of(uint32_t id)193f507cf29SChaoyong He NFP_CPP_ID_ACTION_of(uint32_t id)
194f507cf29SChaoyong He {
195f507cf29SChaoyong He 	return (id >> 8) & 0xff;
196f507cf29SChaoyong He }
197f507cf29SChaoyong He 
1986d03aa61SChaoyong He /**
199f507cf29SChaoyong He  * Return the NFP CPP island of a NFP CPP ID
200f507cf29SChaoyong He  *
2016d03aa61SChaoyong He  * @param id
2026d03aa61SChaoyong He  *   NFP CPP ID
2036d03aa61SChaoyong He  *
2046d03aa61SChaoyong He  * @return
2056d03aa61SChaoyong He  *   NFP CPP island
206f507cf29SChaoyong He  */
207f507cf29SChaoyong He static inline uint8_t
NFP_CPP_ID_ISLAND_of(uint32_t id)208f507cf29SChaoyong He NFP_CPP_ID_ISLAND_of(uint32_t id)
209f507cf29SChaoyong He {
210f507cf29SChaoyong He 	return id & 0xff;
211f507cf29SChaoyong He }
212f507cf29SChaoyong He 
213c7e9729dSAlejandro Lucero void nfp_cpp_model_set(struct nfp_cpp *cpp, uint32_t model);
214c7e9729dSAlejandro Lucero 
215c7e9729dSAlejandro Lucero void nfp_cpp_interface_set(struct nfp_cpp *cpp, uint32_t interface);
216c7e9729dSAlejandro Lucero 
217ff627b74SChaoyong He void nfp_cpp_serial_set(struct nfp_cpp *cpp, const uint8_t *serial,
218c7e9729dSAlejandro Lucero 		size_t serial_len);
219c7e9729dSAlejandro Lucero 
220c7e9729dSAlejandro Lucero void nfp_cpp_priv_set(struct nfp_cpp *cpp, void *priv);
221c7e9729dSAlejandro Lucero 
222c7e9729dSAlejandro Lucero void *nfp_cpp_priv(struct nfp_cpp *cpp);
223c7e9729dSAlejandro Lucero 
224c7e9729dSAlejandro Lucero void *nfp_cpp_area_priv(struct nfp_cpp_area *cpp_area);
225c7e9729dSAlejandro Lucero 
226588c5b10SChaoyong He uint32_t nfp_cpp_model_autodetect(struct nfp_cpp *cpp, uint32_t *model);
227c7e9729dSAlejandro Lucero 
2286d03aa61SChaoyong He /* NFP CPP core interface for CPP clients */
229ebf2ed72SAlejandro Lucero struct nfp_cpp *nfp_cpp_from_device_name(struct rte_pci_device *dev,
230796f1aecSChaoyong He 		void *priv, bool driver_lock_needed);
231c7e9729dSAlejandro Lucero 
232c7e9729dSAlejandro Lucero void nfp_cpp_free(struct nfp_cpp *cpp);
233c7e9729dSAlejandro Lucero 
234c7e9729dSAlejandro Lucero #define NFP_CPP_MODEL_INVALID   0xffffffff
235c7e9729dSAlejandro Lucero 
236c7e9729dSAlejandro Lucero uint32_t nfp_cpp_model(struct nfp_cpp *cpp);
237c7e9729dSAlejandro Lucero 
238c7e9729dSAlejandro Lucero /*
239c7e9729dSAlejandro Lucero  * NFP Interface types - logical interface for this CPP connection 4 bits are
240c7e9729dSAlejandro Lucero  * reserved for interface type.
241c7e9729dSAlejandro Lucero  */
242c7e9729dSAlejandro Lucero #define NFP_CPP_INTERFACE_TYPE_INVALID          0x0
243c7e9729dSAlejandro Lucero #define NFP_CPP_INTERFACE_TYPE_PCI              0x1
244c7e9729dSAlejandro Lucero #define NFP_CPP_INTERFACE_TYPE_ARM              0x2
245c7e9729dSAlejandro Lucero #define NFP_CPP_INTERFACE_TYPE_RPC              0x3
246c7e9729dSAlejandro Lucero #define NFP_CPP_INTERFACE_TYPE_ILA              0x4
247c7e9729dSAlejandro Lucero 
2486d03aa61SChaoyong He /**
249c7e9729dSAlejandro Lucero  * Construct a 16-bit NFP Interface ID
250c7e9729dSAlejandro Lucero  *
251c7e9729dSAlejandro Lucero  * Interface IDs consists of 4 bits of interface type, 4 bits of unit
252c7e9729dSAlejandro Lucero  * identifier, and 8 bits of channel identifier.
253c7e9729dSAlejandro Lucero  *
254c7e9729dSAlejandro Lucero  * The NFP Interface ID is used in the implementation of NFP CPP API mutexes,
255c7e9729dSAlejandro Lucero  * which use the MU Atomic CompareAndWrite operation - hence the limit to 16
256c7e9729dSAlejandro Lucero  * bits to be able to use the NFP Interface ID as a lock owner.
257c7e9729dSAlejandro Lucero  *
2586d03aa61SChaoyong He  * @param type
2596d03aa61SChaoyong He  *   NFP Interface Type
2606d03aa61SChaoyong He  * @param unit
2616d03aa61SChaoyong He  *   Unit identifier for the interface type
2626d03aa61SChaoyong He  * @param channel
2636d03aa61SChaoyong He  *   Channel identifier for the interface unit
2646d03aa61SChaoyong He  *
2656d03aa61SChaoyong He  * @return
2666d03aa61SChaoyong He  *   Interface ID
267c7e9729dSAlejandro Lucero  */
268c7e9729dSAlejandro Lucero #define NFP_CPP_INTERFACE(type, unit, channel) \
269c7e9729dSAlejandro Lucero 	((((type) & 0xf) << 12) | \
270c7e9729dSAlejandro Lucero 	 (((unit) & 0xf) <<  8) | \
271c7e9729dSAlejandro Lucero 	 (((channel) & 0xff) << 0))
272c7e9729dSAlejandro Lucero 
2736d03aa61SChaoyong He /**
274c7e9729dSAlejandro Lucero  * Get the interface type of a NFP Interface ID
2756d03aa61SChaoyong He  *
2766d03aa61SChaoyong He  * @param interface
2776d03aa61SChaoyong He  *   NFP Interface ID
2786d03aa61SChaoyong He  *
2796d03aa61SChaoyong He  * @return
2806d03aa61SChaoyong He  *   NFP Interface ID's type
281c7e9729dSAlejandro Lucero  */
282c7e9729dSAlejandro Lucero #define NFP_CPP_INTERFACE_TYPE_of(interface)	(((interface) >> 12) & 0xf)
283c7e9729dSAlejandro Lucero 
2846d03aa61SChaoyong He /**
285c7e9729dSAlejandro Lucero  * Get the interface unit of a NFP Interface ID
2866d03aa61SChaoyong He  *
2876d03aa61SChaoyong He  * @param interface
2886d03aa61SChaoyong He  *   NFP Interface ID
2896d03aa61SChaoyong He  *
2906d03aa61SChaoyong He  * @return
2916d03aa61SChaoyong He  *   NFP Interface ID's unit
292c7e9729dSAlejandro Lucero  */
293c7e9729dSAlejandro Lucero #define NFP_CPP_INTERFACE_UNIT_of(interface)	(((interface) >>  8) & 0xf)
294c7e9729dSAlejandro Lucero 
2956d03aa61SChaoyong He /**
296c7e9729dSAlejandro Lucero  * Get the interface channel of a NFP Interface ID
2976d03aa61SChaoyong He  *
2986d03aa61SChaoyong He  * @param interface
2996d03aa61SChaoyong He  *   NFP Interface ID
3006d03aa61SChaoyong He  *
3016d03aa61SChaoyong He  * @return
3026d03aa61SChaoyong He  *   NFP Interface ID's channel
303c7e9729dSAlejandro Lucero  */
304c7e9729dSAlejandro Lucero #define NFP_CPP_INTERFACE_CHANNEL_of(interface)	(((interface) >>  0) & 0xff)
305c7e9729dSAlejandro Lucero 
306796f1aecSChaoyong He /*
307796f1aecSChaoyong He  * Use this channel ID for multiple virtual channel interfaces
308796f1aecSChaoyong He  * (ie ARM and PCIe) when setting up the interface field.
309796f1aecSChaoyong He  */
310796f1aecSChaoyong He #define NFP_CPP_INTERFACE_CHANNEL_PEROPENER    255
311796f1aecSChaoyong He 
312c7e9729dSAlejandro Lucero uint16_t nfp_cpp_interface(struct nfp_cpp *cpp);
313c7e9729dSAlejandro Lucero 
314ff627b74SChaoyong He uint32_t nfp_cpp_serial(struct nfp_cpp *cpp, const uint8_t **serial);
315ff627b74SChaoyong He 
316ff627b74SChaoyong He bool nfp_cpp_driver_need_lock(const struct nfp_cpp *cpp);
317c7e9729dSAlejandro Lucero 
318c7e9729dSAlejandro Lucero struct nfp_cpp_area *nfp_cpp_area_alloc(struct nfp_cpp *cpp, uint32_t cpp_id,
319c69debceSChaoyong He 		uint64_t address, size_t size);
320c7e9729dSAlejandro Lucero 
321c7e9729dSAlejandro Lucero struct nfp_cpp_area *nfp_cpp_area_alloc_with_name(struct nfp_cpp *cpp,
322c69debceSChaoyong He 		uint32_t cpp_id, const char *name, uint64_t address,
323c69debceSChaoyong He 		uint32_t size);
324c7e9729dSAlejandro Lucero 
325c7e9729dSAlejandro Lucero void nfp_cpp_area_free(struct nfp_cpp_area *area);
326c7e9729dSAlejandro Lucero 
327c7e9729dSAlejandro Lucero int nfp_cpp_area_acquire(struct nfp_cpp_area *area);
328c7e9729dSAlejandro Lucero 
329c7e9729dSAlejandro Lucero void nfp_cpp_area_release(struct nfp_cpp_area *area);
330c7e9729dSAlejandro Lucero 
331c7e9729dSAlejandro Lucero struct nfp_cpp_area *nfp_cpp_area_alloc_acquire(struct nfp_cpp *cpp,
332c69debceSChaoyong He 		uint32_t cpp_id, uint64_t address, size_t size);
333c7e9729dSAlejandro Lucero 
334c7e9729dSAlejandro Lucero void nfp_cpp_area_release_free(struct nfp_cpp_area *area);
335c7e9729dSAlejandro Lucero 
336925c27ecSChaoyong He uint8_t *nfp_cpp_map_area(struct nfp_cpp *cpp, uint32_t cpp_id,
337c69debceSChaoyong He 		uint64_t addr, uint32_t size, struct nfp_cpp_area **area);
338c69debceSChaoyong He 
339c69debceSChaoyong He int nfp_cpp_area_read(struct nfp_cpp_area *area, uint32_t offset,
340588c5b10SChaoyong He 		void *address, size_t length);
341c7e9729dSAlejandro Lucero 
342c69debceSChaoyong He int nfp_cpp_area_write(struct nfp_cpp_area *area, uint32_t offset,
343588c5b10SChaoyong He 		const void *address, size_t length);
344c7e9729dSAlejandro Lucero 
345c7e9729dSAlejandro Lucero void *nfp_cpp_area_iomem(struct nfp_cpp_area *area);
346c7e9729dSAlejandro Lucero 
347c7e9729dSAlejandro Lucero struct nfp_cpp *nfp_cpp_area_cpp(struct nfp_cpp_area *cpp_area);
348c7e9729dSAlejandro Lucero 
349c7e9729dSAlejandro Lucero const char *nfp_cpp_area_name(struct nfp_cpp_area *cpp_area);
350c7e9729dSAlejandro Lucero 
351c7e9729dSAlejandro Lucero int nfp_cpp_read(struct nfp_cpp *cpp, uint32_t cpp_id,
352588c5b10SChaoyong He 		uint64_t address, void *buf, size_t length);
353c7e9729dSAlejandro Lucero 
354c7e9729dSAlejandro Lucero int nfp_cpp_write(struct nfp_cpp *cpp, uint32_t cpp_id,
355588c5b10SChaoyong He 		uint64_t address, const void *buf, size_t length);
356c7e9729dSAlejandro Lucero 
357c69debceSChaoyong He int nfp_cpp_area_readl(struct nfp_cpp_area *area, uint32_t offset,
358c7e9729dSAlejandro Lucero 		uint32_t *value);
359c7e9729dSAlejandro Lucero 
360c69debceSChaoyong He int nfp_cpp_area_writel(struct nfp_cpp_area *area, uint32_t offset,
361c7e9729dSAlejandro Lucero 		uint32_t value);
362c7e9729dSAlejandro Lucero 
363c69debceSChaoyong He int nfp_cpp_area_readq(struct nfp_cpp_area *area, uint32_t offset,
364c7e9729dSAlejandro Lucero 		uint64_t *value);
365c7e9729dSAlejandro Lucero 
366c69debceSChaoyong He int nfp_cpp_area_writeq(struct nfp_cpp_area *area, uint32_t offset,
367c7e9729dSAlejandro Lucero 		uint64_t value);
368c7e9729dSAlejandro Lucero 
369c7e9729dSAlejandro Lucero int nfp_xpb_writel(struct nfp_cpp *cpp, uint32_t xpb_tgt, uint32_t value);
370c7e9729dSAlejandro Lucero 
371c7e9729dSAlejandro Lucero int nfp_xpb_readl(struct nfp_cpp *cpp, uint32_t xpb_tgt, uint32_t *value);
372c7e9729dSAlejandro Lucero 
373c7e9729dSAlejandro Lucero int nfp_cpp_readl(struct nfp_cpp *cpp, uint32_t cpp_id,
374c69debceSChaoyong He 		uint64_t address, uint32_t *value);
375c7e9729dSAlejandro Lucero 
376c7e9729dSAlejandro Lucero int nfp_cpp_writel(struct nfp_cpp *cpp, uint32_t cpp_id,
377c69debceSChaoyong He 		uint64_t address, uint32_t value);
378c7e9729dSAlejandro Lucero 
379c7e9729dSAlejandro Lucero int nfp_cpp_readq(struct nfp_cpp *cpp, uint32_t cpp_id,
380c69debceSChaoyong He 		uint64_t address, uint64_t *value);
381c7e9729dSAlejandro Lucero 
382c7e9729dSAlejandro Lucero int nfp_cpp_writeq(struct nfp_cpp *cpp, uint32_t cpp_id,
383c69debceSChaoyong He 		uint64_t address, uint64_t value);
384c7e9729dSAlejandro Lucero 
385925c27ecSChaoyong He uint32_t nfp_cpp_mu_locality_lsb(struct nfp_cpp *cpp);
386925c27ecSChaoyong He 
3872cd8817aSChaoyong He #endif /* __NFP_CPP_H__ */
388