Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Allow nodes to attach child devices using the same sorti...
details: https://anonhg.NetBSD.org/src/rev/f17b2393a574
branches: trunk
changeset: 833541:f17b2393a574
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sat Jun 30 16:22:56 2018 +0000
description:
Allow nodes to attach child devices using the same sorting rules as used
by the simplebus driver.
diffstat:
sys/arch/arm/fdt/files.fdt | 4 +-
sys/arch/evbarm/conf/EXYNOS | 4 +-
sys/arch/evbarm/conf/GENERIC | 4 +-
sys/arch/evbarm/conf/GENERIC64 | 4 +-
sys/arch/evbarm/conf/RPI | 4 +-
sys/arch/evbarm/conf/RPI64 | 4 +-
sys/arch/evbarm/conf/SUNXI | 4 +-
sys/arch/evbarm/conf/TEGRA | 4 +-
sys/arch/evbarm/conf/TI | 4 +-
sys/arch/evbarm/conf/VEXPRESS_A15 | 4 +-
sys/arch/evbarm/conf/VIRT | 4 +-
sys/dev/fdt/fdtbus.c | 108 +++++++++++++++++++++----------------
sys/dev/fdt/fdtvar.h | 4 +-
sys/dev/fdt/files.fdt | 46 ++++++++--------
sys/dev/fdt/syscon.c | 6 +-
15 files changed, 112 insertions(+), 96 deletions(-)
diffs (truncated from 537 to 300 lines):
diff -r 0e43a559d482 -r f17b2393a574 sys/arch/arm/fdt/files.fdt
--- a/sys/arch/arm/fdt/files.fdt Sat Jun 30 16:05:44 2018 +0000
+++ b/sys/arch/arm/fdt/files.fdt Sat Jun 30 16:22:56 2018 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: files.fdt,v 1.17 2018/06/20 08:03:55 hkenken Exp $
+# $NetBSD: files.fdt,v 1.18 2018/06/30 16:22:56 jmcneill Exp $
include "dev/pckbport/files.pckbport"
-device armfdt { }: bus_space_generic, fdtbus
+device armfdt { }: bus_space_generic, fdt
attach armfdt at root with arm_fdt
file arch/arm/fdt/arm_fdt.c arm_fdt
diff -r 0e43a559d482 -r f17b2393a574 sys/arch/evbarm/conf/EXYNOS
--- a/sys/arch/evbarm/conf/EXYNOS Sat Jun 30 16:05:44 2018 +0000
+++ b/sys/arch/evbarm/conf/EXYNOS Sat Jun 30 16:22:56 2018 +0000
@@ -1,5 +1,5 @@
#
-# $NetBSD: EXYNOS,v 1.22 2017/06/20 20:20:02 skrll Exp $
+# $NetBSD: EXYNOS,v 1.23 2018/06/30 16:22:56 jmcneill Exp $
#
# Samsung Exynos SoC kernel
#
@@ -38,7 +38,7 @@
# Device tree support
armfdt0 at root
-fdt* at fdtbus?
+simplebus* at fdt?
# CPUs
cpus* at fdt? pass 0
diff -r 0e43a559d482 -r f17b2393a574 sys/arch/evbarm/conf/GENERIC
--- a/sys/arch/evbarm/conf/GENERIC Sat Jun 30 16:05:44 2018 +0000
+++ b/sys/arch/evbarm/conf/GENERIC Sat Jun 30 16:22:56 2018 +0000
@@ -1,5 +1,5 @@
#
-# $NetBSD: GENERIC,v 1.1 2018/04/01 04:35:04 ryo Exp $
+# $NetBSD: GENERIC,v 1.2 2018/06/30 16:22:56 jmcneill Exp $
#
# GENERIC ARM (aarch32) kernel
#
@@ -54,7 +54,7 @@
# Device tree support
armfdt0 at root
-fdt* at fdtbus?
+simplebus* at fdt?
# CPUs
cpus* at fdt? pass 0
diff -r 0e43a559d482 -r f17b2393a574 sys/arch/evbarm/conf/GENERIC64
--- a/sys/arch/evbarm/conf/GENERIC64 Sat Jun 30 16:05:44 2018 +0000
+++ b/sys/arch/evbarm/conf/GENERIC64 Sat Jun 30 16:22:56 2018 +0000
@@ -1,5 +1,5 @@
#
-# $NetBSD: GENERIC64,v 1.20 2018/06/30 12:42:42 jmcneill Exp $
+# $NetBSD: GENERIC64,v 1.21 2018/06/30 16:22:56 jmcneill Exp $
#
# GENERIC ARM (aarch64) kernel
#
@@ -80,7 +80,7 @@
# Device tree support
armfdt0 at root
-fdt* at fdtbus?
+simplebus* at fdt?
# CPUs
cpus* at fdt? pass 0
diff -r 0e43a559d482 -r f17b2393a574 sys/arch/evbarm/conf/RPI
--- a/sys/arch/evbarm/conf/RPI Sat Jun 30 16:05:44 2018 +0000
+++ b/sys/arch/evbarm/conf/RPI Sat Jun 30 16:22:56 2018 +0000
@@ -1,5 +1,5 @@
#
-# $NetBSD: RPI,v 1.78 2017/12/10 21:38:26 skrll Exp $
+# $NetBSD: RPI,v 1.79 2018/06/30 16:22:56 jmcneill Exp $
#
# RPi -- Raspberry Pi
#
@@ -55,7 +55,7 @@
# Device tree support
armfdt0 at root
-fdt* at fdtbus?
+simplebus* at fdt?
# The CPU(s)
cpus* at fdt? pass 0
diff -r 0e43a559d482 -r f17b2393a574 sys/arch/evbarm/conf/RPI64
--- a/sys/arch/evbarm/conf/RPI64 Sat Jun 30 16:05:44 2018 +0000
+++ b/sys/arch/evbarm/conf/RPI64 Sat Jun 30 16:22:56 2018 +0000
@@ -1,5 +1,5 @@
#
-# $NetBSD: RPI64,v 1.1 2018/04/01 04:35:04 ryo Exp $
+# $NetBSD: RPI64,v 1.2 2018/06/30 16:22:56 jmcneill Exp $
#
# RPI64 - Raspberry Pi 3 and Pi 2 v1.2 in AARCH64 mode
#
@@ -61,7 +61,7 @@
# Device tree support
armfdt0 at root
-fdt* at fdtbus?
+simplebus* at fdt?
# The CPU(s)
cpus* at fdt? pass 0
diff -r 0e43a559d482 -r f17b2393a574 sys/arch/evbarm/conf/SUNXI
--- a/sys/arch/evbarm/conf/SUNXI Sat Jun 30 16:05:44 2018 +0000
+++ b/sys/arch/evbarm/conf/SUNXI Sat Jun 30 16:22:56 2018 +0000
@@ -1,5 +1,5 @@
#
-# $NetBSD: SUNXI,v 1.75 2018/06/30 12:42:42 jmcneill Exp $
+# $NetBSD: SUNXI,v 1.76 2018/06/30 16:22:56 jmcneill Exp $
#
# Allwinner sunxi family
#
@@ -168,7 +168,7 @@
# Device tree support
armfdt0 at root
-fdt* at fdtbus?
+simplebus* at fdt?
# CPUs
cpus* at fdt? pass 0
diff -r 0e43a559d482 -r f17b2393a574 sys/arch/evbarm/conf/TEGRA
--- a/sys/arch/evbarm/conf/TEGRA Sat Jun 30 16:05:44 2018 +0000
+++ b/sys/arch/evbarm/conf/TEGRA Sat Jun 30 16:22:56 2018 +0000
@@ -1,5 +1,5 @@
#
-# $NetBSD: TEGRA,v 1.33 2017/09/26 16:12:45 jmcneill Exp $
+# $NetBSD: TEGRA,v 1.34 2018/06/30 16:22:56 jmcneill Exp $
#
# NVIDIA Tegra family SoCs
#
@@ -46,7 +46,7 @@
# Device tree support
armfdt0 at root
-fdt* at fdtbus?
+simplebus* at fdt?
# CPUs
cpus* at fdt? pass 0
diff -r 0e43a559d482 -r f17b2393a574 sys/arch/evbarm/conf/TI
--- a/sys/arch/evbarm/conf/TI Sat Jun 30 16:05:44 2018 +0000
+++ b/sys/arch/evbarm/conf/TI Sat Jun 30 16:22:56 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: TI,v 1.2 2017/10/26 23:28:14 jmcneill Exp $
+# $NetBSD: TI,v 1.3 2018/06/30 16:22:56 jmcneill Exp $
#
include "arch/evbarm/conf/std.ti"
@@ -29,7 +29,7 @@
config netbsd root on ? type ?
armfdt0 at root
-fdt* at fdtbus?
+simplebus* at fdt?
cpus* at fdt? pass 0
cpu* at cpus?
diff -r 0e43a559d482 -r f17b2393a574 sys/arch/evbarm/conf/VEXPRESS_A15
--- a/sys/arch/evbarm/conf/VEXPRESS_A15 Sat Jun 30 16:05:44 2018 +0000
+++ b/sys/arch/evbarm/conf/VEXPRESS_A15 Sat Jun 30 16:22:56 2018 +0000
@@ -1,5 +1,5 @@
#
-# $NetBSD: VEXPRESS_A15,v 1.19 2018/06/11 19:49:18 jakllsch Exp $
+# $NetBSD: VEXPRESS_A15,v 1.20 2018/06/30 16:22:56 jmcneill Exp $
#
# ARM Versatile Express A15
#
@@ -29,7 +29,7 @@
# Device tree support
armfdt0 at root
-fdt* at fdtbus?
+simplebus* at fdt?
# CPUs
cpus* at fdt? pass 0
diff -r 0e43a559d482 -r f17b2393a574 sys/arch/evbarm/conf/VIRT
--- a/sys/arch/evbarm/conf/VIRT Sat Jun 30 16:05:44 2018 +0000
+++ b/sys/arch/evbarm/conf/VIRT Sat Jun 30 16:22:56 2018 +0000
@@ -1,5 +1,5 @@
#
-# $NetBSD: VIRT,v 1.3 2018/06/15 19:52:01 jakllsch Exp $
+# $NetBSD: VIRT,v 1.4 2018/06/30 16:22:56 jmcneill Exp $
#
# QEMU ARM 'virt' virtual machine
#
@@ -30,7 +30,7 @@
# Device tree support
armfdt0 at root
-fdt* at fdtbus?
+simplebus* at fdt?
# CPUs
cpus* at fdt? pass 0
diff -r 0e43a559d482 -r f17b2393a574 sys/dev/fdt/fdtbus.c
--- a/sys/dev/fdt/fdtbus.c Sat Jun 30 16:05:44 2018 +0000
+++ b/sys/dev/fdt/fdtbus.c Sat Jun 30 16:22:56 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtbus.c,v 1.20 2018/06/30 13:44:50 jmcneill Exp $ */
+/* $NetBSD: fdtbus.c,v 1.21 2018/06/30 16:22:56 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.20 2018/06/30 13:44:50 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.21 2018/06/30 16:22:56 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -50,7 +50,8 @@
device_t n_bus;
device_t n_dev;
int n_phandle;
- char *n_name;
+ const char *n_name;
+ struct fdt_attach_args n_faa;
u_int n_order;
@@ -59,6 +60,7 @@
static TAILQ_HEAD(, fdt_node) fdt_nodes =
TAILQ_HEAD_INITIALIZER(fdt_nodes);
+static bool fdt_need_rescan = false;
struct fdt_softc {
device_t sc_dev;
@@ -69,7 +71,7 @@
static int fdt_match(device_t, cfdata_t, void *);
static void fdt_attach(device_t, device_t, void *);
static int fdt_scan_submatch(device_t, cfdata_t, const int *, void *);
-static void fdt_scan_bus(struct fdt_softc *);
+static void fdt_scan_bus(device_t, const int);
static void fdt_scan(struct fdt_softc *, int);
static void fdt_add_node(struct fdt_node *);
static u_int fdt_get_order(int);
@@ -77,7 +79,7 @@
static const char * const fdtbus_compatible[] =
{ "simple-bus", "simple-mfd", NULL };
-CFATTACH_DECL_NEW(fdt, sizeof(struct fdt_softc),
+CFATTACH_DECL_NEW(simplebus, sizeof(struct fdt_softc),
fdt_match, fdt_attach, NULL, NULL);
static int
@@ -111,51 +113,25 @@
const struct fdt_attach_args *faa = aux;
const int phandle = faa->faa_phandle;
struct fdt_node *node;
- char *model, *name;
- int len, child;
+ const char *model;
+ int pass;
sc->sc_dev = self;
sc->sc_phandle = phandle;
sc->sc_faa = *faa;
aprint_naive("\n");
- len = OF_getproplen(phandle, "model");
- if (len > 0) {
- model = kmem_zalloc(len, KM_SLEEP);
- if (OF_getprop(phandle, "model", model, len) == len) {
- aprint_normal(": %s\n", model);
- } else {
- aprint_normal("\n");
- }
- kmem_free(model, len);
- } else {
+ model = fdtbus_get_string(phandle, "model");
+ if (model)
+ aprint_normal(": %s\n", model);
+ else
aprint_normal("\n");
- }
-
- for (child = OF_child(phandle); child; child = OF_peer(child)) {
- if (!fdtbus_status_okay(child))
- continue;
- len = OF_getproplen(child, "name");
- if (len <= 0)
- continue;
-
- name = kmem_zalloc(len, KM_SLEEP);
- if (OF_getprop(child, "name", name, len) != len)
- continue;
-
Home |
Main Index |
Thread Index |
Old Index