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

GIC: Add APIs to query interrupt types



These APIs allow the GIC implementation to categorize interrupt numbers
into SPIs, PPIs, and SGIs. The default implementations for GICv2 and
GICv3 follows interrupt numbering as specified by the ARM GIC
architecture.

API documentation updated.

Change-Id: Ia6aa379dc955994333232e6138f259535d4fa087
Signed-off-by: default avatarJeenu Viswambharan <jeenu.viswambharan@arm.com>
parent dea417cd
......@@ -27,6 +27,45 @@ acknowledged via. ``plat_ic_acknowledge_interrupt``.
In the case of ARM standard platforms using GIC, the *Running Priority Register*
is read to determine the priority of the interrupt.
Function: int plat_ic_is_spi(unsigned int id); [optional]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
Argument : unsigned int
Return : int
The API should return whether the interrupt ID (first parameter) is categorized
as a Shared Peripheral Interrupt. Shared Peripheral Interrupts are typically
associated to system-wide peripherals, and these interrupts can target any PE in
the system.
Function: int plat_ic_is_ppi(unsigned int id); [optional]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
Argument : unsigned int
Return : int
The API should return whether the interrupt ID (first parameter) is categorized
as a Private Peripheral Interrupt. Private Peripheral Interrupts are typically
associated with peripherals that are private to each PE. Interrupts from private
peripherals target to that PE only.
Function: int plat_ic_is_sgi(unsigned int id); [optional]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
Argument : unsigned int
Return : int
The API should return whether the interrupt ID (first parameter) is categorized
as a Software Generated Interrupt. Software Generated Interrupts are raised by
explicit programming by software, and are typically used in inter-PE
communication. Secure SGIs are reserved for use by Secure world software.
----
*Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.*
......@@ -12,6 +12,7 @@
******************************************************************************/
/* Constants to categorise interrupts */
#define MIN_SGI_ID 0
#define MIN_SEC_SGI_ID 8
#define MIN_PPI_ID 16
#define MIN_SPI_ID 32
#define MAX_SPI_ID 1019
......
......@@ -73,6 +73,9 @@ uint32_t plat_interrupt_type_to_line(uint32_t type,
* Optional interrupt management functions, depending on chosen EL3 components.
******************************************************************************/
unsigned int plat_ic_get_running_priority(void);
int plat_ic_is_spi(unsigned int id);
int plat_ic_is_ppi(unsigned int id);
int plat_ic_is_sgi(unsigned int id);
/*******************************************************************************
* Optional common functions (may be overridden)
......
......@@ -21,6 +21,9 @@
#pragma weak plat_interrupt_type_to_line
#pragma weak plat_ic_get_running_priority
#pragma weak plat_ic_is_spi
#pragma weak plat_ic_is_ppi
#pragma weak plat_ic_is_sgi
/*
* This function returns the highest priority pending interrupt at
......@@ -129,3 +132,18 @@ unsigned int plat_ic_get_running_priority(void)
{
return gicv2_get_running_priority();
}
int plat_ic_is_spi(unsigned int id)
{
return (id >= MIN_SPI_ID) && (id <= MAX_SPI_ID);
}
int plat_ic_is_ppi(unsigned int id)
{
return (id >= MIN_PPI_ID) && (id < MIN_SPI_ID);
}
int plat_ic_is_sgi(unsigned int id)
{
return (id >= MIN_SGI_ID) && (id < MIN_PPI_ID);
}
......@@ -27,6 +27,9 @@
#pragma weak plat_interrupt_type_to_line
#pragma weak plat_ic_get_running_priority
#pragma weak plat_ic_is_spi
#pragma weak plat_ic_is_ppi
#pragma weak plat_ic_is_sgi
CASSERT((INTR_TYPE_S_EL1 == INTR_GROUP1S) &&
(INTR_TYPE_NS == INTR_GROUP1NS) &&
......@@ -163,6 +166,20 @@ unsigned int plat_ic_get_running_priority(void)
return gicv3_get_running_priority();
}
int plat_ic_is_spi(unsigned int id)
{
return (id >= MIN_SPI_ID) && (id <= MAX_SPI_ID);
}
int plat_ic_is_ppi(unsigned int id)
{
return (id >= MIN_PPI_ID) && (id < MIN_SPI_ID);
}
int plat_ic_is_sgi(unsigned int id)
{
return (id >= MIN_SGI_ID) && (id < MIN_PPI_ID);
}
#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