Module Name:    src
Committed By:   jmcneill
Date:           Thu Apr 13 22:12:53 UTC 2017

Modified Files:
        src/sys/dev/fdt: fdt_subr.c fdtbus.c fdtvar.h

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/fdt/fdt_subr.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/fdt/fdtbus.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/fdt/fdtvar.h

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.5 src/sys/dev/fdt/fdt_subr.c:1.6
--- src/sys/dev/fdt/fdt_subr.c:1.5	Tue Dec 22 21:42:11 2015
+++ src/sys/dev/fdt/fdt_subr.c	Thu Apr 13 22:12:53 2017
@@ -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 <jmcne...@invisible.ca>
@@ -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 @@ fdtbus_get_phandle_from_native(int phand
 	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)
 {

Index: src/sys/dev/fdt/fdtbus.c
diff -u src/sys/dev/fdt/fdtbus.c:1.3 src/sys/dev/fdt/fdtbus.c:1.4
--- src/sys/dev/fdt/fdtbus.c:1.3	Tue Feb  7 09:14:52 2017
+++ src/sys/dev/fdt/fdtbus.c	Thu Apr 13 22:12:53 2017
@@ -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 <jmcne...@invisible.ca>
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1
 
 #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 @@ static int
 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;

Index: src/sys/dev/fdt/fdtvar.h
diff -u src/sys/dev/fdt/fdtvar.h:1.7 src/sys/dev/fdt/fdtvar.h:1.8
--- src/sys/dev/fdt/fdtvar.h:1.7	Tue Jan  5 21:53:48 2016
+++ src/sys/dev/fdt/fdtvar.h	Thu Apr 13 22:12:53 2017
@@ -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 <jmcne...@invisible.ca>
@@ -166,5 +166,6 @@ bool		fdtbus_set_data(const void *);
 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 */

Reply via email to