summaryrefslogtreecommitdiff
path: root/na/include
diff options
context:
space:
mode:
Diffstat (limited to 'na/include')
-rw-r--r--na/include/lume/fdt.h55
1 files changed, 29 insertions, 26 deletions
diff --git a/na/include/lume/fdt.h b/na/include/lume/fdt.h
index 783b030..63d185b 100644
--- a/na/include/lume/fdt.h
+++ b/na/include/lume/fdt.h
@@ -18,47 +18,50 @@
* Reference: docs/specs/fdt.md
*/
-#include <lume/types.h>
#include <lume/device_node.h>
+#include <lume/types.h>
class FdtManager {
public:
- // Construct with the physical address of the FDT blob.
- // Called via Placement New in fdt_init().
- FdtManager(uint64 fdt_paddr);
+ // Construct with the physical address of the FDT blob.
+ // Called via Placement New in fdt_init().
+ FdtManager(uint64 fdt_paddr);
+
+ // --- Phase 1: Early scan (static, allocation-free) ---
- // --- Phase 1: Early scan (static, allocation-free) ---
+ // Extract physical memory base and size from the /memory node.
+ // Panics if the FDT is invalid or /memory is missing.
+ static void early_scan_mem(uint64 fdt_paddr, uint64 *base, uint64 *size);
- // Extract physical memory base and size from the /memory node.
- // Panics if the FDT is invalid or /memory is missing.
- static void early_scan_mem(uint64 fdt_paddr, uint64 *base, uint64 *size);
+ // Extract the UART base address and size by matching compatible = "ns16550a".
+ // Falls back to platform default on failure.
+ static void early_scan_uart(uint64 fdt_paddr, uint64 *uart_addr,
+ uint64 *uart_size);
- // Extract the UART base address and size by matching compatible = "ns16550a".
- // Falls back to platform default on failure.
- static void early_scan_uart(uint64 fdt_paddr, uint64 *uart_addr, uint64 *uart_size);
+ static void early_scan_kaslr(uint64 fdt_paddr, uint64 *seed);
- // --- Phase 2: Object tree construction (requires Slab) ---
+ // --- Phase 2: Object tree construction (requires Slab) ---
- // Walk the FDT blob and build the DeviceNode tree.
- void unflatten();
+ // Walk the FDT blob and build the DeviceNode tree.
+ void unflatten();
- // --- Query interface (read-only after unflatten) ---
+ // --- Query interface (read-only after unflatten) ---
- // Find the first node whose "compatible" property contains the string.
- // Returns nullptr if no match.
- DeviceNode *find_compatible(const char *compat_string);
+ // Find the first node whose "compatible" property contains the string.
+ // Returns nullptr if no match.
+ DeviceNode *find_compatible(const char *compat_string);
- // Look up a node by its full path (e.g. "/soc/uart@10000000").
- // Returns nullptr if not found.
- DeviceNode *get_node_by_path(const char *path);
+ // Look up a node by its full path (e.g. "/soc/uart@10000000").
+ // Returns nullptr if not found.
+ DeviceNode *get_node_by_path(const char *path);
- // Return the stored FDT physical address.
- uint64 get_paddr() const { return fdt_paddr_; }
+ // Return the stored FDT physical address.
+ uint64 get_paddr() const { return fdt_paddr_; }
private:
- uint64 fdt_paddr_; // Physical address of the FDT blob
- bool is_unflattened_ = false; // True after unflatten() completes
- DeviceNode *root_ = nullptr; // Root of the unflattened tree
+ uint64 fdt_paddr_; // Physical address of the FDT blob
+ bool is_unflattened_ = false; // True after unflatten() completes
+ DeviceNode *root_ = nullptr; // Root of the unflattened tree
};
/* Global FDT manager singleton (Placement New, see global_init.md ยง3.1) */