xilinx: Remove platform specific dependency from IPI function

ipi_mb function uses platform specific ipi configuration table.
These ipi_mb functions can be used for other Xilinx platform.
So, instead of using direct data structure, initialize IPI
configuration data by passing platform specific ipi table.
Macros are updated accordingly for this ipi table change.

This change is done so that ipi_mb functions can be moved to
common file without major changes. All common functions now would
be moved to common file in next patch.

Signed-off-by: Tejas Patel <tejas.patel@xilinx.com>
Reviewed-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Jolly Shah <jollys@xilinx.com>
This commit is contained in:
Jolly Shah 2019-01-08 11:27:36 -08:00
parent 703a5aacfa
commit b8e39f49e6
3 changed files with 43 additions and 5 deletions

View File

@ -10,6 +10,7 @@
#define PLAT_IPI_H
#include <stdint.h>
#include <ipi.h>
/*********************************************************************
* IPI agent IDs macros
@ -42,6 +43,12 @@
/*********************************************************************
* IPI APIs declarations
********************************************************************/
/* Configure IPI table for zynqmp */
void zynqmp_ipi_config_table_init(void);
/* Initialize IPI configuration table */
void ipi_config_table_init(const struct ipi_config *ipi_table,
uint32_t total_ipi);
/* Validate IPI mailbox access */
int ipi_mb_validate(uint32_t local, uint32_t remote, unsigned int is_secure);

View File

@ -41,6 +41,9 @@ DEFINE_SVC_UUID2(zynqmp_sip_uuid,
*/
static int32_t sip_svc_setup(void)
{
/* Configure IPI data for ZynqMP */
zynqmp_ipi_config_table_init();
/* PM implementation as SiP Service */
pm_setup();

View File

@ -36,15 +36,21 @@
#define IPI_IDR_OFFSET 0x1CU
/* IPI register start offset */
#define IPI_REG_BASE(I) (zynqmp_ipi_table[(I)].ipi_reg_base)
#define IPI_REG_BASE(I) (ipi_table[(I)].ipi_reg_base)
/* IPI register bit mask */
#define IPI_BIT_MASK(I) (zynqmp_ipi_table[(I)].ipi_bit_mask)
#define IPI_BIT_MASK(I) (ipi_table[(I)].ipi_bit_mask)
/* IPI secure check */
#define IPI_SECURE_MASK 0x1U
#define IPI_IS_SECURE(I) ((zynqmp_ipi_table[(I)].secure_only & \
IPI_SECURE_MASK) ? 1 : 0)
#define IPI_IS_SECURE(I) ((ipi_table[(I)].secure_only & \
IPI_SECURE_MASK) ? 1 : 0)
/* IPI configuration table */
const static struct ipi_config *ipi_table;
/* Total number of IPI */
static uint32_t ipi_total;
/* Zynqmp ipi configuration table */
const static struct ipi_config zynqmp_ipi_table[] = {
@ -116,6 +122,29 @@ const static struct ipi_config zynqmp_ipi_table[] = {
},
};
/**
* zynqmp_ipi_config_table_init() - Initialize ZynqMP IPI configuration data
*
*/
void zynqmp_ipi_config_table_init(void)
{
ipi_config_table_init(zynqmp_ipi_table, ARRAY_SIZE(zynqmp_ipi_table));
}
/**
* ipi_config_table_init() - Initialize IPI configuration data
*
* @ipi_config_table - IPI configuration table
* @ipi_total - Total number of IPI available
*
*/
void ipi_config_table_init(const struct ipi_config *ipi_config_table,
uint32_t total_ipi)
{
ipi_table = ipi_config_table;
ipi_total = total_ipi;
}
/* is_ipi_mb_within_range() - verify if IPI mailbox is within range
*
* @local - local IPI ID
@ -126,7 +155,6 @@ const static struct ipi_config zynqmp_ipi_table[] = {
static inline int is_ipi_mb_within_range(uint32_t local, uint32_t remote)
{
int ret = 1;
uint32_t ipi_total = ARRAY_SIZE(zynqmp_ipi_table);
if (remote >= ipi_total || local >= ipi_total)
ret = 0;