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