1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
2 /* Copyright (C) 2015-2018 Netronome Systems, Inc. */
6 * Interface for NFP device access and query functions.
12 #include <linux/device.h>
13 #include <linux/types.h>
17 /* Implemented in nfp_hwinfo.c */
20 struct nfp_hwinfo
*nfp_hwinfo_read(struct nfp_cpp
*cpp
);
21 const char *nfp_hwinfo_lookup(struct nfp_hwinfo
*hwinfo
, const char *lookup
);
22 char *nfp_hwinfo_get_packed_strings(struct nfp_hwinfo
*hwinfo
);
23 u32
nfp_hwinfo_get_packed_str_size(struct nfp_hwinfo
*hwinfo
);
25 /* Implemented in nfp_nsp.c, low level functions */
29 struct nfp_cpp
*nfp_nsp_cpp(struct nfp_nsp
*state
);
30 bool nfp_nsp_config_modified(struct nfp_nsp
*state
);
31 void nfp_nsp_config_set_modified(struct nfp_nsp
*state
, bool modified
);
32 void *nfp_nsp_config_entries(struct nfp_nsp
*state
);
33 unsigned int nfp_nsp_config_idx(struct nfp_nsp
*state
);
34 void nfp_nsp_config_set_state(struct nfp_nsp
*state
, void *entries
,
36 void nfp_nsp_config_clear_state(struct nfp_nsp
*state
);
37 int nfp_nsp_read_eth_table(struct nfp_nsp
*state
, void *buf
, unsigned int size
);
38 int nfp_nsp_write_eth_table(struct nfp_nsp
*state
,
39 const void *buf
, unsigned int size
);
40 int nfp_nsp_read_identify(struct nfp_nsp
*state
, void *buf
, unsigned int size
);
41 int nfp_nsp_read_sensors(struct nfp_nsp
*state
, unsigned int sensor_mask
,
42 void *buf
, unsigned int size
);
44 /* Implemented in nfp_resource.c */
46 /* All keys are CRC32-POSIX of the 8-byte identification string */
48 /* ARM/PCI vNIC Interfaces 0..3 */
49 #define NFP_RESOURCE_VNIC_PCI_0 "vnic.p0"
50 #define NFP_RESOURCE_VNIC_PCI_1 "vnic.p1"
51 #define NFP_RESOURCE_VNIC_PCI_2 "vnic.p2"
52 #define NFP_RESOURCE_VNIC_PCI_3 "vnic.p3"
54 /* NFP Hardware Info Database */
55 #define NFP_RESOURCE_NFP_HWINFO "nfp.info"
57 /* Service Processor */
58 #define NFP_RESOURCE_NSP "nfp.sp"
59 #define NFP_RESOURCE_NSP_DIAG "arm.diag"
61 /* Netronone Flow Firmware Table */
62 #define NFP_RESOURCE_NFP_NFFW "nfp.nffw"
64 /* MAC Statistics Accumulator */
65 #define NFP_RESOURCE_MAC_STATISTICS "mac.stat"
67 int nfp_resource_table_init(struct nfp_cpp
*cpp
);
70 nfp_resource_acquire(struct nfp_cpp
*cpp
, const char *name
);
72 void nfp_resource_release(struct nfp_resource
*res
);
74 int nfp_resource_wait(struct nfp_cpp
*cpp
, const char *name
, unsigned int secs
);
76 u32
nfp_resource_cpp_id(struct nfp_resource
*res
);
78 const char *nfp_resource_name(struct nfp_resource
*res
);
80 u64
nfp_resource_address(struct nfp_resource
*res
);
82 u64
nfp_resource_size(struct nfp_resource
*res
);
84 #endif /* !__NFP_H__ */