secHw_def.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*****************************************************************************
  2. * Copyright 2003 - 2008 Broadcom Corporation. All rights reserved.
  3. *
  4. * Unless you and Broadcom execute a separate written software license
  5. * agreement governing use of this software, this software is licensed to you
  6. * under the terms of the GNU General Public License version 2, available at
  7. * http://www.broadcom.com/licenses/GPLv2.php (the "GPL").
  8. *
  9. * Notwithstanding the above, under no circumstances may you combine this
  10. * software in any way with any other Broadcom software provided under a
  11. * license other than the GPL, without Broadcom's express prior written
  12. * consent.
  13. *****************************************************************************/
  14. /****************************************************************************/
  15. /**
  16. * @file secHw_def.h
  17. *
  18. * @brief Definitions for configuring/testing secure blocks
  19. *
  20. * @note
  21. * None
  22. */
  23. /****************************************************************************/
  24. #ifndef SECHW_DEF_H
  25. #define SECHW_DEF_H
  26. #include <mach/csp/mm_io.h>
  27. /* Bit mask for various secure device */
  28. #define secHw_BLK_MASK_CHIP_CONTROL 0x00000001
  29. #define secHw_BLK_MASK_KEY_SCAN 0x00000002
  30. #define secHw_BLK_MASK_TOUCH_SCREEN 0x00000004
  31. #define secHw_BLK_MASK_UART0 0x00000008
  32. #define secHw_BLK_MASK_UART1 0x00000010
  33. #define secHw_BLK_MASK_WATCHDOG 0x00000020
  34. #define secHw_BLK_MASK_SPUM 0x00000040
  35. #define secHw_BLK_MASK_DDR2 0x00000080
  36. #define secHw_BLK_MASK_EXT_MEM 0x00000100
  37. #define secHw_BLK_MASK_ESW 0x00000200
  38. #define secHw_BLK_MASK_SPU 0x00010000
  39. #define secHw_BLK_MASK_PKA 0x00020000
  40. #define secHw_BLK_MASK_RNG 0x00040000
  41. #define secHw_BLK_MASK_RTC 0x00080000
  42. #define secHw_BLK_MASK_OTP 0x00100000
  43. #define secHw_BLK_MASK_BOOT 0x00200000
  44. #define secHw_BLK_MASK_MPU 0x00400000
  45. #define secHw_BLK_MASK_TZCTRL 0x00800000
  46. #define secHw_BLK_MASK_INTR 0x01000000
  47. /* Trustzone register set */
  48. typedef struct {
  49. volatile uint32_t status; /* read only - reflects status of writes of 2 write registers */
  50. volatile uint32_t setUnsecure; /* write only. reads back as 0 */
  51. volatile uint32_t setSecure; /* write only. reads back as 0 */
  52. } secHw_TZREG_t;
  53. /* There are 2 register sets. The first is for the lower 16 bits, the 2nd */
  54. /* is for the higher 16 bits. */
  55. typedef enum {
  56. secHw_IDX_LS = 0,
  57. secHw_IDX_MS = 1,
  58. secHw_IDX_NUM
  59. } secHw_IDX_e;
  60. typedef struct {
  61. volatile secHw_TZREG_t reg[secHw_IDX_NUM];
  62. } secHw_REGS_t;
  63. /****************************************************************************/
  64. /**
  65. * @brief Configures a device as a secure device
  66. *
  67. */
  68. /****************************************************************************/
  69. static inline void secHw_setSecure(uint32_t mask /* mask of type secHw_BLK_MASK_XXXXXX */
  70. );
  71. /****************************************************************************/
  72. /**
  73. * @brief Configures a device as a non-secure device
  74. *
  75. */
  76. /****************************************************************************/
  77. static inline void secHw_setUnsecure(uint32_t mask /* mask of type secHw_BLK_MASK_XXXXXX */
  78. );
  79. /****************************************************************************/
  80. /**
  81. * @brief Get the trustzone status for all components. 1 = non-secure, 0 = secure
  82. *
  83. */
  84. /****************************************************************************/
  85. static inline uint32_t secHw_getStatus(void);
  86. #include <mach/csp/secHw_inline.h>
  87. #endif /* SECHW_DEF_H */