Date: Sat, 13 Jan 2018 21:08:38 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327942 - stable/11/sys/boot/fdt Message-ID: <201801132108.w0DL8cwH047935@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kevans Date: Sat Jan 13 21:08:38 2018 New Revision: 327942 URL: https://svnweb.freebsd.org/changeset/base/327942 Log: MFC (conceptually) r327298, r327299: Fix overlay application behavior This is a direct commit to stable/11 due to restructuring of sys/boot => stand in -HEAD. The diff remains the same and it simply applied to the previous location. MFC r327298: stand/fdt: Fix loading of multiple fdt_overlays fdt_load_dtb_overlays was written to unload previous overlay when a new valid one is come across. fdt_apply_overlays further down is written to iterate over all .dtbo's currently loaded and apply them one-by-one. Correct fdt_load_dtb_overlays to stop dropping valid overlays that were previously loaded and match expectations. MFC r327299: stand/fdt: Avoid bailout when dtbo has no fixups In the case of a simple dtbo where fragment uses target-path and the overlay contains no references, /__fixups__ will not be included by either our dtc or dtc from ports, but the file still has valid fragments to be applied. Additional testing found that /__symbols__ might also be omitted if it's empty, which is not necessarily an error. Modified: stable/11/sys/boot/fdt/fdt_loader_cmd.c stable/11/sys/boot/fdt/fdt_overlay.c Modified: stable/11/sys/boot/fdt/fdt_loader_cmd.c ============================================================================== --- stable/11/sys/boot/fdt/fdt_loader_cmd.c Sat Jan 13 20:35:32 2018 (r327941) +++ stable/11/sys/boot/fdt/fdt_loader_cmd.c Sat Jan 13 21:08:38 2018 (r327942) @@ -280,14 +280,12 @@ fdt_load_dtb_file(const char * filename) static int fdt_load_dtb_overlay(const char * filename) { - struct preloaded_file *bfp, *oldbfp; + struct preloaded_file *bfp; struct fdt_header header; int err; debugf("fdt_load_dtb_overlay(%s)\n", filename); - oldbfp = file_findfile(filename, "dtbo"); - /* Attempt to load and validate a new dtb from a file. */ if ((bfp = file_loadraw(filename, "dtbo", 1)) == NULL) { printf("failed to load file '%s'\n", filename); @@ -308,10 +306,6 @@ fdt_load_dtb_overlay(const char * filename) fdt_strerror(err)); return (1); } - - /* A new dtb was validated, discard any previous file. */ - if (oldbfp) - file_discard(oldbfp); return (0); } Modified: stable/11/sys/boot/fdt/fdt_overlay.c ============================================================================== --- stable/11/sys/boot/fdt/fdt_overlay.c Sat Jan 13 20:35:32 2018 (r327941) +++ stable/11/sys/boot/fdt/fdt_overlay.c Sat Jan 13 21:08:38 2018 (r327942) @@ -324,10 +324,16 @@ fdt_overlay_do_fixups(void *main_fdtp, void *overlay_f main_symbols_o = fdt_path_offset(main_fdtp, "/__symbols__"); overlay_fixups_o = fdt_path_offset(overlay_fdtp, "/__fixups__"); - if (main_symbols_o < 0) + if (main_symbols_o < 0) { + if (main_symbols_o == -FDT_ERR_NOTFOUND) + return (0); return (-1); - if (overlay_fixups_o < 0) + } + if (overlay_fixups_o < 0) { + if (overlay_fixups_o == -FDT_ERR_NOTFOUND) + return (0); return (-1); + } for (fixup_prop_o = fdt_first_property_offset(overlay_fdtp, overlay_fixups_o); fixup_prop_o >= 0;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801132108.w0DL8cwH047935>