common/mlx5: add Direct Verbs constants for Windows
[dpdk.git] / drivers / net / ngbe / base / ngbe_mng.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018-2021 Beijing WangXun Technology Co., Ltd.
3  * Copyright(c) 2010-2017 Intel Corporation
4  */
5
6 #ifndef _NGBE_MNG_H_
7 #define _NGBE_MNG_H_
8
9 #include "ngbe_type.h"
10
11 #define NGBE_PMMBX_QSIZE       64 /* Num of dwords in range */
12 #define NGBE_PMMBX_BSIZE       (NGBE_PMMBX_QSIZE * 4)
13 #define NGBE_PMMBX_DATA_SIZE   (NGBE_PMMBX_BSIZE - FW_NVM_DATA_OFFSET * 4)
14 #define NGBE_HI_COMMAND_TIMEOUT        5000 /* Process HI command limit */
15
16 /* CEM Support */
17 #define FW_CEM_MAX_RETRIES              3
18 #define FW_CEM_RESP_STATUS_SUCCESS      0x1
19 #define FW_READ_SHADOW_RAM_CMD          0x31
20 #define FW_READ_SHADOW_RAM_LEN          0x6
21 #define FW_WRITE_SHADOW_RAM_CMD         0x33
22 #define FW_WRITE_SHADOW_RAM_LEN         0xA /* 8 plus 1 WORD to write */
23 #define FW_DEFAULT_CHECKSUM             0xFF /* checksum always 0xFF */
24 #define FW_NVM_DATA_OFFSET              3
25 #define FW_EEPROM_CHECK_STATUS          0xE9
26
27 #define FW_CHECKSUM_CAP_ST_PASS 0x80658383
28 #define FW_CHECKSUM_CAP_ST_FAIL 0x70657376
29
30 /* Host Interface Command Structures */
31 struct ngbe_hic_hdr {
32         u8 cmd;
33         u8 buf_len;
34         union {
35                 u8 cmd_resv;
36                 u8 ret_status;
37         } cmd_or_resp;
38         u8 checksum;
39 };
40
41 struct ngbe_hic_hdr2_req {
42         u8 cmd;
43         u8 buf_lenh;
44         u8 buf_lenl;
45         u8 checksum;
46 };
47
48 struct ngbe_hic_hdr2_rsp {
49         u8 cmd;
50         u8 buf_lenl;
51         u8 ret_status;     /* 7-5: high bits of buf_len, 4-0: status */
52         u8 checksum;
53 };
54
55 union ngbe_hic_hdr2 {
56         struct ngbe_hic_hdr2_req req;
57         struct ngbe_hic_hdr2_rsp rsp;
58 };
59
60 /* These need to be dword aligned */
61 struct ngbe_hic_read_shadow_ram {
62         union ngbe_hic_hdr2 hdr;
63         u32 address;
64         u16 length;
65         u16 pad2;
66         u16 data;
67         u16 pad3;
68 };
69
70 struct ngbe_hic_write_shadow_ram {
71         union ngbe_hic_hdr2 hdr;
72         u32 address;
73         u16 length;
74         u16 pad2;
75         u16 data;
76         u16 pad3;
77 };
78
79 s32 ngbe_hic_sr_read(struct ngbe_hw *hw, u32 addr, u8 *buf, int len);
80 s32 ngbe_hic_sr_write(struct ngbe_hw *hw, u32 addr, u8 *buf, int len);
81
82 s32 ngbe_hic_check_cap(struct ngbe_hw *hw);
83 #endif /* _NGBE_MNG_H_ */