svn commit: r327350 - in head/stand: efi/fdt uboot/fdt

Kyle Evans kevans at FreeBSD.org
Fri Dec 29 18:08:32 UTC 2017


Author: kevans
Date: Fri Dec 29 18:08:30 2017
New Revision: 327350
URL: https://svnweb.freebsd.org/changeset/base/327350

Log:
  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.
  
  Reviewed by:	gonzo, imp, manu
  Differential Revision:	https://reviews.freebsd.org/D13664

Modified:
  head/stand/efi/fdt/efi_fdt.c
  head/stand/uboot/fdt/uboot_fdt.c

Modified: head/stand/efi/fdt/efi_fdt.c
==============================================================================
--- head/stand/efi/fdt/efi_fdt.c	Fri Dec 29 17:02:22 2017	(r327349)
+++ head/stand/efi/fdt/efi_fdt.c	Fri Dec 29 18:08:30 2017	(r327350)
@@ -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: head/stand/uboot/fdt/uboot_fdt.c
==============================================================================
--- head/stand/uboot/fdt/uboot_fdt.c	Fri Dec 29 17:02:22 2017	(r327349)
+++ head/stand/uboot/fdt/uboot_fdt.c	Fri Dec 29 18:08:30 2017	(r327350)
@@ -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-head mailing list