intel_pmc_ipc.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_X86_INTEL_PMC_IPC_H_
  3. #define _ASM_X86_INTEL_PMC_IPC_H_
  4. /* Commands */
  5. #define PMC_IPC_PMIC_ACCESS 0xFF
  6. #define PMC_IPC_PMIC_ACCESS_READ 0x0
  7. #define PMC_IPC_PMIC_ACCESS_WRITE 0x1
  8. #define PMC_IPC_USB_PWR_CTRL 0xF0
  9. #define PMC_IPC_PMIC_BLACKLIST_SEL 0xEF
  10. #define PMC_IPC_PHY_CONFIG 0xEE
  11. #define PMC_IPC_NORTHPEAK_CTRL 0xED
  12. #define PMC_IPC_PM_DEBUG 0xEC
  13. #define PMC_IPC_PMC_TELEMTRY 0xEB
  14. #define PMC_IPC_PMC_FW_MSG_CTRL 0xEA
  15. /* IPC return code */
  16. #define IPC_ERR_NONE 0
  17. #define IPC_ERR_CMD_NOT_SUPPORTED 1
  18. #define IPC_ERR_CMD_NOT_SERVICED 2
  19. #define IPC_ERR_UNABLE_TO_SERVICE 3
  20. #define IPC_ERR_CMD_INVALID 4
  21. #define IPC_ERR_CMD_FAILED 5
  22. #define IPC_ERR_EMSECURITY 6
  23. #define IPC_ERR_UNSIGNEDKERNEL 7
  24. /* GCR reg offsets from gcr base*/
  25. #define PMC_GCR_PMC_CFG_REG 0x08
  26. #define PMC_GCR_TELEM_DEEP_S0IX_REG 0x78
  27. #define PMC_GCR_TELEM_SHLW_S0IX_REG 0x80
  28. #if IS_ENABLED(CONFIG_INTEL_PMC_IPC)
  29. int intel_pmc_ipc_simple_command(int cmd, int sub);
  30. int intel_pmc_ipc_raw_cmd(u32 cmd, u32 sub, u8 *in, u32 inlen,
  31. u32 *out, u32 outlen, u32 dptr, u32 sptr);
  32. int intel_pmc_ipc_command(u32 cmd, u32 sub, u8 *in, u32 inlen,
  33. u32 *out, u32 outlen);
  34. int intel_pmc_s0ix_counter_read(u64 *data);
  35. int intel_pmc_gcr_read(u32 offset, u32 *data);
  36. int intel_pmc_gcr_write(u32 offset, u32 data);
  37. int intel_pmc_gcr_update(u32 offset, u32 mask, u32 val);
  38. #else
  39. static inline int intel_pmc_ipc_simple_command(int cmd, int sub)
  40. {
  41. return -EINVAL;
  42. }
  43. static inline int intel_pmc_ipc_raw_cmd(u32 cmd, u32 sub, u8 *in, u32 inlen,
  44. u32 *out, u32 outlen, u32 dptr, u32 sptr)
  45. {
  46. return -EINVAL;
  47. }
  48. static inline int intel_pmc_ipc_command(u32 cmd, u32 sub, u8 *in, u32 inlen,
  49. u32 *out, u32 outlen)
  50. {
  51. return -EINVAL;
  52. }
  53. static inline int intel_pmc_s0ix_counter_read(u64 *data)
  54. {
  55. return -EINVAL;
  56. }
  57. static inline int intel_pmc_gcr_read(u32 offset, u32 *data)
  58. {
  59. return -EINVAL;
  60. }
  61. static inline int intel_pmc_gcr_write(u32 offset, u32 data)
  62. {
  63. return -EINVAL;
  64. }
  65. static inline int intel_pmc_gcr_update(u32 offset, u32 mask, u32 val)
  66. {
  67. return -EINVAL;
  68. }
  69. #endif /*CONFIG_INTEL_PMC_IPC*/
  70. #endif