mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-27 15:24:54 +00:00

The SCU connects one to four Cortex-A5/Cortex-A9 processors to the memory system through the AXI interfaces. The SCU functions are to: - maintain data cache coherency between the Cortex-A5/Cortex-A9 processors - initiate L2 AXI memory accesses - arbitrate between Cortex-A5/Cortex-A9 processors requesting L2 accesses - manage ACP accesses. Snoop Control Unit will enable to snoop on other CPUs caches. This is very important when it comes to synchronizing data between CPUs. As an example, there is a high chance that data might be cache'd and other CPUs can't see the change. In such cases, if snoop control unit is enabled, data is synchoronized immediately between CPUs and the changes are visible to other CPUs. This driver provides functionality to enable SCU as well as enabling user to know the following - number of CPUs present - is a particular CPU operating in SMP mode or AMP mode - data cache size of a particular CPU - does SCU has ACP port - is L2CPRESENT Change-Id: I0d977970154fa60df57caf449200d471f02312a0 Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
51 lines
1.5 KiB
C
51 lines
1.5 KiB
C
/*
|
|
* Copyright (c) 2019, Arm Limited. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#include <assert.h>
|
|
#include <drivers/arm/scu.h>
|
|
#include <lib/mmio.h>
|
|
#include <plat/common/platform.h>
|
|
#include <stdint.h>
|
|
|
|
/*******************************************************************************
|
|
* Turn ON snoop control unit. This is needed to synchronize the data between
|
|
* CPU's.
|
|
******************************************************************************/
|
|
void enable_snoop_ctrl_unit(uintptr_t base)
|
|
{
|
|
uint32_t scu_ctrl;
|
|
|
|
INFO("[SCU]: enabling snoop control unit ... \n");
|
|
|
|
assert(base != 0U);
|
|
scu_ctrl = mmio_read_32(base + SCU_CTRL_REG);
|
|
|
|
/* already enabled? */
|
|
if ((scu_ctrl & SCU_ENABLE_BIT) != 0) {
|
|
return;
|
|
}
|
|
|
|
scu_ctrl |= SCU_ENABLE_BIT;
|
|
mmio_write_32(base + SCU_CTRL_REG, scu_ctrl);
|
|
}
|
|
|
|
/*******************************************************************************
|
|
* Snoop Control Unit configuration register. This is read-only register and
|
|
* contains information such as
|
|
* - number of CPUs present
|
|
* - is a particular CPU operating in SMP mode or AMP mode
|
|
* - data cache size of a particular CPU
|
|
* - does SCU has ACP port
|
|
* - is L2CPRESENT
|
|
* NOTE: user of this API should interpert the bits in this register according
|
|
* to the TRM
|
|
******************************************************************************/
|
|
uint32_t read_snoop_ctrl_unit_cfg(uintptr_t base)
|
|
{
|
|
assert(base != 0U);
|
|
|
|
return mmio_read_32(base + SCU_CFG_REG);
|
|
}
|