aboutsummaryrefslogtreecommitdiff
path: root/stand
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2019-04-11 13:26:28 +0000
committerKyle Evans <kevans@FreeBSD.org>2019-04-11 13:26:28 +0000
commit2a1e52f347ff179183abb5e2a143f36c8e9feb42 (patch)
tree72210511a7b41c86dea6425d517890b01cf5d0ff /stand
parentcf973b4420f8b55ae80e0fcd0408d666356d20dd (diff)
downloadsrc-2a1e52f347ff179183abb5e2a143f36c8e9feb42.tar.gz
src-2a1e52f347ff179183abb5e2a143f36c8e9feb42.zip
stand: refactor overlay loading a little bit
It was pointed out that manually loading a .dtb to be used rather than relying on platform-specific method for loading .dtb will result in overlays not being applied. This was true because overlay loading was hacked into fdt_platform_load_dtb, rather than done in a way more independent from how the .dtb is loaded. Instead, push overlay loading (for now) out into an fdt_platform_load_overlays. This method easily allows ubldr to pull in any fdt_overlays specified in the ub env, and omits overlay-checking on platforms where they're not tested and/or not desired (e.g. powerpc). If we eventually stop caring about fdt_overlays from ubenv (if we ever cared), this method should get chopped out in favor of just calling fdt_load_dtb_overlays() directly. Reported by: Manuel Stühn (freebsdnewbie freenet de)
Notes
Notes: svn path=/head/; revision=346132
Diffstat (limited to 'stand')
-rw-r--r--stand/efi/fdt/efi_fdt.c8
-rw-r--r--stand/fdt/fdt_loader_cmd.c6
-rw-r--r--stand/fdt/fdt_platform.h1
-rw-r--r--stand/powerpc/kboot/kbootfdt.c6
-rw-r--r--stand/powerpc/ofw/ofwfdt.c6
-rw-r--r--stand/uboot/fdt/uboot_fdt.c9
6 files changed, 32 insertions, 4 deletions
diff --git a/stand/efi/fdt/efi_fdt.c b/stand/efi/fdt/efi_fdt.c
index 8703aedc228d..cf3cbabee722 100644
--- a/stand/efi/fdt/efi_fdt.c
+++ b/stand/efi/fdt/efi_fdt.c
@@ -52,11 +52,17 @@ fdt_platform_load_dtb(void)
return (1);
printf("Using DTB provided by EFI at %p.\n", hdr);
- fdt_load_dtb_overlays(NULL);
return (0);
}
void
+fdt_platform_load_overlays(void)
+{
+
+ fdt_load_dtb_overlays(NULL);
+}
+
+void
fdt_platform_fixups(void)
{
diff --git a/stand/fdt/fdt_loader_cmd.c b/stand/fdt/fdt_loader_cmd.c
index 38ac9876774a..87b587275bc2 100644
--- a/stand/fdt/fdt_loader_cmd.c
+++ b/stand/fdt/fdt_loader_cmd.c
@@ -522,6 +522,7 @@ fdt_setup_fdtp()
if (fdt_load_dtb(bfp->f_addr) == 0) {
printf("Using DTB from loaded file '%s'.\n",
bfp->f_name);
+ fdt_platform_load_overlays();
return (0);
}
}
@@ -531,12 +532,15 @@ fdt_setup_fdtp()
if (fdt_load_dtb_addr(fdt_to_load) == 0) {
printf("Using DTB from memory address %p.\n",
fdt_to_load);
+ fdt_platform_load_overlays();
return (0);
}
}
- if (fdt_platform_load_dtb() == 0)
+ if (fdt_platform_load_dtb() == 0) {
+ fdt_platform_load_overlays();
return (0);
+ }
/* If there is a dtb compiled into the kernel, use it. */
if ((va = fdt_find_static_dtb()) != 0) {
diff --git a/stand/fdt/fdt_platform.h b/stand/fdt/fdt_platform.h
index 8930340053c4..0528dd0f033e 100644
--- a/stand/fdt/fdt_platform.h
+++ b/stand/fdt/fdt_platform.h
@@ -51,6 +51,7 @@ int fdt_setup_fdtp(void);
/* The platform library needs to implement these functions */
int fdt_platform_load_dtb(void);
+void fdt_platform_load_overlays(void);
void fdt_platform_fixups(void);
#endif /* FDT_PLATFORM_H */
diff --git a/stand/powerpc/kboot/kbootfdt.c b/stand/powerpc/kboot/kbootfdt.c
index 67a2082eddd9..14bc94326fe6 100644
--- a/stand/powerpc/kboot/kbootfdt.c
+++ b/stand/powerpc/kboot/kbootfdt.c
@@ -177,6 +177,12 @@ fdt_platform_load_dtb(void)
}
void
+fdt_platform_load_overlays(void)
+{
+
+}
+
+void
fdt_platform_fixups(void)
{
diff --git a/stand/powerpc/ofw/ofwfdt.c b/stand/powerpc/ofw/ofwfdt.c
index 493bae7576fb..fa0ff4165f4a 100644
--- a/stand/powerpc/ofw/ofwfdt.c
+++ b/stand/powerpc/ofw/ofwfdt.c
@@ -198,6 +198,12 @@ fdt_platform_load_dtb(void)
}
void
+fdt_platform_load_overlays(void)
+{
+
+}
+
+void
fdt_platform_fixups(void)
{
diff --git a/stand/uboot/fdt/uboot_fdt.c b/stand/uboot/fdt/uboot_fdt.c
index 417ec4aeb6eb..21e23931c710 100644
--- a/stand/uboot/fdt/uboot_fdt.c
+++ b/stand/uboot/fdt/uboot_fdt.c
@@ -103,12 +103,17 @@ fdt_platform_load_dtb(void)
}
exit:
- if (rv == 0)
- fdt_load_dtb_overlays(ub_env_get("fdt_overlays"));
return (rv);
}
void
+fdt_platform_load_overlays(void)
+{
+
+ fdt_load_dtb_overlays(ub_env_get("fdt_overlays"));
+}
+
+void
fdt_platform_fixups(void)
{
static struct fdt_mem_region regions[UB_MAX_MR];