summaryrefslogtreecommitdiff
path: root/plat/arm/board/fvp/fvp_drtm_dma_prot.c
blob: 1ada6c795d1d1005e97cc09da01e6ea7892740f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
 * Copyright (c) 2021, ARM Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include <stdbool.h>
#include <stddef.h>

#include <drivers/arm/smmu_v3.h>
#include <plat/arm/common/arm_config.h>
#include <platform_def.h>
#include <services/drtm_svc_plat.h>


bool plat_has_non_host_platforms(void)
{
	/* Note: FVP base platforms typically have GPU, as per --list-instances. */
	return true;
}

bool plat_has_unmanaged_dma_peripherals(void)
{
	/*
	 * Note-LPT: As far as I can tell, RevC's --list-instances does not show
	 * devices that are described as DMA-capable but not managed by an SMMU
	 * in the FVP documentation.
	 * However, the SMMU seems to have only been introduced in the RevC
	 * revision.
	 */
	return !(arm_config.flags & ARM_CONFIG_FVP_HAS_SMMUV3);
}

unsigned int plat_get_total_num_smmus(void)
{
	if ((arm_config.flags & ARM_CONFIG_FVP_HAS_SMMUV3)) {
		return 1;
	} else {
		return 0;
	}
}

static const uintptr_t smmus[] = {
	PLAT_FVP_SMMUV3_BASE,
};

void plat_enumerate_smmus(const uintptr_t (*smmus_out)[],
                          size_t *smmu_count_out)
{
	if ((arm_config.flags & ARM_CONFIG_FVP_HAS_SMMUV3)) {
		*(const uintptr_t **)smmus_out = smmus;
		*smmu_count_out = sizeof(smmus) / sizeof(uintptr_t);
	} else {
		*(const uintptr_t **)smmus_out = NULL;
		*smmu_count_out = 0;
	}
}