Skip to content

Commit d4efbe1

Browse files
committed
uboot: fix uefi boot
1 parent 4779810 commit d4efbe1

3 files changed

Lines changed: 158 additions & 0 deletions

File tree

configs/u-boot/lx2k_additions.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ CONFIG_EFI_VARIABLE_NO_STORE=y
22
CONFIG_PCI_IOMMU_EXTRA_MAPPINGS=y
33
CONFIG_LED=y
44
CONFIG_LED_GPIO=y
5+
CONFIG_FSL_ESDHC_SUPPORT_ADMA2=y
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
From 10a28336d837029c3f3c714adc5edd4f19ff8ca1 Mon Sep 17 00:00:00 2001
2+
From: Josua Mayer <josua@solid-run.com>
3+
Date: Wed, 1 Jul 2026 16:52:13 +0200
4+
Subject: [PATCH 46/47] drivers: net: fsl-mc: mark mc reserved memory no-map
5+
MIME-Version: 1.0
6+
Content-Type: text/plain; charset=UTF-8
7+
Content-Transfer-Encoding: 8bit
8+
9+
When booting an operating system via the UEFI pathway (e.g., using
10+
grub.efi), passing 0 as the flags argument to fdtdec_add_reserved_memory()
11+
omits the "no-map" property from the generated DTB entries.
12+
13+
Consequently, U-Boot's internal UEFI memory allocator translates these
14+
regions—including the 256MB 'mc-mem5@0' co-processor block—into standard
15+
EFI_BOOT_SERVICES_DATA descriptors. The early Linux EFI stub parses this
16+
table and incorrectly maps absolute physical address 0x0 into system RAM:
17+
18+
[ 0.000000] Early memory node ranges
19+
[ 0.000000] node 0: [mem 0x0000000000000000-0x000000000fffffff]
20+
21+
Because the kernel now registers the SoC's lower peripheral configuration
22+
space as cacheable system memory, subsequent ioremap() calls to critical
23+
hardware blocks fail, preventing the system from initializing and
24+
triggering a watchdog reset loop:
25+
26+
[    0.000000] GICv3: [Firmware Bug]: GICD region 0x0000000006000000 has overlapping address
27+
[    0.000000] WARNING: CPU: 0 PID: 0 at arch/arm64/mm/ioremap.c:28 ioremap_prot+0xb0/0xf0
28+
[    0.000000] Modules linked in:
29+
[    0.000000] CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.12.86+deb13-arm64 #1  Debian 6.12.86-1
30+
[    0.000000] Hardware name: SolidRun LX2160A SolidWAN Single (DT)
31+
[    0.000000] pstate: 800000c5 (Nzcv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
32+
[    0.000000] pc : ioremap_prot+0xb0/0xf0
33+
[    0.000000] lr : ioremap_prot+0x64/0xf0
34+
[    0.000000] sp : ffffb9bd5a833bc0
35+
[    0.000000] x29: ffffb9bd5a833bd0 x28: 000000000000000a x27: ffffb9bd5abc38a0
36+
[    0.000000] x26: dead000000000122 x25: ffff47ff00037d00 x24: dead000000000100
37+
[    0.000000] x23: ffffb9bd5abc34e8 x22: ffffb9bd59dcfe88 x21: 0000000000000000
38+
[    0.000000] x20: 0000000000010000 x19: 0000000006000000 x18: 0000000000000006
39+
[    0.000000] x17: 616c7265766f2073 x16: 6168203030303030 x15: 3036303030303030
40+
[    0.000000] x14: 3030307830206e6f x13: 7373657264646120 x12: ffffb9bd5a8c2b00
41+
[    0.000000] x11: ffffb9bd5a86ab58 x10: ffffb9bd5a89cca9 x9 : ffffb9bd58836d78
42+
[    0.000000] x8 : 0000000010000000 x7 : 0000000000000018 x6 : ffffb9bd5ac3c398
43+
[    0.000000] x5 : ffffb9bd5ac3c398 x4 : 0000000000000001 x3 : 0000000000000001
44+
[    0.000000] x2 : 0000000010000000 x1 : 0000000000000000 x0 : 0000000000000001
45+
[    0.000000] Call trace:
46+
[    0.000000]  ioremap_prot+0xb0/0xf0
47+
[    0.000000]  of_iomap+0x10c/0x128
48+
[    0.000000]  gic_of_iomap+0x60/0x88
49+
[    0.000000]  gic_of_init+0x70/0x288
50+
[    0.000000]  of_irq_init+0x210/0x388
51+
[    0.000000]  irqchip_init+0x20/0x50
52+
[    0.000000]  init_IRQ+0xa4/0xc8
53+
[    0.000000]  start_kernel+0x5d0/0x798
54+
[    0.000000]  __primary_switched+0x80/0x90
55+
[    0.000000] ---[ end trace 0000000000000000 ]---
56+
[    0.000000] GICv3: /interrupt-controller@6000000: unable to map gic dist registers
57+
[    0.000000] OF: of_irq_init: Failed to init /interrupt-controller@6000000 ((____ptrval____)), parent 0000000000000000
58+
[    0.000000] OF: of_irq_init: children remain, but no parents
59+
[    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
60+
61+
Fix this by explicitly passing the FDTDEC_RESERVED_MEMORY_NO_MAP flag.
62+
This injects the proper "no-map;" property into the device tree. U-Boot
63+
UEFI will then correctly treat it as EFI_RESERVED_MEMORY_TYPE, forcing
64+
the downstream Linux kernel to mark the pool as MEMBLOCK_NOMAP. This keeps
65+
the linear mapping clear and unblocks early system ioremap operations.
66+
67+
Signed-off-by: Josua Mayer <josua@solid-run.com>
68+
---
69+
drivers/net/fsl-mc/mc.c | 2 +-
70+
1 file changed, 1 insertion(+), 1 deletion(-)
71+
72+
diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
73+
index 7d2bae924b0..714acafb7f4 100644
74+
--- a/drivers/net/fsl-mc/mc.c
75+
+++ b/drivers/net/fsl-mc/mc.c
76+
@@ -994,7 +994,7 @@ void fdt_reserve_mc_mem(void *blob, u32 mc_icid)
77+
sprintf(mem_name, "mc-mem%d", i);
78+
ret = fdtdec_add_reserved_memory(blob, mem_name,
79+
&mc_mem_ranges[i], NULL, 0,
80+
- &phandle, 0);
81+
+ &phandle, FDTDEC_RESERVED_MEMORY_NO_MAP);
82+
if (ret < 0) {
83+
printf("ERROR: failed to reserve MC memory: %d\n", ret);
84+
return;
85+
--
86+
2.51.0
87+
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
From af5435907f0098905d932251c6a4f284ad2e9d2b Mon Sep 17 00:00:00 2001
2+
From: Josua Mayer <josua@solid-run.com>
3+
Date: Wed, 1 Jul 2026 17:40:12 +0200
4+
Subject: [PATCH 47/47] drivers: net: fsl-mc: remove MMIO and CCSR ranges from
5+
reserved-memory
6+
7+
The fdt_reserve_mc_mem() function historically injected peripheral MMIO
8+
and CCSR register blocks into the device tree's /reserved-memory node.
9+
However, the /reserved-memory parent node is strictly specified for
10+
carving out system DRAM regions, not memory-mapped I/O registers.
11+
12+
When booting via UEFI, this improper categorization causes the Linux
13+
kernel's resource allocator to flag address collisions when native
14+
drivers try to claim their register planes. This blocks the serial
15+
console from probing:
16+
17+
[ 0.906343] OF: amba_device_add() failed (-16) for /soc/serial@21c0000
18+
[ 3.294935] Warning: unable to open an initial console.
19+
20+
It also prevents the management complex bus driver from probing its
21+
hardware communication portals, completely breaking the network subsystem:
22+
23+
[ 3.239842] fsl_mc_bus 80c000000.fsl-mc: devm_request_mem_region failed for MC portal 0x000000080c000000
24+
[ 3.249438] fsl_mc_bus 80c000000.fsl-mc: probe with driver fsl_mc_bus failed with error -16
25+
26+
Remove the legacy MMIO and CCSR blocks from the mc_mem_ranges array,
27+
leaving only index 0 (the actual dynamic DRAM carveout pool). This
28+
allows native Linux drivers to claim and map their register spaces cleanly.
29+
30+
Signed-off-by: Josua Mayer <josua@solid-run.com>
31+
---
32+
drivers/net/fsl-mc/mc.c | 22 ----------------------
33+
1 file changed, 22 deletions(-)
34+
35+
diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
36+
index 714acafb7f4..739d91c6fa2 100644
37+
--- a/drivers/net/fsl-mc/mc.c
38+
+++ b/drivers/net/fsl-mc/mc.c
39+
@@ -947,28 +947,6 @@ void fdt_reserve_mc_mem(void *blob, u32 mc_icid)
40+
{
41+
.start = 0,
42+
.end = 0
43+
- },
44+
- {
45+
- .start = CFG_SYS_FSL_MC_BASE,
46+
- .end = CFG_SYS_FSL_MC_BASE + CFG_SYS_FSL_MC_SIZE - 1
47+
- },
48+
- {
49+
- .start = CFG_SYS_FSL_NI_BASE,
50+
- .end = CFG_SYS_FSL_NI_BASE + CFG_SYS_FSL_NI_SIZE - 1
51+
- },
52+
- {
53+
- .start = CFG_SYS_FSL_QBMAN_BASE,
54+
- .end = CFG_SYS_FSL_QBMAN_BASE +
55+
- CFG_SYS_FSL_QBMAN_SIZE - 1
56+
- },
57+
- {
58+
- .start = CFG_SYS_FSL_PEBUF_BASE,
59+
- .end = CFG_SYS_FSL_PEBUF_BASE +
60+
- CFG_SYS_FSL_PEBUF_SIZE - 1
61+
- },
62+
- {
63+
- .start = CFG_SYS_FSL_CCSR_BASE,
64+
- .end = CFG_SYS_FSL_CCSR_BASE + CFG_SYS_FSL_CCSR_SIZE - 1
65+
}
66+
};
67+
68+
--
69+
2.51.0
70+

0 commit comments

Comments
 (0)