refactor(el3-runtime): plat_ic_has_interrupt_type returns bool

Rather than returning 0 or 1, the above function returns bool false
or true. No functional change.

Change-Id: Iea904ffc368568208fa8203e0d2e0cdaa500b1e0
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
This commit is contained in:
Madhukar Pappireddy 2023-09-06 16:50:22 -05:00
parent 07f867b122
commit 1f6bb41dd9
6 changed files with 20 additions and 20 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017-2022, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2017-2023, Arm Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -458,7 +458,7 @@ void __init ehf_init(void)
int ret __unused; int ret __unused;
/* Ensure EL3 interrupts are supported */ /* Ensure EL3 interrupts are supported */
assert(plat_ic_has_interrupt_type(INTR_TYPE_EL3) != 0); assert(plat_ic_has_interrupt_type(INTR_TYPE_EL3));
/* /*
* Make sure that priority water mark has enough bits to represent the * Make sure that priority water mark has enough bits to represent the

View file

@ -47,7 +47,7 @@ static intr_type_desc_t intr_type_descs[MAX_INTR_TYPES];
******************************************************************************/ ******************************************************************************/
static int32_t validate_interrupt_type(uint32_t type) static int32_t validate_interrupt_type(uint32_t type)
{ {
if (plat_ic_has_interrupt_type(type) != 0) { if (plat_ic_has_interrupt_type(type)) {
return 0; return 0;
} }

View file

@ -120,39 +120,39 @@ This API should set the priority of the interrupt specified by first parameter
In case of Arm standard platforms using GIC, the implementation of the API In case of Arm standard platforms using GIC, the implementation of the API
writes to GIC *Priority Register* set interrupt priority. writes to GIC *Priority Register* set interrupt priority.
Function: int plat_ic_has_interrupt_type(unsigned int type); [optional] Function: bool plat_ic_has_interrupt_type(unsigned int type); [optional]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: ::
Argument : unsigned int Argument : unsigned int
Return : int Return : bool
This API should return whether the platform supports a given interrupt type. The This API should return whether the platform supports a given interrupt type. The
parameter ``type`` shall be one of ``INTR_TYPE_EL3``, ``INTR_TYPE_S_EL1``, or parameter ``type`` shall be one of ``INTR_TYPE_EL3``, ``INTR_TYPE_S_EL1``, or
``INTR_TYPE_NS``. ``INTR_TYPE_NS``.
In case of Arm standard platforms using GICv3, the implementation of the API In case of Arm standard platforms using GICv3, the implementation of the API
returns ``1`` for all interrupt types. returns *true* for all interrupt types.
In case of Arm standard platforms using GICv2, the API always return ``1`` for In case of Arm standard platforms using GICv2, the API always return *true* for
``INTR_TYPE_NS``. Return value for other types depends on the value of build ``INTR_TYPE_NS``. Return value for other types depends on the value of build
option ``GICV2_G0_FOR_EL3``: option ``GICV2_G0_FOR_EL3``:
- For interrupt type ``INTR_TYPE_EL3``: - For interrupt type ``INTR_TYPE_EL3``:
- When ``GICV2_G0_FOR_EL3`` is ``0``, it returns ``0``, indicating no support - When ``GICV2_G0_FOR_EL3`` is ``0``, it returns *false*, indicating no support
for EL3 interrupts. for EL3 interrupts.
- When ``GICV2_G0_FOR_EL3`` is ``1``, it returns ``1``, indicating support for - When ``GICV2_G0_FOR_EL3`` is ``1``, it returns *true*, indicating support for
EL3 interrupts. EL3 interrupts.
- For interrupt type ``INTR_TYPE_S_EL1``: - For interrupt type ``INTR_TYPE_S_EL1``:
- When ``GICV2_G0_FOR_EL3`` is ``0``, it returns ``1``, indicating support for - When ``GICV2_G0_FOR_EL3`` is ``0``, it returns *true*, indicating support for
Secure EL1 interrupts. Secure EL1 interrupts.
- When ``GICV2_G0_FOR_EL3`` is ``1``, it returns ``0``, indicating no support - When ``GICV2_G0_FOR_EL3`` is ``1``, it returns *false*, indicating no support
for Secure EL1 interrupts. for Secure EL1 interrupts.
Function: void plat_ic_set_interrupt_type(unsigned int id, unsigned int type); [optional] Function: void plat_ic_set_interrupt_type(unsigned int id, unsigned int type); [optional]
@ -306,4 +306,4 @@ masks out the interrupt ID field from the acknowledged value from GIC.
-------------- --------------
*Copyright (c) 2017-2019, Arm Limited and Contributors. All rights reserved.* *Copyright (c) 2017-2023, Arm Limited and Contributors. All rights reserved.*

View file

@ -111,7 +111,7 @@ int plat_ic_is_sgi(unsigned int id);
unsigned int plat_ic_get_interrupt_active(unsigned int id); unsigned int plat_ic_get_interrupt_active(unsigned int id);
void plat_ic_disable_interrupt(unsigned int id); void plat_ic_disable_interrupt(unsigned int id);
void plat_ic_enable_interrupt(unsigned int id); void plat_ic_enable_interrupt(unsigned int id);
int plat_ic_has_interrupt_type(unsigned int type); bool plat_ic_has_interrupt_type(unsigned int type);
void plat_ic_set_interrupt_type(unsigned int id, unsigned int type); void plat_ic_set_interrupt_type(unsigned int id, unsigned int type);
void plat_ic_set_interrupt_priority(unsigned int id, unsigned int priority); void plat_ic_set_interrupt_priority(unsigned int id, unsigned int priority);
void plat_ic_raise_el3_sgi(int sgi_num, u_register_t target); void plat_ic_raise_el3_sgi(int sgi_num, u_register_t target);

View file

@ -193,9 +193,9 @@ void plat_ic_set_interrupt_priority(unsigned int id, unsigned int priority)
gicv2_set_interrupt_priority(id, priority); gicv2_set_interrupt_priority(id, priority);
} }
int plat_ic_has_interrupt_type(unsigned int type) bool plat_ic_has_interrupt_type(unsigned int type)
{ {
int has_interrupt_type = 0; bool has_interrupt_type = false;
switch (type) { switch (type) {
#if GICV2_G0_FOR_EL3 #if GICV2_G0_FOR_EL3
@ -204,7 +204,7 @@ int plat_ic_has_interrupt_type(unsigned int type)
case INTR_TYPE_S_EL1: case INTR_TYPE_S_EL1:
#endif #endif
case INTR_TYPE_NS: case INTR_TYPE_NS:
has_interrupt_type = 1; has_interrupt_type = true;
break; break;
default: default:
/* Do nothing in default case */ /* Do nothing in default case */

View file

@ -235,14 +235,14 @@ void plat_ic_set_interrupt_priority(unsigned int id, unsigned int priority)
gicv3_set_interrupt_priority(id, plat_my_core_pos(), priority); gicv3_set_interrupt_priority(id, plat_my_core_pos(), priority);
} }
int plat_ic_has_interrupt_type(unsigned int type) bool plat_ic_has_interrupt_type(unsigned int type)
{ {
if ((type == INTR_TYPE_EL3) || (type == INTR_TYPE_S_EL1) || if ((type == INTR_TYPE_EL3) || (type == INTR_TYPE_S_EL1) ||
(type == INTR_TYPE_NS)) { (type == INTR_TYPE_NS)) {
return 1; return true;
} }
return 0; return false;
} }
void plat_ic_set_interrupt_type(unsigned int id, unsigned int type) void plat_ic_set_interrupt_type(unsigned int id, unsigned int type)