summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSughosh Ganu <[email protected]>2024-10-25 22:57:23 +0530
committerMichal Simek <[email protected]>2024-11-15 14:32:02 +0100
commitfeb423a3a3d34ed7903d6eb833ddd0593a410474 (patch)
treefe024078f6a8b01c4a22e0c8caf0c07c87abe77f /include
parent7aeed221dbd354f34428d709dfd7679a2c94199d (diff)
common: memtop: add logic to detect ram_top
Add generic logic to determine the ram_top value for boards. Earlier, this was achieved in an indirect manner through a set of LMB API's. That has since changed so that the LMB code is available only after relocation. Replace those LMB calls with a single call to get_mem_top() to determine the value of ram_top. Signed-off-by: Sughosh Ganu <[email protected]> Reviewed-by: Michal Simek <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michal Simek <[email protected]>
Diffstat (limited to 'include')
-rw-r--r--include/memtop.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/memtop.h b/include/memtop.h
new file mode 100644
index 00000000000..28f62e24ea7
--- /dev/null
+++ b/include/memtop.h
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2024, Linaro Limited
+ */
+
+/**
+ * get_mem_top() - Compute the value of ram_top
+ * @ram_start: Start of RAM
+ * @ram_size: RAM size
+ * @size: Minimum RAM size requested
+ * @fdt: FDT blob
+ *
+ * The function computes the top address of RAM memory that can be
+ * used by U-Boot. This is being done by going through the list of
+ * reserved memory regions specified in the devicetree blob passed
+ * to the function. The logic used here is derived from the lmb
+ * allocation function.
+ *
+ * Return: address of ram top on success, 0 on failure
+ */
+phys_addr_t get_mem_top(phys_addr_t ram_start, phys_size_t ram_size,
+ phys_size_t size, void *fdt);