1 /* SPDX-License-Identifier: GPL-2.0+ */
4 * Rich Ireland, Enterasys Networks, rireland@enterasys.com.
7 #include <linux/types.h> /* for ulong typedef */
12 #ifndef CONFIG_MAX_FPGA_DEVICES
13 #define CONFIG_MAX_FPGA_DEVICES 5
16 /* fpga_xxxx function return value definitions */
17 #define FPGA_SUCCESS 0
20 /* device numbers must be non-negative */
21 #define FPGA_INVALID_DEVICE -1
23 #define FPGA_ENC_DEV_KEY 0
24 #define FPGA_ENC_USR_KEY 1
25 #define FPGA_NO_ENC_OR_NO_AUTH 2
27 /* root data type defintions */
28 typedef enum { /* typedef fpga_type */
29 fpga_min_type, /* range check value */
30 fpga_xilinx, /* Xilinx Family) */
31 fpga_altera, /* unimplemented */
32 fpga_lattice, /* Lattice family */
33 fpga_undefined /* invalid range check value */
34 } fpga_type; /* end, typedef fpga_type */
36 typedef struct { /* typedef fpga_desc */
37 fpga_type devtype; /* switch value to select sub-functions */
38 void *devdesc; /* real device descriptor */
39 } fpga_desc; /* end, typedef fpga_desc */
41 typedef struct { /* typedef fpga_desc */
42 unsigned int blocksize;
49 struct fpga_secure_info {
61 /* root function definitions */
63 int fpga_add(fpga_type devtype, void *desc);
65 const fpga_desc *const fpga_get_desc(int devnum);
66 int fpga_is_partial_data(int devnum, size_t img_len);
67 int fpga_load(int devnum, const void *buf, size_t bsize,
68 bitstream_type bstype, int flags);
69 int fpga_fsload(int devnum, const void *buf, size_t size,
70 fpga_fs_info *fpga_fsinfo);
71 int fpga_loads(int devnum, const void *buf, size_t size,
72 struct fpga_secure_info *fpga_sec_info);
73 int fpga_loadbitstream(int devnum, char *fpgadata, size_t size,
74 bitstream_type bstype);
75 int fpga_dump(int devnum, const void *buf, size_t bsize);
76 int fpga_info(int devnum);
77 const fpga_desc *const fpga_validate(int devnum, const void *buf,
78 size_t bsize, char *fn);
79 int fpga_compatible2flag(int devnum, const char *compatible);