macros and dtc

Segher Boessenkool segher at kernel.crashing.org
Wed Feb 21 00:15:00 EST 2007


> There are lot's of hardcoded constants floating around
> in the dts files that for clarity should be #defined (or
> whatever the m4 equivalent is) at the top of the file.

For *clarity*, they should be bare constants :-)

For maintainability, values that are not changing ever
(fixed addresses on some SoC for example) are fine as
a constant; they never change, after all.  Addresses
that are configurable though (PCI ranges for example)
could benefit from a macro def.  Then again, such things
should ideally be filled in by the boot wrapper instead
(for PCI, this means the boot wrapper would need to know
how to do PCI config on your PHB; it then could automatically
generate almost all of the PCI tree).  Well this is not
the best example I guess, Linux can do without the PCI
stuff in the tree, but the same idea goes for many other
features that can be probed; you have one basic DTB for
a whole family of boards and the boot wrapper fills in
the details.  It would be useful then (and now already)
to have some /proc/flatdevtree that outputs the binary
blob that the kernel was fed -- someone create that please :-)


Segher




More information about the Linuxppc-dev mailing list