Date: Thu, 11 Apr 2019 13:26:28 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r346132 - in head/stand: efi/fdt fdt powerpc/kboot powerpc/ofw uboot/fdt Message-ID: <201904111326.x3BDQSAA086815@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kevans Date: Thu Apr 11 13:26:28 2019 New Revision: 346132 URL: https://svnweb.freebsd.org/changeset/base/346132 Log: 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) Modified: head/stand/efi/fdt/efi_fdt.c head/stand/fdt/fdt_loader_cmd.c head/stand/fdt/fdt_platform.h head/stand/powerpc/kboot/kbootfdt.c head/stand/powerpc/ofw/ofwfdt.c head/stand/uboot/fdt/uboot_fdt.c Modified: head/stand/efi/fdt/efi_fdt.c ============================================================================== --- head/stand/efi/fdt/efi_fdt.c Thu Apr 11 13:21:10 2019 (r346131) +++ head/stand/efi/fdt/efi_fdt.c Thu Apr 11 13:26:28 2019 (r346132) @@ -52,8 +52,14 @@ 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 Modified: head/stand/fdt/fdt_loader_cmd.c ============================================================================== --- head/stand/fdt/fdt_loader_cmd.c Thu Apr 11 13:21:10 2019 (r346131) +++ head/stand/fdt/fdt_loader_cmd.c Thu Apr 11 13:26:28 2019 (r346132) @@ -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) { Modified: head/stand/fdt/fdt_platform.h ============================================================================== --- head/stand/fdt/fdt_platform.h Thu Apr 11 13:21:10 2019 (r346131) +++ head/stand/fdt/fdt_platform.h Thu Apr 11 13:26:28 2019 (r346132) @@ -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 */ Modified: head/stand/powerpc/kboot/kbootfdt.c ============================================================================== --- head/stand/powerpc/kboot/kbootfdt.c Thu Apr 11 13:21:10 2019 (r346131) +++ head/stand/powerpc/kboot/kbootfdt.c Thu Apr 11 13:26:28 2019 (r346132) @@ -177,6 +177,12 @@ fdt_platform_load_dtb(void) } void +fdt_platform_load_overlays(void) +{ + +} + +void fdt_platform_fixups(void) { Modified: head/stand/powerpc/ofw/ofwfdt.c ============================================================================== --- head/stand/powerpc/ofw/ofwfdt.c Thu Apr 11 13:21:10 2019 (r346131) +++ head/stand/powerpc/ofw/ofwfdt.c Thu Apr 11 13:26:28 2019 (r346132) @@ -198,6 +198,12 @@ fdt_platform_load_dtb(void) } void +fdt_platform_load_overlays(void) +{ + +} + +void fdt_platform_fixups(void) { Modified: head/stand/uboot/fdt/uboot_fdt.c ============================================================================== --- head/stand/uboot/fdt/uboot_fdt.c Thu Apr 11 13:21:10 2019 (r346131) +++ head/stand/uboot/fdt/uboot_fdt.c Thu Apr 11 13:26:28 2019 (r346132) @@ -103,9 +103,14 @@ 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904111326.x3BDQSAA086815>