summaryrefslogtreecommitdiffstats
path: root/arch/arm/cpu/cpuinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/cpu/cpuinfo.c')
-rw-r--r--arch/arm/cpu/cpuinfo.c64
1 files changed, 42 insertions, 22 deletions
diff --git a/arch/arm/cpu/cpuinfo.c b/arch/arm/cpu/cpuinfo.c
index ff6e1eb87b..2d3fe2ac8d 100644
--- a/arch/arm/cpu/cpuinfo.c
+++ b/arch/arm/cpu/cpuinfo.c
@@ -1,22 +1,10 @@
-/*
- * cpuinfo.c - Show information about cp15 registers
- *
- * Copyright (c) 2009 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
+// SPDX-License-Identifier: GPL-2.0-only
+// SPDX-FileCopyrightText: 2009 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
+
+/* cpuinfo.c - Show information about cp15 registers */
#include <common.h>
+#include <getopt.h>
#include <command.h>
#include <complete.h>
#include <asm/system.h>
@@ -40,6 +28,7 @@
#define ARM_CPU_PART_CORTEX_A15 0xC0F0
#define ARM_CPU_PART_CORTEX_A53 0xD030
#define ARM_CPU_PART_CORTEX_A57 0xD070
+#define ARM_CPU_PART_CORTEX_A72 0xD080
static void decode_cache(unsigned long size)
{
@@ -61,9 +50,23 @@ static int do_cpuinfo(int argc, char *argv[])
{
unsigned long mainid, cache, cr;
char *architecture, *implementer;
- int i;
+ int opt, i;
int cpu_arch;
+ while ((opt = getopt(argc, argv, "s")) > 0) {
+ switch (opt) {
+ case 's':
+ if (!IS_ENABLED(CONFIG_ARCH_HAS_STACK_DUMP))
+ return -ENOSYS;
+
+ printf("SP: 0x%08lx\n", get_sp());
+ dump_stack();
+ return 0;
+ default:
+ return COMMAND_ERROR_USAGE;
+ }
+ }
+
#ifdef CONFIG_CPU_64v8
__asm__ __volatile__(
"mrs %0, midr_el1\n"
@@ -204,7 +207,7 @@ static int do_cpuinfo(int argc, char *argv[])
if (cpu_arch >= CPU_ARCH_ARMv7) {
unsigned int major, minor;
- char *part;
+ const char *part = NULL;
major = (mainid >> 20) & 0xf;
minor = mainid & 0xf;
switch (mainid & 0xfff0) {
@@ -229,12 +232,23 @@ static int do_cpuinfo(int argc, char *argv[])
case ARM_CPU_PART_CORTEX_A57:
part = "Cortex-A57";
break;
+ case ARM_CPU_PART_CORTEX_A72:
+ part = "Cortex-A72";
+ break;
default:
- part = "unknown";
+ printf("core: unknown (0x%08lx) r%up%u\n",
+ mainid, major, minor);
+ break;
}
- printf("core: %s r%up%u\n", part, major, minor);
+
+ if (part)
+ printf("core: %s r%up%u\n", part, major, minor);
}
+#ifdef CONFIG_CPU_64v8
+ printf("exception level: %u\n", current_el());
+#endif
+
if (cache & (1 << 24)) {
/* separate I/D cache */
printf("I-cache: ");
@@ -256,10 +270,16 @@ static int do_cpuinfo(int argc, char *argv[])
return 0;
}
+BAREBOX_CMD_HELP_START(cpuinfo)
+BAREBOX_CMD_HELP_TEXT("Shows misc info about CPU")
+BAREBOX_CMD_HELP_OPT ("-s", "print call stack info (if supported)")
+BAREBOX_CMD_HELP_END
+
BAREBOX_CMD_START(cpuinfo)
.cmd = do_cpuinfo,
BAREBOX_CMD_DESC("show info about CPU")
+ BAREBOX_CMD_OPTS("[-s]")
BAREBOX_CMD_GROUP(CMD_GRP_INFO)
BAREBOX_CMD_COMPLETE(empty_complete)
+ BAREBOX_CMD_HELP(cmd_cpuinfo_help)
BAREBOX_CMD_END
-