xref: /openbmc/linux/include/linux/mlx5/mlx5_ifc_fpga.h (revision c43051d72a8dc4a00d49db27292a76d26e8df7af)
1e29341fbSIlan Tayari /*
2e29341fbSIlan Tayari  * Copyright (c) 2017, Mellanox Technologies, Ltd.  All rights reserved.
3e29341fbSIlan Tayari  *
4e29341fbSIlan Tayari  * This software is available to you under a choice of one of two
5e29341fbSIlan Tayari  * licenses.  You may choose to be licensed under the terms of the GNU
6e29341fbSIlan Tayari  * General Public License (GPL) Version 2, available from the file
7e29341fbSIlan Tayari  * COPYING in the main directory of this source tree, or the
8e29341fbSIlan Tayari  * OpenIB.org BSD license below:
9e29341fbSIlan Tayari  *
10e29341fbSIlan Tayari  *     Redistribution and use in source and binary forms, with or
11e29341fbSIlan Tayari  *     without modification, are permitted provided that the following
12e29341fbSIlan Tayari  *     conditions are met:
13e29341fbSIlan Tayari  *
14e29341fbSIlan Tayari  *      - Redistributions of source code must retain the above
15e29341fbSIlan Tayari  *        copyright notice, this list of conditions and the following
16e29341fbSIlan Tayari  *        disclaimer.
17e29341fbSIlan Tayari  *
18e29341fbSIlan Tayari  *      - Redistributions in binary form must reproduce the above
19e29341fbSIlan Tayari  *        copyright notice, this list of conditions and the following
20e29341fbSIlan Tayari  *        disclaimer in the documentation and/or other materials
21e29341fbSIlan Tayari  *        provided with the distribution.
22e29341fbSIlan Tayari  *
23e29341fbSIlan Tayari  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24e29341fbSIlan Tayari  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25e29341fbSIlan Tayari  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26e29341fbSIlan Tayari  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27e29341fbSIlan Tayari  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28e29341fbSIlan Tayari  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29e29341fbSIlan Tayari  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30e29341fbSIlan Tayari  * SOFTWARE.
31e29341fbSIlan Tayari  */
32e29341fbSIlan Tayari #ifndef MLX5_IFC_FPGA_H
33e29341fbSIlan Tayari #define MLX5_IFC_FPGA_H
34e29341fbSIlan Tayari 
35e29341fbSIlan Tayari struct mlx5_ifc_fpga_shell_caps_bits {
36e29341fbSIlan Tayari 	u8         max_num_qps[0x10];
37e29341fbSIlan Tayari 	u8         reserved_at_10[0x8];
38e29341fbSIlan Tayari 	u8         total_rcv_credits[0x8];
39e29341fbSIlan Tayari 
40e29341fbSIlan Tayari 	u8         reserved_at_20[0xe];
41e29341fbSIlan Tayari 	u8         qp_type[0x2];
42e29341fbSIlan Tayari 	u8         reserved_at_30[0x5];
43e29341fbSIlan Tayari 	u8         rae[0x1];
44e29341fbSIlan Tayari 	u8         rwe[0x1];
45e29341fbSIlan Tayari 	u8         rre[0x1];
46e29341fbSIlan Tayari 	u8         reserved_at_38[0x4];
47e29341fbSIlan Tayari 	u8         dc[0x1];
48e29341fbSIlan Tayari 	u8         ud[0x1];
49e29341fbSIlan Tayari 	u8         uc[0x1];
50e29341fbSIlan Tayari 	u8         rc[0x1];
51e29341fbSIlan Tayari 
52e29341fbSIlan Tayari 	u8         reserved_at_40[0x1a];
53e29341fbSIlan Tayari 	u8         log_ddr_size[0x6];
54e29341fbSIlan Tayari 
55e29341fbSIlan Tayari 	u8         max_fpga_qp_msg_size[0x20];
56e29341fbSIlan Tayari 
57e29341fbSIlan Tayari 	u8         reserved_at_80[0x180];
58e29341fbSIlan Tayari };
59e29341fbSIlan Tayari 
60e29341fbSIlan Tayari struct mlx5_ifc_fpga_cap_bits {
61e29341fbSIlan Tayari 	u8         fpga_id[0x8];
62e29341fbSIlan Tayari 	u8         fpga_device[0x18];
63e29341fbSIlan Tayari 
64e29341fbSIlan Tayari 	u8         register_file_ver[0x20];
65e29341fbSIlan Tayari 
66e29341fbSIlan Tayari 	u8         fpga_ctrl_modify[0x1];
67e29341fbSIlan Tayari 	u8         reserved_at_41[0x5];
68e29341fbSIlan Tayari 	u8         access_reg_query_mode[0x2];
69e29341fbSIlan Tayari 	u8         reserved_at_48[0x6];
70e29341fbSIlan Tayari 	u8         access_reg_modify_mode[0x2];
71e29341fbSIlan Tayari 	u8         reserved_at_50[0x10];
72e29341fbSIlan Tayari 
73e29341fbSIlan Tayari 	u8         reserved_at_60[0x20];
74e29341fbSIlan Tayari 
75e29341fbSIlan Tayari 	u8         image_version[0x20];
76e29341fbSIlan Tayari 
77e29341fbSIlan Tayari 	u8         image_date[0x20];
78e29341fbSIlan Tayari 
79e29341fbSIlan Tayari 	u8         image_time[0x20];
80e29341fbSIlan Tayari 
81e29341fbSIlan Tayari 	u8         shell_version[0x20];
82e29341fbSIlan Tayari 
83e29341fbSIlan Tayari 	u8         reserved_at_100[0x80];
84e29341fbSIlan Tayari 
85e29341fbSIlan Tayari 	struct mlx5_ifc_fpga_shell_caps_bits shell_caps;
86e29341fbSIlan Tayari 
87e29341fbSIlan Tayari 	u8         reserved_at_380[0x8];
88e29341fbSIlan Tayari 	u8         ieee_vendor_id[0x18];
89e29341fbSIlan Tayari 
90e29341fbSIlan Tayari 	u8         sandbox_product_version[0x10];
91e29341fbSIlan Tayari 	u8         sandbox_product_id[0x10];
92e29341fbSIlan Tayari 
93e29341fbSIlan Tayari 	u8         sandbox_basic_caps[0x20];
94e29341fbSIlan Tayari 
95e29341fbSIlan Tayari 	u8         reserved_at_3e0[0x10];
96e29341fbSIlan Tayari 	u8         sandbox_extended_caps_len[0x10];
97e29341fbSIlan Tayari 
98e29341fbSIlan Tayari 	u8         sandbox_extended_caps_addr[0x40];
99e29341fbSIlan Tayari 
100e29341fbSIlan Tayari 	u8         fpga_ddr_start_addr[0x40];
101e29341fbSIlan Tayari 
102e29341fbSIlan Tayari 	u8         fpga_cr_space_start_addr[0x40];
103e29341fbSIlan Tayari 
104e29341fbSIlan Tayari 	u8         fpga_ddr_size[0x20];
105e29341fbSIlan Tayari 
106e29341fbSIlan Tayari 	u8         fpga_cr_space_size[0x20];
107e29341fbSIlan Tayari 
108e29341fbSIlan Tayari 	u8         reserved_at_500[0x300];
109e29341fbSIlan Tayari };
110e29341fbSIlan Tayari 
111*c43051d7SIlan Tayari enum {
112*c43051d7SIlan Tayari 	MLX5_FPGA_CTRL_OPERATION_LOAD                = 0x1,
113*c43051d7SIlan Tayari 	MLX5_FPGA_CTRL_OPERATION_RESET               = 0x2,
114*c43051d7SIlan Tayari 	MLX5_FPGA_CTRL_OPERATION_FLASH_SELECT        = 0x3,
115*c43051d7SIlan Tayari 	MLX5_FPGA_CTRL_OPERATION_SANDBOX_BYPASS_ON   = 0x4,
116*c43051d7SIlan Tayari 	MLX5_FPGA_CTRL_OPERATION_SANDBOX_BYPASS_OFF  = 0x5,
117*c43051d7SIlan Tayari 	MLX5_FPGA_CTRL_OPERATION_RESET_SANDBOX       = 0x6,
118*c43051d7SIlan Tayari };
119*c43051d7SIlan Tayari 
120e29341fbSIlan Tayari struct mlx5_ifc_fpga_ctrl_bits {
121e29341fbSIlan Tayari 	u8         reserved_at_0[0x8];
122e29341fbSIlan Tayari 	u8         operation[0x8];
123e29341fbSIlan Tayari 	u8         reserved_at_10[0x8];
124e29341fbSIlan Tayari 	u8         status[0x8];
125e29341fbSIlan Tayari 
126e29341fbSIlan Tayari 	u8         reserved_at_20[0x8];
127e29341fbSIlan Tayari 	u8         flash_select_admin[0x8];
128e29341fbSIlan Tayari 	u8         reserved_at_30[0x8];
129e29341fbSIlan Tayari 	u8         flash_select_oper[0x8];
130e29341fbSIlan Tayari 
131e29341fbSIlan Tayari 	u8         reserved_at_40[0x40];
132e29341fbSIlan Tayari };
133e29341fbSIlan Tayari 
134e29341fbSIlan Tayari enum {
135e29341fbSIlan Tayari 	MLX5_FPGA_ERROR_EVENT_SYNDROME_CORRUPTED_DDR        = 0x1,
136e29341fbSIlan Tayari 	MLX5_FPGA_ERROR_EVENT_SYNDROME_FLASH_TIMEOUT        = 0x2,
137e29341fbSIlan Tayari 	MLX5_FPGA_ERROR_EVENT_SYNDROME_INTERNAL_LINK_ERROR  = 0x3,
138e29341fbSIlan Tayari 	MLX5_FPGA_ERROR_EVENT_SYNDROME_WATCHDOG_FAILURE     = 0x4,
139e29341fbSIlan Tayari 	MLX5_FPGA_ERROR_EVENT_SYNDROME_I2C_FAILURE          = 0x5,
140e29341fbSIlan Tayari 	MLX5_FPGA_ERROR_EVENT_SYNDROME_IMAGE_CHANGED        = 0x6,
141e29341fbSIlan Tayari 	MLX5_FPGA_ERROR_EVENT_SYNDROME_TEMPERATURE_CRITICAL = 0x7,
142e29341fbSIlan Tayari };
143e29341fbSIlan Tayari 
144e29341fbSIlan Tayari struct mlx5_ifc_fpga_error_event_bits {
145e29341fbSIlan Tayari 	u8         reserved_at_0[0x40];
146e29341fbSIlan Tayari 
147e29341fbSIlan Tayari 	u8         reserved_at_40[0x18];
148e29341fbSIlan Tayari 	u8         syndrome[0x8];
149e29341fbSIlan Tayari 
150e29341fbSIlan Tayari 	u8         reserved_at_60[0x80];
151e29341fbSIlan Tayari };
152e29341fbSIlan Tayari 
1536062118dSIlan Tayari enum mlx5_ifc_fpga_qp_state {
1546062118dSIlan Tayari 	MLX5_FPGA_QPC_STATE_INIT    = 0x0,
1556062118dSIlan Tayari 	MLX5_FPGA_QPC_STATE_ACTIVE  = 0x1,
1566062118dSIlan Tayari 	MLX5_FPGA_QPC_STATE_ERROR   = 0x2,
1576062118dSIlan Tayari };
1586062118dSIlan Tayari 
1596062118dSIlan Tayari enum mlx5_ifc_fpga_qp_type {
1606062118dSIlan Tayari 	MLX5_FPGA_QPC_QP_TYPE_SHELL_QP    = 0x0,
1616062118dSIlan Tayari 	MLX5_FPGA_QPC_QP_TYPE_SANDBOX_QP  = 0x1,
1626062118dSIlan Tayari };
1636062118dSIlan Tayari 
1646062118dSIlan Tayari enum mlx5_ifc_fpga_qp_service_type {
1656062118dSIlan Tayari 	MLX5_FPGA_QPC_ST_RC  = 0x0,
1666062118dSIlan Tayari };
1676062118dSIlan Tayari 
1686062118dSIlan Tayari struct mlx5_ifc_fpga_qpc_bits {
1696062118dSIlan Tayari 	u8         state[0x4];
1706062118dSIlan Tayari 	u8         reserved_at_4[0x1b];
1716062118dSIlan Tayari 	u8         qp_type[0x1];
1726062118dSIlan Tayari 
1736062118dSIlan Tayari 	u8         reserved_at_20[0x4];
1746062118dSIlan Tayari 	u8         st[0x4];
1756062118dSIlan Tayari 	u8         reserved_at_28[0x10];
1766062118dSIlan Tayari 	u8         traffic_class[0x8];
1776062118dSIlan Tayari 
1786062118dSIlan Tayari 	u8         ether_type[0x10];
1796062118dSIlan Tayari 	u8         prio[0x3];
1806062118dSIlan Tayari 	u8         dei[0x1];
1816062118dSIlan Tayari 	u8         vid[0xc];
1826062118dSIlan Tayari 
1836062118dSIlan Tayari 	u8         reserved_at_60[0x20];
1846062118dSIlan Tayari 
1856062118dSIlan Tayari 	u8         reserved_at_80[0x8];
1866062118dSIlan Tayari 	u8         next_rcv_psn[0x18];
1876062118dSIlan Tayari 
1886062118dSIlan Tayari 	u8         reserved_at_a0[0x8];
1896062118dSIlan Tayari 	u8         next_send_psn[0x18];
1906062118dSIlan Tayari 
1916062118dSIlan Tayari 	u8         reserved_at_c0[0x10];
1926062118dSIlan Tayari 	u8         pkey[0x10];
1936062118dSIlan Tayari 
1946062118dSIlan Tayari 	u8         reserved_at_e0[0x8];
1956062118dSIlan Tayari 	u8         remote_qpn[0x18];
1966062118dSIlan Tayari 
1976062118dSIlan Tayari 	u8         reserved_at_100[0x15];
1986062118dSIlan Tayari 	u8         rnr_retry[0x3];
1996062118dSIlan Tayari 	u8         reserved_at_118[0x5];
2006062118dSIlan Tayari 	u8         retry_count[0x3];
2016062118dSIlan Tayari 
2026062118dSIlan Tayari 	u8         reserved_at_120[0x20];
2036062118dSIlan Tayari 
2046062118dSIlan Tayari 	u8         reserved_at_140[0x10];
2056062118dSIlan Tayari 	u8         remote_mac_47_32[0x10];
2066062118dSIlan Tayari 
2076062118dSIlan Tayari 	u8         remote_mac_31_0[0x20];
2086062118dSIlan Tayari 
2096062118dSIlan Tayari 	u8         remote_ip[16][0x8];
2106062118dSIlan Tayari 
2116062118dSIlan Tayari 	u8         reserved_at_200[0x40];
2126062118dSIlan Tayari 
2136062118dSIlan Tayari 	u8         reserved_at_240[0x10];
2146062118dSIlan Tayari 	u8         fpga_mac_47_32[0x10];
2156062118dSIlan Tayari 
2166062118dSIlan Tayari 	u8         fpga_mac_31_0[0x20];
2176062118dSIlan Tayari 
2186062118dSIlan Tayari 	u8         fpga_ip[16][0x8];
2196062118dSIlan Tayari };
2206062118dSIlan Tayari 
2216062118dSIlan Tayari struct mlx5_ifc_fpga_create_qp_in_bits {
2226062118dSIlan Tayari 	u8         opcode[0x10];
2236062118dSIlan Tayari 	u8         reserved_at_10[0x10];
2246062118dSIlan Tayari 
2256062118dSIlan Tayari 	u8         reserved_at_20[0x10];
2266062118dSIlan Tayari 	u8         op_mod[0x10];
2276062118dSIlan Tayari 
2286062118dSIlan Tayari 	u8         reserved_at_40[0x40];
2296062118dSIlan Tayari 
2306062118dSIlan Tayari 	struct mlx5_ifc_fpga_qpc_bits fpga_qpc;
2316062118dSIlan Tayari };
2326062118dSIlan Tayari 
2336062118dSIlan Tayari struct mlx5_ifc_fpga_create_qp_out_bits {
2346062118dSIlan Tayari 	u8         status[0x8];
2356062118dSIlan Tayari 	u8         reserved_at_8[0x18];
2366062118dSIlan Tayari 
2376062118dSIlan Tayari 	u8         syndrome[0x20];
2386062118dSIlan Tayari 
2396062118dSIlan Tayari 	u8         reserved_at_40[0x8];
2406062118dSIlan Tayari 	u8         fpga_qpn[0x18];
2416062118dSIlan Tayari 
2426062118dSIlan Tayari 	u8         reserved_at_60[0x20];
2436062118dSIlan Tayari 
2446062118dSIlan Tayari 	struct mlx5_ifc_fpga_qpc_bits fpga_qpc;
2456062118dSIlan Tayari };
2466062118dSIlan Tayari 
2476062118dSIlan Tayari struct mlx5_ifc_fpga_modify_qp_in_bits {
2486062118dSIlan Tayari 	u8         opcode[0x10];
2496062118dSIlan Tayari 	u8         reserved_at_10[0x10];
2506062118dSIlan Tayari 
2516062118dSIlan Tayari 	u8         reserved_at_20[0x10];
2526062118dSIlan Tayari 	u8         op_mod[0x10];
2536062118dSIlan Tayari 
2546062118dSIlan Tayari 	u8         reserved_at_40[0x8];
2556062118dSIlan Tayari 	u8         fpga_qpn[0x18];
2566062118dSIlan Tayari 
2576062118dSIlan Tayari 	u8         field_select[0x20];
2586062118dSIlan Tayari 
2596062118dSIlan Tayari 	struct mlx5_ifc_fpga_qpc_bits fpga_qpc;
2606062118dSIlan Tayari };
2616062118dSIlan Tayari 
2626062118dSIlan Tayari struct mlx5_ifc_fpga_modify_qp_out_bits {
2636062118dSIlan Tayari 	u8         status[0x8];
2646062118dSIlan Tayari 	u8         reserved_at_8[0x18];
2656062118dSIlan Tayari 
2666062118dSIlan Tayari 	u8         syndrome[0x20];
2676062118dSIlan Tayari 
2686062118dSIlan Tayari 	u8         reserved_at_40[0x40];
2696062118dSIlan Tayari };
2706062118dSIlan Tayari 
2716062118dSIlan Tayari struct mlx5_ifc_fpga_query_qp_in_bits {
2726062118dSIlan Tayari 	u8         opcode[0x10];
2736062118dSIlan Tayari 	u8         reserved_at_10[0x10];
2746062118dSIlan Tayari 
2756062118dSIlan Tayari 	u8         reserved_at_20[0x10];
2766062118dSIlan Tayari 	u8         op_mod[0x10];
2776062118dSIlan Tayari 
2786062118dSIlan Tayari 	u8         reserved_at_40[0x8];
2796062118dSIlan Tayari 	u8         fpga_qpn[0x18];
2806062118dSIlan Tayari 
2816062118dSIlan Tayari 	u8         reserved_at_60[0x20];
2826062118dSIlan Tayari };
2836062118dSIlan Tayari 
2846062118dSIlan Tayari struct mlx5_ifc_fpga_query_qp_out_bits {
2856062118dSIlan Tayari 	u8         status[0x8];
2866062118dSIlan Tayari 	u8         reserved_at_8[0x18];
2876062118dSIlan Tayari 
2886062118dSIlan Tayari 	u8         syndrome[0x20];
2896062118dSIlan Tayari 
2906062118dSIlan Tayari 	u8         reserved_at_40[0x40];
2916062118dSIlan Tayari 
2926062118dSIlan Tayari 	struct mlx5_ifc_fpga_qpc_bits fpga_qpc;
2936062118dSIlan Tayari };
2946062118dSIlan Tayari 
2956062118dSIlan Tayari struct mlx5_ifc_fpga_query_qp_counters_in_bits {
2966062118dSIlan Tayari 	u8         opcode[0x10];
2976062118dSIlan Tayari 	u8         reserved_at_10[0x10];
2986062118dSIlan Tayari 
2996062118dSIlan Tayari 	u8         reserved_at_20[0x10];
3006062118dSIlan Tayari 	u8         op_mod[0x10];
3016062118dSIlan Tayari 
3026062118dSIlan Tayari 	u8         clear[0x1];
3036062118dSIlan Tayari 	u8         reserved_at_41[0x7];
3046062118dSIlan Tayari 	u8         fpga_qpn[0x18];
3056062118dSIlan Tayari 
3066062118dSIlan Tayari 	u8         reserved_at_60[0x20];
3076062118dSIlan Tayari };
3086062118dSIlan Tayari 
3096062118dSIlan Tayari struct mlx5_ifc_fpga_query_qp_counters_out_bits {
3106062118dSIlan Tayari 	u8         status[0x8];
3116062118dSIlan Tayari 	u8         reserved_at_8[0x18];
3126062118dSIlan Tayari 
3136062118dSIlan Tayari 	u8         syndrome[0x20];
3146062118dSIlan Tayari 
3156062118dSIlan Tayari 	u8         reserved_at_40[0x40];
3166062118dSIlan Tayari 
3176062118dSIlan Tayari 	u8         rx_ack_packets[0x40];
3186062118dSIlan Tayari 
3196062118dSIlan Tayari 	u8         rx_send_packets[0x40];
3206062118dSIlan Tayari 
3216062118dSIlan Tayari 	u8         tx_ack_packets[0x40];
3226062118dSIlan Tayari 
3236062118dSIlan Tayari 	u8         tx_send_packets[0x40];
3246062118dSIlan Tayari 
3256062118dSIlan Tayari 	u8         rx_total_drop[0x40];
3266062118dSIlan Tayari 
3276062118dSIlan Tayari 	u8         reserved_at_1c0[0x1c0];
3286062118dSIlan Tayari };
3296062118dSIlan Tayari 
3306062118dSIlan Tayari struct mlx5_ifc_fpga_destroy_qp_in_bits {
3316062118dSIlan Tayari 	u8         opcode[0x10];
3326062118dSIlan Tayari 	u8         reserved_at_10[0x10];
3336062118dSIlan Tayari 
3346062118dSIlan Tayari 	u8         reserved_at_20[0x10];
3356062118dSIlan Tayari 	u8         op_mod[0x10];
3366062118dSIlan Tayari 
3376062118dSIlan Tayari 	u8         reserved_at_40[0x8];
3386062118dSIlan Tayari 	u8         fpga_qpn[0x18];
3396062118dSIlan Tayari 
3406062118dSIlan Tayari 	u8         reserved_at_60[0x20];
3416062118dSIlan Tayari };
3426062118dSIlan Tayari 
3436062118dSIlan Tayari struct mlx5_ifc_fpga_destroy_qp_out_bits {
3446062118dSIlan Tayari 	u8         status[0x8];
3456062118dSIlan Tayari 	u8         reserved_at_8[0x18];
3466062118dSIlan Tayari 
3476062118dSIlan Tayari 	u8         syndrome[0x20];
3486062118dSIlan Tayari 
3496062118dSIlan Tayari 	u8         reserved_at_40[0x40];
3506062118dSIlan Tayari };
3516062118dSIlan Tayari 
352e29341fbSIlan Tayari #endif /* MLX5_IFC_FPGA_H */
353