Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/fdt Support rescan and child detachment
details: https://anonhg.NetBSD.org/src/rev/ffa8cb6be962
branches: trunk
changeset: 433607:ffa8cb6be962
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sun Sep 23 19:32:03 2018 +0000
description:
Support rescan and child detachment
diffstat:
sys/dev/fdt/fdtbus.c | 35 ++++++++++++++++++++++++++++++-----
1 files changed, 30 insertions(+), 5 deletions(-)
diffs (84 lines):
diff -r 9063bbd47212 -r ffa8cb6be962 sys/dev/fdt/fdtbus.c
--- a/sys/dev/fdt/fdtbus.c Sun Sep 23 19:07:10 2018 +0000
+++ b/sys/dev/fdt/fdtbus.c Sun Sep 23 19:32:03 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtbus.c,v 1.23 2018/09/09 21:14:04 jmcneill Exp $ */
+/* $NetBSD: fdtbus.c,v 1.24 2018/09/23 19:32:03 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.23 2018/09/09 21:14:04 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.24 2018/09/23 19:32:03 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -70,6 +70,9 @@
static int fdt_match(device_t, cfdata_t, void *);
static void fdt_attach(device_t, device_t, void *);
+static int fdt_rescan(device_t, const char *, const int *);
+static void fdt_childdet(device_t, device_t);
+
static int fdt_scan_submatch(device_t, cfdata_t, const int *, void *);
static void fdt_scan(struct fdt_softc *, int);
static void fdt_add_node(struct fdt_node *);
@@ -78,8 +81,8 @@
static const char * const fdtbus_compatible[] =
{ "simple-bus", "simple-mfd", NULL };
-CFATTACH_DECL_NEW(simplebus, sizeof(struct fdt_softc),
- fdt_match, fdt_attach, NULL, NULL);
+CFATTACH_DECL2_NEW(simplebus, sizeof(struct fdt_softc),
+ fdt_match, fdt_attach, NULL, NULL, fdt_rescan, fdt_childdet);
static int
fdt_match(device_t parent, cfdata_t cf, void *aux)
@@ -112,7 +115,6 @@
const struct fdt_attach_args *faa = aux;
const int phandle = faa->faa_phandle;
const char *descr;
- int pass;
sc->sc_dev = self;
sc->sc_phandle = phandle;
@@ -134,6 +136,15 @@
return;
/* Scan devices */
+ fdt_rescan(self, NULL, NULL);
+}
+
+static int
+fdt_rescan(device_t self, const char *ifattr, const int *locs)
+{
+ struct fdt_softc *sc = device_private(self);
+ int pass;
+
pass = 0;
fdt_need_rescan = false;
do {
@@ -145,6 +156,20 @@
pass++;
}
} while (pass <= FDTCF_PASS_DEFAULT);
+
+ return 0;
+}
+
+static void
+fdt_childdet(device_t parent, device_t child)
+{
+ struct fdt_node *node;
+
+ TAILQ_FOREACH(node, &fdt_nodes, n_nodes)
+ if (node->n_dev == child) {
+ node->n_dev = NULL;
+ break;
+ }
}
static void
Home |
Main Index |
Thread Index |
Old Index