Maximilian Brune | ee1cb8f | 2024-02-24 04:34:55 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <cbmem.h> |
| 4 | #include <symbols.h> |
| 5 | #include <ramdetect.h> |
Alper Nebi Yasak | 08d7d31 | 2024-02-05 20:16:26 +0300 | [diff] [blame^] | 6 | #include <device_tree.h> |
| 7 | #include <mcall.h> |
Maximilian Brune | ee1cb8f | 2024-02-24 04:34:55 +0100 | [diff] [blame] | 8 | |
| 9 | uintptr_t cbmem_top_chipset(void) |
| 10 | { |
Alper Nebi Yasak | 08d7d31 | 2024-02-05 20:16:26 +0300 | [diff] [blame^] | 11 | uint64_t top; |
| 12 | |
| 13 | top = fdt_get_memory_top((void *)HLS()->fdt); |
| 14 | if (top) |
| 15 | return MIN(top, (uint64_t)4 * GiB - 1); |
| 16 | |
Maximilian Brune | ee1cb8f | 2024-02-24 04:34:55 +0100 | [diff] [blame] | 17 | size_t dram_mb_detected = probe_ramsize((uintptr_t)_dram, CONFIG_DRAM_SIZE_MB); |
| 18 | return (uintptr_t)_dram + dram_mb_detected * MiB; |
| 19 | } |