drtm_remediation.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright (c) 2022-2024 Arm Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. *
  6. * DRTM support for DRTM error remediation.
  7. *
  8. */
  9. #include <inttypes.h>
  10. #include <stdint.h>
  11. #include <common/debug.h>
  12. #include <common/runtime_svc.h>
  13. #include "drtm_main.h"
  14. #include <plat/common/platform.h>
  15. uint64_t drtm_set_error(uint64_t x1, void *ctx)
  16. {
  17. int rc;
  18. rc = plat_set_drtm_error(x1);
  19. if (rc != 0) {
  20. SMC_RET1(ctx, NOT_FOUND);
  21. }
  22. SMC_RET1(ctx, SUCCESS);
  23. }
  24. uint64_t drtm_get_error(void *ctx)
  25. {
  26. uint64_t error_code;
  27. int rc;
  28. rc = plat_get_drtm_error(&error_code);
  29. if (rc != 0) {
  30. SMC_RET1(ctx, NOT_FOUND);
  31. }
  32. SMC_RET2(ctx, SUCCESS, error_code);
  33. }
  34. void drtm_enter_remediation(uint64_t err_code, const char *err_str)
  35. {
  36. int rc = plat_set_drtm_error(err_code);
  37. if (rc != 0) {
  38. ERROR("%s(): drtm_error_set() failed unexpectedly rc=%d\n",
  39. __func__, rc);
  40. panic();
  41. }
  42. ERROR("DRTM: entering remediation of error:\n%" PRIu64 "\t\'%s\'\n",
  43. err_code, err_str);
  44. ERROR("%s(): system reset is not yet supported\n", __func__);
  45. plat_system_reset();
  46. }