blob: 483902e0ead786cc34e2362763b0b05e426d0f52 [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 ********************************************************************/
17#define IPI_MB_STATUS_IDLE 0
18#define IPI_MB_STATUS_SEND_PENDING 1
19#define IPI_MB_STATUS_RECV_PENDING 2
20
21/*********************************************************************
22 * IPI mailbox call is secure or not macros
23 ********************************************************************/
24#define IPI_MB_CALL_NOTSECURE 0
25#define IPI_MB_CALL_SECURE 1
26
27/*********************************************************************
28 * IPI secure check
29 ********************************************************************/
30#define IPI_SECURE_MASK 0x1U
31#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 */
50void ipi_config_table_init(const struct ipi_config *ipi_table,
51 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 */
66void ipi_mb_notify(uint32_t local, uint32_t remote, uint32_t is_blocking);
67
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 */