> Date: Sun, 1 May 2016 13:27:29 +0200 > From: Patrick Wildt <patr...@blueri.se> > > Hi, > > I updated the diff with the feedback received. This basically adds > a tree-like topology by making mainbus FDT aware and implementing > a simplebus that can span the tree's roots into more branches. > > Next steps (and diffs) are implementing an FDT platform for armv7, > similar to imx/omap/... and having the generic interrupt controller > and timer attach to a simplebus/fdt bus. > > Comments?
Looks good to me. If jsg@ agrees, let's get this in and work on it further in the tree. > diff --git sys/arch/arm/conf/files.arm sys/arch/arm/conf/files.arm > index cb11960..c70f9ab 100644 > --- sys/arch/arm/conf/files.arm > +++ sys/arch/arm/conf/files.arm > @@ -16,15 +16,24 @@ file arch/arm/arm/disassem.c ddb > file arch/arm/arm/fiq.c fiq > file arch/arm/arm/fiq_subr.S fiq > > +define fdt {} > + > # mainbus files > -device mainbus {} > +device mainbus: fdt > attach mainbus at root > file arch/arm/mainbus/mainbus.c mainbus > > +device simplebus: fdt > +attach simplebus at fdt > +file arch/arm/simplebus/simplebus.c simplebus > + > +# FDT support > +file dev/ofw/fdt.c > + > include "arch/arm/cortex/files.cortex" > > device cpu {} > -attach cpu at mainbus with cpu_mainbus > +attach cpu at fdt with cpu_mainbus > file arch/arm/mainbus/cpu_mainbus.c cpu_mainbus > > > diff --git sys/arch/arm/cortex/cortex.c sys/arch/arm/cortex/cortex.c > index 913feb7..06a7823 100644 > --- sys/arch/arm/cortex/cortex.c > +++ sys/arch/arm/cortex/cortex.c > @@ -97,7 +97,7 @@ struct cfdriver cortex_cd = { > int > cortexmatch(struct device *parent, void *cfdata, void *aux) > { > - struct mainbus_attach_args *ma = aux; > + union mainbus_attach_args *ma = aux; > struct cfdata *cf = (struct cfdata *)cfdata; > int cputype = cpufunc_id(); > > diff --git sys/arch/arm/cortex/files.cortex sys/arch/arm/cortex/files.cortex > index c0f4359..052acfd 100644 > --- sys/arch/arm/cortex/files.cortex > +++ sys/arch/arm/cortex/files.cortex > @@ -2,7 +2,7 @@ > > # ARM core > device cortex {} > -attach cortex at mainbus > +attach cortex at fdt > file arch/arm/cortex/cortex.c cortex > > device ampintc > diff --git sys/arch/arm/include/fdt.h sys/arch/arm/include/fdt.h > new file mode 100644 > index 0000000..0eec567 > --- /dev/null > +++ sys/arch/arm/include/fdt.h > @@ -0,0 +1,31 @@ > +/* $OpenBSD$ */ > +/* > + * Copyright (c) 2016 Patrick Wildt <patr...@blueri.se> > + * > + * Permission to use, copy, modify, and distribute this software for any > + * purpose with or without fee is hereby granted, provided that the above > + * copyright notice and this permission notice appear in all copies. > + * > + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES > + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF > + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR > + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES > + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN > + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF > + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > + */ > + > +#ifndef __ARM_FDT_H__ > +#define __ARM_FDT_H__ > + > +#define _ARM32_BUS_DMA_PRIVATE > +#include <machine/bus.h> > + > +struct fdt_attach_args { > + const char *fa_name; > + int fa_node; > + bus_space_tag_t fa_iot; > + bus_dma_tag_t fa_dmat; > +}; > + > +#endif /* __ARM_FDT_H__ */ > diff --git sys/arch/arm/mainbus/cpu_mainbus.c > sys/arch/arm/mainbus/cpu_mainbus.c > index 63de209..88410bf 100644 > --- sys/arch/arm/mainbus/cpu_mainbus.c > +++ sys/arch/arm/mainbus/cpu_mainbus.c > @@ -72,7 +72,7 @@ static void cpu_mainbus_attach (struct device *, struct > device *, void *); > static int > cpu_mainbus_match(struct device *parent, void *vcf, void *aux) > { > - struct mainbus_attach_args *ma = aux; > + union mainbus_attach_args *ma = aux; > struct cfdata *cf = (struct cfdata *)vcf; > > return (strcmp(cf->cf_driver->cd_name, ma->ma_name) == 0); > diff --git sys/arch/arm/mainbus/mainbus.c sys/arch/arm/mainbus/mainbus.c > index 6ad3e8f..7f72161 100644 > --- sys/arch/arm/mainbus/mainbus.c > +++ sys/arch/arm/mainbus/mainbus.c > @@ -1,45 +1,18 @@ > -/* $OpenBSD: mainbus.c,v 1.7 2013/05/30 16:15:01 deraadt Exp $ */ > -/* $NetBSD: mainbus.c,v 1.3 2001/06/13 17:52:43 nathanw Exp $ */ > - > +/* $OpenBSD$ */ > /* > - * Copyright (c) 1994,1995 Mark Brinicombe. > - * Copyright (c) 1994 Brini. > - * All rights reserved. > - * > - * Redistribution and use in source and binary forms, with or without > - * modification, are permitted provided that the following conditions > - * are met: > - * 1. Redistributions of source code must retain the above copyright > - * notice, this list of conditions and the following disclaimer. > - * 2. Redistributions in binary form must reproduce the above copyright > - * notice, this list of conditions and the following disclaimer in the > - * documentation and/or other materials provided with the distribution. > - * 3. All advertising materials mentioning features or use of this software > - * must display the following acknowledgement: > - * This product includes software developed by Brini. > - * 4. The name of the company nor the name of the author may be used to > - * endorse or promote products derived from this software without specific > - * prior written permission. > - * > - * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED > - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF > - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. > - * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, > - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES > - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR > - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > - * SUCH DAMAGE. > - * > - * RiscBSD kernel project > + * Copyright (c) 2016 Patrick Wildt <patr...@blueri.se> > * > - * mainbus.c > + * Permission to use, copy, modify, and distribute this software for any > + * purpose with or without fee is hereby granted, provided that the above > + * copyright notice and this permission notice appear in all copies. > * > - * mainbus configuration > - * > - * Created : 15/12/94 > + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES > + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF > + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR > + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES > + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN > + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF > + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > */ > > #include <sys/param.h> > @@ -47,78 +20,155 @@ > #include <sys/kernel.h> > #include <sys/device.h> > > +#include <dev/ofw/openfirm.h> > + > #include <arm/mainbus/mainbus.h> > > -/* Prototypes for functions provided */ > +int mainbus_match(struct device *, void *, void *); > +void mainbus_attach(struct device *, struct device *, void *); > > -int mainbusmatch(struct device *, void *, void *); > -void mainbusattach(struct device *, struct device *, void *); > -int mainbusprint(void *aux, const char *mainbus); > -int mainbussearch(struct device *, void *, void *); > +void mainbus_attach_node(struct device *, int); > > -/* attach and device structures for the device */ > +int mainbus_legacy_search(struct device *, void *, void *); > +void mainbus_legacy_found(struct device *, char *); > + > +struct mainbus_softc { > + struct device sc_dev; > + bus_space_tag_t sc_iot; > + bus_dma_tag_t sc_dmat; > +}; > > struct cfattach mainbus_ca = { > - sizeof(struct device), mainbusmatch, mainbusattach > + sizeof(struct mainbus_softc), mainbus_match, mainbus_attach, NULL, > + config_activate_children > }; > > struct cfdriver mainbus_cd = { > NULL, "mainbus", DV_DULL > }; > > +struct arm32_bus_dma_tag mainbus_dma_tag = { > + 0, > + 0, > + NULL, > + _bus_dmamap_create, > + _bus_dmamap_destroy, > + _bus_dmamap_load, > + _bus_dmamap_load_mbuf, > + _bus_dmamap_load_uio, > + _bus_dmamap_load_raw, > + _bus_dmamap_unload, > + _bus_dmamap_sync, > + _bus_dmamem_alloc, > + _bus_dmamem_free, > + _bus_dmamem_map, > + _bus_dmamem_unmap, > + _bus_dmamem_mmap, > +}; > + > /* > - * int mainbusmatch(struct device *parent, struct cfdata *cf, void *aux) > + * Mainbus takes care of FDT and non-FDT machines, so we > + * always attach. > */ > - > int > -mainbusmatch(struct device *parent, void *cf, void *aux) > +mainbus_match(struct device *parent, void *cfdata, void *aux) > { > return (1); > } > > +void > +mainbus_attach(struct device *parent, struct device *self, void *aux) > +{ > + struct mainbus_softc *sc = (struct mainbus_softc *)self; > + char buffer[128]; > + int node; > + > + if ((node = OF_peer(0)) == 0) { > + printf(": no device tree\n"); > + config_search(mainbus_legacy_search, self, aux); > + return; > + } > + > +#ifdef CPU_ARMv7 > + extern struct bus_space armv7_bs_tag; > + sc->sc_iot = &armv7_bs_tag; > +#endif > + sc->sc_dmat = &mainbus_dma_tag; > + > + if (OF_getprop(node, "model", buffer, sizeof(buffer))) > + printf(": %s\n", buffer); > + else > + printf(": unknown model\n"); > + > + /* Attach CPU first. */ > + mainbus_legacy_found(self, "cpu"); > + > + /* TODO: Scan for interrupt controllers and attach them first? */ > + > + /* Scan the whole tree. */ > + for (node = OF_child(node); > + node != 0; > + node = OF_peer(node)) > + { > + mainbus_attach_node(self, node); > + } > +} > + > /* > - * void mainbusattach(struct device *parent, struct device *self, void *aux) > - * > - * probe and attach all children > + * Look for a driver that wants to be attached to this node. > */ > - > void > -mainbusattach(struct device *parent, struct device *self, void *aux) > +mainbus_attach_node(struct device *self, int node) > { > - printf("\n"); > + struct mainbus_softc *sc = (struct mainbus_softc *)self; > + struct fdt_attach_args fa; > + char buffer[128]; > + > + if (!OF_getprop(node, "compatible", buffer, sizeof(buffer))) > + return; > + > + if (OF_getprop(node, "status", buffer, sizeof(buffer))) > + if (!strcmp(buffer, "disabled")) > + return; > > - config_search(mainbussearch, self, aux); > + memset(&fa, 0, sizeof(fa)); > + fa.fa_name = ""; > + fa.fa_node = node; > + fa.fa_iot = sc->sc_iot; > + fa.fa_dmat = sc->sc_dmat; > + > + /* TODO: attach the device's clocks first? */ > + > + config_found(self, &fa, NULL); > } > > +/* > + * Legacy support for SoCs that do not use FDT. > + */ > int > -mainbussearch(struct device *parent, void *vcf, void *aux) > +mainbus_legacy_search(struct device *parent, void *match, void *aux) > { > - struct mainbus_attach_args ma; > - struct cfdata *cf = vcf; > + union mainbus_attach_args ma; > + struct cfdata *cf = match; > > + memset(&ma, 0, sizeof(ma)); > ma.ma_name = cf->cf_driver->cd_name; > > /* allow for devices to be disabled in UKC */ > if ((*cf->cf_attach->ca_match)(parent, cf, &ma) == 0) > return 0; > > - config_attach(parent, cf, &ma, mainbusprint); > + config_attach(parent, cf, &ma, NULL); > return 1; > } > > -/* > - * int mainbusprint(void *aux, const char *mainbus) > - * > - * print routine used during config of children > - */ > - > -int > -mainbusprint(void *aux, const char *mainbus) > +void > +mainbus_legacy_found(struct device *self, char *name) > { > - struct mainbus_attach_args *ma = aux; > + union mainbus_attach_args ma; > > - if (mainbus != NULL) > - printf("%s at %s", ma->ma_name, mainbus); > + memset(&ma, 0, sizeof(ma)); > + ma.ma_name = name; > > - return (UNCONF); > + config_found(self, &ma, NULL); > } > diff --git sys/arch/arm/mainbus/mainbus.h sys/arch/arm/mainbus/mainbus.h > index 3e17996..42ec9e3 100644 > --- sys/arch/arm/mainbus/mainbus.h > +++ sys/arch/arm/mainbus/mainbus.h > @@ -1,51 +1,29 @@ > -/* $OpenBSD: mainbus.h,v 1.2 2011/09/22 17:45:59 miod Exp $ */ > -/* $NetBSD: mainbus.h,v 1.1 2001/02/24 19:38:02 reinoud Exp $ */ > - > +/* $OpenBSD$ */ > /* > - * Copyright (c) 1994,1995 Mark Brinicombe. > - * Copyright (c) 1994 Brini. > - * All rights reserved. > - * > - * Redistribution and use in source and binary forms, with or without > - * modification, are permitted provided that the following conditions > - * are met: > - * 1. Redistributions of source code must retain the above copyright > - * notice, this list of conditions and the following disclaimer. > - * 2. Redistributions in binary form must reproduce the above copyright > - * notice, this list of conditions and the following disclaimer in the > - * documentation and/or other materials provided with the distribution. > - * 3. All advertising materials mentioning features or use of this software > - * must display the following acknowledgement: > - * This product includes software developed by Brini. > - * 4. The name of the company nor the name of the author may be used to > - * endorse or promote products derived from this software without specific > - * prior written permission. > - * > - * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED > - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF > - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. > - * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, > - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES > - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR > - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > - * SUCH DAMAGE. > - * > - * RiscBSD kernel project > - * > - * mainbus.h > + * Copyright (c) 2016 Patrick Wildt <patr...@blueri.se> > * > - * mainbus configuration > + * Permission to use, copy, modify, and distribute this software for any > + * purpose with or without fee is hereby granted, provided that the above > + * copyright notice and this permission notice appear in all copies. > * > - * Created : 15/12/94 > + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES > + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF > + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR > + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES > + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN > + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF > + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > */ > > -/* > - * mainbus driver attach arguments > - */ > +#ifndef __MAINBUS_H__ > +#define __MAINBUS_H__ > > -struct mainbus_attach_args { > - const char *ma_name; > +#include <arm/fdt.h> > + > +/* Passed as third arg to attach functions. */ > +union mainbus_attach_args { > + const char *ma_name; > + struct fdt_attach_args ma_faa; > }; > + > +#endif /* __MAINBUS_H__ */ > diff --git sys/arch/arm/simplebus/simplebus.c > sys/arch/arm/simplebus/simplebus.c > new file mode 100644 > index 0000000..0ae17f5 > --- /dev/null > +++ sys/arch/arm/simplebus/simplebus.c > @@ -0,0 +1,118 @@ > +/* $OpenBSD$ */ > +/* > + * Copyright (c) 2016 Patrick Wildt <patr...@blueri.se> > + * > + * Permission to use, copy, modify, and distribute this software for any > + * purpose with or without fee is hereby granted, provided that the above > + * copyright notice and this permission notice appear in all copies. > + * > + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES > + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF > + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR > + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES > + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN > + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF > + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > + */ > + > +#include <sys/param.h> > +#include <sys/systm.h> > +#include <sys/kernel.h> > +#include <sys/device.h> > + > +#include <dev/ofw/openfirm.h> > + > +#include <arm/fdt.h> > + > +int simplebus_match(struct device *, void *, void *); > +void simplebus_attach(struct device *, struct device *, void *); > + > +void simplebus_attach_node(struct device *, int); > + > +struct simplebus_softc { > + struct device sc_dev; > + int sc_node; > + bus_space_tag_t sc_iot; > + bus_dma_tag_t sc_dmat; > +}; > + > +struct cfattach simplebus_ca = { > + sizeof(struct simplebus_softc), simplebus_match, simplebus_attach, NULL, > + config_activate_children > +}; > + > +struct cfdriver simplebus_cd = { > + NULL, "simplebus", DV_DULL > +}; > + > +/* > + * Simplebus is a generic bus with no special casings. > + */ > +int > +simplebus_match(struct device *parent, void *cfdata, void *aux) > +{ > + struct fdt_attach_args *fa = (struct fdt_attach_args *)aux; > + char buffer[128]; > + > + if (fa->fa_node == 0) > + return (0); > + > + if (!OF_getprop(fa->fa_node, "compatible", buffer, > + sizeof(buffer))) > + return (0); > + > + if (strcmp(buffer, "simple-bus")) > + return (0); > + > + return (1); > +} > + > +void > +simplebus_attach(struct device *parent, struct device *self, void *aux) > +{ > + struct simplebus_softc *sc = (struct simplebus_softc *)self; > + struct fdt_attach_args *fa = (struct fdt_attach_args *)aux; > + int node; > + > + sc->sc_node = fa->fa_node; > + sc->sc_iot = fa->fa_iot; > + sc->sc_dmat = fa->fa_dmat; > + > + printf("\n"); > + > + /* Scan the whole tree. */ > + for (node = OF_child(sc->sc_node); > + node != 0; > + node = OF_peer(node)) > + { > + simplebus_attach_node(self, node); > + } > +} > + > +/* > + * Look for a driver that wants to be attached to this node. > + */ > +void > +simplebus_attach_node(struct device *self, int node) > +{ > + struct simplebus_softc *sc = (struct simplebus_softc *)self; > + struct fdt_attach_args fa; > + char buffer[128]; > + > + if (!OF_getprop(node, "compatible", buffer, sizeof(buffer))) > + return; > + > + if (OF_getprop(node, "status", buffer, sizeof(buffer))) > + if (!strcmp(buffer, "disabled")) > + return; > + > + memset(&fa, 0, sizeof(fa)); > + fa.fa_name = ""; > + fa.fa_node = node; > + fa.fa_iot = sc->sc_iot; > + fa.fa_dmat = sc->sc_dmat; > + > + /* TODO: attach the device's clocks first? */ > + > + config_found(self, &fa, NULL); > +} > diff --git sys/arch/arm/xscale/files.pxa2x0 sys/arch/arm/xscale/files.pxa2x0 > index b73d7b7..a1833c1 100644 > --- sys/arch/arm/xscale/files.pxa2x0 > +++ sys/arch/arm/xscale/files.pxa2x0 > @@ -9,7 +9,7 @@ file arch/arm/arm/softintr.c # Use the generic ARM soft > interrupt code. > # PXA2[51]0's integrated peripherals bus. > define pxaip {[addr=-1], [size=0], [intr=-1], [index=-1]} > device pxaip > -attach pxaip at mainbus > +attach pxaip at fdt > file arch/arm/xscale/pxa2x0.c > file arch/arm/arm/irq_dispatch.S > file arch/arm/xscale/pxa2x0_space.c > diff --git sys/arch/armish/conf/files.armish sys/arch/armish/conf/files.armish > index 9bb866a..8e860f1 100644 > --- sys/arch/armish/conf/files.armish > +++ sys/arch/armish/conf/files.armish > @@ -32,14 +32,14 @@ include "dev/i2c/files.i2c" > # ARM i80321 files > include "arch/arm/xscale/files.i80321" > > -attach iopxs at mainbus with iopxs_mainbus > +attach iopxs at fdt with iopxs_mainbus > file arch/armish/dev/i80321_mainbus.c iopxs_mainbus > file arch/armish/dev/pci_addr_fixup.c iopxs > file arch/armish/dev/iq80321_pci.c iopxs > > # IQ80310 on-board devices (including CPLD) > device obio {addr, [size = -1], [width = -1], [xint = -1]}: > bus_space_generic > -attach obio at mainbus > +attach obio at fdt > file arch/armish/dev/obio.c obio > file arch/armish/dev/obio_space.c obio > > diff --git sys/arch/armish/dev/i80321_mainbus.c > sys/arch/armish/dev/i80321_mainbus.c > index ce711aa..4cc584c 100644 > --- sys/arch/armish/dev/i80321_mainbus.c > +++ sys/arch/armish/dev/i80321_mainbus.c > @@ -91,7 +91,7 @@ int i80321_mainbus_found; > int > i80321_mainbus_match(struct device *parent, void *match, void *aux) > { > - struct mainbus_attach_args *ma = aux; > + union mainbus_attach_args *ma = aux; > struct cfdata *cf = match; > > if (i80321_mainbus_found) > diff --git sys/arch/armish/dev/obio.c sys/arch/armish/dev/obio.c > index 0704ba7..6575008 100644 > --- sys/arch/armish/dev/obio.c > +++ sys/arch/armish/dev/obio.c > @@ -73,7 +73,7 @@ int obio_found; > int > obio_match(struct device *parent, void *match, void *aux) > { > - struct mainbus_attach_args *ma = aux; > + union mainbus_attach_args *ma = aux; > struct cfdata *cf = match; > > if (obio_found) > diff --git sys/arch/armv7/conf/GENERIC sys/arch/armv7/conf/GENERIC > index ccb34ce..019c0ef 100644 > --- sys/arch/armv7/conf/GENERIC > +++ sys/arch/armv7/conf/GENERIC > @@ -28,6 +28,7 @@ config bsd swap generic > > # The main bus device > mainbus0 at root > +simplebus* at fdt? > cpu0 at mainbus? > > # Cortex-A9 > diff --git sys/arch/armv7/conf/RAMDISK sys/arch/armv7/conf/RAMDISK > index 8c0c22b..9c1b1b8 100644 > --- sys/arch/armv7/conf/RAMDISK > +++ sys/arch/armv7/conf/RAMDISK > @@ -27,6 +27,7 @@ config bsd root on rd0a swap on rd0b > > # The main bus device > mainbus0 at root > +simplebus* at fdt? > cpu0 at mainbus? > > # Cortex-A9 > diff --git sys/arch/armv7/conf/files.armv7 sys/arch/armv7/conf/files.armv7 > index 7a9dc6a..333cf0c 100644 > --- sys/arch/armv7/conf/files.armv7 > +++ sys/arch/armv7/conf/files.armv7 > @@ -8,9 +8,6 @@ major {sd = 24} > major {cd = 26} > major {rd = 18} > > -define fdt {} > -file dev/ofw/fdt.c > - > file arch/arm/arm/conf.c > > #interrupt API layer > diff --git sys/arch/armv7/exynos/files.exynos > sys/arch/armv7/exynos/files.exynos > index 89c4193..bd804f0 100644 > --- sys/arch/armv7/exynos/files.exynos > +++ sys/arch/armv7/exynos/files.exynos > @@ -2,7 +2,7 @@ > > define exynos {} > device exynos: exynos > -attach exynos at mainbus > +attach exynos at fdt > file arch/armv7/exynos/exynos_machdep.c exynos needs-flag > file arch/armv7/exynos/exynos.c exynos > file arch/armv7/exynos/exynos4.c exynos > diff --git sys/arch/armv7/imx/files.imx sys/arch/armv7/imx/files.imx > index 3e7ec33..c2eb458 100644 > --- sys/arch/armv7/imx/files.imx > +++ sys/arch/armv7/imx/files.imx > @@ -2,7 +2,7 @@ > > define imx {} > device imx: imx > -attach imx at mainbus > +attach imx at fdt > file arch/armv7/imx/imx_machdep.c imx needs-flag > file arch/armv7/imx/imx.c imx > file arch/armv7/imx/imx6.c > diff --git sys/arch/armv7/include/fdt.h sys/arch/armv7/include/fdt.h > new file mode 100644 > index 0000000..83549d1 > --- /dev/null > +++ sys/arch/armv7/include/fdt.h > @@ -0,0 +1,3 @@ > +/* $OpenBSD$ */ > + > +#include <arm/fdt.h> > diff --git sys/arch/armv7/omap/files.omap sys/arch/armv7/omap/files.omap > index 8fd446f..161ebdb 100644 > --- sys/arch/armv7/omap/files.omap > +++ sys/arch/armv7/omap/files.omap > @@ -2,7 +2,7 @@ > > define omap {} > device omap: omap > -attach omap at mainbus > +attach omap at fdt > file arch/armv7/omap/omap_machdep.c omap needs-flag > file arch/armv7/omap/omap.c omap > file arch/armv7/omap/omap3.c > diff --git sys/arch/armv7/sunxi/files.sunxi sys/arch/armv7/sunxi/files.sunxi > index 80c4ba4..76d9546 100644 > --- sys/arch/armv7/sunxi/files.sunxi > +++ sys/arch/armv7/sunxi/files.sunxi > @@ -2,7 +2,7 @@ > > define sunxi {} > device sunxi: sunxi > -attach sunxi at mainbus > +attach sunxi at fdt > file arch/armv7/sunxi/sunxi_machdep.c sunxi needs-flag > file arch/armv7/sunxi/sunxi.c sunxi > file arch/armv7/sunxi/sun4i.c > diff --git sys/arch/armv7/vexpress/files.vexpress > sys/arch/armv7/vexpress/files.vexpress > index dd7db10..23cf503 100644 > --- sys/arch/armv7/vexpress/files.vexpress > +++ sys/arch/armv7/vexpress/files.vexpress > @@ -2,7 +2,7 @@ > > define vexpress {} > device vexpress: vexpress > -attach vexpress at mainbus > +attach vexpress at fdt > file arch/armv7/vexpress/vexpress_machdep.c vexpress needs-flag > file arch/armv7/vexpress/vexpress.c vexpress > file arch/armv7/vexpress/vexpress_a9.c vexpress > >