Wed Jan 30 00:56:47 2019 UTC ()
Hide address decoding debug messages under FDTBUS_DEBUG


(jmcneill)
diff -r1.26 -r1.27 src/sys/dev/fdt/fdt_subr.c

cvs diff -r1.26 -r1.27 src/sys/dev/fdt/fdt_subr.c (expand / switch to unified diff)

--- src/sys/dev/fdt/fdt_subr.c 2019/01/27 09:19:36 1.26
+++ src/sys/dev/fdt/fdt_subr.c 2019/01/30 00:56:47 1.27
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: fdt_subr.c,v 1.26 2019/01/27 09:19:36 rin Exp $ */ 1/* $NetBSD: fdt_subr.c,v 1.27 2019/01/30 00:56:47 jmcneill Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.26 2019/01/27 09:19:36 rin Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.27 2019/01/30 00:56:47 jmcneill Exp $");
31 31
32#include "opt_fdt.h" 32#include "opt_fdt.h"
33 33
34#include <sys/param.h> 34#include <sys/param.h>
35#include <sys/bus.h> 35#include <sys/bus.h>
36 36
37#include <libfdt.h> 37#include <libfdt.h>
38#include <dev/fdt/fdtvar.h> 38#include <dev/fdt/fdtvar.h>
39 39
40static const void *fdt_data; 40static const void *fdt_data;
41 41
42static struct fdt_conslist fdt_console_list = 42static struct fdt_conslist fdt_console_list =
43 TAILQ_HEAD_INITIALIZER(fdt_console_list); 43 TAILQ_HEAD_INITIALIZER(fdt_console_list);
@@ -279,30 +279,32 @@ fdtbus_get_reg64(int phandle, u_int inde @@ -279,30 +279,32 @@ fdtbus_get_reg64(int phandle, u_int inde
279 if (reglen == 0) 279 if (reglen == 0)
280 return EINVAL; 280 return EINVAL;
281 281
282 if (index >= len / reglen) 282 if (index >= len / reglen)
283 return ENXIO; 283 return ENXIO;
284 284
285 buf += index * reglen; 285 buf += index * reglen;
286 addr = fdtbus_get_cells(buf, addr_cells); 286 addr = fdtbus_get_cells(buf, addr_cells);
287 buf += addr_cells * 4; 287 buf += addr_cells * 4;
288 size = fdtbus_get_cells(buf, size_cells); 288 size = fdtbus_get_cells(buf, size_cells);
289 289
290 if (paddr) { 290 if (paddr) {
291 *paddr = fdtbus_decode_range(OF_parent(phandle), addr); 291 *paddr = fdtbus_decode_range(OF_parent(phandle), addr);
 292#ifdef FDTBUS_DEBUG
292 const char *name = fdt_get_name(fdtbus_get_data(), 293 const char *name = fdt_get_name(fdtbus_get_data(),
293 fdtbus_phandle2offset(phandle), NULL); 294 fdtbus_phandle2offset(phandle), NULL);
294 aprint_debug("fdt: [%s] decoded addr #%u: %" PRIx64 295 printf("fdt: [%s] decoded addr #%u: %" PRIx64
295 " -> %" PRIx64 "\n", name, index, addr, *paddr); 296 " -> %" PRIx64 "\n", name, index, addr, *paddr);
 297#endif
296 } 298 }
297 if (psize) 299 if (psize)
298 *psize = size; 300 *psize = size;
299 301
300 return 0; 302 return 0;
301} 303}
302 304
303#if defined(FDT) 305#if defined(FDT)
304const struct fdt_console * 306const struct fdt_console *
305fdtbus_get_console(void) 307fdtbus_get_console(void)
306{ 308{
307 static const struct fdt_console_info *booted_console = NULL; 309 static const struct fdt_console_info *booted_console = NULL;
308 310