blob: b89de9f287bccdf4444ec60352aeca9d599bf505 [file] [log] [blame]
Javier Almansa Sobrino4165e842022-04-25 17:18:15 +01001/*
AlexeiFedorov334d2352022-12-29 15:57:40 +00002 * Copyright (c) 2022-2023, Arm Limited. All rights reserved.
Javier Almansa Sobrino4165e842022-04-25 17:18:15 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef RMM_CORE_MANIFEST_H
8#define RMM_CORE_MANIFEST_H
9
10#include <assert.h>
11#include <stddef.h>
12#include <stdint.h>
13
14#include <lib/cassert.h>
15
16#define RMMD_MANIFEST_VERSION_MAJOR U(0)
AlexeiFedorov8e754f92022-12-14 17:28:11 +000017#define RMMD_MANIFEST_VERSION_MINOR U(2)
Javier Almansa Sobrino4165e842022-04-25 17:18:15 +010018
19/*
20 * Manifest version encoding:
21 * - Bit[31] RES0
22 * - Bits [30:16] Major version
23 * - Bits [15:0] Minor version
24 */
AlexeiFedorov334d2352022-12-29 15:57:40 +000025#define SET_RMMD_MANIFEST_VERSION(_major, _minor) \
Javier Almansa Sobrino4165e842022-04-25 17:18:15 +010026 ((((_major) & 0x7FFF) << 16) | ((_minor) & 0xFFFF))
27
AlexeiFedorov334d2352022-12-29 15:57:40 +000028#define RMMD_MANIFEST_VERSION SET_RMMD_MANIFEST_VERSION( \
29 RMMD_MANIFEST_VERSION_MAJOR, \
Javier Almansa Sobrino4165e842022-04-25 17:18:15 +010030 RMMD_MANIFEST_VERSION_MINOR)
31
AlexeiFedorov334d2352022-12-29 15:57:40 +000032#define RMMD_GET_MANIFEST_VERSION_MAJOR(_version) \
Javier Almansa Sobrino4165e842022-04-25 17:18:15 +010033 ((_version >> 16) & 0x7FFF)
34
AlexeiFedorov334d2352022-12-29 15:57:40 +000035#define RMMD_GET_MANIFEST_VERSION_MINOR(_version) \
Javier Almansa Sobrino4165e842022-04-25 17:18:15 +010036 (_version & 0xFFFF)
37
AlexeiFedorov334d2352022-12-29 15:57:40 +000038/* NS DRAM bank structure */
39struct ns_dram_bank {
AlexeiFedorov8e754f92022-12-14 17:28:11 +000040 uintptr_t base; /* Base address */
41 uint64_t size; /* Size of bank */
42};
43
AlexeiFedorov334d2352022-12-29 15:57:40 +000044CASSERT(offsetof(struct ns_dram_bank, base) == 0UL,
AlexeiFedorov8e754f92022-12-14 17:28:11 +000045 rmm_manifest_base_unaligned);
AlexeiFedorov334d2352022-12-29 15:57:40 +000046CASSERT(offsetof(struct ns_dram_bank, size) == 8UL,
AlexeiFedorov8e754f92022-12-14 17:28:11 +000047 rmm_manifest_size_unaligned);
48
AlexeiFedorov334d2352022-12-29 15:57:40 +000049/* NS DRAM layout info structure */
50struct ns_dram_info {
51 uint64_t num_banks; /* Number of NS DRAM banks */
52 struct ns_dram_bank *banks; /* Pointer to ns_dram_bank[] */
53 uint64_t checksum; /* Checksum of ns_dram_info data */
AlexeiFedorov8e754f92022-12-14 17:28:11 +000054};
55
AlexeiFedorov334d2352022-12-29 15:57:40 +000056CASSERT(offsetof(struct ns_dram_info, num_banks) == 0UL,
57 rmm_manifest_num_banks_unaligned);
58CASSERT(offsetof(struct ns_dram_info, banks) == 8UL,
AlexeiFedorov8e754f92022-12-14 17:28:11 +000059 rmm_manifest_dram_data_unaligned);
AlexeiFedorov334d2352022-12-29 15:57:40 +000060CASSERT(offsetof(struct ns_dram_info, checksum) == 16UL,
61 rmm_manifest_checksum_unaligned);
AlexeiFedorov8e754f92022-12-14 17:28:11 +000062
63/* Boot manifest core structure as per v0.2 */
64struct rmm_manifest {
65 uint32_t version; /* Manifest version */
66 uint32_t padding; /* RES0 */
67 uintptr_t plat_data; /* Manifest platform data */
AlexeiFedorov334d2352022-12-29 15:57:40 +000068 struct ns_dram_info plat_dram; /* Platform NS DRAM data */
AlexeiFedorov8e754f92022-12-14 17:28:11 +000069};
Javier Almansa Sobrino4165e842022-04-25 17:18:15 +010070
AlexeiFedorov334d2352022-12-29 15:57:40 +000071CASSERT(offsetof(struct rmm_manifest, version) == 0UL,
AlexeiFedorov8e754f92022-12-14 17:28:11 +000072 rmm_manifest_version_unaligned);
AlexeiFedorov334d2352022-12-29 15:57:40 +000073CASSERT(offsetof(struct rmm_manifest, plat_data) == 8UL,
AlexeiFedorov8e754f92022-12-14 17:28:11 +000074 rmm_manifest_plat_data_unaligned);
AlexeiFedorov334d2352022-12-29 15:57:40 +000075CASSERT(offsetof(struct rmm_manifest, plat_dram) == 16UL,
AlexeiFedorov8e754f92022-12-14 17:28:11 +000076 rmm_manifest_plat_dram_unaligned);
Javier Almansa Sobrino4165e842022-04-25 17:18:15 +010077
78#endif /* RMM_CORE_MANIFEST_H */