hab.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (C) 2012 Freescale Semiconductor, Inc. All Rights Reserved.
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. *
  6. */
  7. #ifndef __SECURE_MX6Q_H__
  8. #define __SECURE_MX6Q_H__
  9. #include <linux/types.h>
  10. /* -------- start of HAB API updates ------------*/
  11. /* The following are taken from HAB4 SIS */
  12. /* Status definitions */
  13. enum hab_status {
  14. HAB_STS_ANY = 0x00,
  15. HAB_FAILURE = 0x33,
  16. HAB_WARNING = 0x69,
  17. HAB_SUCCESS = 0xf0
  18. };
  19. /* Security Configuration definitions */
  20. enum hab_config {
  21. HAB_CFG_RETURN = 0x33, /**< Field Return IC */
  22. HAB_CFG_OPEN = 0xf0, /**< Non-secure IC */
  23. HAB_CFG_CLOSED = 0xcc /**< Secure IC */
  24. };
  25. /* State definitions */
  26. enum hab_state {
  27. HAB_STATE_INITIAL = 0x33, /**< Initialising state (transitory) */
  28. HAB_STATE_CHECK = 0x55, /**< Check state (non-secure) */
  29. HAB_STATE_NONSECURE = 0x66, /**< Non-secure state */
  30. HAB_STATE_TRUSTED = 0x99, /**< Trusted state */
  31. HAB_STATE_SECURE = 0xaa, /**< Secure state */
  32. HAB_STATE_FAIL_SOFT = 0xcc, /**< Soft fail state */
  33. HAB_STATE_FAIL_HARD = 0xff, /**< Hard fail state (terminal) */
  34. HAB_STATE_NONE = 0xf0, /**< No security state machine */
  35. HAB_STATE_MAX
  36. };
  37. /*Function prototype description*/
  38. typedef enum hab_status hab_rvt_report_event_t(enum hab_status, uint32_t,
  39. uint8_t* , size_t*);
  40. typedef enum hab_status hab_rvt_report_status_t(enum hab_config *,
  41. enum hab_state *);
  42. typedef enum hab_status hab_loader_callback_f_t(void**, size_t*, const void*);
  43. typedef enum hab_status hab_rvt_entry_t(void);
  44. typedef enum hab_status hab_rvt_exit_t(void);
  45. typedef void *hab_rvt_authenticate_image_t(uint8_t, ptrdiff_t,
  46. void **, size_t *, hab_loader_callback_f_t);
  47. typedef void hapi_clock_init_t(void);
  48. #ifdef CONFIG_MX6SX
  49. #define HAB_RVT_BASE 0x00000100
  50. #else
  51. #define HAB_RVT_BASE 0x00000094
  52. #endif
  53. #define HAB_RVT_ENTRY (*(uint32_t *)(HAB_RVT_BASE + 0x04))
  54. #define HAB_RVT_EXIT (*(uint32_t *)(HAB_RVT_BASE + 0x08))
  55. #define HAB_RVT_AUTHENTICATE_IMAGE (*(uint32_t *)(HAB_RVT_BASE + 0x10))
  56. #define HAB_RVT_REPORT_EVENT (*(uint32_t *)(HAB_RVT_BASE + 0x20))
  57. #define HAB_RVT_REPORT_STATUS (*(uint32_t *)(HAB_RVT_BASE + 0x24))
  58. #define HAB_RVT_REPORT_EVENT_NEW (*(uint32_t *)0x000000B8)
  59. #define HAB_RVT_REPORT_STATUS_NEW (*(uint32_t *)0x000000BC)
  60. #define HAB_RVT_AUTHENTICATE_IMAGE_NEW (*(uint32_t *)0x000000A8)
  61. #define HAB_RVT_ENTRY_NEW (*(uint32_t *)0x0000009C)
  62. #define HAB_RVT_EXIT_NEW (*(uint32_t *)0x000000A0)
  63. #define HAB_CID_ROM 0 /**< ROM Caller ID */
  64. #define HAB_CID_UBOOT 1 /**< UBOOT Caller ID*/
  65. /* ----------- end of HAB API updates ------------*/
  66. #endif