1 /* 2 * Copyright (c) 2022-2023, Arm Limited. All rights reserved. 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) 17 #define RMMD_MANIFEST_VERSION_MINOR U(2) 18 19 /* 20 * Manifest version encoding: 21 * - Bit[31] RES0 22 * - Bits [30:16] Major version 23 * - Bits [15:0] Minor version 24 */ 25 #define SET_RMMD_MANIFEST_VERSION(_major, _minor) \ 26 ((((_major) & 0x7FFF) << 16) | ((_minor) & 0xFFFF)) 27 28 #define RMMD_MANIFEST_VERSION SET_RMMD_MANIFEST_VERSION( \ 29 RMMD_MANIFEST_VERSION_MAJOR, \ 30 RMMD_MANIFEST_VERSION_MINOR) 31 32 #define RMMD_GET_MANIFEST_VERSION_MAJOR(_version) \ 33 ((_version >> 16) & 0x7FFF) 34 35 #define RMMD_GET_MANIFEST_VERSION_MINOR(_version) \ 36 (_version & 0xFFFF) 37 38 /* NS DRAM bank structure */ 39 struct ns_dram_bank { 40 uintptr_t base; /* Base address */ 41 uint64_t size; /* Size of bank */ 42 }; 43 44 CASSERT(offsetof(struct ns_dram_bank, base) == 0UL, 45 rmm_manifest_base_unaligned); 46 CASSERT(offsetof(struct ns_dram_bank, size) == 8UL, 47 rmm_manifest_size_unaligned); 48 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 */ 54 }; 55 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, 59 rmm_manifest_dram_data_unaligned); 60 CASSERT(offsetof(struct ns_dram_info, checksum) == 16UL, 61 rmm_manifest_checksum_unaligned); 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 */ 68 struct ns_dram_info plat_dram; /* Platform NS DRAM data */ 69 }; 70 71 CASSERT(offsetof(struct rmm_manifest, version) == 0UL, 72 rmm_manifest_version_unaligned); 73 CASSERT(offsetof(struct rmm_manifest, plat_data) == 8UL, 74 rmm_manifest_plat_data_unaligned); 75 CASSERT(offsetof(struct rmm_manifest, plat_dram) == 16UL, 76 rmm_manifest_plat_dram_unaligned); 77 78 #endif /* RMM_CORE_MANIFEST_H */ 79