qed_selftest.c 1.4 KB

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