Module Name:    src
Committed By:   macallan
Date:           Fri Jan 21 21:00:26 UTC 2022

Modified Files:
        src/sys/dev/fdt: fdt_port.c

Log Message:
when enumerating ports and endpoints treat missing 'reg' properties as zero
ok jmcneill:
Looking at Linux. If port or endpoint are missing a 'reg' property it defaults 
to 0.
Please make our code do the same.

see 
https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/graph.yaml

with this my pinebook has a usable console again


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/fdt/fdt_port.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_port.c
diff -u src/sys/dev/fdt/fdt_port.c:1.6 src/sys/dev/fdt/fdt_port.c:1.7
--- src/sys/dev/fdt/fdt_port.c:1.6	Wed Jan  1 12:46:44 2020
+++ src/sys/dev/fdt/fdt_port.c	Fri Jan 21 21:00:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fdt_port.c,v 1.6 2020/01/01 12:46:44 jmcneill Exp $	*/
+/*	$NetBSD: fdt_port.c,v 1.7 2022/01/21 21:00:26 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: fdt_port.c,v 1.6 2020/01/01 12:46:44 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: fdt_port.c,v 1.7 2022/01/21 21:00:26 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -298,10 +298,10 @@ again:
 			continue;
 		if (fdtbus_get_reg(child, 0, &id, NULL) != 0) {
 			if (ports->dp_nports > 1)
-				aprint_error_dev(self,
+				aprint_debug_dev(self,
 				    "%s: missing reg property",
 				    fdtbus_get_string(child, "name"));
-			id = i;
+			id = 0;
 		}
 		ports->dp_port[i].port_id = id;
 		ports->dp_port[i].port_phandle = child;
@@ -349,10 +349,10 @@ fdt_endpoints_register(int phandle, stru
 			continue;
 		if (fdtbus_get_reg64(child, 0, &id, NULL) != 0) {
 			if (port->port_nep > 1)
-				aprint_error_dev(port->port_dp->dp_dev,
+				aprint_debug_dev(port->port_dp->dp_dev,
 				    "%s: missing reg property",
 				    fdtbus_get_string(child, "name"));
-			id = i;
+			id = 0;
 		}
 		ep = &port->port_ep[i];
 		ep->ep_id = id;

Reply via email to