Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/fdt when enumerating ports and endpoints treat missi...



details:   https://anonhg.NetBSD.org/src/rev/7db9debfda3e
branches:  trunk
changeset: 359753:7db9debfda3e
user:      macallan <macallan%NetBSD.org@localhost>
date:      Fri Jan 21 21:00:26 2022 +0000

description:
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

diffstat:

 sys/dev/fdt/fdt_port.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (44 lines):

diff -r f0a296f36beb -r 7db9debfda3e sys/dev/fdt/fdt_port.c
--- a/sys/dev/fdt/fdt_port.c    Fri Jan 21 19:14:14 2022 +0000
+++ b/sys/dev/fdt/fdt_port.c    Fri Jan 21 21:00:26 2022 +0000
@@ -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 @@
                        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 @@
                        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;



Home | Main Index | Thread Index | Old Index