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;
72 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
74 * Get raw device ID from PCI address string like 'Domain:Bus:Dev.Func'
77 * The PCI address of specified Intel FPGA device.
79 * The buffer to output device ID.
81 * - (0) if successful.
82 * - (-EINVAL) if bad parameter.
83 * - (-ENODEV) if FPGA is not probed by ifpga driver.
87 rte_pmd_ifpga_get_dev_id(const char *pci_addr, uint16_t *dev_id);
91 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
93 * Get current RSU status of the specified Intel FPGA device
96 * The raw device ID of specified Intel FPGA device.
98 * The buffer to output RSU status.
100 * The buffer to output RSU progress.
102 * - (0) if successful.
103 * - (-ENODEV) if dev_id is invalid.
104 * - (-ENOMEM) if share data is not initialized.
108 rte_pmd_ifpga_get_rsu_status(uint16_t dev_id, uint32_t *stat, uint32_t *prog);
112 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
114 * Set current RSU status of the specified Intel FPGA device
117 * The raw device ID of specified Intel FPGA device.
119 * The RSU status value to set.
121 * The RSU progress value to set.
123 * - (0) if successful.
124 * - (-ENODEV) if dev_id is invalid.
125 * - (-ENOMEM) if share data is not initialized.
129 rte_pmd_ifpga_set_rsu_status(uint16_t dev_id, uint32_t stat, uint32_t prog);
133 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
135 * Get FPGA property of specified Intel FPGA device
138 * The raw device ID of specified Intel FPGA device.
140 * The data pointer of FPGA property buffer.
142 * - (0) if successful.
143 * - (-ENODEV) if dev_id is invalid.
144 * - (-EBUSY) if FPGA is rebooting.
145 * - (-EIO) if failed to access hardware.
149 rte_pmd_ifpga_get_property(uint16_t dev_id, rte_pmd_ifpga_prop *prop);
153 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
155 * Get PHY information of specified Intel FPGA device
158 * The raw device ID of specified Intel FPGA device.
160 * The data pointer of PHY information buffer.
162 * - (0) if successful.
163 * - (-ENODEV) if dev_id is invalid.
164 * - (-EBUSY) if FPGA is rebooting.
165 * - (-EIO) if failed to access hardware.
169 rte_pmd_ifpga_get_phy_info(uint16_t dev_id, rte_pmd_ifpga_phy_info *info);
173 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
175 * Update image flash of specified Intel FPGA device
178 * The raw device ID of specified Intel FPGA device.
180 * The image file name string.
182 * The detailed update status for debug.
184 * - (0) if successful.
185 * - (-ENODEV) if dev_id is invalid.
186 * - (-EINVAL) if bad parameter or staging area is not initialized.
187 * - (-EBUSY) if FPGA is updating or rebooting.
188 * - (-EIO) if failed to open image file.
192 rte_pmd_ifpga_update_flash(uint16_t dev_id, const char *image,
197 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
199 * Stop flash update of specified Intel FPGA device
202 * The raw device ID of specified Intel FPGA device.
204 * Abort the update process by writing register if set non-zero.
206 * - (0) if successful.
207 * - (-ENODEV) if dev_id is invalid.
208 * - (-EINVAL) if bad parameter.
209 * - (-EAGAIN) if failed with force.
213 rte_pmd_ifpga_stop_update(uint16_t dev_id, int force);
217 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
219 * Check current Intel FPGA status and change it to reboot status if it is idle
222 * The raw device ID of specified Intel FPGA device.
224 * - (0) if FPGA is ready to reboot.
225 * - (-ENODEV) if dev_id is invalid.
226 * - (-ENOMEM) if share data is not initialized.
227 * - (-EBUSY) if FPGA is updating or rebooting.
231 rte_pmd_ifpga_reboot_try(uint16_t dev_id);
235 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
237 * Trigger full reconfiguration of specified Intel FPGA device
240 * The raw device ID of specified Intel FPGA device.
242 * Select reconfiguration type.
243 * 0 - reconfigure FPGA only.
244 * 1 - reboot the whole card including FPGA.
246 * Select image from which flash partition.
247 * 0 - factory partition.
248 * 1 - user partition.
250 * - (0) if successful.
251 * - (-ENODEV) if dev_id is invalid.
252 * - (-EINVAL) if bad parameter.
253 * - (-EBUSY) if failed to access BMC register.
257 rte_pmd_ifpga_reload(uint16_t dev_id, int type, int page);
261 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
263 * Get PCI bus the Intel FPGA driver register to
266 * - (valid pointer) if successful.
267 * - (NULL) if the Intel FPGA driver is not registered to any PCI bus.
270 const struct rte_pci_bus *
271 rte_pmd_ifpga_get_pci_bus(void);
275 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
277 * Perform PR (partial reconfiguration) on specified Intel FPGA device
280 * The raw device ID of specified Intel FPGA device.
282 * The port index of the partial reconfiguration area.
284 * The GBS (Green BitStream) image file name string.
286 * - (0) if successful.
287 * - (-EINVAL) if bad parameter or operation failed.
288 * - (-ENOMEM) if failed to allocate memory.
292 rte_pmd_ifpga_partial_reconfigure(uint16_t dev_id, int port, const char *file);
296 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
298 * Free software resources allocated by Intel FPGA PMD
302 rte_pmd_ifpga_cleanup(void);
308 #endif /* _RTE_PMD_IFPGA_H_ */