qed_selftest.c 1.4 KB

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