1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2021 Intel Corporation
5 #ifndef _RTE_PMD_IFPGA_H_
6 #define _RTE_PMD_IFPGA_H_
9 * @file rte_pmd_ifpga.h
11 * ifpga PMD specific functions.
13 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
23 #define IFPGA_MAX_PORT_NUM 4
26 * UUID data structure.
33 * FME property data structure.
38 uint64_t bitstream_id;
39 uint64_t bitstream_metadata;
40 rte_pmd_ifpga_uuid pr_id;
42 uint32_t bmc_nios_version;
43 } rte_pmd_ifpga_common_prop;
46 * port property data structure.
49 rte_pmd_ifpga_uuid afu_id;
50 uint32_t type; /* AFU memory access control type */
51 } rte_pmd_ifpga_port_prop;
54 * FPGA property data structure.
57 rte_pmd_ifpga_common_prop common;
58 rte_pmd_ifpga_port_prop port[IFPGA_MAX_PORT_NUM];
62 * PHY information data structure.
65 uint32_t num_retimers;
68 } rte_pmd_ifpga_phy_info;
71 * Get raw device ID from PCI address string like 'Domain:Bus:Dev.Func'
74 * The PCI address of specified Intel FPGA device.
76 * The buffer to output device ID.
78 * - (0) if successful.
79 * - (-EINVAL) if bad parameter.
80 * - (-ENODEV) if FPGA is not probed by ifpga driver.
83 rte_pmd_ifpga_get_dev_id(const char *pci_addr, uint16_t *dev_id);
86 * Get current RSU status of the specified Intel FPGA device
89 * The raw device ID of specified Intel FPGA device.
91 * The buffer to output RSU status.
93 * The buffer to output RSU progress.
95 * - (0) if successful.
96 * - (-ENODEV) if dev_id is invalid.
97 * - (-ENOMEM) if share data is not initialized.
100 rte_pmd_ifpga_get_rsu_status(uint16_t dev_id, uint32_t *stat, uint32_t *prog);
103 * Set current RSU status of the specified Intel FPGA device
106 * The raw device ID of specified Intel FPGA device.
108 * The RSU status value to set.
110 * The RSU progress value to set.
112 * - (0) if successful.
113 * - (-ENODEV) if dev_id is invalid.
114 * - (-ENOMEM) if share data is not initialized.
117 rte_pmd_ifpga_set_rsu_status(uint16_t dev_id, uint32_t stat, uint32_t prog);
120 * Get FPGA property of specified Intel FPGA device
123 * The raw device ID of specified Intel FPGA device.
125 * The data pointer of FPGA property buffer.
127 * - (0) if successful.
128 * - (-ENODEV) if dev_id is invalid.
129 * - (-EBUSY) if FPGA is rebooting.
130 * - (-EIO) if failed to access hardware.
133 rte_pmd_ifpga_get_property(uint16_t dev_id, rte_pmd_ifpga_prop *prop);
136 * Get PHY information of specified Intel FPGA device
139 * The raw device ID of specified Intel FPGA device.
141 * The data pointer of PHY information buffer.
143 * - (0) if successful.
144 * - (-ENODEV) if dev_id is invalid.
145 * - (-EBUSY) if FPGA is rebooting.
146 * - (-EIO) if failed to access hardware.
149 rte_pmd_ifpga_get_phy_info(uint16_t dev_id, rte_pmd_ifpga_phy_info *info);
152 * Update image flash of specified Intel FPGA device
155 * The raw device ID of specified Intel FPGA device.
157 * The image file name string.
159 * The detailed update status for debug.
161 * - (0) if successful.
162 * - (-ENODEV) if dev_id is invalid.
163 * - (-EINVAL) if bad parameter or staging area is not initialized.
164 * - (-EBUSY) if FPGA is updating or rebooting.
165 * - (-EIO) if failed to open image file.
168 rte_pmd_ifpga_update_flash(uint16_t dev_id, const char *image,
172 * Stop flash update of specified Intel FPGA device
175 * The raw device ID of specified Intel FPGA device.
177 * Abort the update process by writing register if set non-zero.
179 * - (0) if successful.
180 * - (-ENODEV) if dev_id is invalid.
181 * - (-EINVAL) if bad parameter.
182 * - (-EAGAIN) if failed with force.
185 rte_pmd_ifpga_stop_update(uint16_t dev_id, int force);
188 * Check current Intel FPGA status and change it to reboot status if it is idle
191 * The raw device ID of specified Intel FPGA device.
193 * - (0) if FPGA is ready to reboot.
194 * - (-ENODEV) if dev_id is invalid.
195 * - (-ENOMEM) if share data is not initialized.
196 * - (-EBUSY) if FPGA is updating or rebooting.
199 rte_pmd_ifpga_reboot_try(uint16_t dev_id);
202 * Trigger full reconfiguration of specified Intel FPGA device
205 * The raw device ID of specified Intel FPGA device.
207 * Select reconfiguration type.
208 * 0 - reconfigure FPGA only.
209 * 1 - reboot the whole card including FPGA.
211 * Select image from which flash partition.
212 * 0 - factory partition.
213 * 1 - user partition.
215 * - (0) if successful.
216 * - (-ENODEV) if dev_id is invalid.
217 * - (-EINVAL) if bad parameter.
218 * - (-EBUSY) if failed to access BMC register.
221 rte_pmd_ifpga_reload(uint16_t dev_id, int type, int page);
224 * Get PCI bus the Intel FPGA driver register to
227 * - (valid pointer) if successful.
228 * - (NULL) if the Intel FPGA driver is not registered to any PCI bus.
230 const struct rte_pci_bus *
231 rte_pmd_ifpga_get_pci_bus(void);
234 * Perform PR (partial reconfiguration) on specified Intel FPGA device
237 * The raw device ID of specified Intel FPGA device.
239 * The port index of the partial reconfiguration area.
241 * The GBS (Green BitStream) image file name string.
243 * - (0) if successful.
244 * - (-EINVAL) if bad parameter or operation failed.
245 * - (-ENOMEM) if failed to allocate memory.
248 rte_pmd_ifpga_partial_reconfigure(uint16_t dev_id, int port, const char *file);
251 * Free software resources allocated by Intel FPGA PMD
254 rte_pmd_ifpga_cleanup(void);
260 #endif /* _RTE_PMD_IFPGA_H_ */