svn commit: r327944 - in stable/11/sys/boot: efi/fdt uboot/fdt

Kyle Evans kevans at FreeBSD.org
Sat Jan 13 21:19:57 UTC 2018


Author: kevans
Date: Sat Jan 13 21:19:55 2018
New Revision: 327944
URL: https://svnweb.freebsd.org/changeset/base/327944

Log:
  MFC (conceptually) r327350: Consistently apply fdt_overlays
  
  This is a direct commit to stable/11 due to restructuring of sys/boot =>
  stand in -HEAD. The diff remains the same and it is simply applied to the
  previous location.
  
  MFC r327350: 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.

Modified:
  stable/11/sys/boot/efi/fdt/efi_fdt.c
  stable/11/sys/boot/uboot/fdt/uboot_fdt.c

Modified: stable/11/sys/boot/efi/fdt/efi_fdt.c
==============================================================================
--- stable/11/sys/boot/efi/fdt/efi_fdt.c	Sat Jan 13 21:10:42 2018	(r327943)
+++ stable/11/sys/boot/efi/fdt/efi_fdt.c	Sat Jan 13 21:19:55 2018	(r327944)
@@ -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();
 }

Modified: stable/11/sys/boot/uboot/fdt/uboot_fdt.c
==============================================================================
--- stable/11/sys/boot/uboot/fdt/uboot_fdt.c	Sat Jan 13 21:10:42 2018	(r327943)
+++ stable/11/sys/boot/uboot/fdt/uboot_fdt.c	Sat Jan 13 21:19:55 2018	(r327944)
@@ -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)


More information about the svn-src-all mailing list