Browse Source

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>
pull/1130/head
Jeenu Viswambharan 7 years ago
parent
commit
ca43b55d22
  1. 39
      docs/platform-interrupt-controller-API.rst
  2. 1
      include/drivers/arm/gic_common.h
  3. 3
      include/plat/common/platform.h
  4. 18
      plat/common/plat_gicv2.c
  5. 17
      plat/common/plat_gicv3.c

39
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.*

1
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

3
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)

18
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);
}

17
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

Loading…
Cancel
Save