Commit | Line | Data |
---|---|---|
03dc76ca SRK |
1 | #include "qed.h" |
2 | #include "qed_dev_api.h" | |
3 | #include "qed_mcp.h" | |
4 | #include "qed_sp.h" | |
72e8d5fd | 5 | #include "qed_selftest.h" |
03dc76ca SRK |
6 | |
7 | int qed_selftest_memory(struct qed_dev *cdev) | |
8 | { | |
9 | int rc = 0, i; | |
10 | ||
11 | for_each_hwfn(cdev, i) { | |
12 | rc = qed_sp_heartbeat_ramrod(&cdev->hwfns[i]); | |
13 | if (rc) | |
14 | return rc; | |
15 | } | |
16 | ||
17 | return rc; | |
18 | } | |
19 | ||
20 | int qed_selftest_interrupt(struct qed_dev *cdev) | |
21 | { | |
22 | int rc = 0, i; | |
23 | ||
24 | for_each_hwfn(cdev, i) { | |
25 | rc = qed_sp_heartbeat_ramrod(&cdev->hwfns[i]); | |
26 | if (rc) | |
27 | return rc; | |
28 | } | |
29 | ||
30 | return rc; | |
31 | } | |
32 | ||
33 | int qed_selftest_register(struct qed_dev *cdev) | |
34 | { | |
35 | struct qed_hwfn *p_hwfn; | |
36 | struct qed_ptt *p_ptt; | |
37 | int rc = 0, i; | |
38 | ||
39 | /* although performed by MCP, this test is per engine */ | |
40 | for_each_hwfn(cdev, i) { | |
41 | p_hwfn = &cdev->hwfns[i]; | |
42 | p_ptt = qed_ptt_acquire(p_hwfn); | |
43 | if (!p_ptt) { | |
44 | DP_ERR(p_hwfn, "failed to acquire ptt\n"); | |
45 | return -EBUSY; | |
46 | } | |
47 | rc = qed_mcp_bist_register_test(p_hwfn, p_ptt); | |
48 | qed_ptt_release(p_hwfn, p_ptt); | |
49 | if (rc) | |
50 | break; | |
51 | } | |
52 | ||
53 | return rc; | |
54 | } | |
55 | ||
56 | int qed_selftest_clock(struct qed_dev *cdev) | |
57 | { | |
58 | struct qed_hwfn *p_hwfn; | |
59 | struct qed_ptt *p_ptt; | |
60 | int rc = 0, i; | |
61 | ||
62 | /* although performed by MCP, this test is per engine */ | |
63 | for_each_hwfn(cdev, i) { | |
64 | p_hwfn = &cdev->hwfns[i]; | |
65 | p_ptt = qed_ptt_acquire(p_hwfn); | |
66 | if (!p_ptt) { | |
67 | DP_ERR(p_hwfn, "failed to acquire ptt\n"); | |
68 | return -EBUSY; | |
69 | } | |
70 | rc = qed_mcp_bist_clock_test(p_hwfn, p_ptt); | |
71 | qed_ptt_release(p_hwfn, p_ptt); | |
72 | if (rc) | |
73 | break; | |
74 | } | |
75 | ||
76 | return rc; | |
77 | } |