AlexeiFedorov | ffef39a | 2024-10-28 16:35:21 +0000 | [diff] [blame] | 1 | /* |
| 2 | * SPDX-License-Identifier: BSD-3-Clause |
| 3 | * SPDX-FileCopyrightText: Copyright TF-RMM Contributors. |
| 4 | */ |
| 5 | |
| 6 | #ifndef ARM_MEMORY_H |
| 7 | #define ARM_MEMORY_H |
| 8 | |
| 9 | #include <rmm_el3_ifc.h> |
| 10 | #include <stddef.h> |
| 11 | #include <stdint.h> |
| 12 | |
| 13 | /* Arm platform memory management structures */ |
| 14 | struct arm_memory_bank { |
| 15 | uint64_t base; /* bank base address */ |
| 16 | uint64_t size; /* size of this bank */ |
| 17 | /* This idx is a cumulative granule count of previous banks */ |
| 18 | uint64_t start_gran_idx; /* start granule index for this bank */ |
| 19 | }; |
| 20 | |
| 21 | struct arm_memory_layout { |
| 22 | unsigned long num_granules; /* number of granules */ |
| 23 | unsigned long num_banks; /* number of memory banks */ |
| 24 | struct arm_memory_bank bank[PLAT_ARM_MAX_MEM_BANKS]; |
| 25 | /* sorted array of memory banks */ |
| 26 | }; |
| 27 | |
| 28 | void arm_set_dram_layout(struct memory_info *plat_dram); |
| 29 | void arm_set_dev_layout(struct memory_info *plat_dev, enum range_type type); |
| 30 | struct arm_memory_layout *arm_get_dram_layout(void); |
| 31 | struct arm_memory_layout *arm_get_dev_ncoh_layout(void); |
| 32 | struct arm_memory_layout *arm_get_dev_coh_layout(void); |
| 33 | |
| 34 | #endif /* ARM_MEMORY_H */ |