refactor(gicv3): add helper function to get the limit of ESPI INTID
Add helper function gicv3_get_espi_limit() to get the value of (maximum extended SPI INTID + 1), so that some duplicated code can be removed later. Signed-off-by: Heyi Guo <guoheyi@linux.alibaba.com> Change-Id: I0355ca2647f872e8189add259f6c47d415494cce
This commit is contained in:
parent
ed0f0a0968
commit
30524ff80a
|
@ -110,6 +110,28 @@ unsigned int gicv3_get_spi_limit(uintptr_t gicd_base)
|
|||
return spi_limit;
|
||||
}
|
||||
|
||||
#if GIC_EXT_INTID
|
||||
/*******************************************************************************
|
||||
* Helper function to get the maximum ESPI INTID + 1.
|
||||
******************************************************************************/
|
||||
unsigned int gicv3_get_espi_limit(uintptr_t gicd_base)
|
||||
{
|
||||
unsigned int typer_reg = gicd_read_typer(gicd_base);
|
||||
|
||||
/* Check if extended SPI range is implemented */
|
||||
if ((typer_reg & TYPER_ESPI) != 0U) {
|
||||
/*
|
||||
* (maximum ESPI INTID + 1) is equal to
|
||||
* 32 * (GICD_TYPER.ESPI_range + 1) + 4096
|
||||
*/
|
||||
return ((((typer_reg >> TYPER_ESPI_RANGE_SHIFT) &
|
||||
TYPER_ESPI_RANGE_MASK) + 1U) << 5) + MIN_ESPI_ID;
|
||||
}
|
||||
|
||||
return 0U;
|
||||
}
|
||||
#endif /* GIC_EXT_INTID */
|
||||
|
||||
/*******************************************************************************
|
||||
* Helper function to configure the default attributes of (E)SPIs.
|
||||
******************************************************************************/
|
||||
|
|
|
@ -234,6 +234,7 @@ void gicr_set_icfgr(uintptr_t base, unsigned int id, unsigned int cfg);
|
|||
* Private GICv3 helper function prototypes
|
||||
******************************************************************************/
|
||||
unsigned int gicv3_get_spi_limit(uintptr_t gicd_base);
|
||||
unsigned int gicv3_get_espi_limit(uintptr_t gicd_base);
|
||||
void gicv3_spis_config_defaults(uintptr_t gicd_base);
|
||||
void gicv3_ppi_sgi_config_defaults(uintptr_t gicr_base);
|
||||
unsigned int gicv3_secure_ppi_sgi_config_props(uintptr_t gicr_base,
|
||||
|
|
Loading…
Reference in New Issue