1703a5aacSJolly Shah /* 2703a5aacSJolly Shah * Copyright (c) 2018, Xilinx, Inc. All rights reserved. 3703a5aacSJolly Shah * 4703a5aacSJolly Shah * SPDX-License-Identifier: BSD-3-Clause 5703a5aacSJolly Shah */ 6703a5aacSJolly Shah 7703a5aacSJolly Shah /* Xilinx IPI management configuration data and macros */ 8703a5aacSJolly Shah 9703a5aacSJolly Shah #ifndef IPI_H 10703a5aacSJolly Shah #define IPI_H 11703a5aacSJolly Shah 12703a5aacSJolly Shah #include <stdint.h> 13703a5aacSJolly Shah 14703a5aacSJolly Shah /********************************************************************* 1563436bdeSJolly Shah * IPI mailbox status macros 1663436bdeSJolly Shah ********************************************************************/ 1715dc3e4fSHariBabu Gattem #define IPI_MB_STATUS_IDLE (0U) 1815dc3e4fSHariBabu Gattem #define IPI_MB_STATUS_SEND_PENDING (1U) 1915dc3e4fSHariBabu Gattem #define IPI_MB_STATUS_RECV_PENDING (2U) 2063436bdeSJolly Shah 2163436bdeSJolly Shah /********************************************************************* 2263436bdeSJolly Shah * IPI mailbox call is secure or not macros 2363436bdeSJolly Shah ********************************************************************/ 2415dc3e4fSHariBabu Gattem #define IPI_MB_CALL_NOTSECURE (0U) 2515dc3e4fSHariBabu Gattem #define IPI_MB_CALL_SECURE (1U) 2663436bdeSJolly Shah 2763436bdeSJolly Shah /********************************************************************* 2863436bdeSJolly Shah * IPI secure check 2963436bdeSJolly Shah ********************************************************************/ 3015dc3e4fSHariBabu Gattem #define IPI_SECURE_MASK (0x1U) 3163436bdeSJolly Shah #define IPI_IS_SECURE(I) ((ipi_table[(I)].secure_only & \ 32*7d15b94bSMaheedhar Bollapalli IPI_SECURE_MASK) ? true : false) 3363436bdeSJolly Shah 3463436bdeSJolly Shah /********************************************************************* 35703a5aacSJolly Shah * Struct definitions 36703a5aacSJolly Shah ********************************************************************/ 37703a5aacSJolly Shah 38703a5aacSJolly Shah /* structure to maintain IPI configuration information */ 39703a5aacSJolly Shah struct ipi_config { 40703a5aacSJolly Shah unsigned int ipi_bit_mask; 41703a5aacSJolly Shah unsigned int ipi_reg_base; 42703a5aacSJolly Shah unsigned char secure_only; 43703a5aacSJolly Shah }; 44703a5aacSJolly Shah 4563436bdeSJolly Shah /********************************************************************* 4663436bdeSJolly Shah * IPI APIs declarations 4763436bdeSJolly Shah ********************************************************************/ 4863436bdeSJolly Shah 4963436bdeSJolly Shah /* Initialize IPI configuration table */ 50944e7ea9SVenkatesh Yadav Abbarapu void ipi_config_table_init(const struct ipi_config *ipi_config_table, 5163436bdeSJolly Shah uint32_t total_ipi); 5263436bdeSJolly Shah 5363436bdeSJolly Shah /* Validate IPI mailbox access */ 5463436bdeSJolly Shah int ipi_mb_validate(uint32_t local, uint32_t remote, unsigned int is_secure); 5563436bdeSJolly Shah 5663436bdeSJolly Shah /* Open the IPI mailbox */ 5763436bdeSJolly Shah void ipi_mb_open(uint32_t local, uint32_t remote); 5863436bdeSJolly Shah 5963436bdeSJolly Shah /* Release the IPI mailbox */ 6063436bdeSJolly Shah void ipi_mb_release(uint32_t local, uint32_t remote); 6163436bdeSJolly Shah 6263436bdeSJolly Shah /* Enquire IPI mailbox status */ 6363436bdeSJolly Shah int ipi_mb_enquire_status(uint32_t local, uint32_t remote); 6463436bdeSJolly Shah 6563436bdeSJolly Shah /* Trigger notification on the IPI mailbox */ 6662f9134dSVenkatesh Yadav Abbarapu void ipi_mb_notify(uint32_t local, uint32_t remote, uint32_t is_blocking); 6763436bdeSJolly Shah 6863436bdeSJolly Shah /* Ack IPI mailbox notification */ 6963436bdeSJolly Shah void ipi_mb_ack(uint32_t local, uint32_t remote); 7063436bdeSJolly Shah 7163436bdeSJolly Shah /* Disable IPI mailbox notification interrupt */ 7263436bdeSJolly Shah void ipi_mb_disable_irq(uint32_t local, uint32_t remote); 7363436bdeSJolly Shah 7463436bdeSJolly Shah /* Enable IPI mailbox notification interrupt */ 7563436bdeSJolly Shah void ipi_mb_enable_irq(uint32_t local, uint32_t remote); 7663436bdeSJolly Shah 77703a5aacSJolly Shah #endif /* IPI_H */ 78