When a node is missing the "ranges" property, offset should be set to 0.
The current implementation sets offset to the address to be translated,
which ignores the fact that `fdt_default_translate` is later called.
The latter function adds the offset to the same address,
resulting in doubling the effective address, when in fact a 1-to-1
mapping is necessary.
Signed-off-by: Eduard Vintilă <eduard.vintila47@gmail.com>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #805
if (!ranges)
return 1;
if (rlen == 0) {
- offset = fdt_reg_read_number(addr, na);
+ offset = 0;
uk_pr_debug("empty ranges, 1:1 translation\n");
goto finish;
}
memcpy(addr, ranges + na, 4 * pna);
finish:
- uk_pr_info("parent translation for:%p %x", addr, pna);
+ uk_pr_info("parent translation for:%p %x\n", addr, pna);
/* Translate it into parent bus space */
return fdt_default_translate(addr, offset, pna);