blob: 1d62f3e4ab1cc659350a17fcef637e70f3152c2e [file] [log] [blame]
Jolly Shahb07fd0c2019-01-08 11:25:28 -08001/*
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 Shahc2583ab2019-01-08 11:31:49 -080015 * IPI mailbox status macros
16 ********************************************************************/
HariBabu Gattem9f9db612022-09-15 22:35:11 -070017#define IPI_MB_STATUS_IDLE (0U)
18#define IPI_MB_STATUS_SEND_PENDING (1U)
19#define IPI_MB_STATUS_RECV_PENDING (2U)
Jolly Shahc2583ab2019-01-08 11:31:49 -080020
21/*********************************************************************
22 * IPI mailbox call is secure or not macros
23 ********************************************************************/
HariBabu Gattem9f9db612022-09-15 22:35:11 -070024#define IPI_MB_CALL_NOTSECURE (0U)
25#define IPI_MB_CALL_SECURE (1U)
Jolly Shahc2583ab2019-01-08 11:31:49 -080026
27/*********************************************************************
28 * IPI secure check
29 ********************************************************************/
HariBabu Gattem9f9db612022-09-15 22:35:11 -070030#define IPI_SECURE_MASK (0x1U)
Jolly Shahc2583ab2019-01-08 11:31:49 -080031#define IPI_IS_SECURE(I) ((ipi_table[(I)].secure_only & \
32 IPI_SECURE_MASK) ? 1 : 0)
33
34/*********************************************************************
Jolly Shahb07fd0c2019-01-08 11:25:28 -080035 * Struct definitions
36 ********************************************************************/
37
38/* structure to maintain IPI configuration information */
39struct ipi_config {
40 unsigned int ipi_bit_mask;
41 unsigned int ipi_reg_base;
42 unsigned char secure_only;
43};
44
Jolly Shahc2583ab2019-01-08 11:31:49 -080045/*********************************************************************
46 * IPI APIs declarations
47 ********************************************************************/
48
49/* Initialize IPI configuration table */
Venkatesh Yadav Abbarapuc70726f2022-05-16 17:44:33 +053050void ipi_config_table_init(const struct ipi_config *ipi_config_table,
Jolly Shahc2583ab2019-01-08 11:31:49 -080051 uint32_t total_ipi);
52
53/* Validate IPI mailbox access */
54int ipi_mb_validate(uint32_t local, uint32_t remote, unsigned int is_secure);
55
56/* Open the IPI mailbox */
57void ipi_mb_open(uint32_t local, uint32_t remote);
58
59/* Release the IPI mailbox */
60void ipi_mb_release(uint32_t local, uint32_t remote);
61
62/* Enquire IPI mailbox status */
63int ipi_mb_enquire_status(uint32_t local, uint32_t remote);
64
65/* Trigger notification on the IPI mailbox */
Venkatesh Yadav Abbarapuefa1d322021-08-04 21:33:15 -060066void ipi_mb_notify(uint32_t local, uint32_t remote, uint32_t is_blocking);
Jolly Shahc2583ab2019-01-08 11:31:49 -080067
68/* Ack IPI mailbox notification */
69void ipi_mb_ack(uint32_t local, uint32_t remote);
70
71/* Disable IPI mailbox notification interrupt */
72void ipi_mb_disable_irq(uint32_t local, uint32_t remote);
73
74/* Enable IPI mailbox notification interrupt */
75void ipi_mb_enable_irq(uint32_t local, uint32_t remote);
76
Jolly Shahb07fd0c2019-01-08 11:25:28 -080077#endif /* IPI_H */