git: 63f344024a0d - main - arm64: Check dtb version against the one we're expecting to find
Emmanuel Vadot
manu at FreeBSD.org
Tue Mar 23 14:25:02 UTC 2021
The branch main has been updated by manu:
URL: https://cgit.FreeBSD.org/src/commit/?id=63f344024a0d336b116f3563a1604fbd9b4253c7
commit 63f344024a0d336b116f3563a1604fbd9b4253c7
Author: Emmanuel Vadot <manu at FreeBSD.org>
AuthorDate: 2021-03-23 14:24:14 +0000
Commit: Emmanuel Vadot <manu at FreeBSD.org>
CommitDate: 2021-03-23 14:24:53 +0000
arm64: Check dtb version against the one we're expecting to find
Do for arm64 what was done for armv7 in e63faa9ba832b6
---
sys/arm64/arm64/machdep.c | 16 ++++++++++++++++
sys/conf/Makefile.arm64 | 3 +++
2 files changed, 19 insertions(+)
diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c
index 8a1e7520aacb..308a870fe188 100644
--- a/sys/arm64/arm64/machdep.c
+++ b/sys/arm64/arm64/machdep.c
@@ -1241,6 +1241,8 @@ initarm(struct arm64_bootparams *abp)
#ifdef FDT
struct mem_region mem_regions[FDT_MEM_REGIONS];
int mem_regions_sz;
+ phandle_t root;
+ char dts_version[255];
#endif
vm_offset_t lastaddr;
caddr_t kmdp;
@@ -1353,6 +1355,20 @@ initarm(struct arm64_bootparams *abp)
if (env != NULL)
strlcpy(kernelname, env, sizeof(kernelname));
+#ifdef FDT
+ 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");
+ }
+#endif
+
if (boothowto & RB_VERBOSE) {
if (efihdr != NULL)
print_efi_map_entries(efihdr);
diff --git a/sys/conf/Makefile.arm64 b/sys/conf/Makefile.arm64
index c7951872ca2d..2e404664708c 100644
--- a/sys/conf/Makefile.arm64
+++ b/sys/conf/Makefile.arm64
@@ -27,6 +27,9 @@ S= ../../..
INCLUDES+= -I$S/contrib/libfdt -I$S/contrib/device-tree/include
+LINUX_DTS_VERSION!= awk '/freebsd,dts-version/ { sub(/;$$/,"", $$NF); print $$NF }' $S/dts/freebsd-compatible.dts
+CFLAGS += -DLINUX_DTS_VERSION=\"${LINUX_DTS_VERSION}\"
+
# Use a custom SYSTEM_LD command to generate the elf kernel, so we can
# set the text segment start address, and also strip the "arm mapping
# symbols" which have names like $a.0 and $d.2; see the document
More information about the dev-commits-src-all
mailing list