rmmd_private.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (c) 2021-2024, Arm Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef RMMD_PRIVATE_H
  7. #define RMMD_PRIVATE_H
  8. #include <context.h>
  9. /*******************************************************************************
  10. * Constants that allow assembler code to preserve callee-saved registers of the
  11. * C runtime context while performing a security state switch.
  12. ******************************************************************************/
  13. #define RMMD_C_RT_CTX_X19 0x0
  14. #define RMMD_C_RT_CTX_X20 0x8
  15. #define RMMD_C_RT_CTX_X21 0x10
  16. #define RMMD_C_RT_CTX_X22 0x18
  17. #define RMMD_C_RT_CTX_X23 0x20
  18. #define RMMD_C_RT_CTX_X24 0x28
  19. #define RMMD_C_RT_CTX_X25 0x30
  20. #define RMMD_C_RT_CTX_X26 0x38
  21. #define RMMD_C_RT_CTX_X27 0x40
  22. #define RMMD_C_RT_CTX_X28 0x48
  23. #define RMMD_C_RT_CTX_X29 0x50
  24. #define RMMD_C_RT_CTX_X30 0x58
  25. #define RMMD_C_RT_CTX_SIZE 0x60
  26. #define RMMD_C_RT_CTX_ENTRIES (RMMD_C_RT_CTX_SIZE >> DWORD_SHIFT)
  27. #ifndef __ASSEMBLER__
  28. #include <stdint.h>
  29. /*
  30. * Data structure used by the RMM dispatcher (RMMD) in EL3 to track context of
  31. * the RMM at R-EL2.
  32. */
  33. typedef struct rmmd_rmm_context {
  34. uint64_t c_rt_ctx;
  35. cpu_context_t cpu_ctx;
  36. } rmmd_rmm_context_t;
  37. /* Functions used to enter/exit the RMM synchronously */
  38. uint64_t rmmd_rmm_sync_entry(rmmd_rmm_context_t *ctx);
  39. __dead2 void rmmd_rmm_sync_exit(uint64_t rc);
  40. /* Functions implementing attestation utilities for RMM */
  41. int rmmd_attest_get_platform_token(uint64_t buf_pa, uint64_t *buf_size,
  42. uint64_t c_size,
  43. uint64_t *remaining_len);
  44. int rmmd_attest_get_signing_key(uint64_t buf_pa, uint64_t *buf_size,
  45. uint64_t ecc_curve);
  46. uint64_t rmmd_el3_token_sign(void *handle, uint64_t x1, uint64_t x2,
  47. uint64_t x3, uint64_t x4);
  48. /* Assembly helpers */
  49. uint64_t rmmd_rmm_enter(uint64_t *c_rt_ctx);
  50. void __dead2 rmmd_rmm_exit(uint64_t c_rt_ctx, uint64_t ret);
  51. /* Reference to PM ops for the RMMD */
  52. extern const spd_pm_ops_t rmmd_pm;
  53. #endif /* __ASSEMBLER__ */
  54. #endif /* RMMD_PRIVATE_H */