diff options
author | 2016-09-18 17:50:25 +0000 | |
---|---|---|
committer | 2016-09-18 17:50:25 +0000 | |
commit | abc4f2a0e3d3628005c2e9aa0046e1e2202e4372 (patch) | |
tree | 4dd11ac584e5ce44fb9966f105e360331d788ef9 | |
parent | unbreak IPv6 source selection (diff) | |
download | wireguard-openbsd-abc4f2a0e3d3628005c2e9aa0046e1e2202e4372.tar.xz wireguard-openbsd-abc4f2a0e3d3628005c2e9aa0046e1e2202e4372.zip |
Use a locator (named "early") to let designated drivers attach before others.
ok patrick@, jsg@
-rw-r--r-- | sys/arch/arm/conf/files.arm | 4 | ||||
-rw-r--r-- | sys/arch/arm/simplebus/simplebus.c | 29 |
2 files changed, 22 insertions, 11 deletions
diff --git a/sys/arch/arm/conf/files.arm b/sys/arch/arm/conf/files.arm index 0efcbbd157b..890abed0ba6 100644 --- a/sys/arch/arm/conf/files.arm +++ b/sys/arch/arm/conf/files.arm @@ -1,4 +1,4 @@ -# $OpenBSD: files.arm,v 1.40 2016/08/14 11:30:54 jsg Exp $ +# $OpenBSD: files.arm,v 1.41 2016/09/18 17:50:25 kettenis Exp $ # $NetBSD: files.arm,v 1.76 2003/11/05 12:53:15 scw Exp $ # generic networking files @@ -16,7 +16,7 @@ file arch/arm/arm/disassem.c ddb file arch/arm/arm/fiq.c fiq file arch/arm/arm/fiq_subr.S fiq -define fdt {} +define fdt {[early = 0]} # mainbus files device mainbus: fdt diff --git a/sys/arch/arm/simplebus/simplebus.c b/sys/arch/arm/simplebus/simplebus.c index 557999ae9ba..d2f5bfe8b8d 100644 --- a/sys/arch/arm/simplebus/simplebus.c +++ b/sys/arch/arm/simplebus/simplebus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: simplebus.c,v 1.8 2016/07/27 11:45:02 patrick Exp $ */ +/* $OpenBSD: simplebus.c,v 1.9 2016/09/18 17:50:26 kettenis Exp $ */ /* * Copyright (c) 2016 Patrick Wildt <patrick@blueri.se> * @@ -44,6 +44,7 @@ struct simplebus_softc { struct bus_space sc_bus; int *sc_ranges; int sc_rangeslen; + int sc_early; }; struct cfattach simplebus_ca = { @@ -109,12 +110,24 @@ simplebus_attach(struct device *parent, struct device *self, void *aux) } /* Scan the whole tree. */ - for (node = OF_child(sc->sc_node); - node != 0; - node = OF_peer(node)) - { + sc->sc_early = 1; + for (node = OF_child(sc->sc_node); node; node = OF_peer(node)) simplebus_attach_node(self, node); - } + + sc->sc_early = 0; + for (node = OF_child(sc->sc_node); node; node = OF_peer(node)) + simplebus_attach_node(self, node); +} + +int +simplebus_submatch(struct device *self, void *match, void *aux) +{ + struct simplebus_softc *sc = (struct simplebus_softc *)self; + struct cfdata *cf = match; + + if (cf->cf_loc[0] == sc->sc_early) + return (*cf->cf_attach->ca_match)(self, match, aux); + return 0; } /* @@ -182,9 +195,7 @@ simplebus_attach_node(struct device *self, int node) OF_getpropintarray(node, "interrupts", fa.fa_intr, len); } - /* TODO: attach the device's clocks first? */ - - config_found(self, &fa, NULL); + config_found_sm(self, &fa, NULL, simplebus_submatch); free(fa.fa_reg, M_DEVBUF, fa.fa_nreg * sizeof(struct fdt_reg)); free(fa.fa_intr, M_DEVBUF, fa.fa_nintr * sizeof(uint32_t)); |