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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
/*
* Arm SCP/MCP Software
* Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "clock_soc.h"
#include "scp_pik.h"
#include "scp_software_mmap.h"
#include "tc0_sds.h"
#include <mod_sds.h>
#include <fwk_assert.h>
#include <fwk_element.h>
#include <fwk_id.h>
#include <fwk_macros.h>
#include <fwk_module.h>
#include <fwk_module_idx.h>
#include <stdbool.h>
#include <stdint.h>
static const uint32_t feature_flags = 0x00000000;
static const struct mod_sds_region_desc sds_module_regions[] = {
[TC0_SDS_REGION_SECURE] =
{
.base = (void *)SCP_SDS_MEM_BASE,
.size = SCP_SDS_MEM_SIZE,
},
};
static_assert(
FWK_ARRAY_SIZE(sds_module_regions) == TC0_SDS_REGION_COUNT,
"Mismatch between number of SDS regions and number of regions "
"provided by the SDS configuration.");
const struct mod_sds_config sds_module_config = {
.regions = sds_module_regions,
.region_count = TC0_SDS_REGION_COUNT,
.clock_id =
FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_CLOCK, CLOCK_IDX_CPU_GROUP_KLEIN)
};
static struct fwk_element sds_element_table[] = {
{
.name = "CPU Info",
.data = &((struct mod_sds_structure_desc){
.id = TC0_SDS_CPU_INFO,
.size = TC0_SDS_CPU_INFO_SIZE,
.region_id = TC0_SDS_REGION_SECURE,
.finalize = true,
}),
},
{
.name = "Feature Availability",
.data = &((struct mod_sds_structure_desc){
.id = TC0_SDS_FEATURE_AVAILABILITY,
.size = TC0_SDS_FEATURE_AVAILABILITY_SIZE,
.payload = &feature_flags,
.region_id = TC0_SDS_REGION_SECURE,
.finalize = true,
}),
},
{
.name = "Bootloader",
.data = &((struct mod_sds_structure_desc){
.id = TC0_SDS_BOOTLOADER,
.size = TC0_SDS_BOOTLOADER_SIZE,
.region_id = TC0_SDS_REGION_SECURE,
.finalize = true,
}),
},
{ 0 }, /* Termination description. */
};
static_assert(
SCP_SDS_MEM_SIZE > TC0_SDS_CPU_INFO_SIZE +
TC0_SDS_FEATURE_AVAILABILITY_SIZE + TC0_SDS_BOOTLOADER_SIZE,
"SDS structures too large for SDS SRAM.\n");
static const struct fwk_element *sds_get_element_table(fwk_id_t module_id)
{
static_assert(BUILD_VERSION_MAJOR < UINT8_MAX, "Invalid version size");
static_assert(BUILD_VERSION_MINOR < UINT8_MAX, "Invalid version size");
static_assert(BUILD_VERSION_PATCH < UINT16_MAX, "Invalid version size");
return sds_element_table;
}
struct fwk_module_config config_sds = {
.elements = FWK_MODULE_DYNAMIC_ELEMENTS(sds_get_element_table),
.data = &sds_module_config,
};
|