From e63faa9ba832b6c4eb38fcd6f96d22d7ebaf66a7 Mon Sep 17 00:00:00 2001 From: Emmanuel Vadot Date: Sat, 10 Oct 2020 07:20:59 +0000 Subject: [PATCH] arm: Check dtb version against the one we're expecting to find Reviewed by: imp, emaste, mmel Differential Revision: https://reviews.freebsd.org/D26725 --- sys/arm/arm/machdep.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c index 318563491076..c92d493b21d6 100644 --- a/sys/arm/arm/machdep.c +++ b/sys/arm/arm/machdep.c @@ -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 @@ -1273,6 +1275,18 @@ initarm(struct arm_boot_params *abp) 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.... * Cleaning may be done by reading new data to displace any