pcc.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * PCC (Platform Communications Channel) methods
  4. */
  5. #ifndef _PCC_H
  6. #define _PCC_H
  7. #include <linux/mailbox_controller.h>
  8. #include <linux/mailbox_client.h>
  9. struct pcc_mbox_chan {
  10. struct mbox_chan *mchan;
  11. u64 shmem_base_addr;
  12. void __iomem *shmem;
  13. u64 shmem_size;
  14. u32 latency;
  15. u32 max_access_rate;
  16. u16 min_turnaround_time;
  17. };
  18. /* Generic Communications Channel Shared Memory Region */
  19. #define PCC_SIGNATURE 0x50434300
  20. /* Generic Communications Channel Command Field */
  21. #define PCC_CMD_GENERATE_DB_INTR BIT(15)
  22. /* Generic Communications Channel Status Field */
  23. #define PCC_STATUS_CMD_COMPLETE BIT(0)
  24. #define PCC_STATUS_SCI_DOORBELL BIT(1)
  25. #define PCC_STATUS_ERROR BIT(2)
  26. #define PCC_STATUS_PLATFORM_NOTIFY BIT(3)
  27. /* Initiator Responder Communications Channel Flags */
  28. #define PCC_CMD_COMPLETION_NOTIFY BIT(0)
  29. #define MAX_PCC_SUBSPACES 256
  30. #ifdef CONFIG_PCC
  31. extern struct pcc_mbox_chan *
  32. pcc_mbox_request_channel(struct mbox_client *cl, int subspace_id);
  33. extern void pcc_mbox_free_channel(struct pcc_mbox_chan *chan);
  34. #else
  35. static inline struct pcc_mbox_chan *
  36. pcc_mbox_request_channel(struct mbox_client *cl, int subspace_id)
  37. {
  38. return ERR_PTR(-ENODEV);
  39. }
  40. static inline void pcc_mbox_free_channel(struct pcc_mbox_chan *chan) { }
  41. #endif
  42. #endif /* _PCC_H */