ipi.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Copyright (c) 2018, Xilinx, Inc. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. /* Xilinx IPI management configuration data and macros */
  7. #ifndef IPI_H
  8. #define IPI_H
  9. #include <stdint.h>
  10. /*********************************************************************
  11. * IPI mailbox status macros
  12. ********************************************************************/
  13. #define IPI_MB_STATUS_IDLE (0U)
  14. #define IPI_MB_STATUS_SEND_PENDING (1U)
  15. #define IPI_MB_STATUS_RECV_PENDING (2U)
  16. /*********************************************************************
  17. * IPI mailbox call is secure or not macros
  18. ********************************************************************/
  19. #define IPI_MB_CALL_NOTSECURE (0U)
  20. #define IPI_MB_CALL_SECURE (1U)
  21. /*********************************************************************
  22. * IPI secure check
  23. ********************************************************************/
  24. #define IPI_SECURE_MASK (0x1U)
  25. #define IPI_IS_SECURE(I) ((ipi_table[(I)].secure_only & \
  26. IPI_SECURE_MASK) ? 1 : 0)
  27. /*********************************************************************
  28. * Struct definitions
  29. ********************************************************************/
  30. /* structure to maintain IPI configuration information */
  31. struct ipi_config {
  32. unsigned int ipi_bit_mask;
  33. unsigned int ipi_reg_base;
  34. unsigned char secure_only;
  35. };
  36. /*********************************************************************
  37. * IPI APIs declarations
  38. ********************************************************************/
  39. /* Initialize IPI configuration table */
  40. void ipi_config_table_init(const struct ipi_config *ipi_config_table,
  41. uint32_t total_ipi);
  42. /* Validate IPI mailbox access */
  43. int ipi_mb_validate(uint32_t local, uint32_t remote, unsigned int is_secure);
  44. /* Open the IPI mailbox */
  45. void ipi_mb_open(uint32_t local, uint32_t remote);
  46. /* Release the IPI mailbox */
  47. void ipi_mb_release(uint32_t local, uint32_t remote);
  48. /* Enquire IPI mailbox status */
  49. int ipi_mb_enquire_status(uint32_t local, uint32_t remote);
  50. /* Trigger notification on the IPI mailbox */
  51. void ipi_mb_notify(uint32_t local, uint32_t remote, uint32_t is_blocking);
  52. /* Ack IPI mailbox notification */
  53. void ipi_mb_ack(uint32_t local, uint32_t remote);
  54. /* Disable IPI mailbox notification interrupt */
  55. void ipi_mb_disable_irq(uint32_t local, uint32_t remote);
  56. /* Enable IPI mailbox notification interrupt */
  57. void ipi_mb_enable_irq(uint32_t local, uint32_t remote);
  58. #endif /* IPI_H */