sipsvc.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * Copyright 2018-2020 NXP
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. *
  6. */
  7. #ifndef SIPSVC_H
  8. #define SIPSVC_H
  9. #include <stdint.h>
  10. #define SMC_FUNC_MASK 0x0000ffff
  11. #define SMC32_PARAM_MASK 0xffffffff
  12. /* SMC function IDs for SiP Service queries */
  13. #define SIP_SVC_CALL_COUNT 0xff00
  14. #define SIP_SVC_UID 0xff01
  15. #define SIP_SVC_VERSION 0xff03
  16. #define SIP_SVC_PRNG 0xff10
  17. #define SIP_SVC_RNG 0xff11
  18. #define SIP_SVC_MEM_BANK 0xff12
  19. #define SIP_SVC_PREFETCH_DIS 0xff13
  20. #define SIP_SVC_HUK 0xff14
  21. #define SIP_SVC_ALLOW_L1L2_ERR 0xff15
  22. #define SIP_SVC_ALLOW_L2_CLR 0xff16
  23. #define SIP_SVC_2_AARCH32 0xff17
  24. #define SIP_SVC_PORSR1 0xff18
  25. /* Layerscape SiP Service Calls version numbers */
  26. #define LS_SIP_SVC_VERSION_MAJOR 0x0
  27. #define LS_SIP_SVC_VERSION_MINOR 0x1
  28. /* Number of Layerscape SiP Calls implemented */
  29. #define LS_COMMON_SIP_NUM_CALLS 10
  30. /* Parameter Type Constants */
  31. #define SIP_PARAM_TYPE_NONE 0x0
  32. #define SIP_PARAM_TYPE_VALUE_INPUT 0x1
  33. #define SIP_PARAM_TYPE_VALUE_OUTPUT 0x2
  34. #define SIP_PARAM_TYPE_VALUE_INOUT 0x3
  35. #define SIP_PARAM_TYPE_MEMREF_INPUT 0x5
  36. #define SIP_PARAM_TYPE_MEMREF_OUTPUT 0x6
  37. #define SIP_PARAM_TYPE_MEMREF_INOUT 0x7
  38. #define SIP_PARAM_TYPE_MASK 0xF
  39. /*
  40. * The macro SIP_PARAM_TYPES can be used to construct a value that you can
  41. * compare against an incoming paramTypes to check the type of all the
  42. * parameters in one comparison.
  43. */
  44. #define SIP_PARAM_TYPES(t0, t1, t2, t3) \
  45. ((t0) | ((t1) << 4) | ((t2) << 8) | ((t3) << 12))
  46. /*
  47. * The macro SIP_PARAM_TYPE_GET can be used to extract the type of a given
  48. * parameter from paramTypes if you need more fine-grained type checking.
  49. */
  50. #define SIP_PARAM_TYPE_GET(t, i) ((((uint32_t)(t)) >> ((i) * 4)) & 0xF)
  51. /*
  52. * The macro SIP_PARAM_TYPE_SET can be used to load the type of a given
  53. * parameter from paramTypes without specifying all types (SIP_PARAM_TYPES)
  54. */
  55. #define SIP_PARAM_TYPE_SET(t, i) (((uint32_t)(t) & 0xF) << ((i) * 4))
  56. #define SIP_SVC_RNG_PARAMS (SIP_PARAM_TYPE_VALUE_INPUT, \
  57. SIP_PARAM_TYPE_MEMREF_OUTPUT, \
  58. SIP_PARAM_TYPE_NONE, \
  59. SIP_PARAM_TYPE_NONE)
  60. /* Layerscape SiP Calls error code */
  61. enum {
  62. LS_SIP_SUCCESS = 0,
  63. LS_SIP_INVALID_PARAM = -1,
  64. LS_SIP_NOT_SUPPORTED = -2,
  65. };
  66. #endif /* SIPSVC_H */