Module Name: src
Committed By: ryo
Date: Sat Sep 7 11:10:24 UTC 2019
Modified Files:
src/sys/arch/aarch64/include: cpufunc.h
Log Message:
add checking status of MMU and devmap to make _platform_early_putchar()
available at all times.
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/aarch64/include/cpufunc.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/aarch64/include/cpufunc.h
diff -u src/sys/arch/aarch64/include/cpufunc.h:1.5 src/sys/arch/aarch64/include/cpufunc.h:1.6
--- src/sys/arch/aarch64/include/cpufunc.h:1.5 Fri Dec 21 08:01:01 2018
+++ src/sys/arch/aarch64/include/cpufunc.h Sat Sep 7 11:10:24 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cpufunc.h,v 1.5 2018/12/21 08:01:01 ryo Exp $ */
+/* $NetBSD: cpufunc.h,v 1.6 2019/09/07 11:10:24 ryo Exp $ */
/*
* Copyright (c) 2017 Ryo Shimizu <[email protected]>
@@ -148,8 +148,17 @@ cpu_clusterid(void)
static inline bool
cpu_earlydevice_va_p(void)
{
+ extern vaddr_t virtual_devmap_addr; /* in pmap.c */
- return false;
+ /* This function may be called before enabling MMU, or mapping KVA */
+ if ((reg_sctlr_el1_read() & SCTLR_M) == 0)
+ return false;
+
+ /* device mapping will be availabled after pmap_devmap_bootstrap() */
+ if (virtual_devmap_addr == 0)
+ return false;
+
+ return true;
}
#endif /* _KERNEL */