mce.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright (c) 2016-2019, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef MCE_H
  7. #define MCE_H
  8. #include <lib/mmio.h>
  9. #include <tegra_def.h>
  10. /*******************************************************************************
  11. * MCE commands
  12. ******************************************************************************/
  13. typedef enum mce_cmd {
  14. MCE_CMD_ENTER_CSTATE = 0U,
  15. MCE_CMD_UPDATE_CSTATE_INFO = 1U,
  16. MCE_CMD_UPDATE_CROSSOVER_TIME = 2U,
  17. MCE_CMD_READ_CSTATE_STATS = 3U,
  18. MCE_CMD_WRITE_CSTATE_STATS = 4U,
  19. MCE_CMD_IS_SC7_ALLOWED = 5U,
  20. MCE_CMD_ONLINE_CORE = 6U,
  21. MCE_CMD_CC3_CTRL = 7U,
  22. MCE_CMD_ECHO_DATA = 8U,
  23. MCE_CMD_READ_VERSIONS = 9U,
  24. MCE_CMD_ENUM_FEATURES = 10U,
  25. MCE_CMD_ROC_FLUSH_CACHE_TRBITS = 11U,
  26. MCE_CMD_ENUM_READ_MCA = 12U,
  27. MCE_CMD_ENUM_WRITE_MCA = 13U,
  28. MCE_CMD_ROC_FLUSH_CACHE = 14U,
  29. MCE_CMD_ROC_CLEAN_CACHE = 15U,
  30. MCE_CMD_ENABLE_LATIC = 16U,
  31. MCE_CMD_UNCORE_PERFMON_REQ = 17U,
  32. MCE_CMD_MISC_CCPLEX = 18U,
  33. MCE_CMD_IS_CCX_ALLOWED = 0xFEU,
  34. MCE_CMD_MAX = 0xFFU,
  35. } mce_cmd_t;
  36. #define MCE_CMD_MASK 0xFFU
  37. /*******************************************************************************
  38. * Timeout value used to powerdown a core
  39. ******************************************************************************/
  40. #define MCE_CORE_SLEEP_TIME_INFINITE 0xFFFFFFFFU
  41. /*******************************************************************************
  42. * Struct to prepare UPDATE_CSTATE_INFO request
  43. ******************************************************************************/
  44. typedef struct mce_cstate_info {
  45. /* cluster cstate value */
  46. uint32_t cluster;
  47. /* ccplex cstate value */
  48. uint32_t ccplex;
  49. /* system cstate value */
  50. uint32_t system;
  51. /* force system state? */
  52. uint8_t system_state_force;
  53. /* wake mask value */
  54. uint32_t wake_mask;
  55. /* update the wake mask? */
  56. uint8_t update_wake_mask;
  57. } mce_cstate_info_t;
  58. /* public interfaces */
  59. int mce_command_handler(uint64_t cmd, uint64_t arg0, uint64_t arg1,
  60. uint64_t arg2);
  61. int mce_update_reset_vector(void);
  62. int mce_update_gsc_videomem(void);
  63. int mce_update_gsc_tzdram(void);
  64. __dead2 void mce_enter_ccplex_state(uint32_t state_idx);
  65. void mce_update_cstate_info(const mce_cstate_info_t *cstate);
  66. void mce_verify_firmware_version(void);
  67. #endif /* MCE_H */