svn commit: r331524 - stable/11/sys/arm/arm

Ian Lepore ian at FreeBSD.org
Sun Mar 25 02:04:45 UTC 2018


Author: ian
Date: Sun Mar 25 02:04:44 2018
New Revision: 331524
URL: https://svnweb.freebsd.org/changeset/base/331524

Log:
  MFC r329989, r330044
  
  r329989:
  Add support for booting into kdb on arm platforms when the RB_KDB is set
  (using "boot -d" at the loader propmt or setting boot_ddb in loader.conf).
  
  Submitted by:	Thomas Skibo <thomasskibo at yahoo.com>
  Differential Revision:	https://reviews.freebsd.org/D14428
  
  r330044:
  Add a hw.model sysctl oid for armv6/7 which reports the CPU model, similar
  to what other arches (all except riscv and armv4/5) do.
  
  Submitted by:	Hyun Hwang <hyun at caffeinated.codes>
  Differential Revision:	https://reviews.freebsd.org/D14465

Modified:
  stable/11/sys/arm/arm/identcpu-v6.c
  stable/11/sys/arm/arm/machdep.c
  stable/11/sys/arm/arm/machdep_boot.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/arm/identcpu-v6.c
==============================================================================
--- stable/11/sys/arm/arm/identcpu-v6.c	Sun Mar 25 01:59:54 2018	(r331523)
+++ stable/11/sys/arm/arm/identcpu-v6.c	Sun Mar 25 02:04:44 2018	(r331524)
@@ -56,6 +56,10 @@ char machine[] = "arm";
 SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD,
 	machine, 0, "Machine class");
 
+static char cpu_model[64];
+SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD,
+    cpu_model, sizeof(cpu_model), "Machine model");
+
 static char hw_buf[81];
 static int hw_buf_idx;
 static bool hw_buf_newline;
@@ -266,11 +270,13 @@ identify_arm_cpu(void)
 	for(i = 0; i < nitems(cpu_names); i++) {
 		if (cpu_names[i].implementer == cpuinfo.implementer &&
 		    cpu_names[i].part_number == cpuinfo.part_number) {
-			printf("CPU: %s %s r%dp%d (ECO: 0x%08X)\n",
+			snprintf(cpu_model, sizeof(cpu_model),
+			    "%s %s r%dp%d (ECO: 0x%08X)",
 			    cpu_names[i].impl_name, cpu_names[i].core_name,
 			    cpuinfo.revision, cpuinfo.patch,
 			    cpuinfo.midr != cpuinfo.revidr ?
 			    cpuinfo.revidr : 0);
+			printf("CPU: %s\n", cpu_model);
 			break;
 		}
 

Modified: stable/11/sys/arm/arm/machdep.c
==============================================================================
--- stable/11/sys/arm/arm/machdep.c	Sun Mar 25 01:59:54 2018	(r331523)
+++ stable/11/sys/arm/arm/machdep.c	Sun Mar 25 02:04:44 2018	(r331524)
@@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/kernel.h>
 #include <sys/linker.h>
 #include <sys/msgbuf.h>
+#include <sys/reboot.h>
 #include <sys/rwlock.h>
 #include <sys/sched.h>
 #include <sys/syscallsubr.h>
@@ -773,7 +774,17 @@ set_stackptrs(int cpu)
 }
 #endif
 
+static void
+arm_kdb_init(void)
+{
 
+	kdb_init();
+#ifdef KDB
+	if (boothowto & RB_KDB)
+		kdb_enter(KDB_WHY_BOOTFLAGS, "Boot flags requested debugger");
+#endif
+}
+
 #ifdef FDT
 #if __ARM_ARCH < 6
 void *
@@ -1041,7 +1052,7 @@ initarm(struct arm_boot_params *abp)
 
 	init_param2(physmem);
 	dbg_monitor_init();
-	kdb_init();
+	arm_kdb_init();
 
 	return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP -
 	    sizeof(struct pcb)));
@@ -1250,7 +1261,7 @@ initarm(struct arm_boot_params *abp)
 	/* Init message buffer. */
 	msgbufinit(msgbufp, msgbufsize);
 	dbg_monitor_init();
-	kdb_init();
+	arm_kdb_init();
 	return ((void *)STACKALIGN(thread0.td_pcb));
 
 }

Modified: stable/11/sys/arm/arm/machdep_boot.c
==============================================================================
--- stable/11/sys/arm/arm/machdep_boot.c	Sun Mar 25 01:59:54 2018	(r331523)
+++ stable/11/sys/arm/arm/machdep_boot.c	Sun Mar 25 02:04:44 2018	(r331524)
@@ -27,6 +27,7 @@
  */
 
 #include "opt_platform.h"
+#include "opt_ddb.h"
 
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
@@ -55,6 +56,10 @@ __FBSDID("$FreeBSD$");
 
 #ifdef EFI
 #include <sys/efi.h>
+#endif
+
+#ifdef DDB
+#include <ddb/ddb.h>
 #endif
 
 #ifdef DEBUG


More information about the svn-src-all mailing list