stand/fdt: Consistently apply fdt_overlays

Overlays were previously not applied when U-Boot provides FDT or EFI
provides FDT, only when we load FDT from /boot/dtb given name from U-Boot.

Make all three paths lead to loading fdt_overlays and applying them, so that
fdt_overlays can be expected to Just Work.

Reviewed by:	gonzo, imp, manu
Differential Revision:	https://reviews.freebsd.org/D13664
This commit is contained in:
Kyle Evans 2017-12-29 18:08:30 +00:00
parent 5c515efc88
commit 06d6750e0d
2 changed files with 18 additions and 7 deletions

View File

@ -44,19 +44,27 @@ int
fdt_platform_load_dtb(void)
{
struct fdt_header *hdr;
const char *s;
hdr = efi_get_table(&fdtdtb);
if (hdr != NULL) {
if (fdt_load_dtb_addr(hdr) == 0) {
printf("Using DTB provided by EFI at %p.\n", hdr);
return (0);
}
if (hdr == NULL)
return (1);
if (fdt_load_dtb_addr(hdr) != 0)
return (1);
printf("Using DTB provided by EFI at %p.\n", hdr);
s = getenv("fdt_overlays");
if (s != NULL && *s != '\0') {
printf("Loading DTB overlays: '%s'\n", s);
fdt_load_dtb_overlays(s);
}
return (1);
return (0);
}
void
fdt_platform_fixups(void)
{
fdt_apply_overlays();
}

View File

@ -64,7 +64,8 @@ fdt_platform_load_dtb(void)
if (fdt_load_dtb_addr(hdr) == 0) {
printf("Using DTB provided by U-Boot at "
"address %p.\n", hdr);
return (0);
rv = 0;
goto exit;
}
}
}
@ -83,9 +84,11 @@ fdt_platform_load_dtb(void)
if (fdt_load_dtb_file(s) == 0) {
printf("Loaded DTB from file '%s'.\n", s);
rv = 0;
goto exit;
}
}
exit:
if (rv == 0) {
s = getenv("fdt_overlays");
if (s == NULL)