mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-08-22 01:48:52 +09:00
![Xiubo Li](/assets/img/avatar_default.png)
The Central Security Unit (CSU) allows secure world software to change the default access control policies of peripherals/bus slaves, determining which bus masters may access them. This allows peripherals to be separated into distinct security domains. Combined with SMMU configuration of the system masters privileges, these features provide protection against indirect unauthorized access to data. For now we configure all the peripheral access permissions as R/W. Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Reviewed-by: York Sun <yorksun@freescale.com>
31 lines
575 B
C
31 lines
575 B
C
/*
|
|
* Copyright 2014 Freescale Semiconductor
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <asm/io.h>
|
|
#include <asm/arch/ns_access.h>
|
|
|
|
void enable_devices_ns_access(struct csu_ns_dev *ns_dev, uint32_t num)
|
|
{
|
|
u32 *base = (u32 *)CONFIG_SYS_FSL_CSU_ADDR;
|
|
u32 *reg;
|
|
uint32_t val;
|
|
int i;
|
|
|
|
for (i = 0; i < num; i++) {
|
|
reg = base + ns_dev[i].ind / 2;
|
|
val = in_be32(reg);
|
|
if (ns_dev[i].ind % 2 == 0) {
|
|
val &= 0x0000ffff;
|
|
val |= ns_dev[i].val << 16;
|
|
} else {
|
|
val &= 0xffff0000;
|
|
val |= ns_dev[i].val;
|
|
}
|
|
out_be32(reg, val);
|
|
}
|
|
}
|