85 lines · c
1/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */2/* Copyright (C) 2015-2018 Netronome Systems, Inc. */3 4/*5 * nfp.h6 * Interface for NFP device access and query functions.7 */8 9#ifndef __NFP_H__10#define __NFP_H__11 12#include <linux/device.h>13#include <linux/types.h>14 15#include "nfp_cpp.h"16 17/* Implemented in nfp_hwinfo.c */18 19struct nfp_hwinfo;20struct nfp_hwinfo *nfp_hwinfo_read(struct nfp_cpp *cpp);21const char *nfp_hwinfo_lookup(struct nfp_hwinfo *hwinfo, const char *lookup);22char *nfp_hwinfo_get_packed_strings(struct nfp_hwinfo *hwinfo);23u32 nfp_hwinfo_get_packed_str_size(struct nfp_hwinfo *hwinfo);24 25/* Implemented in nfp_nsp.c, low level functions */26 27struct nfp_nsp;28 29struct nfp_cpp *nfp_nsp_cpp(struct nfp_nsp *state);30bool nfp_nsp_config_modified(struct nfp_nsp *state);31void nfp_nsp_config_set_modified(struct nfp_nsp *state, bool modified);32void *nfp_nsp_config_entries(struct nfp_nsp *state);33unsigned int nfp_nsp_config_idx(struct nfp_nsp *state);34void nfp_nsp_config_set_state(struct nfp_nsp *state, void *entries,35 unsigned int idx);36void nfp_nsp_config_clear_state(struct nfp_nsp *state);37int nfp_nsp_read_eth_table(struct nfp_nsp *state, void *buf, unsigned int size);38int nfp_nsp_write_eth_table(struct nfp_nsp *state,39 const void *buf, unsigned int size);40int nfp_nsp_read_identify(struct nfp_nsp *state, void *buf, unsigned int size);41int nfp_nsp_read_sensors(struct nfp_nsp *state, unsigned int sensor_mask,42 void *buf, unsigned int size);43 44/* Implemented in nfp_resource.c */45 46/* All keys are CRC32-POSIX of the 8-byte identification string */47 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"53 54/* NFP Hardware Info Database */55#define NFP_RESOURCE_NFP_HWINFO "nfp.info"56 57/* Service Processor */58#define NFP_RESOURCE_NSP "nfp.sp"59#define NFP_RESOURCE_NSP_DIAG "arm.diag"60 61/* Netronone Flow Firmware Table */62#define NFP_RESOURCE_NFP_NFFW "nfp.nffw"63 64/* MAC Statistics Accumulator */65#define NFP_RESOURCE_MAC_STATISTICS "mac.stat"66 67int nfp_resource_table_init(struct nfp_cpp *cpp);68 69struct nfp_resource *70nfp_resource_acquire(struct nfp_cpp *cpp, const char *name);71 72void nfp_resource_release(struct nfp_resource *res);73 74int nfp_resource_wait(struct nfp_cpp *cpp, const char *name, unsigned int secs);75 76u32 nfp_resource_cpp_id(struct nfp_resource *res);77 78const char *nfp_resource_name(struct nfp_resource *res);79 80u64 nfp_resource_address(struct nfp_resource *res);81 82u64 nfp_resource_size(struct nfp_resource *res);83 84#endif /* !__NFP_H__ */85