net/ngbe: initialize and validate EEPROM
[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_HI_COMMAND_TIMEOUT        5000 /* Process HI command limit */
14
15 /* CEM Support */
16 #define FW_CEM_MAX_RETRIES              3
17 #define FW_CEM_RESP_STATUS_SUCCESS      0x1
18 #define FW_DEFAULT_CHECKSUM             0xFF /* checksum always 0xFF */
19 #define FW_EEPROM_CHECK_STATUS          0xE9
20
21 #define FW_CHECKSUM_CAP_ST_PASS 0x80658383
22 #define FW_CHECKSUM_CAP_ST_FAIL 0x70657376
23
24 /* Host Interface Command Structures */
25 struct ngbe_hic_hdr {
26         u8 cmd;
27         u8 buf_len;
28         union {
29                 u8 cmd_resv;
30                 u8 ret_status;
31         } cmd_or_resp;
32         u8 checksum;
33 };
34
35 struct ngbe_hic_hdr2_req {
36         u8 cmd;
37         u8 buf_lenh;
38         u8 buf_lenl;
39         u8 checksum;
40 };
41
42 struct ngbe_hic_hdr2_rsp {
43         u8 cmd;
44         u8 buf_lenl;
45         u8 ret_status;     /* 7-5: high bits of buf_len, 4-0: status */
46         u8 checksum;
47 };
48
49 union ngbe_hic_hdr2 {
50         struct ngbe_hic_hdr2_req req;
51         struct ngbe_hic_hdr2_rsp rsp;
52 };
53
54 /* These need to be dword aligned */
55 struct ngbe_hic_read_shadow_ram {
56         union ngbe_hic_hdr2 hdr;
57         u32 address;
58         u16 length;
59         u16 pad2;
60         u16 data;
61         u16 pad3;
62 };
63
64 s32 ngbe_hic_check_cap(struct ngbe_hw *hw);
65 #endif /* _NGBE_MNG_H_ */