diff options
Diffstat (limited to 'arch/arm/cpu/cpuinfo.c')
-rw-r--r-- | arch/arm/cpu/cpuinfo.c | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/arch/arm/cpu/cpuinfo.c b/arch/arm/cpu/cpuinfo.c index a08fc253ef..2d3fe2ac8d 100644 --- a/arch/arm/cpu/cpuinfo.c +++ b/arch/arm/cpu/cpuinfo.c @@ -4,6 +4,7 @@ /* cpuinfo.c - Show information about cp15 registers */ #include <common.h> +#include <getopt.h> #include <command.h> #include <complete.h> #include <asm/system.h> @@ -27,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) { @@ -48,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" @@ -191,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) { @@ -216,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: "); @@ -243,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 - |