> Date: Thu, 7 Apr 2016 16:54:19 +0200
> From: Patrick Wildt <[email protected]>
>
> Hi,
>
> after a bit of talking with jsg@ we have found a way forward on how to
> integrate FDT into ARM.
>
> An aspect of this is having an MI FDT bus residing in sys/dev/ofw/,
> where the fdt subroutines currently already are. Then we'll convert
> the vexpress platform to use FDT and continue with Exynos later on.
>
> As a first step I would rename fdt.c to fdt_subr.c. The actual fdt bus
> will then be committed to fdt.c. Also, create sys/dev/ofw/files.fdt to
> later on declare the new fdt bus in there.
>
> As we'll soon declare fdt at mainbus, I think we should also move the
> include of files.fdt to be after mainbus on socppc. Even if it won't
> be used on socppc.
>
> ok?
I have no objections to rename fdt.c fdt_subr.c. However, I do object
against having an "fdt" bus, at least for socppc. The fdt code should
just be the enumeration mechanism for "mainbus". And I think armv7
should be the same.
It should be relatively easy to add an ma_node member to the arm
struct mainbus_attach_args and use the fdt to attach the right drivers
if it is present and fall back on mainbussearch() if the fdt
information is not available yet (or if a particular platform has not
been converted yet). You just have to make mainbussearch() set
ma_node to -1 (or some other magic value) and check for that in the
existing "platform" drivers,
I think that implies that we don't need sys/dev/ofw/files.fdt either.
Cheers,
Mark
> diff --git sys/arch/armv7/conf/files.armv7 sys/arch/armv7/conf/files.armv7
> index c5d022c..fc0a14f 100644
> --- sys/arch/armv7/conf/files.armv7
> +++ sys/arch/armv7/conf/files.armv7
> @@ -10,7 +10,8 @@ major {rd = 18}
>
> define fdt {}
> file arch/armv7/fdt/fdt_machdep.c fdt needs-flag
> -file dev/ofw/fdt.c
> +
> +include "dev/ofw/files.fdt"
>
> file arch/arm/arm/conf.c
>
> diff --git sys/arch/socppc/conf/files.socppc sys/arch/socppc/conf/files.socppc
> index 4aa9526..3d02ddb 100644
> --- sys/arch/socppc/conf/files.socppc
> +++ sys/arch/socppc/conf/files.socppc
> @@ -14,10 +14,8 @@ file arch/socppc/socppc/disksubr.c
> disk
> file arch/socppc/socppc/machdep.c
> file arch/socppc/socppc/mem.c
> file dev/cninit.c
> -file dev/ofw/fdt.c
> file arch/socppc/socppc/n1200_dts.S
>
> -
> define mainbus {}
> device mainbus
> attach mainbus at root
> @@ -27,6 +25,8 @@ device cpu
> attach cpu at mainbus
> file arch/socppc/socppc/cpu.c
>
> +include "dev/ofw/files.fdt"
> +
> # MPC8349E on-board devices
> device obio {[addr = 0], [ivec = -1], [phy = -1]}
> attach obio at mainbus
> diff --git sys/dev/ofw/fdt.c sys/dev/ofw/fdt_subr.c
> similarity index 100%
> rename from sys/dev/ofw/fdt.c
> rename to sys/dev/ofw/fdt_subr.c
> diff --git sys/dev/ofw/files.fdt sys/dev/ofw/files.fdt
> new file mode 100644
> index 0000000..0ff8192
> --- /dev/null
> +++ sys/dev/ofw/files.fdt
> @@ -0,0 +1,3 @@
> +# $OpenBSD$
> +
> +file dev/ofw/fdt_subr.c
>
>