Author: manu
Date: Sat Oct 10 07:20:59 2020
New Revision: 366600
URL: https://svnweb.freebsd.org/changeset/base/366600

Log:
  arm: Check dtb version against the one we're expecting to find
  
  Reviewed by:  imp, emaste, mmel
  Differential Revision:        https://reviews.freebsd.org/D26725

Modified:
  head/sys/arm/arm/machdep.c

Modified: head/sys/arm/arm/machdep.c
==============================================================================
--- head/sys/arm/arm/machdep.c  Sat Oct 10 07:18:51 2020        (r366599)
+++ head/sys/arm/arm/machdep.c  Sat Oct 10 07:20:59 2020        (r366600)
@@ -1111,6 +1111,8 @@ initarm(struct arm_boot_params *abp)
        char *env;
        void *kmdp;
        int err_devmap, mem_regions_sz;
+       phandle_t root;
+       char dts_version[255];
 #ifdef EFI
        struct efi_map_header *efihdr;
 #endif
@@ -1272,6 +1274,18 @@ initarm(struct arm_boot_params *abp)
                    err_devmap);
 
        platform_late_init();
+
+       root = OF_finddevice("/");
+       if (OF_getprop(root, "freebsd,dts-version", dts_version, 
sizeof(dts_version)) > 0) {
+               if (strcmp(LINUX_DTS_VERSION, dts_version) != 0)
+                       printf("WARNING: DTB version is %s while kernel expects 
%s, "
+                           "please update the DTB in the ESP\n",
+                           dts_version,
+                           LINUX_DTS_VERSION);
+       } else {
+               printf("WARNING: Cannot find freebsd,dts-version property, "
+                   "cannot check DTB compliance\n");
+       }
 
        /*
         * We must now clean the cache again....
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to