summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/qlogic/qed/qed_selftest.c
blob: a342bfe4280d8e176fa74dd5f12a71330114c246 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include "qed.h"
#include "qed_dev_api.h"
#include "qed_mcp.h"
#include "qed_sp.h"

int qed_selftest_memory(struct qed_dev *cdev)
{
	int rc = 0, i;

	for_each_hwfn(cdev, i) {
		rc = qed_sp_heartbeat_ramrod(&cdev->hwfns[i]);
		if (rc)
			return rc;
	}

	return rc;
}

int qed_selftest_interrupt(struct qed_dev *cdev)
{
	int rc = 0, i;

	for_each_hwfn(cdev, i) {
		rc = qed_sp_heartbeat_ramrod(&cdev->hwfns[i]);
		if (rc)
			return rc;
	}

	return rc;
}

int qed_selftest_register(struct qed_dev *cdev)
{
	struct qed_hwfn *p_hwfn;
	struct qed_ptt *p_ptt;
	int rc = 0, i;

	/* although performed by MCP, this test is per engine */
	for_each_hwfn(cdev, i) {
		p_hwfn = &cdev->hwfns[i];
		p_ptt = qed_ptt_acquire(p_hwfn);
		if (!p_ptt) {
			DP_ERR(p_hwfn, "failed to acquire ptt\n");
			return -EBUSY;
		}
		rc = qed_mcp_bist_register_test(p_hwfn, p_ptt);
		qed_ptt_release(p_hwfn, p_ptt);
		if (rc)
			break;
	}

	return rc;
}

int qed_selftest_clock(struct qed_dev *cdev)
{
	struct qed_hwfn *p_hwfn;
	struct qed_ptt *p_ptt;
	int rc = 0, i;

	/* although performed by MCP, this test is per engine */
	for_each_hwfn(cdev, i) {
		p_hwfn = &cdev->hwfns[i];
		p_ptt = qed_ptt_acquire(p_hwfn);
		if (!p_ptt) {
			DP_ERR(p_hwfn, "failed to acquire ptt\n");
			return -EBUSY;
		}
		rc = qed_mcp_bist_clock_test(p_hwfn, p_ptt);
		qed_ptt_release(p_hwfn, p_ptt);
		if (rc)
			break;
	}

	return rc;
}
OpenPOWER on IntegriCloud