mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-08 05:43:53 +00:00

Enforce full include path for includes. Deprecate old paths. The following folders inside include/lib have been left unchanged: - include/lib/cpus/${ARCH} - include/lib/el3_runtime/${ARCH} The reason for this change is that having a global namespace for includes isn't a good idea. It defeats one of the advantages of having folders and it introduces problems that are sometimes subtle (because you may not know the header you are actually including if there are two of them). For example, this patch had to be created because two headers were called the same way:e0ea0928d5
("Fix gpio includes of mt8173 platform to avoid collision."). More recently, this patch has had similar problems:46f9b2c3a2
("drivers: add tzc380 support"). This problem was introduced in commit4ecca33988
("Move include and source files to logical locations"). At that time, there weren't too many headers so it wasn't a real issue. However, time has shown that this creates problems. Platforms that want to preserve the way they include headers may add the removed paths to PLAT_INCLUDES, but this is discouraged. Change-Id: I39dc53ed98f9e297a5966e723d1936d6ccf2fc8f Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
115 lines
3.5 KiB
C
115 lines
3.5 KiB
C
/*
|
|
* Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
/*
|
|
* Driver for implementation defined features that are identical in ARM GICv3
|
|
* implementations (GIC-500 and GIC-600 for now). This driver only overrides
|
|
* APIs that are different to those generic ones in GICv3 driver.
|
|
*/
|
|
|
|
#include <assert.h>
|
|
|
|
#include <arch_helpers.h>
|
|
#include <drivers/arm/arm_gicv3_common.h>
|
|
#include <drivers/arm/gicv3.h>
|
|
|
|
#include "gicv3_private.h"
|
|
|
|
/*
|
|
* Flush the internal GIC cache of the LPIs pending tables to memory before
|
|
* saving the state of the Redistributor. This is required before powering off
|
|
* the GIC when the pending status must be preserved.
|
|
* `rdist_proc_num` is the processor number corresponding to the Redistributor of the
|
|
* current CPU.
|
|
*/
|
|
void arm_gicv3_distif_pre_save(unsigned int rdist_proc_num)
|
|
{
|
|
uintptr_t gicr_base = 0;
|
|
|
|
assert(gicv3_driver_data);
|
|
assert(gicv3_driver_data->rdistif_base_addrs);
|
|
|
|
/*
|
|
* The GICR_WAKER.Sleep bit should be set only when both
|
|
* GICR_WAKER.ChildrenAsleep and GICR_WAKER.ProcessorSleep are set on
|
|
* all the Redistributors.
|
|
*/
|
|
for (unsigned int i = 0; i < gicv3_driver_data->rdistif_num; i++) {
|
|
gicr_base = gicv3_driver_data->rdistif_base_addrs[i];
|
|
assert(gicr_base);
|
|
assert(gicr_read_waker(gicr_base) & WAKER_CA_BIT);
|
|
assert(gicr_read_waker(gicr_base) & WAKER_PS_BIT);
|
|
}
|
|
|
|
gicr_base = gicv3_driver_data->rdistif_base_addrs[rdist_proc_num];
|
|
/*
|
|
* According to the TRM, there is only one instance of the
|
|
* GICR_WAKER.Sleep and GICR_WAKER.Quiescent bits that can be accessed
|
|
* through any of the Redistributor.
|
|
*/
|
|
|
|
/*
|
|
* Set GICR_WAKER.Sleep
|
|
* After this point, the system must be configured so that the
|
|
* wake_request signals for the right cores are asserted when a wakeup
|
|
* interrupt is detected. The GIC will not be able to do that anymore
|
|
* when the GICR_WAKER.Sleep bit is set to 1.
|
|
*/
|
|
gicr_write_waker(gicr_base, gicr_read_waker(gicr_base) | WAKER_SL_BIT);
|
|
|
|
/* Wait until the GICR_WAKER.Quiescent bit is set */
|
|
while (!(gicr_read_waker(gicr_base) & WAKER_QSC_BIT))
|
|
;
|
|
}
|
|
|
|
/*
|
|
* Allow the LPIs pending state to be read back from the tables in memory after
|
|
* having restored the state of the GIC Redistributor.
|
|
*/
|
|
void arm_gicv3_distif_post_restore(unsigned int rdist_proc_num)
|
|
{
|
|
uintptr_t gicr_base;
|
|
|
|
assert(gicv3_driver_data);
|
|
assert(gicv3_driver_data->rdistif_base_addrs);
|
|
|
|
/*
|
|
* According to the TRM, there is only one instance of the
|
|
* GICR_WAKER.Sleep and GICR_WAKER.Quiescent bits that can be accessed
|
|
* through any of the Redistributor.
|
|
*/
|
|
gicr_base = gicv3_driver_data->rdistif_base_addrs[rdist_proc_num];
|
|
assert(gicr_base);
|
|
|
|
/*
|
|
* If the GIC had power removed, the GICR_WAKER state will be reset.
|
|
* Since the GICR_WAKER.Sleep and GICR_WAKER.Quiescent bits are cleared,
|
|
* we can exit early. This also prevents the following assert from
|
|
* erroneously triggering.
|
|
*/
|
|
if (!(gicr_read_waker(gicr_base) & WAKER_SL_BIT))
|
|
return;
|
|
|
|
/*
|
|
* Writes to GICR_WAKER.Sleep bit are ignored if GICR_WAKER.Quiescent
|
|
* bit is not set. We should be alright on power on path, therefore
|
|
* coming out of sleep and Quiescent should be set, but we assert in
|
|
* case.
|
|
*/
|
|
assert(gicr_read_waker(gicr_base) & WAKER_QSC_BIT);
|
|
|
|
/* Clear GICR_WAKER.Sleep */
|
|
gicr_write_waker(gicr_base, gicr_read_waker(gicr_base) & ~WAKER_SL_BIT);
|
|
|
|
/*
|
|
* We don't know if the effects of setting GICR_WAKER.Sleep bit is
|
|
* instantaneous, so we wait until the interface is not Quiescent
|
|
* anymore.
|
|
*/
|
|
while (gicr_read_waker(gicr_base) & WAKER_QSC_BIT)
|
|
;
|
|
}
|
|
|