1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018-2019 Hisilicon Limited.
8 #define HNS3_PPP_MPF_ECC_ERR_INT0_EN 0xFFFFFFFF
9 #define HNS3_PPP_MPF_ECC_ERR_INT0_EN_MASK 0xFFFFFFFF
10 #define HNS3_PPP_MPF_ECC_ERR_INT1_EN 0xFFFFFFFF
11 #define HNS3_PPP_MPF_ECC_ERR_INT1_EN_MASK 0xFFFFFFFF
12 #define HNS3_PPP_PF_ERR_INT_EN 0x0003
13 #define HNS3_PPP_PF_ERR_INT_EN_MASK 0x0003
14 #define HNS3_PPP_MPF_ECC_ERR_INT2_EN 0x003F
15 #define HNS3_PPP_MPF_ECC_ERR_INT2_EN_MASK 0x003F
16 #define HNS3_PPP_MPF_ECC_ERR_INT3_EN 0x003F
17 #define HNS3_PPP_MPF_ECC_ERR_INT3_EN_MASK 0x003F
19 #define HNS3_MAC_COMMON_ERR_INT_EN 0x107FF
20 #define HNS3_MAC_COMMON_ERR_INT_EN_MASK 0x107FF
22 #define HNS3_IMP_TCM_ECC_ERR_INT_EN 0xFFFF0000
23 #define HNS3_IMP_TCM_ECC_ERR_INT_EN_MASK 0xFFFF0000
24 #define HNS3_IMP_ITCM4_ECC_ERR_INT_EN 0x300
25 #define HNS3_IMP_ITCM4_ECC_ERR_INT_EN_MASK 0x300
26 #define HNS3_IMP_RD_POISON_ERR_INT_EN 0x0100
27 #define HNS3_IMP_RD_POISON_ERR_INT_EN_MASK 0x0100
29 #define HNS3_CMDQ_NIC_ECC_ERR_INT_EN 0xFFFF
30 #define HNS3_CMDQ_NIC_ECC_ERR_INT_EN_MASK 0xFFFF
32 #define HNS3_TQP_ECC_ERR_INT_EN 0x0FFF
33 #define HNS3_TQP_ECC_ERR_INT_EN_MASK 0x0FFF
35 #define HNS3_MSIX_SRAM_ECC_ERR_INT_EN 0x0F000000
36 #define HNS3_MSIX_SRAM_ECC_ERR_INT_EN_MASK 0x0F000000
38 #define HNS3_PPU_MPF_ABNORMAL_INT0_EN GENMASK(31, 0)
39 #define HNS3_PPU_MPF_ABNORMAL_INT0_EN_MASK GENMASK(31, 0)
40 #define HNS3_PPU_MPF_ABNORMAL_INT1_EN GENMASK(31, 0)
41 #define HNS3_PPU_MPF_ABNORMAL_INT1_EN_MASK GENMASK(31, 0)
42 #define HNS3_PPU_MPF_ABNORMAL_INT2_EN 0x3FFF3FFF
43 #define HNS3_PPU_MPF_ABNORMAL_INT2_EN_MASK 0x3FFF3FFF
44 #define HNS3_PPU_MPF_ABNORMAL_INT2_EN2 0xB
45 #define HNS3_PPU_MPF_ABNORMAL_INT2_EN2_MASK 0xB
46 #define HNS3_PPU_MPF_ABNORMAL_INT3_EN GENMASK(7, 0)
47 #define HNS3_PPU_MPF_ABNORMAL_INT3_EN_MASK GENMASK(23, 16)
48 #define HNS3_PPU_PF_ABNORMAL_INT_EN GENMASK(5, 0)
49 #define HNS3_PPU_PF_ABNORMAL_INT_EN_MASK GENMASK(5, 0)
51 #define HNS3_SSU_1BIT_ECC_ERR_INT_EN GENMASK(31, 0)
52 #define HNS3_SSU_1BIT_ECC_ERR_INT_EN_MASK GENMASK(31, 0)
53 #define HNS3_SSU_MULTI_BIT_ECC_ERR_INT_EN GENMASK(31, 0)
54 #define HNS3_SSU_MULTI_BIT_ECC_ERR_INT_EN_MASK GENMASK(31, 0)
55 #define HNS3_SSU_BIT32_ECC_ERR_INT_EN 0x0101
56 #define HNS3_SSU_BIT32_ECC_ERR_INT_EN_MASK 0x0101
57 #define HNS3_SSU_COMMON_INT_EN GENMASK(9, 0)
58 #define HNS3_SSU_COMMON_INT_EN_MASK GENMASK(9, 0)
59 #define HNS3_SSU_PORT_BASED_ERR_INT_EN 0x0BFF
60 #define HNS3_SSU_PORT_BASED_ERR_INT_EN_MASK 0x0BFF0000
61 #define HNS3_SSU_FIFO_OVERFLOW_ERR_INT_EN GENMASK(23, 0)
62 #define HNS3_SSU_FIFO_OVERFLOW_ERR_INT_EN_MASK GENMASK(23, 0)
64 #define HNS3_IGU_ERR_INT_ENABLE 0x0000066F
65 #define HNS3_IGU_ERR_INT_DISABLE 0x00000660
66 #define HNS3_IGU_ERR_INT_EN_MASK 0x000F
67 #define HNS3_IGU_TNL_ERR_INT_EN 0x0002AABF
68 #define HNS3_IGU_TNL_ERR_INT_EN_MASK 0x003F
70 #define HNS3_NCSI_ERR_INT_EN 0x3
72 #define HNS3_TM_SCH_ECC_ERR_INT_EN 0x3
73 #define HNS3_TM_QCN_MEM_ERR_INT_EN 0xFFFFFF
75 #define HNS3_RESET_PROCESS_MS 200
79 int (*enable_err_intr)(struct hns3_adapter *hns, bool en);
82 struct hns3_hw_error {
85 enum hns3_reset_level reset_level;
88 struct hns3_hw_error_desc {
92 const struct hns3_hw_error *hw_err;
95 int hns3_enable_hw_error_intr(struct hns3_adapter *hns, bool state);
96 void hns3_handle_msix_error(struct hns3_adapter *hns, uint64_t *levels);
97 void hns3_handle_ras_error(struct hns3_adapter *hns, uint64_t *levels);
99 void hns3_intr_unregister(const struct rte_intr_handle *hdl,
100 rte_intr_callback_fn cb_fn, void *cb_arg);
101 void hns3_notify_reset_ready(struct hns3_hw *hw, bool enable);
102 int hns3_reset_init(struct hns3_hw *hw);
103 void hns3_wait_callback(void *param);
104 void hns3_schedule_reset(struct hns3_adapter *hns);
105 void hns3_schedule_delayed_reset(struct hns3_adapter *hns);
106 int hns3_reset_req_hw_reset(struct hns3_adapter *hns);
107 int hns3_reset_process(struct hns3_adapter *hns,
108 enum hns3_reset_level reset_level);
109 void hns3_reset_abort(struct hns3_adapter *hns);
111 #endif /* _HNS3_INTR_H_ */