Commit f3a86600 authored by Jeenu Viswambharan's avatar Jeenu Viswambharan
Browse files

GIC: Add API to set interrupt priority



API documentation updated.

Change-Id: Ib700eb1b8ca65503aeed0ac4ce0e7b934df67ff9
Co-authored-by: default avatarYousuf A <yousuf.sait@arm.com>
Signed-off-by: default avatarJeenu Viswambharan <jeenu.viswambharan@arm.com>
parent 979225f4
......@@ -111,6 +111,21 @@ In case of ARM standard platforms using GIC, the implementation of the API
writes to GIC *Clear Enable Register* to disable the interrupt, and inserts
barrier to make memory updates visible afterwards.
Function: void plat_ic_set_interrupt_priority(unsigned int id, unsigned int priority); [optional]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
Argument : unsigned int
Argument : unsigned int
Return : void
This API should set the priority of the interrupt specified by first parameter
``id`` to the value set by the second parameter ``priority``.
In case of ARM standard platforms using GIC, the implementation of the API
writes to GIC *Priority Register* set interrupt priority.
----
*Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.*
......@@ -322,3 +322,16 @@ void gicv2_disable_interrupt(unsigned int id)
gicd_set_icenabler(driver_data->gicd_base, id);
dsbishst();
}
/*******************************************************************************
* This function sets the interrupt priority as supplied for the given interrupt
* id.
******************************************************************************/
void gicv2_set_interrupt_priority(unsigned int id, unsigned int priority)
{
assert(driver_data);
assert(driver_data->gicd_base);
assert(id <= MAX_SPI_ID);
gicd_set_ipriorityr(driver_data->gicd_base, id, priority);
}
......@@ -869,3 +869,26 @@ void gicv3_disable_interrupt(unsigned int id, unsigned int proc_num)
dsbishst();
}
/*******************************************************************************
* This function sets the interrupt priority as supplied for the given interrupt
* id.
******************************************************************************/
void gicv3_set_interrupt_priority(unsigned int id, unsigned int proc_num,
unsigned int priority)
{
uintptr_t gicr_base;
assert(gicv3_driver_data);
assert(gicv3_driver_data->gicd_base);
assert(proc_num < gicv3_driver_data->rdistif_num);
assert(gicv3_driver_data->rdistif_base_addrs);
assert(id <= MAX_SPI_ID);
if (id < MIN_SPI_ID) {
gicr_base = gicv3_driver_data->rdistif_base_addrs[proc_num];
gicr_set_ipriorityr(gicr_base, id, priority);
} else {
gicd_set_ipriorityr(gicv3_driver_data->gicd_base, id, priority);
}
}
......@@ -150,6 +150,7 @@ void gicv2_set_pe_target_mask(unsigned int proc_num);
unsigned int gicv2_get_interrupt_active(unsigned int id);
void gicv2_enable_interrupt(unsigned int id);
void gicv2_disable_interrupt(unsigned int id);
void gicv2_set_interrupt_priority(unsigned int id, unsigned int priority);
#endif /* __ASSEMBLY__ */
#endif /* __GICV2_H__ */
......@@ -353,6 +353,8 @@ unsigned int gicv3_get_running_priority(void);
unsigned int gicv3_get_interrupt_active(unsigned int id, unsigned int proc_num);
void gicv3_enable_interrupt(unsigned int id, unsigned int proc_num);
void gicv3_disable_interrupt(unsigned int id, unsigned int proc_num);
void gicv3_set_interrupt_priority(unsigned int id, unsigned int proc_num,
unsigned int priority);
#endif /* __ASSEMBLY__ */
#endif /* __GICV3_H__ */
......@@ -79,6 +79,7 @@ int plat_ic_is_sgi(unsigned int id);
unsigned int plat_ic_get_interrupt_active(unsigned int id);
void plat_ic_disable_interrupt(unsigned int id);
void plat_ic_enable_interrupt(unsigned int id);
void plat_ic_set_interrupt_priority(unsigned int id, unsigned int priority);
/*******************************************************************************
* Optional common functions (may be overridden)
......
......@@ -27,6 +27,7 @@
#pragma weak plat_ic_get_interrupt_active
#pragma weak plat_ic_enable_interrupt
#pragma weak plat_ic_disable_interrupt
#pragma weak plat_ic_set_interrupt_priority
/*
* This function returns the highest priority pending interrupt at
......@@ -165,3 +166,8 @@ void plat_ic_disable_interrupt(unsigned int id)
{
gicv2_disable_interrupt(id);
}
void plat_ic_set_interrupt_priority(unsigned int id, unsigned int priority)
{
gicv2_set_interrupt_priority(id, priority);
}
......@@ -33,6 +33,7 @@
#pragma weak plat_ic_get_interrupt_active
#pragma weak plat_ic_enable_interrupt
#pragma weak plat_ic_disable_interrupt
#pragma weak plat_ic_set_interrupt_priority
CASSERT((INTR_TYPE_S_EL1 == INTR_GROUP1S) &&
(INTR_TYPE_NS == INTR_GROUP1NS) &&
......@@ -198,6 +199,11 @@ void plat_ic_disable_interrupt(unsigned int id)
{
gicv3_disable_interrupt(id, plat_my_core_pos());
}
void plat_ic_set_interrupt_priority(unsigned int id, unsigned int priority)
{
gicv3_set_interrupt_priority(id, plat_my_core_pos(), priority);
}
#endif
#ifdef IMAGE_BL32
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment