-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
qed: add infrastructure for device self tests.
This patch adds the functionality and APIs needed for selftests. It adds the ability to configure the link-mode which is required for the implementation of loopback tests. It adds the APIs for clock test, register test, interrupt test and memory test. Signed-off-by: Sudarsana Reddy Kalluru <sudarsana.kalluru@qlogic.com> Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
- Loading branch information
Sudarsana Reddy Kalluru
authored and
David S. Miller
committed
May 2, 2016
1 parent
158bc06
commit 03dc76c
Showing
10 changed files
with
301 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
obj-$(CONFIG_QED) := qed.o | ||
|
||
qed-y := qed_cxt.o qed_dev.o qed_hw.o qed_init_fw_funcs.o qed_init_ops.o \ | ||
qed_int.o qed_main.o qed_mcp.o qed_sp_commands.o qed_spq.o qed_l2.o | ||
qed_int.o qed_main.o qed_mcp.o qed_sp_commands.o qed_spq.o qed_l2.o \ | ||
qed_selftest.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#ifndef _QED_SELFTEST_API_H | ||
#define _QED_SELFTEST_API_H | ||
#include <linux/types.h> | ||
|
||
/** | ||
* @brief qed_selftest_memory - Perform memory test | ||
* | ||
* @param cdev | ||
* | ||
* @return int | ||
*/ | ||
int qed_selftest_memory(struct qed_dev *cdev); | ||
|
||
/** | ||
* @brief qed_selftest_interrupt - Perform interrupt test | ||
* | ||
* @param cdev | ||
* | ||
* @return int | ||
*/ | ||
int qed_selftest_interrupt(struct qed_dev *cdev); | ||
|
||
/** | ||
* @brief qed_selftest_register - Perform register test | ||
* | ||
* @param cdev | ||
* | ||
* @return int | ||
*/ | ||
int qed_selftest_register(struct qed_dev *cdev); | ||
|
||
/** | ||
* @brief qed_selftest_clock - Perform clock test | ||
* | ||
* @param cdev | ||
* | ||
* @return int | ||
*/ | ||
int qed_selftest_clock(struct qed_dev *cdev); | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters