secure.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef SECURE_H
  7. #define SECURE_H
  8. /******************************************************************************
  9. * TZPC TrustZone controller
  10. ******************************************************************************/
  11. #define TZPC_R0SIZE 0x0
  12. #define TZPC_SRAM_SECURE_4K(n) ((n) > 0x200 ? 0x200 : (n))
  13. #define TZPC_DECPROT1STAT 0x80c
  14. #define TZPC_DECPROT1SET 0x810
  15. #define TZPC_DECPROT1CLR 0x814
  16. #define TZPC_DECPROT2STAT 0x818
  17. #define TZPC_DECPROT2SET 0x818
  18. #define TZPC_DECPROT2CLR 0x820
  19. /**************************************************
  20. * sgrf reg, offset
  21. **************************************************/
  22. /*
  23. * soc_con0-5 start at 0x0, soc_con6-... start art 0x50
  24. * adjusted for the 5 lower registers
  25. */
  26. #define SGRF_SOC_CON(n) ((((n) < 6) ? 0x0 : 0x38) + (n) * 4)
  27. #define SGRF_BUSDMAC_CON(n) (0x20 + (n) * 4)
  28. #define SGRF_CPU_CON(n) (0x40 + (n) * 4)
  29. #define SGRF_SOC_STATUS(n) (0x100 + (n) * 4)
  30. #define SGRF_FAST_BOOT_ADDR 0x120
  31. /* SGRF_SOC_CON0 */
  32. #define SGRF_FAST_BOOT_ENA BIT_WITH_WMSK(8)
  33. #define SGRF_FAST_BOOT_DIS WMSK_BIT(8)
  34. #define SGRF_PCLK_WDT_GATE BIT_WITH_WMSK(6)
  35. #define SGRF_PCLK_WDT_UNGATE WMSK_BIT(6)
  36. #define SGRF_PCLK_STIMER_GATE BIT_WITH_WMSK(4)
  37. #define SGRF_SOC_CON2_MST_NS 0xffe0ffe0
  38. #define SGRF_SOC_CON3_MST_NS 0x003f003f
  39. /* SGRF_SOC_CON4 */
  40. #define SGRF_SOC_CON4_SECURE_WMSK 0xffff0000
  41. #define SGRF_DDRC1_SECURE BIT_WITH_WMSK(12)
  42. #define SGRF_DDRC0_SECURE BIT_WITH_WMSK(11)
  43. #define SGRF_PMUSRAM_SECURE BIT_WITH_WMSK(8)
  44. #define SGRF_WDT_SECURE BIT_WITH_WMSK(7)
  45. #define SGRF_STIMER_SECURE BIT_WITH_WMSK(6)
  46. /* SGRF_SOC_CON5 */
  47. #define SGRF_SLV_SEC_BYPS BIT_WITH_WMSK(15)
  48. #define SGRF_SLV_SEC_NO_BYPS WMSK_BIT(15)
  49. #define SGRF_SOC_CON5_SECURE_WMSK 0x00ff0000
  50. /* ddr regions in SGRF_SOC_CON6 and following */
  51. #define SGRF_DDR_RGN_SECURE_SEL BIT_WITH_WMSK(15)
  52. #define SGRF_DDR_RGN_SECURE_EN BIT_WITH_WMSK(14)
  53. #define SGRF_DDR_RGN_ADDR_WMSK 0x0fff
  54. /* SGRF_SOC_CON21 */
  55. /* All security of the DDR RGNs are bypassed */
  56. #define SGRF_DDR_RGN_BYPS BIT_WITH_WMSK(15)
  57. #define SGRF_DDR_RGN_NO_BYPS WMSK_BIT(15)
  58. /* SGRF_CPU_CON0 */
  59. #define SGRF_DAPDEVICE_ENA BIT_WITH_WMSK(0)
  60. #define SGRF_DAPDEVICE_MSK WMSK_BIT(0)
  61. /*****************************************************************************
  62. * core-axi
  63. *****************************************************************************/
  64. #define CORE_AXI_SECURITY0 0x08
  65. #define AXI_SECURITY0_GIC BIT(0)
  66. /*****************************************************************************
  67. * secure timer
  68. *****************************************************************************/
  69. #define TIMER_LOAD_COUNT0 0x00
  70. #define TIMER_LOAD_COUNT1 0x04
  71. #define TIMER_CURRENT_VALUE0 0x08
  72. #define TIMER_CURRENT_VALUE1 0x0C
  73. #define TIMER_CONTROL_REG 0x10
  74. #define TIMER_INTSTATUS 0x18
  75. #define TIMER_EN 0x1
  76. #define STIMER1_BASE (STIME_BASE + 0x20)
  77. /* export secure operating APIs */
  78. void secure_watchdog_gate(void);
  79. void secure_watchdog_ungate(void);
  80. void secure_gic_init(void);
  81. void secure_timer_init(void);
  82. void secure_sgrf_init(void);
  83. void secure_sgrf_ddr_rgn_init(void);
  84. __pmusramfunc void sram_secure_timer_init(void);
  85. #endif /* SECURE_H */