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