Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/fdt Print the full DT node path in "not configured" ...



details:   https://anonhg.NetBSD.org/src/rev/2929c4de535d
branches:  trunk
changeset: 823150:2929c4de535d
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu Apr 13 22:12:53 2017 +0000

description:
Print the full DT node path in "not configured" autoconf messages.

Before:  clock at fdt2 not configured
After:   /clocks/clock@0 at fdt2 not configured

diffstat:

 sys/dev/fdt/fdt_subr.c |  17 +++++++++++++++--
 sys/dev/fdt/fdtbus.c   |  12 +++++++++---
 sys/dev/fdt/fdtvar.h   |   3 ++-
 3 files changed, 26 insertions(+), 6 deletions(-)

diffs (96 lines):

diff -r 4286cc989ec1 -r 2929c4de535d sys/dev/fdt/fdt_subr.c
--- a/sys/dev/fdt/fdt_subr.c    Thu Apr 13 21:20:44 2017 +0000
+++ b/sys/dev/fdt/fdt_subr.c    Thu Apr 13 22:12:53 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_subr.c,v 1.5 2015/12/22 21:42:11 jmcneill Exp $ */
+/* $NetBSD: fdt_subr.c,v 1.6 2017/04/13 22:12:53 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.5 2015/12/22 21:42:11 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.6 2017/04/13 22:12:53 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -143,6 +143,19 @@
        return fdtbus_offset2phandle(off);
 }
 
+bool
+fdtbus_get_path(int phandle, char *buf, size_t buflen)
+{
+       const int off = fdtbus_phandle2offset(phandle);
+       if (off < 0) {
+               return false;
+       }
+       if (fdt_get_path(fdt_data, off, buf, (int)buflen) != 0) {
+               return false;
+       }
+       return true;
+}
+
 int
 fdtbus_get_reg(int phandle, u_int index, bus_addr_t *paddr, bus_size_t *psize)
 {
diff -r 4286cc989ec1 -r 2929c4de535d sys/dev/fdt/fdtbus.c
--- a/sys/dev/fdt/fdtbus.c      Thu Apr 13 21:20:44 2017 +0000
+++ b/sys/dev/fdt/fdtbus.c      Thu Apr 13 22:12:53 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtbus.c,v 1.3 2017/02/07 09:14:52 skrll Exp $ */
+/* $NetBSD: fdtbus.c,v 1.4 2017/04/13 22:12:53 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.3 2017/02/07 09:14:52 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.4 2017/04/13 22:12:53 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -40,6 +40,8 @@
 
 #include <dev/fdt/fdtvar.h>
 
+#define        FDT_MAX_PATH    256
+
 static int     fdt_match(device_t, cfdata_t, void *);
 static void    fdt_attach(device_t, device_t, void *);
 static void    fdt_scan(device_t, const struct fdt_attach_args *, const char *);
@@ -153,9 +155,13 @@
 fdt_print(void *aux, const char *pnp)
 {
        const struct fdt_attach_args * const faa = aux;
+       char buf[FDT_MAX_PATH];
+       const char *name = buf;
 
        if (pnp) {
-               aprint_normal("%s at %s", faa->faa_name, pnp);
+               if (!fdtbus_get_path(faa->faa_phandle, buf, sizeof(buf)))
+                       name = faa->faa_name;
+               aprint_normal("%s at %s", name, pnp);
        }
 
        return UNCONF;
diff -r 4286cc989ec1 -r 2929c4de535d sys/dev/fdt/fdtvar.h
--- a/sys/dev/fdt/fdtvar.h      Thu Apr 13 21:20:44 2017 +0000
+++ b/sys/dev/fdt/fdtvar.h      Thu Apr 13 22:12:53 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtvar.h,v 1.7 2016/01/05 21:53:48 marty Exp $ */
+/* $NetBSD: fdtvar.h,v 1.8 2017/04/13 22:12:53 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -166,5 +166,6 @@
 const void *   fdtbus_get_data(void);
 int            fdtbus_phandle2offset(int);
 int            fdtbus_offset2phandle(int);
+bool           fdtbus_get_path(int, char *, size_t);
 
 #endif /* _DEV_FDT_FDTVAR_H */



Home | Main Index | Thread Index | Old Index