From ae72f8dcb029eed0f054b4c8b845868229b07038 Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Sat, 2 May 2026 01:48:10 +0800 Subject: feat: update UART handling and memory management parameters for improved functionality --- na/include/lume/device_node.h | 2 +- na/include/lume/fdt.h | 8 ++++---- na/include/lume/pmm.h | 6 ++++-- 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'na/include') diff --git a/na/include/lume/device_node.h b/na/include/lume/device_node.h index 14b4a9c..e35f22d 100644 --- a/na/include/lume/device_node.h +++ b/na/include/lume/device_node.h @@ -10,7 +10,7 @@ * Nodes form a parent-children hierarchy via intrusive linked lists. * After unflattening, the tree is globally read-only and requires no locks. * - * Created during Phase 2 (fdt_unflatten) when Slab is available. + * Created when Slab is available. * * Reference: docs/specs/fdt.md §3.2 */ diff --git a/na/include/lume/fdt.h b/na/include/lume/fdt.h index 8da223c..783b030 100644 --- a/na/include/lume/fdt.h +++ b/na/include/lume/fdt.h @@ -33,9 +33,9 @@ public: // 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 by matching compatible = "ns16550a". - // Falls back to platform default (0x10000000) on failure. - static void early_scan_uart(uint64 fdt_paddr, uint64 *uart_addr); + // 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); // --- Phase 2: Object tree construction (requires Slab) --- @@ -78,4 +78,4 @@ DeviceNode *fdt_get_node_by_path(const char *path); // Early scan wrappers (delegate to FdtManager static methods). void fdt_early_get_mem_info(uint64 *base, uint64 *size); -void fdt_early_get_uart_info(uint64 *uart_addr); +void fdt_early_get_uart_info(uint64 *uart_addr, uint64 *uart_size); diff --git a/na/include/lume/pmm.h b/na/include/lume/pmm.h index 1ac1e17..b970404 100644 --- a/na/include/lume/pmm.h +++ b/na/include/lume/pmm.h @@ -24,8 +24,10 @@ /* Buddy system constants */ inline constexpr int kMaxOrder = 11; // Orders 0..10 → 4KB..4MB -inline constexpr int kPcpHighWatermark = 64; // Max frames cached per CPU -inline constexpr int kPcpBatchSize = 32; // Frames moved per refill/drain + +/* Per-CPU cache dynamic parameters (calculated in pmm_init) */ +extern uint32 g_pcp_high_watermark; +extern uint32 g_pcp_batch_size; /* ================================================================== */ /* Public free-function API */ -- cgit v1.2.3