dd63df2bff
Firmware has symbols helping to configure things like number of PF ports, vNIC BARs addresses inside NFP memories, or ethernet link state. Different firmware apps have different things to map and likely different internal NFP addresses to use. Host drivers can use the NSPU interface for getting symbol data regarding different hardware configurations. Once the driver has the information about a specific object, a mapping is required configuring an NFP expansion bar creating a device PCI bar window. Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
80 lines
3.3 KiB
C
80 lines
3.3 KiB
C
/*
|
|
* Copyright (c) 2017 Netronome Systems, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions are met:
|
|
*
|
|
* 1. Redistributions of source code must retain the above copyright notice,
|
|
* this list of conditions and the following disclaimer.
|
|
*
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
* documentation and/or other materials provided with the distribution
|
|
*
|
|
* 3. Neither the name of the copyright holder nor the names of its
|
|
* contributors may be used to endorse or promote products derived from this
|
|
* software without specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
*/
|
|
|
|
/*
|
|
* vim:shiftwidth=8:noexpandtab
|
|
*
|
|
* @file dpdk/pmd/nfp_nspu.h
|
|
*
|
|
* Netronome NFP_NET PDM driver
|
|
*/
|
|
|
|
/*
|
|
* NSP is the NFP Service Processor. NSPU is NSP Userspace interface.
|
|
*
|
|
* NFP NSP helps with firmware/hardware configuration. NSP is another component
|
|
* in NFP programmable processor and accessing it from host requires to firstly
|
|
* configure a specific NFP PCI expansion BAR.
|
|
*
|
|
* Once access is ready, configuration can be done reading and writing
|
|
* from/to a specific PF PCI BAR window. This same interface will allow to
|
|
* create other PCI BAR windows for accessing other NFP components.
|
|
*
|
|
* This file includes low-level functions, using the NSPU interface, and high
|
|
* level functions, invoked by the PMD for using NSP services. This allows
|
|
* firmware upload, vNIC PCI BARs mapping and other low-level configurations
|
|
* like link setup.
|
|
*
|
|
* NSP access is done during initialization and it is not involved at all with
|
|
* the fast path.
|
|
*/
|
|
|
|
typedef struct {
|
|
int nfp; /* NFP device */
|
|
int pcie_bar; /* PF PCI BAR to work with */
|
|
int exp_bar; /* Expansion BAR number used by NSPU */
|
|
int barsz; /* PCIE BAR log2 size */
|
|
uint64_t bufaddr; /* commands buffer address */
|
|
size_t buf_size; /* commands buffer size */
|
|
uint64_t windowsz; /* NSPU BAR window size */
|
|
void *cfg_base; /* Expansion BARs address */
|
|
void *mem_base; /* NSP interface */
|
|
} nspu_desc_t;
|
|
|
|
int nfp_nspu_init(nspu_desc_t *desc, int nfp, int pcie_bar, size_t pcie_barsz,
|
|
int exp_bar, void *exp_bar_cfg_base, void *exp_bar_mmap);
|
|
int nfp_nsp_get_abi_version(nspu_desc_t *desc, int *major, int *minor);
|
|
int nfp_fw_reset(nspu_desc_t *nspu_desc);
|
|
int nfp_fw_upload(nspu_desc_t *nspu_desc);
|
|
int nfp_nspu_set_bar_from_symbl(nspu_desc_t *desc, const char *symbl,
|
|
uint32_t expbar, uint64_t *pcie_offset,
|
|
ssize_t *size);
|