History log of /freebsd-10.1-release/sys/boot/fdt/fdt_loader_cmd.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 265069 28-Apr-2014 ian

MFC r262664, r262694:

Prevent fdt data loaded from a file from overwriting the kernel environment,
by having uboot_autoload() do the fdt setup (which may load a file) rather
than waiting until we're actually in the process of launching the kernel.

As part of making this happen...
- Define LOADER_FDT_SUPPORT on the uboot/lib compile command line when
MK_FDT is set.
- Make fdt_setup_fdtb() public.
- Declare public fdt_whatever() functions in a header instead of using
scattered extern decls in .c files.


# 265068 28-Apr-2014 ian

MFC r262340, r262345, r262347, find and load an appropriate dtb file.

The search order for a usable dtb in fdt_setup_fdtp() is now

- A dtb loaded with an explicit "load -t dtb" command.
- A dtb already loaded into memory somehow[*] and pointed to by fdt_to_load.
- A dtb in the memory pointed to by the u-boot env vars fdtaddr or fdt_addr.
- A file named by the u-boot env vars fdtfile or fdt_file.
- A static dtb compiled into the kernel.

* Presumably by some arch-specific command or code.


# 265066 28-Apr-2014 ian

MFC r262326 (white space) and r262327 (fdt_addr).

This change was supposed to be whitespace only, but a functional change
snuck in, as follows:

Look for both fdtaddr and fdt_addr env var names. Grepping the u-boot
source shows that board vendors seem to be about evenly split on this.
The added lines were:

/* Board vendors use both fdtaddr and fdt_addr names. Grrrr. */

if (s == NULL)
s = ub_env_get("fdt_addr");


# 265065 28-Apr-2014 ian

MFC r261819 & r262242: Actually validate the header of a loaded dtb file.


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 248934 30-Mar-2013 kientzle

Initialize sym_count to 0.

This fixes a compiler warning introduced in r248121.


# 248121 09-Mar-2013 ian

Attach the elf section headers to the loaded kernel as metadata, so
they can easily be used by later post-processing. When searching for
a compiled-in fdt blob, use the section headers to get the size and
location of the .dynsym section to do a symbol search.

This fixes a problem where the search could overshoot the symbol
table and wander into the string table. Sometimes that was harmless
and sometimes it lead to spurious panic messages about an offset
bigger than the module size.


# 247250 24-Feb-2013 kientzle

Fix the bug I introduced in r247045.
After digging through more carefully, it looks like there's
no real need to have the DTB in the module directory.
So we can simplify a lot: Just copy DTB into local heap
for "fdt addr" and U-Boot integration, drop all the extra
COPYIN() calls.

I've left one final COPYIN() to update the in-kernel DTB
for consistency with how this code used to work, but I'm
no longer convinced it's appropriate here.

I've also remove the mem_load_raw() utility that I added
to boot/common/module.c with r247045 since it's no longer
necessary.


# 247201 23-Feb-2013 kientzle

"fdt addr" gets run from loader.rc before the kernel is loaded.
This was broken by r247045 which tried to copy the FDT into the
module directory immediately.
Instead, store the address and arrange for the FDT to get
copied into the module directory later when the usual
FDT initialization runs.


# 247045 20-Feb-2013 kientzle

Fix "fdt addr" to accept literal addresses rather than va offsets.
When initializing the fdt, query U-Boot as well.

With this change, it is now feasible to have U-Boot load
the FDT, ubldr will pull it from U-Boot and hand it to the
kernel.


# 243693 30-Nov-2012 gonzo

- Implement "fdt mres" sub-command that prints reserved memory regions
- Add "fdt addr" subcommand that lets you specify preloaded blob address
- Do not pre-initialize blob for "fdt addr"
- Do not try to load dtb every time fdt subcommand is issued,
do it only once
- Change the way DTB is passed to kernel. With introduction of "fdt addr"
actual blob address can be not virtual but physical or reside in
area higher then 64Mb. ubldr should create copy of it in kernel area
and pass pointer to this newly allocated buffer which is guaranteed to work
in kernel after switching on MMU.
- Convert memreserv FDT info to "memreserv" property of root node
FDT uses /memreserve/ data to notify OS about reserved memory areas.
Technically it's not real property, it's just data blob, sequence
of <start, size> pairs where both start and size are 64-bit integers.
It doesn't fit nicely with OF API we use in kernel, so in order to unify
thing ubldr converts this data to "memreserve" property using the same
format for addresses and sizes as /memory node.


# 235529 17-May-2012 kientzle

Access the device tree blob via copyin/copyout.

The code previously assumed that copyin/copyout did no
address translation and that the device tree blob could
be manipulated in-place (with only a few adjustments for
the ELF loader offset). This isn't possible on all platforms,
so the revised code uses copyout() to copy the device tree
blob into a heap-allocated buffer and then updates the
device tree with copyout(). This isn't ideal, since it
bloats the loader memory usage, but seems the only feasible
approach (short of rewriting all of the fdt manipulation
routines).


# 235261 11-May-2012 kientzle

Don't hang if there is no /cpus node in the device tree.


# 233323 22-Mar-2012 raj

Improve FDT handling in loader(8) and make it more robust.

o Fix buffer overflows when using a long property body in node paths.
o Fix loop end condition when iterating through the symbol table.
o Better error handling during node modification, better problem reporting.
o Eliminate build time warnings.

Submitted by: Lukasz Wojcik
Obtained from: Semihalf
MFC after: 1 week


# 233230 20-Mar-2012 raj

Improve device tree blob (DTB) handling in loader(8).

Enable using the statically embedded blob from the kernel, if present. The KLD
loaded DTB takes precedence, but they are both recognized and handled in the
same way.

Submitted by: Lukasz Wojcik
Obtained from: Semihalf
MFC after: 1 week


# 208538 25-May-2010 raj

Initial loader(8) support for Flattened Device Tree.

o This is disabled by default for now, and can be enabled using WITH_FDT at
build time.

o Tested with ARM and PowerPC.

Reviewed by: imp
Sponsored by: The FreeBSD Foundation