diff options
author | Jeenu Viswambharan <jeenu.viswambharan@arm.com> | 2017-09-22 08:32:09 +0100 |
---|---|---|
committer | Jeenu Viswambharan <jeenu.viswambharan@arm.com> | 2017-10-16 16:50:01 +0100 |
commit | ca43b55d22f3a48f408d16d4bedbf677cbdf8f48 (patch) | |
tree | 1242264410d888d42f8564298fe9e4a8a68cd148 | |
parent | dea417cdd640a3e258db3b817223ffaa5f53e416 (diff) | |
download | arm-trusted-firmware-ca43b55d22f3a48f408d16d4bedbf677cbdf8f48.tar.gz |
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: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
-rw-r--r-- | docs/platform-interrupt-controller-API.rst | 39 | ||||
-rw-r--r-- | include/drivers/arm/gic_common.h | 1 | ||||
-rw-r--r-- | include/plat/common/platform.h | 3 | ||||
-rw-r--r-- | plat/common/plat_gicv2.c | 18 | ||||
-rw-r--r-- | plat/common/plat_gicv3.c | 17 |
5 files changed, 78 insertions, 0 deletions
diff --git a/docs/platform-interrupt-controller-API.rst b/docs/platform-interrupt-controller-API.rst index 9ef2e3f6..a94a90c7 100644 --- a/docs/platform-interrupt-controller-API.rst +++ b/docs/platform-interrupt-controller-API.rst @@ -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.* diff --git a/include/drivers/arm/gic_common.h b/include/drivers/arm/gic_common.h index b9cae802..f4e2c526 100644 --- a/include/drivers/arm/gic_common.h +++ b/include/drivers/arm/gic_common.h @@ -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 diff --git a/include/plat/common/platform.h b/include/plat/common/platform.h index 7468352d..f00db0db 100644 --- a/include/plat/common/platform.h +++ b/include/plat/common/platform.h @@ -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) diff --git a/plat/common/plat_gicv2.c b/plat/common/plat_gicv2.c index 1be693bb..7d91f792 100644 --- a/plat/common/plat_gicv2.c +++ b/plat/common/plat_gicv2.c @@ -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); +} diff --git a/plat/common/plat_gicv3.c b/plat/common/plat_gicv3.c index 02317f1d..5a6021c4 100644 --- a/plat/common/plat_gicv3.c +++ b/plat/common/plat_gicv3.c @@ -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 |