diff options
author | ian <ian@FreeBSD.org> | 2018-03-25 02:04:44 +0000 |
---|---|---|
committer | ian <ian@FreeBSD.org> | 2018-03-25 02:04:44 +0000 |
commit | 6d187bf1abf569898ebf123898a706b155695680 (patch) | |
tree | c0cb09ac2f5e6956dbe98883a6228fa3463fc81a /sys/arm | |
parent | c41bc97806d087ff61f05f5eba64e2b912969ab0 (diff) | |
download | FreeBSD-src-6d187bf1abf569898ebf123898a706b155695680.zip FreeBSD-src-6d187bf1abf569898ebf123898a706b155695680.tar.gz |
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@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@caffeinated.codes>
Differential Revision: https://reviews.freebsd.org/D14465
Diffstat (limited to 'sys/arm')
-rw-r--r-- | sys/arm/arm/identcpu-v6.c | 8 | ||||
-rw-r--r-- | sys/arm/arm/machdep.c | 15 | ||||
-rw-r--r-- | sys/arm/arm/machdep_boot.c | 5 |
3 files changed, 25 insertions, 3 deletions
diff --git a/sys/arm/arm/identcpu-v6.c b/sys/arm/arm/identcpu-v6.c index 7cc8170..686b22b 100644 --- a/sys/arm/arm/identcpu-v6.c +++ b/sys/arm/arm/identcpu-v6.c @@ -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; } diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c index 117fbcb..511fc88 100644 --- a/sys/arm/arm/machdep.c +++ b/sys/arm/arm/machdep.c @@ -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,6 +774,16 @@ 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 @@ -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)); } diff --git a/sys/arm/arm/machdep_boot.c b/sys/arm/arm/machdep_boot.c index adb15f4..eb539675 100644 --- a/sys/arm/arm/machdep_boot.c +++ b/sys/arm/arm/machdep_boot.c @@ -27,6 +27,7 @@ */ #include "opt_platform.h" +#include "opt_ddb.h" #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); @@ -57,6 +58,10 @@ __FBSDID("$FreeBSD$"); #include <sys/efi.h> #endif +#ifdef DDB +#include <ddb/ddb.h> +#endif + #ifdef DEBUG #define debugf(fmt, args...) printf(fmt, ##args) #else |