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)
This commit is contained in:
Kyle Evans 2019-04-11 13:26:28 +00:00
parent cf973b4420
commit 2a1e52f347
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=346132
6 changed files with 32 additions and 4 deletions

View file

@ -52,10 +52,16 @@ 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)
{

View file

@ -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) {

View file

@ -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 */

View file

@ -176,6 +176,12 @@ fdt_platform_load_dtb(void)
return (0);
}
void
fdt_platform_load_overlays(void)
{
}
void
fdt_platform_fixups(void)
{

View file

@ -197,6 +197,12 @@ fdt_platform_load_dtb(void)
return (0);
}
void
fdt_platform_load_overlays(void)
{
}
void
fdt_platform_fixups(void)
{

View file

@ -103,11 +103,16 @@ 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)
{