xref: /rk3399_ARM-atf/plat/xilinx/common/include/ipi.h (revision bc11248abbcd05704bc88bc9c2dcfad32c2c232f)
1703a5aacSJolly Shah /*
2703a5aacSJolly Shah  * Copyright (c) 2018, Xilinx, Inc. All rights reserved.
3bdba3c84SDevanshi Chauhan Alpeshbhai  * Copyright (c) 2022-2025, Advanced Micro Devices, Inc. All rights reserved.
4703a5aacSJolly Shah  *
5703a5aacSJolly Shah  * SPDX-License-Identifier: BSD-3-Clause
6703a5aacSJolly Shah  */
7703a5aacSJolly Shah 
8703a5aacSJolly Shah /* Xilinx IPI management configuration data and macros */
9703a5aacSJolly Shah 
10703a5aacSJolly Shah #ifndef IPI_H
11703a5aacSJolly Shah #define IPI_H
12703a5aacSJolly Shah 
13703a5aacSJolly Shah #include <stdint.h>
14703a5aacSJolly Shah 
15703a5aacSJolly Shah /*********************************************************************
1663436bdeSJolly Shah  * IPI mailbox status macros
1763436bdeSJolly Shah  ********************************************************************/
1815dc3e4fSHariBabu Gattem #define IPI_MB_STATUS_IDLE		(0U)
1915dc3e4fSHariBabu Gattem #define IPI_MB_STATUS_SEND_PENDING	(1U)
2015dc3e4fSHariBabu Gattem #define IPI_MB_STATUS_RECV_PENDING	(2U)
2163436bdeSJolly Shah 
2263436bdeSJolly Shah /*********************************************************************
2363436bdeSJolly Shah  * IPI mailbox call is secure or not macros
2463436bdeSJolly Shah  ********************************************************************/
2515dc3e4fSHariBabu Gattem #define IPI_MB_CALL_NOTSECURE	(0U)
2615dc3e4fSHariBabu Gattem #define IPI_MB_CALL_SECURE	(1U)
2763436bdeSJolly Shah 
2863436bdeSJolly Shah /*********************************************************************
2963436bdeSJolly Shah  * IPI secure check
3063436bdeSJolly Shah  ********************************************************************/
3115dc3e4fSHariBabu Gattem #define IPI_SECURE_MASK  (0x1U)
3263436bdeSJolly Shah #define IPI_IS_SECURE(I) ((ipi_table[(I)].secure_only & \
337d15b94bSMaheedhar Bollapalli 			   IPI_SECURE_MASK) ? true : false)
3463436bdeSJolly Shah 
3563436bdeSJolly Shah /*********************************************************************
36703a5aacSJolly Shah  * Struct definitions
37703a5aacSJolly Shah  ********************************************************************/
38703a5aacSJolly Shah 
39703a5aacSJolly Shah /* structure to maintain IPI configuration information */
40703a5aacSJolly Shah struct ipi_config {
41*6df7184eSDevanshi Chauhan Alpeshbhai 	uint32_t ipi_bit_mask;
42*6df7184eSDevanshi Chauhan Alpeshbhai 	uint32_t ipi_reg_base;
43*6df7184eSDevanshi Chauhan Alpeshbhai 	uint8_t secure_only;
44703a5aacSJolly Shah };
45703a5aacSJolly Shah 
4663436bdeSJolly Shah /*********************************************************************
4763436bdeSJolly Shah  * IPI APIs declarations
4863436bdeSJolly Shah  ********************************************************************/
4963436bdeSJolly Shah 
5063436bdeSJolly Shah /* Initialize IPI configuration table */
51944e7ea9SVenkatesh Yadav Abbarapu void ipi_config_table_init(const struct ipi_config *ipi_config_table,
5263436bdeSJolly Shah 			   uint32_t total_ipi);
5363436bdeSJolly Shah 
5463436bdeSJolly Shah /* Validate IPI mailbox access */
55*6df7184eSDevanshi Chauhan Alpeshbhai int32_t ipi_mb_validate(uint32_t local, uint32_t remote, uint32_t is_secure);
5663436bdeSJolly Shah 
5763436bdeSJolly Shah /* Open the IPI mailbox */
5863436bdeSJolly Shah void ipi_mb_open(uint32_t local, uint32_t remote);
5963436bdeSJolly Shah 
6063436bdeSJolly Shah /* Release the IPI mailbox */
6163436bdeSJolly Shah void ipi_mb_release(uint32_t local, uint32_t remote);
6263436bdeSJolly Shah 
6363436bdeSJolly Shah /* Enquire IPI mailbox status */
64bdba3c84SDevanshi Chauhan Alpeshbhai uint32_t ipi_mb_enquire_status(uint32_t local, uint32_t remote);
6563436bdeSJolly Shah 
6663436bdeSJolly Shah /* Trigger notification on the IPI mailbox */
6762f9134dSVenkatesh Yadav Abbarapu void ipi_mb_notify(uint32_t local, uint32_t remote, uint32_t is_blocking);
6863436bdeSJolly Shah 
6963436bdeSJolly Shah /* Ack IPI mailbox notification */
7063436bdeSJolly Shah void ipi_mb_ack(uint32_t local, uint32_t remote);
7163436bdeSJolly Shah 
7263436bdeSJolly Shah /* Disable IPI mailbox notification interrupt */
7363436bdeSJolly Shah void ipi_mb_disable_irq(uint32_t local, uint32_t remote);
7463436bdeSJolly Shah 
7563436bdeSJolly Shah /* Enable IPI mailbox notification interrupt */
7663436bdeSJolly Shah void ipi_mb_enable_irq(uint32_t local, uint32_t remote);
7763436bdeSJolly Shah 
78703a5aacSJolly Shah #endif /* IPI_H */
79