git: c29c0e68765f - main - arm: allow the debug stuff in CP14 to be disabled at compile time

From: Adrian Chadd <adrian_at_FreeBSD.org>
Date: Mon, 18 Oct 2021 19:19:18 UTC
The branch main has been updated by adrian:

URL: https://cgit.FreeBSD.org/src/commit/?id=c29c0e68765f4b98c8507d0dabb976e589b74d4b

commit c29c0e68765f4b98c8507d0dabb976e589b74d4b
Author:     Adrian Chadd <adrian@FreeBSD.org>
AuthorDate: 2021-10-16 18:32:08 +0000
Commit:     Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2021-10-18 19:18:56 +0000

    arm: allow the debug stuff in CP14 to be disabled at compile time
    
    The upcoming QCA ipq401x support detects the CP14 debug features,
    but any attempt to use it causes an undefined instruction error.
    It apparently needs a specific TZ image loaded by the early bootloader
    (SBL) in order to enable these kinds of features.
    
    So add a new kernel option that explicitly disables this in the
    arm code - the debugger works fine without it.
---
 sys/arm/arm/debug_monitor.c | 5 +++++
 sys/conf/options.arm        | 1 +
 2 files changed, 6 insertions(+)

diff --git a/sys/arm/arm/debug_monitor.c b/sys/arm/arm/debug_monitor.c
index b73249bedcf1..b9678a5040af 100644
--- a/sys/arm/arm/debug_monitor.c
+++ b/sys/arm/arm/debug_monitor.c
@@ -960,6 +960,10 @@ vectr_clr:
 void
 dbg_monitor_init(void)
 {
+#ifdef	ARM_FORCE_DBG_MONITOR_DISABLE
+	db_printf("ARM Debug Architecture disabled in kernel compilation.\n");
+	return;
+#else
 	int err;
 
 	/* Fetch ARM Debug Architecture model */
@@ -1001,6 +1005,7 @@ dbg_monitor_init(void)
 
 	db_printf("HW Breakpoints/Watchpoints not enabled on CPU%d\n",
 	    PCPU_GET(cpuid));
+#endif	/* ARM_FORCE_DBG_MONITOR_DISABLE */
 }
 
 CTASSERT(sizeof(struct dbreg) == sizeof(((struct pcpu *)NULL)->pc_dbreg));
diff --git a/sys/conf/options.arm b/sys/conf/options.arm
index 62f1a79fe314..0e5726e9713e 100644
--- a/sys/conf/options.arm
+++ b/sys/conf/options.arm
@@ -1,6 +1,7 @@
 #$FreeBSD$
 ARMV6			opt_global.h
 ARMV7			opt_global.h
+ARM_FORCE_DBG_MONITOR_DISABLE	opt_ddb.h
 CPSW_ETHERSWITCH	opt_cpsw.h
 CPU_ARM1176		opt_global.h
 CPU_CORTEXA		opt_global.h