1 /* SPDX-License-Identifier: GPL-2.0
2  *
3  * Copyright 2019-2020 HabanaLabs, Ltd.
4  * All Rights Reserved.
5  *
6  */
7 
8 #ifndef GAUDI_FW_IF_H
9 #define GAUDI_FW_IF_H
10 
11 #define GAUDI_EVENT_QUEUE_MSI_IDX	8
12 #define GAUDI_NIC_PORT1_MSI_IDX		10
13 #define GAUDI_NIC_PORT3_MSI_IDX		12
14 #define GAUDI_NIC_PORT5_MSI_IDX		14
15 #define GAUDI_NIC_PORT7_MSI_IDX		16
16 #define GAUDI_NIC_PORT9_MSI_IDX		18
17 
18 #define UBOOT_FW_OFFSET			0x100000	/* 1MB in SRAM */
19 #define LINUX_FW_OFFSET			0x800000	/* 8MB in HBM */
20 
21 /* HBM thermal delta in [Deg] added to composite (CTemp) */
22 #define HBM_TEMP_ADJUST_COEFF		6
23 
24 enum gaudi_nic_axi_error {
25 	RXB,
26 	RXE,
27 	TXS,
28 	TXE,
29 	QPC_RESP,
30 	NON_AXI_ERR,
31 	TMR,
32 };
33 
34 /*
35  * struct eq_nic_sei_event - describes an AXI error cause.
36  * @axi_error_cause: one of the events defined in enum gaudi_nic_axi_error.
37  * @id: can be either 0 or 1, to further describe unit with interrupt cause
38  *      (i.e. TXE0 or TXE1).
39  * @pad[6]: padding structure to 64bit.
40  */
41 struct eq_nic_sei_event {
42 	__u8 axi_error_cause;
43 	__u8 id;
44 	__u8 pad[6];
45 };
46 
47 /*
48  * struct gaudi_nic_status - describes the status of a NIC port.
49  * @port: NIC port index.
50  * @bad_format_cnt: e.g. CRC.
51  * @responder_out_of_sequence_psn_cnt: e.g NAK.
52  * @high_ber_reinit_cnt: link reinit due to high BER.
53  * @correctable_err_cnt: e.g. bit-flip.
54  * @uncorrectable_err_cnt: e.g. MAC errors.
55  * @retraining_cnt: re-training counter.
56  * @up: is port up.
57  * @pcs_link: has PCS link.
58  * @phy_ready: is PHY ready.
59  * @auto_neg: is Autoneg enabled.
60  * @timeout_retransmission_cnt: timeout retransmission events
61  * @high_ber_cnt: high ber events
62  */
63 struct gaudi_nic_status {
64 	__u32 port;
65 	__u32 bad_format_cnt;
66 	__u32 responder_out_of_sequence_psn_cnt;
67 	__u32 high_ber_reinit;
68 	__u32 correctable_err_cnt;
69 	__u32 uncorrectable_err_cnt;
70 	__u32 retraining_cnt;
71 	__u8 up;
72 	__u8 pcs_link;
73 	__u8 phy_ready;
74 	__u8 auto_neg;
75 	__u32 timeout_retransmission_cnt;
76 	__u32 high_ber_cnt;
77 };
78 
79 struct gaudi_cold_rst_data {
80 	union {
81 		struct {
82 			u32 spsram_init_done : 1;
83 			u32 reserved : 31;
84 		};
85 		__le32 data;
86 	};
87 };
88 
89 #define GAUDI_PLL_FREQ_LOW		200000000 /* 200 MHz */
90 
91 #endif /* GAUDI_FW_IF_H */
92