blob: ec9cd7a2e5af1470e2132caa4086a7b068045088 [file] [log] [blame]
Lucian Paul-Trifu5ee4f4e2022-06-22 18:45:30 +01001/*
2 * Copyright (c) 2022, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <stdbool.h>
8#include <stddef.h>
9
10#include <drivers/arm/smmu_v3.h>
11#include <lib/utils_def.h>
12#include <plat/arm/common/arm_config.h>
13#include <plat/common/platform.h>
14
15#include <platform_def.h>
16
17/**
18 * Array mentioning number of SMMUs supported by FVP
19 */
20static const uintptr_t fvp_smmus[] = {
21 PLAT_FVP_SMMUV3_BASE,
22};
23
24bool plat_has_non_host_platforms(void)
25{
26 /* FVP base platforms typically have GPU, as per FVP Reference guide */
27 return true;
28}
29
30bool plat_has_unmanaged_dma_peripherals(void)
31{
32 /*
33 * FVP Reference guide does not show devices that are described as
34 * DMA-capable but not managed by an SMMU in the FVP documentation.
35 * However, the SMMU seems to have only been introduced in the RevC
36 * revision.
37 */
38 return (arm_config.flags & ARM_CONFIG_FVP_HAS_SMMUV3) == 0;
39}
40
41unsigned int plat_get_total_smmus(void)
42{
43 if ((arm_config.flags & ARM_CONFIG_FVP_HAS_SMMUV3) != 0U) {
44 return ARRAY_SIZE(fvp_smmus);
45 } else {
46 return 0;
47 }
48}
49
50void plat_enumerate_smmus(const uintptr_t **smmus_out,
51 size_t *smmu_count_out)
52{
53 if ((arm_config.flags & ARM_CONFIG_FVP_HAS_SMMUV3) != 0U) {
54 *smmus_out = fvp_smmus;
55 *smmu_count_out = ARRAY_SIZE(fvp_smmus);
56 } else {
57 *smmus_out = NULL;
58 *smmu_count_out = 0;
59 }
60}