summaryrefslogtreecommitdiff
path: root/common/cmd_ldrinfo.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_ldrinfo.c
parent25d5352c71dcc599030a4a764d8087185ed537d3 (diff)
downloadu-boot-72a8cf8dccf6f8b86d1683205e032a94eaa86938.tar.gz
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_ldrinfo.c')
-rw-r--r--common/cmd_ldrinfo.c192
1 files changed, 0 insertions, 192 deletions
diff --git a/common/cmd_ldrinfo.c b/common/cmd_ldrinfo.c
deleted file mode 100644
index 2aa56bdb62..0000000000
--- a/common/cmd_ldrinfo.c
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * U-boot - ldrinfo
- *
- * Copyright (c) 2010 Analog Devices Inc.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * Licensed under the GPL-2 or later.
- */
-
-#include <config.h>
-#include <common.h>
-#include <command.h>
-
-#include <asm/blackfin.h>
-#include <asm/mach-common/bits/bootrom.h>
-
-static uint32_t ldrinfo_header(const void *addr)
-{
- uint32_t skip = 0;
-
-#if defined(__ADSPBF561__)
- /* BF56x has a 4 byte global header */
- uint32_t header, sign;
- static const char * const spi_speed[] = {
- "500K", "1M", "2M", "??",
- };
-
- memcpy(&header, addr, sizeof(header));
-
- sign = (header & GFLAG_56X_SIGN_MASK) >> GFLAG_56X_SIGN_SHIFT;
- printf("Header: %08X ( %s-bit-flash wait:%i hold:%i spi:%s %s)\n",
- header,
- (header & GFLAG_56X_16BIT_FLASH) ? "16" : "8",
- (header & GFLAG_56X_WAIT_MASK) >> GFLAG_56X_WAIT_SHIFT,
- (header & GFLAG_56X_HOLD_MASK) >> GFLAG_56X_HOLD_SHIFT,
- spi_speed[(header & GFLAG_56X_SPI_MASK) >> GFLAG_56X_SPI_SHIFT],
- sign == GFLAG_56X_SIGN_MAGIC ? "" : "!!hdrsign!! ");
-
- skip = 4;
-#endif
-
- /* |Block @ 12345678: 12345678 12345678 12345678 12345678 | */
-#if defined(__ADSPBF531__) || defined(__ADSPBF532__) || defined(__ADSPBF533__) || \
- defined(__ADSPBF534__) || defined(__ADSPBF536__) || defined(__ADSPBF537__) || \
- defined(__ADSPBF538__) || defined(__ADSPBF539__) || defined(__ADSPBF561__)
- printf(" Address Count Flags\n");
-#else
- printf(" BCode Address Count Argument\n");
-#endif
-
- return skip;
-}
-
-struct ldr_flag {
- uint16_t flag;
- const char *desc;
-};
-
-static uint32_t ldrinfo_block(const void *base_addr)
-{
- uint32_t count;
-
- printf("Block @ %08X: ", (uint32_t)base_addr);
-
-#if defined(__ADSPBF531__) || defined(__ADSPBF532__) || defined(__ADSPBF533__) || \
- defined(__ADSPBF534__) || defined(__ADSPBF536__) || defined(__ADSPBF537__) || \
- defined(__ADSPBF538__) || defined(__ADSPBF539__) || defined(__ADSPBF561__)
-
- uint32_t addr, pval;
- uint16_t flags;
- int i;
- static const struct ldr_flag ldr_flags[] = {
- { BFLAG_53X_ZEROFILL, "zerofill" },
- { BFLAG_53X_RESVECT, "resvect" },
- { BFLAG_53X_INIT, "init" },
- { BFLAG_53X_IGNORE, "ignore" },
- { BFLAG_53X_COMPRESSED, "compressed"},
- { BFLAG_53X_FINAL, "final" },
- };
-
- memcpy(&addr, base_addr, sizeof(addr));
- memcpy(&count, base_addr+4, sizeof(count));
- memcpy(&flags, base_addr+8, sizeof(flags));
-
- printf("%08X %08X %04X ( ", addr, count, flags);
-
- for (i = 0; i < ARRAY_SIZE(ldr_flags); ++i)
- if (flags & ldr_flags[i].flag)
- printf("%s ", ldr_flags[i].desc);
-
- pval = (flags & BFLAG_53X_PFLAG_MASK) >> BFLAG_53X_PFLAG_SHIFT;
- if (pval)
- printf("gpio%i ", pval);
- pval = (flags & BFLAG_53X_PPORT_MASK) >> BFLAG_53X_PPORT_SHIFT;
- if (pval)
- printf("port%c ", 'e' + pval);
-
- if (flags & BFLAG_53X_ZEROFILL)
- count = 0;
- if (flags & BFLAG_53X_FINAL)
- count = 0;
- else
- count += sizeof(addr) + sizeof(count) + sizeof(flags);
-
-#else
-
- const uint8_t *raw8 = base_addr;
- uint32_t bcode, addr, arg, sign, chk;
- int i;
- static const struct ldr_flag ldr_flags[] = {
- { BFLAG_SAFE, "safe" },
- { BFLAG_AUX, "aux" },
- { BFLAG_FILL, "fill" },
- { BFLAG_QUICKBOOT, "quickboot" },
- { BFLAG_CALLBACK, "callback" },
- { BFLAG_INIT, "init" },
- { BFLAG_IGNORE, "ignore" },
- { BFLAG_INDIRECT, "indirect" },
- { BFLAG_FIRST, "first" },
- { BFLAG_FINAL, "final" },
- };
-
- memcpy(&bcode, base_addr, sizeof(bcode));
- memcpy(&addr, base_addr+4, sizeof(addr));
- memcpy(&count, base_addr+8, sizeof(count));
- memcpy(&arg, base_addr+12, sizeof(arg));
-
- printf("%08X %08X %08X %08X ( ", bcode, addr, count, arg);
-
- if (addr % 4)
- printf("!!addralgn!! ");
- if (count % 4)
- printf("!!cntalgn!! ");
-
- sign = (bcode & BFLAG_HDRSIGN_MASK) >> BFLAG_HDRSIGN_SHIFT;
- if (sign != BFLAG_HDRSIGN_MAGIC)
- printf("!!hdrsign!! ");
-
- chk = 0;
- for (i = 0; i < 16; ++i)
- chk ^= raw8[i];
- if (chk)
- printf("!!hdrchk!! ");
-
- printf("dma:%i ", bcode & BFLAG_DMACODE_MASK);
-
- for (i = 0; i < ARRAY_SIZE(ldr_flags); ++i)
- if (bcode & ldr_flags[i].flag)
- printf("%s ", ldr_flags[i].desc);
-
- if (bcode & BFLAG_FILL)
- count = 0;
- if (bcode & BFLAG_FINAL)
- count = 0;
- else
- count += sizeof(bcode) + sizeof(addr) + sizeof(count) + sizeof(arg);
-
-#endif
-
- printf(")\n");
-
- return count;
-}
-
-static int do_ldrinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
- const void *addr;
- uint32_t skip;
-
- /* Get the address */
- if (argc < 2)
- addr = (void *)load_addr;
- else
- addr = (void *)simple_strtoul(argv[1], NULL, 16);
-
- /* Walk the LDR */
- addr += ldrinfo_header(addr);
- do {
- skip = ldrinfo_block(addr);
- addr += skip;
- } while (skip);
-
- return 0;
-}
-
-U_BOOT_CMD(
- ldrinfo, 2, 0, do_ldrinfo,
- "validate ldr image in memory",
- "[addr]\n"
-);