summaryrefslogtreecommitdiffstats
path: root/common/cmd_cpu.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-01-17 20:53:51 -0700
committerTom Rini <trini@konsulko.com>2016-01-25 10:39:43 -0500
commit72a8cf8dccf6f8b86d1683205e032a94eaa86938 (patch)
treeb29378eb8af182f0faf2028cb52465a021de40cc /common/cmd_cpu.c
parent25d5352c71dcc599030a4a764d8087185ed537d3 (diff)
downloadu-boot-72a8cf8dccf6f8b86d1683205e032a94eaa86938.tar.gz
u-boot-72a8cf8dccf6f8b86d1683205e032a94eaa86938.tar.xz
u-boot-72a8cf8dccf6f8b86d1683205e032a94eaa86938.zip
Move all command code into its own directory
There are a lot of unrelated files in common, including all of the commands. Moving them into their own directory makes them easier to find and is more logical. Some commands include non-command code, such as cmd_scsi.c. This should be sorted out at some point so that the function can be enabled with or without the associated command. Unfortunately, with m68k I get this error: m68k: + M5329AFEE +arch/m68k/cpu/mcf532x/start.o: In function `_start': +arch/m68k/cpu/mcf532x/start.S:159:(.text+0x452): relocation truncated to fit: R_68K_PC16 against symbol `board_init_f' defined in .text.board_init_f section in common/built-in.o I hope someone can shed some light on what this means. I hope it isn't depending on the position of code in the image. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Heiko Schocher <hs@denx.de> Acked-by: Stefan Roese <sr@denx.de> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
Diffstat (limited to 'common/cmd_cpu.c')
-rw-r--r--common/cmd_cpu.c114
1 files changed, 0 insertions, 114 deletions
diff --git a/common/cmd_cpu.c b/common/cmd_cpu.c
deleted file mode 100644
index b4af64f54f..0000000000
--- a/common/cmd_cpu.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 2015 Google, Inc
- * Written by Simon Glass <sjg@chromium.org>
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#include <common.h>
-#include <command.h>
-#include <cpu.h>
-#include <dm.h>
-#include <errno.h>
-
-static const char *cpu_feature_name[CPU_FEAT_COUNT] = {
- "L1 cache",
- "MMU",
-};
-
-static int print_cpu_list(bool detail)
-{
- struct udevice *dev;
- struct uclass *uc;
- char buf[100];
- int ret;
-
- ret = uclass_get(UCLASS_CPU, &uc);
- if (ret) {
- printf("Cannot find CPU uclass\n");
- return ret;
- }
- uclass_foreach_dev(dev, uc) {
- struct cpu_platdata *plat = dev_get_parent_platdata(dev);
- struct cpu_info info;
- bool first;
- int i;
-
- ret = cpu_get_desc(dev, buf, sizeof(buf));
- printf("%3d: %-10s %s\n", dev->seq, dev->name,
- ret ? "<no description>" : buf);
- if (!detail)
- continue;
- ret = cpu_get_info(dev, &info);
- if (ret) {
- printf("\t(no detail available");
- if (ret != -ENOSYS)
- printf(": err=%d\n", ret);
- printf(")\n");
- continue;
- }
- printf("\tID = %d, freq = ", plat->cpu_id);
- print_freq(info.cpu_freq, "");
- first = true;
- for (i = 0; i < CPU_FEAT_COUNT; i++) {
- if (info.features & (1 << i)) {
- printf("%s%s", first ? ": " : ", ",
- cpu_feature_name[i]);
- first = false;
- }
- }
- printf("\n");
- }
-
- return 0;
-}
-
-static int do_cpu_list(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
-{
- if (print_cpu_list(false))
- return CMD_RET_FAILURE;
-
- return 0;
-}
-
-static int do_cpu_detail(cmd_tbl_t *cmdtp, int flag, int argc,
- char *const argv[])
-{
- if (print_cpu_list(true))
- return CMD_RET_FAILURE;
-
- return 0;
-}
-
-static cmd_tbl_t cmd_cpu_sub[] = {
- U_BOOT_CMD_MKENT(list, 2, 1, do_cpu_list, "", ""),
- U_BOOT_CMD_MKENT(detail, 4, 0, do_cpu_detail, "", ""),
-};
-
-/*
- * Process a cpu sub-command
- */
-static int do_cpu(cmd_tbl_t *cmdtp, int flag, int argc,
- char * const argv[])
-{
- cmd_tbl_t *c = NULL;
-
- /* Strip off leading 'cpu' command argument */
- argc--;
- argv++;
-
- if (argc)
- c = find_cmd_tbl(argv[0], cmd_cpu_sub, ARRAY_SIZE(cmd_cpu_sub));
-
- if (c)
- return c->cmd(cmdtp, flag, argc, argv);
- else
- return CMD_RET_USAGE;
-}
-
-U_BOOT_CMD(
- cpu, 2, 1, do_cpu,
- "display information about CPUs",
- "list - list available CPUs\n"
- "cpu detail - show CPU detail"
-);