Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DM/FDT] Fixup memory address reserved and translate in early #9027

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions components/drivers/ofw/fdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ rt_uint64_t rt_fdt_translate_address(void *fdt, int nodeoffset, rt_uint64_t addr

if (parent >= 0)
{
ranges = fdt_getprop(fdt, nodeoffset, "ranges", &length);
ranges = fdt_getprop(fdt, parent, "ranges", &length);
}

if (ranges && length > 0)
{
local.addr_cells = fdt_address_cells(fdt, nodeoffset);
local.size_cells = fdt_size_cells(fdt, nodeoffset);
cpu.addr_cells = fdt_io_addr_cells(fdt, nodeoffset);
cpu.size_cells = fdt_io_size_cells(fdt, nodeoffset);
local.addr_cells = fdt_address_cells(fdt, parent);
local.size_cells = fdt_size_cells(fdt, parent);
cpu.addr_cells = fdt_io_addr_cells(fdt, parent);
cpu.size_cells = fdt_io_size_cells(fdt, parent);

group_len = local.addr_cells + cpu.addr_cells + local.size_cells;

Expand All @@ -105,7 +105,7 @@ rt_uint64_t rt_fdt_translate_address(void *fdt, int nodeoffset, rt_uint64_t addr

if (local.addr <= address && local.addr + local.size > address)
{
ret += address - cpu.addr;
ret = address - local.addr + cpu.addr;
break;
}

Expand Down Expand Up @@ -247,9 +247,9 @@ static rt_err_t fdt_reserved_memory_reg(int nodeoffset, const char *uname)

rt_bool_t is_nomap = fdt_getprop(_fdt, nodeoffset, "no-map", RT_NULL) ? RT_TRUE : RT_FALSE;
base = rt_fdt_translate_address(_fdt, nodeoffset, base);
rt_memblock_reserve_memory(uname, base, base + size, is_nomap);

len -= t_len;
rt_memblock_reserve_memory(fdt_get_name(_fdt, nodeoffset, RT_NULL),
base, base + size, is_nomap);
}
}
}
Expand Down
Loading