1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /* Copyright(c) 2007-2022 Intel Corporation */
3 /* $FreeBSD$ */
4 #ifndef ADF_C4XXX_RESET_H_
5 #define ADF_C4XXX_RESET_H_
6
7 #include <adf_accel_devices.h>
8 #include <adf_common_drv.h>
9 #include "adf_c4xxx_hw_data.h"
10
11 /* IA2IOSFSB register definitions */
12 #define ADF_C4XXX_IA2IOSFSB_PORTCMD (0x60000 + 0x1320)
13 #define ADF_C4XXX_IA2IOSFSB_LOADD (0x60000 + 0x1324)
14 #define ADF_C4XXX_IA2IOSFSB_HIADD (0x60000 + 0x1328)
15 #define ADF_C4XXX_IA2IOSFSB_DATA(index) ((index)*0x4 + 0x60000 + 0x132C)
16 #define ADF_C4XXX_IA2IOSFSB_KHOLE (0x60000 + 0x136C)
17 #define ADF_C4XXX_IA2IOSFSB_STATUS (0x60000 + 0x1370)
18
19 /* IOSF-SB Port command definitions */
20 /* Ethernet controller Port ID */
21 #define ADF_C4XXX_ETH_PORT_ID 0x61
22 /* Byte enable */
23 #define ADF_C4XXX_PORTD_CMD_BE 0xFF
24 /* Non posted; Only non-posted commands are used */
25 #define ADF_C4XXX_PORTD_CMD_NP 0x1
26 /* Number of DWORDs to transfer */
27 #define ADF_C4XXX_PORTD_CMD_LENDW 0x2
28 /* Extended header always used */
29 #define ADF_C4XXX_PORTD_CMD_EH 0x1
30 /* Address length */
31 #define ADF_C4XXX_PORTD_CMD_ALEN 0x0
32 /* Message opcode: Private Register Write Non-Posted or Posted Message*/
33 #define ADF_C4XXX_MOPCODE 0x07
34
35 /* Compute port command based on port ID */
36 #define ADF_C4XXX_GET_PORT_CMD(port_id) \
37 ((((port_id)&0xFF) << 24) | (ADF_C4XXX_PORTD_CMD_BE << 16) | \
38 (ADF_C4XXX_PORTD_CMD_NP << 15) | (ADF_C4XXX_PORTD_CMD_LENDW << 10) | \
39 (ADF_C4XXX_PORTD_CMD_EH << 9) | (ADF_C4XXX_PORTD_CMD_ALEN << 8) | \
40 (ADF_C4XXX_MOPCODE))
41
42 /* Pending reset event/ack message over IOSF-SB */
43 #define ADF_C4XXX_IOSFSB_RESET_EVENT BIT(0)
44 #define ADF_C4XXX_IOSFSB_RESET_ACK BIT(7)
45
46 /* Upon an FLR, the PCI_EXP_AERUCS register must be read and we must make sure
47 * that not other bit is set excepted the:
48 * - UR (Unsupported request) bit<20>
49 * - IEUNC (Uncorrectable Internal Error) bit <22>
50 */
51 #define PCIE_C4XXX_VALID_ERR_MASK (~BIT(20) ^ BIT(22))
52
53 /* Trigger: trigger an IOSF SB message */
54 #define ADF_C4XXX_IOSFSB_TRIGGER BIT(0)
55
56 /* IOSF-SB status definitions */
57 /* Response status bits<1:0> definitions
58 * 00 = Successful
59 * 01 = Unsuccessful
60 * 10 = Powered down
61 * 11 = Multicast
62 */
63 #define ADF_C4XXX_IA2IOSFSB_STATUS_RTS (BIT(0) | BIT(1))
64 #define ADF_C4XXX_IA2IOSFSB_STATUS_PEND BIT(6)
65 /* Allow 100ms polling interval */
66 #define ADF_C4XXX_IA2IOSFSB_POLLING_INTERVAL 100
67 /* Allow a maximum of 500ms before timing out */
68 #define ADF_C4XXX_IA2IOSFSB_POLLING_COUNT 5
69
70 /* Ethernet notification polling interval */
71 #define ADF_C4XXX_MAX_ETH_ACK_ATTEMPT 100
72 #define ADF_C4XXX_ETH_ACK_POLLING_INTERVAL 10
73
74 void adf_c4xxx_dev_restore(struct adf_accel_dev *accel_dev);
75 void notify_and_wait_ethernet(struct adf_accel_dev *accel_dev);
76 #endif
Cache object: 81864c80a7c1cf5ad9fb6a236aaacfe2
|