intel_scu_ipc.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_X86_INTEL_SCU_IPC_H_
  3. #define _ASM_X86_INTEL_SCU_IPC_H_
  4. #include <linux/notifier.h>
  5. #define IPCMSG_INDIRECT_READ 0x02
  6. #define IPCMSG_INDIRECT_WRITE 0x05
  7. #define IPCMSG_COLD_OFF 0x80 /* Only for Tangier */
  8. #define IPCMSG_WARM_RESET 0xF0
  9. #define IPCMSG_COLD_RESET 0xF1
  10. #define IPCMSG_SOFT_RESET 0xF2
  11. #define IPCMSG_COLD_BOOT 0xF3
  12. #define IPCMSG_VRTC 0xFA /* Set vRTC device */
  13. /* Command id associated with message IPCMSG_VRTC */
  14. #define IPC_CMD_VRTC_SETTIME 1 /* Set time */
  15. #define IPC_CMD_VRTC_SETALARM 2 /* Set alarm */
  16. /* Read single register */
  17. int intel_scu_ipc_ioread8(u16 addr, u8 *data);
  18. /* Read two sequential registers */
  19. int intel_scu_ipc_ioread16(u16 addr, u16 *data);
  20. /* Read four sequential registers */
  21. int intel_scu_ipc_ioread32(u16 addr, u32 *data);
  22. /* Read a vector */
  23. int intel_scu_ipc_readv(u16 *addr, u8 *data, int len);
  24. /* Write single register */
  25. int intel_scu_ipc_iowrite8(u16 addr, u8 data);
  26. /* Write two sequential registers */
  27. int intel_scu_ipc_iowrite16(u16 addr, u16 data);
  28. /* Write four sequential registers */
  29. int intel_scu_ipc_iowrite32(u16 addr, u32 data);
  30. /* Write a vector */
  31. int intel_scu_ipc_writev(u16 *addr, u8 *data, int len);
  32. /* Update single register based on the mask */
  33. int intel_scu_ipc_update_register(u16 addr, u8 data, u8 mask);
  34. /* Issue commands to the SCU with or without data */
  35. int intel_scu_ipc_simple_command(int cmd, int sub);
  36. int intel_scu_ipc_command(int cmd, int sub, u32 *in, int inlen,
  37. u32 *out, int outlen);
  38. int intel_scu_ipc_raw_command(int cmd, int sub, u8 *in, int inlen,
  39. u32 *out, int outlen, u32 dptr, u32 sptr);
  40. /* I2C control api */
  41. int intel_scu_ipc_i2c_cntrl(u32 addr, u32 *data);
  42. /* Update FW version */
  43. int intel_scu_ipc_fw_update(u8 *buffer, u32 length);
  44. extern struct blocking_notifier_head intel_scu_notifier;
  45. static inline void intel_scu_notifier_add(struct notifier_block *nb)
  46. {
  47. blocking_notifier_chain_register(&intel_scu_notifier, nb);
  48. }
  49. static inline void intel_scu_notifier_remove(struct notifier_block *nb)
  50. {
  51. blocking_notifier_chain_unregister(&intel_scu_notifier, nb);
  52. }
  53. static inline int intel_scu_notifier_post(unsigned long v, void *p)
  54. {
  55. return blocking_notifier_call_chain(&intel_scu_notifier, v, p);
  56. }
  57. #define SCU_AVAILABLE 1
  58. #define SCU_DOWN 2
  59. #endif