fsl_sec_mon.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Common internal memory map for some Freescale SoCs
  3. *
  4. * Copyright 2015 Freescale Semiconductor, Inc.
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #ifndef __FSL_SEC_MON_H
  8. #define __FSL_SEC_MON_H
  9. #include <common.h>
  10. #include <asm/io.h>
  11. #ifdef CONFIG_SYS_FSL_SEC_MON_LE
  12. #define sec_mon_in32(a) in_le32(a)
  13. #define sec_mon_out32(a, v) out_le32(a, v)
  14. #define sec_mon_in16(a) in_le16(a)
  15. #define sec_mon_clrbits32 clrbits_le32
  16. #define sec_mon_setbits32 setbits_le32
  17. #elif defined(CONFIG_SYS_FSL_SEC_MON_BE)
  18. #define sec_mon_in32(a) in_be32(a)
  19. #define sec_mon_out32(a, v) out_be32(a, v)
  20. #define sec_mon_in16(a) in_be16(a)
  21. #define sec_mon_clrbits32 clrbits_be32
  22. #define sec_mon_setbits32 setbits_be32
  23. #else
  24. #error Neither CONFIG_SYS_FSL_SEC_MON_LE nor CONFIG_SYS_FSL_SEC_MON_BE defined
  25. #endif
  26. struct ccsr_sec_mon_regs {
  27. u8 reserved0[0x04];
  28. u32 hp_com; /* 0x04 SEC_MON_HP Command Register */
  29. u8 reserved2[0x0c];
  30. u32 hp_stat; /* 0x08 SEC_MON_HP Status Register */
  31. };
  32. #define HPCOMR_SW_SV 0x100 /* Security Violation bit */
  33. #define HPCOMR_SW_FSV 0x200 /* Fatal Security Violation bit */
  34. #define HPCOMR_SSM_ST 0x1 /* SSM_ST field in SEC_MON command */
  35. #define HPSR_SSM_ST_CHECK 0x900 /* SEC_MON is in check state */
  36. #define HPSR_SSM_ST_NON_SECURE 0xb00 /* SEC_MON is in non secure state */
  37. #define HPSR_SSM_ST_TRUST 0xd00 /* SEC_MON is in trusted state */
  38. #define HPSR_SSM_ST_SOFT_FAIL 0x300 /* SEC_MON is in soft fail state */
  39. #define HPSR_SSM_ST_MASK 0xf00 /* Mask for SSM_ST field */
  40. /*
  41. * SEC_MON read. This specifies the possible reads
  42. * from the SEC_MON
  43. */
  44. enum {
  45. SEC_MON_SSM_ST,
  46. SEC_MON_SW_FSV,
  47. SEC_MON_SW_SV,
  48. };
  49. int change_sec_mon_state(uint32_t initial_state, uint32_t final_state);
  50. #endif /* __FSL_SEC_MON_H */