Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/aarch64/include add checking status of MMU and devm...



details:   https://anonhg.NetBSD.org/src/rev/2c9973d3ed6c
branches:  trunk
changeset: 454157:2c9973d3ed6c
user:      ryo <ryo%NetBSD.org@localhost>
date:      Sat Sep 07 11:10:24 2019 +0000

description:
add checking status of MMU and devmap to make _platform_early_putchar() available at all times.

diffstat:

 sys/arch/aarch64/include/cpufunc.h |  13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 1da6ada4016b -r 2c9973d3ed6c sys/arch/aarch64/include/cpufunc.h
--- a/sys/arch/aarch64/include/cpufunc.h        Sat Sep 07 11:09:03 2019 +0000
+++ b/sys/arch/aarch64/include/cpufunc.h        Sat Sep 07 11:10:24 2019 +0000
@@ -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 <ryo%nerv.org@localhost>
@@ -148,8 +148,17 @@
 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 */



Home | Main Index | Thread Index | Old Index