Module Name: src Committed By: jmcneill Date: Tue Sep 24 15:23:34 UTC 2019
Modified Files: src/sys/dev/fdt: fdt_subr.c Log Message: Use correct #cells for parent address when decoding ranges To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/dev/fdt/fdt_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/fdt/fdt_subr.c diff -u src/sys/dev/fdt/fdt_subr.c:1.30 src/sys/dev/fdt/fdt_subr.c:1.31 --- src/sys/dev/fdt/fdt_subr.c:1.30 Fri Jun 14 11:08:18 2019 +++ src/sys/dev/fdt/fdt_subr.c Tue Sep 24 15:23:34 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_subr.c,v 1.30 2019/06/14 11:08:18 hkenken Exp $ */ +/* $NetBSD: fdt_subr.c,v 1.31 2019/09/24 15:23:34 jmcneill Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill <jmcne...@invisible.ca> @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.30 2019/06/14 11:08:18 hkenken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.31 2019/09/24 15:23:34 jmcneill Exp $"); #include "opt_fdt.h" @@ -224,7 +224,7 @@ fdtbus_decode_range(int phandle, uint64_ const int addr_cells = fdtbus_get_addr_cells(phandle); const int size_cells = fdtbus_get_size_cells(phandle); - const int paddr_cells = fdtbus_get_addr_cells(OF_parent(parent)); + const int paddr_cells = fdtbus_get_addr_cells(parent); if (addr_cells == -1 || size_cells == -1 || paddr_cells == -1) return paddr; @@ -237,6 +237,10 @@ fdtbus_decode_range(int phandle, uint64_ cl = fdtbus_get_cells(buf, size_cells); buf += size_cells * 4; +#ifdef FDTBUS_DEBUG + printf("%s: %s: cba=0x%#" PRIx64 ", pba=0x%#" PRIx64 ", cl=0x%#" PRIx64 "\n", __func__, fdt_get_name(fdtbus_get_data(), fdtbus_phandle2offset(phandle), NULL), cba, pba, cl); +#endif + if (paddr >= cba && paddr < cba + cl) return fdtbus_decode_range(parent, pba) + (paddr - cba);