Javier Almansa Sobrino | 4165e84 | 2022-04-25 17:18:15 +0100 | [diff] [blame] | 1 | /* |
AlexeiFedorov | 334d235 | 2022-12-29 15:57:40 +0000 | [diff] [blame] | 2 | * Copyright (c) 2022-2023, Arm Limited. All rights reserved. |
Javier Almansa Sobrino | 4165e84 | 2022-04-25 17:18:15 +0100 | [diff] [blame] | 3 | * |
| 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) |
AlexeiFedorov | 8e754f9 | 2022-12-14 17:28:11 +0000 | [diff] [blame] | 17 | #define RMMD_MANIFEST_VERSION_MINOR U(2) |
Javier Almansa Sobrino | 4165e84 | 2022-04-25 17:18:15 +0100 | [diff] [blame] | 18 | |
| 19 | /* |
| 20 | * Manifest version encoding: |
| 21 | * - Bit[31] RES0 |
| 22 | * - Bits [30:16] Major version |
| 23 | * - Bits [15:0] Minor version |
| 24 | */ |
AlexeiFedorov | 334d235 | 2022-12-29 15:57:40 +0000 | [diff] [blame] | 25 | #define SET_RMMD_MANIFEST_VERSION(_major, _minor) \ |
Javier Almansa Sobrino | 4165e84 | 2022-04-25 17:18:15 +0100 | [diff] [blame] | 26 | ((((_major) & 0x7FFF) << 16) | ((_minor) & 0xFFFF)) |
| 27 | |
AlexeiFedorov | 334d235 | 2022-12-29 15:57:40 +0000 | [diff] [blame] | 28 | #define RMMD_MANIFEST_VERSION SET_RMMD_MANIFEST_VERSION( \ |
| 29 | RMMD_MANIFEST_VERSION_MAJOR, \ |
Javier Almansa Sobrino | 4165e84 | 2022-04-25 17:18:15 +0100 | [diff] [blame] | 30 | RMMD_MANIFEST_VERSION_MINOR) |
| 31 | |
AlexeiFedorov | 334d235 | 2022-12-29 15:57:40 +0000 | [diff] [blame] | 32 | #define RMMD_GET_MANIFEST_VERSION_MAJOR(_version) \ |
Javier Almansa Sobrino | 4165e84 | 2022-04-25 17:18:15 +0100 | [diff] [blame] | 33 | ((_version >> 16) & 0x7FFF) |
| 34 | |
AlexeiFedorov | 334d235 | 2022-12-29 15:57:40 +0000 | [diff] [blame] | 35 | #define RMMD_GET_MANIFEST_VERSION_MINOR(_version) \ |
Javier Almansa Sobrino | 4165e84 | 2022-04-25 17:18:15 +0100 | [diff] [blame] | 36 | (_version & 0xFFFF) |
| 37 | |
AlexeiFedorov | 334d235 | 2022-12-29 15:57:40 +0000 | [diff] [blame] | 38 | /* NS DRAM bank structure */ |
| 39 | struct ns_dram_bank { |
AlexeiFedorov | 8e754f9 | 2022-12-14 17:28:11 +0000 | [diff] [blame] | 40 | uintptr_t base; /* Base address */ |
| 41 | uint64_t size; /* Size of bank */ |
| 42 | }; |
| 43 | |
AlexeiFedorov | 334d235 | 2022-12-29 15:57:40 +0000 | [diff] [blame] | 44 | CASSERT(offsetof(struct ns_dram_bank, base) == 0UL, |
AlexeiFedorov | 8e754f9 | 2022-12-14 17:28:11 +0000 | [diff] [blame] | 45 | rmm_manifest_base_unaligned); |
AlexeiFedorov | 334d235 | 2022-12-29 15:57:40 +0000 | [diff] [blame] | 46 | CASSERT(offsetof(struct ns_dram_bank, size) == 8UL, |
AlexeiFedorov | 8e754f9 | 2022-12-14 17:28:11 +0000 | [diff] [blame] | 47 | rmm_manifest_size_unaligned); |
| 48 | |
AlexeiFedorov | 334d235 | 2022-12-29 15:57:40 +0000 | [diff] [blame] | 49 | /* NS DRAM layout info structure */ |
| 50 | struct 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 */ |
AlexeiFedorov | 8e754f9 | 2022-12-14 17:28:11 +0000 | [diff] [blame] | 54 | }; |
| 55 | |
AlexeiFedorov | 334d235 | 2022-12-29 15:57:40 +0000 | [diff] [blame] | 56 | CASSERT(offsetof(struct ns_dram_info, num_banks) == 0UL, |
| 57 | rmm_manifest_num_banks_unaligned); |
| 58 | CASSERT(offsetof(struct ns_dram_info, banks) == 8UL, |
AlexeiFedorov | 8e754f9 | 2022-12-14 17:28:11 +0000 | [diff] [blame] | 59 | rmm_manifest_dram_data_unaligned); |
AlexeiFedorov | 334d235 | 2022-12-29 15:57:40 +0000 | [diff] [blame] | 60 | CASSERT(offsetof(struct ns_dram_info, checksum) == 16UL, |
| 61 | rmm_manifest_checksum_unaligned); |
AlexeiFedorov | 8e754f9 | 2022-12-14 17:28:11 +0000 | [diff] [blame] | 62 | |
| 63 | /* Boot manifest core structure as per v0.2 */ |
| 64 | struct rmm_manifest { |
| 65 | uint32_t version; /* Manifest version */ |
| 66 | uint32_t padding; /* RES0 */ |
| 67 | uintptr_t plat_data; /* Manifest platform data */ |
AlexeiFedorov | 334d235 | 2022-12-29 15:57:40 +0000 | [diff] [blame] | 68 | struct ns_dram_info plat_dram; /* Platform NS DRAM data */ |
AlexeiFedorov | 8e754f9 | 2022-12-14 17:28:11 +0000 | [diff] [blame] | 69 | }; |
Javier Almansa Sobrino | 4165e84 | 2022-04-25 17:18:15 +0100 | [diff] [blame] | 70 | |
AlexeiFedorov | 334d235 | 2022-12-29 15:57:40 +0000 | [diff] [blame] | 71 | CASSERT(offsetof(struct rmm_manifest, version) == 0UL, |
AlexeiFedorov | 8e754f9 | 2022-12-14 17:28:11 +0000 | [diff] [blame] | 72 | rmm_manifest_version_unaligned); |
AlexeiFedorov | 334d235 | 2022-12-29 15:57:40 +0000 | [diff] [blame] | 73 | CASSERT(offsetof(struct rmm_manifest, plat_data) == 8UL, |
AlexeiFedorov | 8e754f9 | 2022-12-14 17:28:11 +0000 | [diff] [blame] | 74 | rmm_manifest_plat_data_unaligned); |
AlexeiFedorov | 334d235 | 2022-12-29 15:57:40 +0000 | [diff] [blame] | 75 | CASSERT(offsetof(struct rmm_manifest, plat_dram) == 16UL, |
AlexeiFedorov | 8e754f9 | 2022-12-14 17:28:11 +0000 | [diff] [blame] | 76 | rmm_manifest_plat_dram_unaligned); |
Javier Almansa Sobrino | 4165e84 | 2022-04-25 17:18:15 +0100 | [diff] [blame] | 77 | |
| 78 | #endif /* RMM_CORE_MANIFEST_H */ |