blob: 71c06c31fceb8dc8a7c95212ddba94bb879229d4 [file] [log] [blame]
Jolly Shahb07fd0c2019-01-08 11:25:28 -08001/*
2 * Copyright (c) 2018, Xilinx, Inc. All rights reserved.
Devanshi Chauhan Alpeshbhaib3d4c9f2025-03-26 02:08:58 -07003 * Copyright (c) 2022-2025, Advanced Micro Devices, Inc. All rights reserved.
Jolly Shahb07fd0c2019-01-08 11:25:28 -08004 *
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/*********************************************************************
Jolly Shahc2583ab2019-01-08 11:31:49 -080016 * IPI mailbox status macros
17 ********************************************************************/
HariBabu Gattem9f9db612022-09-15 22:35:11 -070018#define IPI_MB_STATUS_IDLE (0U)
19#define IPI_MB_STATUS_SEND_PENDING (1U)
20#define IPI_MB_STATUS_RECV_PENDING (2U)
Jolly Shahc2583ab2019-01-08 11:31:49 -080021
22/*********************************************************************
23 * IPI mailbox call is secure or not macros
24 ********************************************************************/
HariBabu Gattem9f9db612022-09-15 22:35:11 -070025#define IPI_MB_CALL_NOTSECURE (0U)
26#define IPI_MB_CALL_SECURE (1U)
Jolly Shahc2583ab2019-01-08 11:31:49 -080027
28/*********************************************************************
29 * IPI secure check
30 ********************************************************************/
HariBabu Gattem9f9db612022-09-15 22:35:11 -070031#define IPI_SECURE_MASK (0x1U)
Jolly Shahc2583ab2019-01-08 11:31:49 -080032#define IPI_IS_SECURE(I) ((ipi_table[(I)].secure_only & \
Maheedhar Bollapalli9c3fc0b2024-04-24 12:53:28 +053033 IPI_SECURE_MASK) ? true : false)
Jolly Shahc2583ab2019-01-08 11:31:49 -080034
35/*********************************************************************
Jolly Shahb07fd0c2019-01-08 11:25:28 -080036 * Struct definitions
37 ********************************************************************/
38
39/* structure to maintain IPI configuration information */
40struct ipi_config {
41 unsigned int ipi_bit_mask;
42 unsigned int ipi_reg_base;
43 unsigned char secure_only;
44};
45
Jolly Shahc2583ab2019-01-08 11:31:49 -080046/*********************************************************************
47 * IPI APIs declarations
48 ********************************************************************/
49
50/* Initialize IPI configuration table */
Venkatesh Yadav Abbarapuc70726f2022-05-16 17:44:33 +053051void ipi_config_table_init(const struct ipi_config *ipi_config_table,
Jolly Shahc2583ab2019-01-08 11:31:49 -080052 uint32_t total_ipi);
53
54/* Validate IPI mailbox access */
55int ipi_mb_validate(uint32_t local, uint32_t remote, unsigned int is_secure);
56
57/* Open the IPI mailbox */
58void ipi_mb_open(uint32_t local, uint32_t remote);
59
60/* Release the IPI mailbox */
61void ipi_mb_release(uint32_t local, uint32_t remote);
62
63/* Enquire IPI mailbox status */
Devanshi Chauhan Alpeshbhaib3d4c9f2025-03-26 02:08:58 -070064uint32_t ipi_mb_enquire_status(uint32_t local, uint32_t remote);
Jolly Shahc2583ab2019-01-08 11:31:49 -080065
66/* Trigger notification on the IPI mailbox */
Venkatesh Yadav Abbarapuefa1d322021-08-04 21:33:15 -060067void ipi_mb_notify(uint32_t local, uint32_t remote, uint32_t is_blocking);
Jolly Shahc2583ab2019-01-08 11:31:49 -080068
69/* Ack IPI mailbox notification */
70void ipi_mb_ack(uint32_t local, uint32_t remote);
71
72/* Disable IPI mailbox notification interrupt */
73void ipi_mb_disable_irq(uint32_t local, uint32_t remote);
74
75/* Enable IPI mailbox notification interrupt */
76void ipi_mb_enable_irq(uint32_t local, uint32_t remote);
77
Jolly Shahb07fd0c2019-01-08 11:25:28 -080078#endif /* IPI_H */