From dca2a1c18576116b33c31ea4d1cd7a3812e3bf95 Mon Sep 17 00:00:00 2001
From: Przemyslaw Marczak
Date: Wed, 22 Jan 2014 11:24:13 +0100
Subject: common: lcd.c: fix data abort exception when try to access bmp header
Changes:
- le16_to_cpu() to get_unaligned_le16()
- le32_to_cpu() to get_unaligned_le32()
when access fields in struct bmp header.
This changes avoids data abort exception caused by unaligned data access.
Signed-off-by: Przemyslaw Marczak
Acked-by: Anatolij Gustschin
Signed-off-by: Minkyu Kang
---
common/lcd.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
(limited to 'common')
diff --git a/common/lcd.c b/common/lcd.c
index 56bf067fb5..aa81522fff 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -26,7 +26,7 @@
#endif
#include
#include
-
+#include
#include
#if defined(CONFIG_CPU_PXA25X) || defined(CONFIG_CPU_PXA27X) || \
@@ -777,9 +777,9 @@ static void lcd_display_rle8_bitmap(bmp_image_t *bmp, ushort *cmap, uchar *fb,
int x, y;
int decode = 1;
- width = le32_to_cpu(bmp->header.width);
- height = le32_to_cpu(bmp->header.height);
- bmap = (uchar *)bmp + le32_to_cpu(bmp->header.data_offset);
+ width = get_unaligned_le32(&bmp->header.width);
+ height = get_unaligned_le32(&bmp->header.height);
+ bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
x = 0;
y = height - 1;
@@ -900,9 +900,10 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
return 1;
}
- width = le32_to_cpu(bmp->header.width);
- height = le32_to_cpu(bmp->header.height);
- bmp_bpix = le16_to_cpu(bmp->header.bit_count);
+ width = get_unaligned_le32(&bmp->header.width);
+ height = get_unaligned_le32(&bmp->header.height);
+ bmp_bpix = get_unaligned_le16(&bmp->header.bit_count);
+
colors = 1 << bmp_bpix;
bpix = NBITS(panel_info.vl_bpix);
@@ -917,9 +918,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
/* We support displaying 8bpp BMPs on 16bpp LCDs */
if (bpix != bmp_bpix && !(bmp_bpix == 8 && bpix == 16)) {
printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
- bpix,
- le16_to_cpu(bmp->header.bit_count));
-
+ bpix, get_unaligned_le16(&bmp->header.bit_count));
return 1;
}
@@ -956,7 +955,6 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
}
}
#endif
-
/*
* BMP format for Monochrome assumes that the state of a
* pixel is described on a per Bit basis, not per Byte.
@@ -987,15 +985,16 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
if ((y + height) > panel_info.vl_row)
height = panel_info.vl_row - y;
- bmap = (uchar *) bmp + le32_to_cpu(bmp->header.data_offset);
- fb = (uchar *) (lcd_base +
+ bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
+ fb = (uchar *)(lcd_base +
(y + height - 1) * lcd_line_length + x * bpix / 8);
switch (bmp_bpix) {
case 1: /* pass through */
case 8:
#ifdef CONFIG_LCD_BMP_RLE8
- if (le32_to_cpu(bmp->header.compression) == BMP_BI_RLE8) {
+ u32 compression = get_unaligned_le32(&bmp->header.compression);
+ if (compression == BMP_BI_RLE8) {
if (bpix != 16) {
/* TODO implement render code for bpix != 16 */
printf("Error: only support 16 bpix");
--
cgit
From 08d0d6f32ecf75a6c5dede5fc9ee84b84d8b90e7 Mon Sep 17 00:00:00 2001
From: Michal Simek
Date: Thu, 21 Nov 2013 13:39:02 -0800
Subject: common: Add new clk command
Command provides just dump subcommand for showing clock
frequencies in a soc.
Signed-off-by: Michal Simek
Acked-by: Stefano Babic
---
common/Makefile | 1 +
common/cmd_clk.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+)
create mode 100644 common/cmd_clk.c
(limited to 'common')
diff --git a/common/Makefile b/common/Makefile
index 4d99ecd616..a83246ee27 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -59,6 +59,7 @@ obj-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o
obj-$(CONFIG_CMD_BOOTSTAGE) += cmd_bootstage.o
obj-$(CONFIG_CMD_CACHE) += cmd_cache.o
obj-$(CONFIG_CMD_CBFS) += cmd_cbfs.o
+obj-$(CONFIG_CMD_CLK) += cmd_clk.o
obj-$(CONFIG_CMD_CONSOLE) += cmd_console.o
obj-$(CONFIG_CMD_CPLBINFO) += cmd_cplbinfo.o
obj-$(CONFIG_DATAFLASH_MMC_SELECT) += cmd_dataflash_mmc_mux.o
diff --git a/common/cmd_clk.c b/common/cmd_clk.c
new file mode 100644
index 0000000000..6d3d46a184
--- /dev/null
+++ b/common/cmd_clk.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2013 Xilinx, Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+#include
+#include
+#include
+
+int __weak soc_clk_dump(void)
+{
+ puts("Not implemented\n");
+ return 1;
+}
+
+static int do_clk_dump(cmd_tbl_t *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ return soc_clk_dump();
+}
+
+static cmd_tbl_t cmd_clk_sub[] = {
+ U_BOOT_CMD_MKENT(dump, 1, 1, do_clk_dump, "", ""),
+};
+
+static int do_clk(cmd_tbl_t *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ cmd_tbl_t *c;
+
+ if (argc < 2)
+ return CMD_RET_USAGE;
+
+ /* Strip off leading 'clk' command argument */
+ argc--;
+ argv++;
+
+ c = find_cmd_tbl(argv[0], &cmd_clk_sub[0], ARRAY_SIZE(cmd_clk_sub));
+
+ if (c)
+ return c->cmd(cmdtp, flag, argc, argv);
+ else
+ return CMD_RET_USAGE;
+}
+
+#ifdef CONFIG_SYS_LONGHELP
+static char clk_help_text[] =
+ "dump - Print clock frequencies";
+#endif
+
+U_BOOT_CMD(clk, 2, 1, do_clk, "CLK sub-system", clk_help_text);
--
cgit
From f43c401b72bb0db43ab0b55c4a79e1f4889d3aa2 Mon Sep 17 00:00:00 2001
From: Stephen Warren
Date: Tue, 28 Jan 2014 14:50:09 -0700
Subject: pxe: support "devicetree" tag
The specification for extlinux.conf[1] states that "fdt" is an alias for
"devicetree". To date, U-Boot only implements "fdt". Rectify that.
[1] http://freedesktop.org/wiki/Specifications/BootLoaderSpec/
Signed-off-by: Stephen Warren
---
common/cmd_pxe.c | 1 +
1 file changed, 1 insertion(+)
(limited to 'common')
diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index c27ec354cc..4f00b1a607 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -745,6 +745,7 @@ static const struct token keywords[] = {
{"append", T_APPEND},
{"initrd", T_INITRD},
{"include", T_INCLUDE},
+ {"devicetree", T_FDT},
{"fdt", T_FDT},
{"ontimeout", T_ONTIMEOUT,},
{"ipappend", T_IPAPPEND,},
--
cgit
From c61d94d86035ab2165aedf208b8f3c768b277a3d Mon Sep 17 00:00:00 2001
From: Stephen Warren
Date: Tue, 28 Jan 2014 14:50:10 -0700
Subject: pxe: implement fdtdir extlinux.conf tag
People who write (or scripts that auto-generate) extlinux.conf don't
want to know about HW-specific information such as FDT filenames. Create
a new extlinux.conf tag "fdtdir" that specifies only the directory where
FDT files are located, and defer all knowledge of the filename to U-Boot.
The algorithm implemented is:
==========
if $fdt_addr_r is set:
if "fdt" tag was specified in extlinux.conf:
load the FDT from the filename in the tag
else if "fdtdir" tag was specified in extlinux.conf:
if "fdtfile" is set in the environment:
load the FDT from filename in "$fdtfile"
else:
load the FDT from some automatically generated filename
if no FDT file was loaded, and $fdtaddr is set:
# This indicates an FDT packaged with firmware
use the FDT at $fdtaddr
==========
A small part of an example /boot/extlinux.conf might be:
==========
LABEL primary
LINUX zImage
FDTDIR ./
LABEL failsafe
LINUX bkp/zImage
FDTDIR bkp/
==========
... with /boot/tegra20-seaboard.dtb or /boot/bkp/tegra20-seaboard.dtb
being loaded by the sysboot/pxe code.
Signed-off-by: Stephen Warren
---
common/cmd_pxe.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 72 insertions(+), 6 deletions(-)
(limited to 'common')
diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index 4f00b1a607..2bd572d646 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -445,6 +445,7 @@ struct pxe_label {
char *append;
char *initrd;
char *fdt;
+ char *fdtdir;
int ipappend;
int attempted;
int localboot;
@@ -517,6 +518,9 @@ static void label_destroy(struct pxe_label *label)
if (label->fdt)
free(label->fdt);
+ if (label->fdtdir)
+ free(label->fdtdir);
+
free(label);
}
@@ -675,13 +679,67 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
bootm_argv[3] = getenv("fdt_addr_r");
/* if fdt label is defined then get fdt from server */
- if (bootm_argv[3] && label->fdt) {
- if (get_relfile_envaddr(cmdtp, label->fdt, "fdt_addr_r") < 0) {
- printf("Skipping %s for failure retrieving fdt\n",
- label->name);
- return 1;
+ if (bootm_argv[3]) {
+ char *fdtfile = NULL;
+ char *fdtfilefree = NULL;
+
+ if (label->fdt) {
+ fdtfile = label->fdt;
+ } else if (label->fdtdir) {
+ fdtfile = getenv("fdtfile");
+ /*
+ * For complex cases, it might be worth calling a
+ * board- or SoC-provided function here to provide a
+ * better default:
+ *
+ * if (!fdtfile)
+ * fdtfile = gen_fdtfile();
+ *
+ * If this is added, be sure to keep the default below,
+ * or move it to the default weak implementation of
+ * gen_fdtfile().
+ */
+ if (!fdtfile) {
+ char *soc = getenv("soc");
+ char *board = getenv("board");
+ char *slash;
+
+ len = strlen(label->fdtdir);
+ if (!len)
+ slash = "./";
+ else if (label->fdtdir[len - 1] != '/')
+ slash = "/";
+ else
+ slash = "";
+
+ len = strlen(label->fdtdir) + strlen(slash) +
+ strlen(soc) + 1 + strlen(board) + 5;
+ fdtfilefree = malloc(len);
+ if (!fdtfilefree) {
+ printf("malloc fail (FDT filename)\n");
+ return 1;
+ }
+
+ snprintf(fdtfilefree, len, "%s%s%s-%s.dtb",
+ label->fdtdir, slash, soc, board);
+ fdtfile = fdtfilefree;
+ }
}
- } else
+
+ if (fdtfile) {
+ int err = get_relfile_envaddr(cmdtp, fdtfile, "fdt_addr_r");
+ free(fdtfilefree);
+ if (err < 0) {
+ printf("Skipping %s for failure retrieving fdt\n",
+ label->name);
+ return 1;
+ }
+ } else {
+ bootm_argv[3] = NULL;
+ }
+ }
+
+ if (!bootm_argv[3])
bootm_argv[3] = getenv("fdt_addr");
if (bootm_argv[3])
@@ -716,6 +774,7 @@ enum token_type {
T_PROMPT,
T_INCLUDE,
T_FDT,
+ T_FDTDIR,
T_ONTIMEOUT,
T_IPAPPEND,
T_INVALID
@@ -747,6 +806,8 @@ static const struct token keywords[] = {
{"include", T_INCLUDE},
{"devicetree", T_FDT},
{"fdt", T_FDT},
+ {"devicetreedir", T_FDTDIR},
+ {"fdtdir", T_FDTDIR},
{"ontimeout", T_ONTIMEOUT,},
{"ipappend", T_IPAPPEND,},
{NULL, T_INVALID}
@@ -1135,6 +1196,11 @@ static int parse_label(char **c, struct pxe_menu *cfg)
err = parse_sliteral(c, &label->fdt);
break;
+ case T_FDTDIR:
+ if (!label->fdtdir)
+ err = parse_sliteral(c, &label->fdtdir);
+ break;
+
case T_LOCALBOOT:
label->localboot = 1;
err = parse_integer(c, &label->localboot_val);
--
cgit
From 6d1a3e5fa1fcaad98a6c7f29a6b1ffa091472178 Mon Sep 17 00:00:00 2001
From: Dennis Gilmore
Date: Tue, 4 Feb 2014 05:25:46 -0600
Subject: cmd_pxe.c add any option for filesystem with sysboot uses generic
load
Signed-off-by: Dennis Gilmore
---
common/cmd_pxe.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
(limited to 'common')
diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index 2bd572d646..29e48db204 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -11,6 +11,7 @@
#include
#include
#include
+#include
#include "menu.h"
@@ -160,6 +161,19 @@ static int do_get_fat(cmd_tbl_t *cmdtp, const char *file_path, char *file_addr)
return -ENOENT;
}
+static int do_get_any(cmd_tbl_t *cmdtp, const char *file_path, char *file_addr)
+{
+#ifdef CONFIG_CMD_FS_GENERIC
+ fs_argv[0] = "load";
+ fs_argv[3] = file_addr;
+ fs_argv[4] = (void *)file_path;
+
+ if (!do_load(cmdtp, 0, 5, fs_argv, FS_TYPE_ANY))
+ return 1;
+#endif
+ return -ENOENT;
+}
+
/*
* As in pxelinux, paths to files referenced from files we retrieve are
* relative to the location of bootfile. get_relfile takes such a path and
@@ -1606,6 +1620,8 @@ int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
do_getfile = do_get_ext2;
else if (strstr(argv[3], "fat"))
do_getfile = do_get_fat;
+ else if (strstr(argv[3], "any"))
+ do_getfile = do_get_any;
else {
printf("Invalid filesystem: %s\n", argv[3]);
return 1;
@@ -1643,7 +1659,7 @@ int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
U_BOOT_CMD(
sysboot, 7, 1, do_sysboot,
"command to get and boot from syslinux files",
- "[-p] [addr] [filename]\n"
- " - load and parse syslinux menu file 'filename' from ext2 or fat\n"
- " filesystem on 'dev' on 'interface' to address 'addr'"
+ "[-p] [addr] [filename]\n"
+ " - load and parse syslinux menu file 'filename' from ext2, fat\n"
+ " or any filesystem on 'dev' on 'interface' to address 'addr'"
);
--
cgit
From bc5d5428805c804cab67a0cc000bbf64e26acf71 Mon Sep 17 00:00:00 2001
From: Alexey Brodkin
Date: Tue, 4 Feb 2014 12:56:16 +0400
Subject: arc: bdinfo, image and arc-specific init functions declarations
support
Signed-off-by: Alexey Brodkin
Cc: Vineet Gupta
Cc: Francois Bedard
Cc: Wolfgang Denk
Cc: Heiko Schocher
---
common/cmd_bdinfo.c | 18 ++++++++++++++++++
common/image.c | 1 +
2 files changed, 19 insertions(+)
(limited to 'common')
diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index 713de1464c..15119a775e 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -517,6 +517,24 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
}
+#elif defined(CONFIG_ARC700)
+
+int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ bd_t *bd = gd->bd;
+
+ print_num("mem start", bd->bi_memstart);
+ print_lnum("mem size", bd->bi_memsize);
+
+#if defined(CONFIG_CMD_NET)
+ print_eth(0);
+ printf("ip_addr = %s\n", getenv("ipaddr"));
+#endif
+ printf("baudrate = %d bps\n", bd->bi_baudrate);
+
+ return 0;
+}
+
#else
#error "a case for this architecture does not exist!"
#endif
diff --git a/common/image.c b/common/image.c
index ae95c3f18a..9c6bec5b76 100644
--- a/common/image.c
+++ b/common/image.c
@@ -82,6 +82,7 @@ static const table_entry_t uimage_arch[] = {
{ IH_ARCH_OPENRISC, "or1k", "OpenRISC 1000",},
{ IH_ARCH_SANDBOX, "sandbox", "Sandbox", },
{ IH_ARCH_ARM64, "arm64", "AArch64", },
+ { IH_ARCH_ARC, "arc", "ARC", },
{ -1, "", "", },
};
--
cgit
From 7dbe63bc950bbd12d021f72bf04104688cd324a9 Mon Sep 17 00:00:00 2001
From: Tom Rini
Date: Wed, 5 Feb 2014 10:24:18 -0500
Subject: SPL: Add CONFIG_SUPPORT_EMMC_BOOT support to CONFIG_SPL_FRAMEWORK
We use the switch CONFIG_SUPPORT_EMMC_BOOT today to enable some
additional features of the eMMC boot partitions. Add support for being
told that we have booted from one of these partitions to the spl
framework and implement this on TI OMAP/related.
Cc: Pantelis Antoniou
Signed-off-by: Tom Rini
Signed-off-by: Pantelis Antoniou
---
common/spl/spl_mmc.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
(limited to 'common')
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 13fbff082c..fa6f891bc8 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -110,6 +110,30 @@ void spl_mmc_load_image(void)
err = spl_load_image_fat(&mmc->block_dev,
CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION,
CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME);
+#endif
+#ifdef CONFIG_SUPPORT_EMMC_BOOT
+ } else if (boot_mode == MMCSD_MODE_EMMCBOOT) {
+ /*
+ * We need to check what the partition is configured to.
+ * 1 and 2 match up to boot0 / boot1 and 7 is user data
+ * which is the first physical partition (0).
+ */
+ int part = (mmc->part_config >> 3) & PART_ACCESS_MASK;
+
+ if (part == 7)
+ part = 0;
+
+ if (mmc_switch_part(0, part)) {
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
+ puts("MMC partition switch failed\n");
+#endif
+ hang();
+ }
+#ifdef CONFIG_SPL_OS_BOOT
+ if (spl_start_uboot() || mmc_load_image_raw_os(mmc))
+#endif
+ err = mmc_load_image_raw(mmc,
+ CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
#endif
} else {
#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
--
cgit
From b01e6fe6c89a07ffc28afeeacd21643c1098766c Mon Sep 17 00:00:00 2001
From: Tom Rini
Date: Wed, 5 Feb 2014 10:24:19 -0500
Subject: cmd_mmc.c: Change 'bootpart' code to match normal coding style
Acked-by: Jaehoon Chung
Signed-off-by: Tom Rini
Signed-off-by: Pantelis Antoniou
---
common/cmd_mmc.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
(limited to 'common')
diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index da5fef9db9..e118252394 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -314,11 +314,18 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
} else if (strcmp(argv[1], "bootpart") == 0) {
int dev;
- dev = simple_strtoul(argv[2], NULL, 10);
+ struct *mmc;
+ u32 bootsize, rpmbsize;
- u32 bootsize = simple_strtoul(argv[3], NULL, 10);
- u32 rpmbsize = simple_strtoul(argv[4], NULL, 10);
- struct mmc *mmc = find_mmc_device(dev);
+ if (argc == 5) {
+ dev = simple_strtoul(argv[2], NULL, 10);
+ bootsize = simple_strtoul(argv[3], NULL, 10);
+ rpmbsize = simple_strtoul(argv[4], NULL, 10);
+ } else {
+ return CMD_RET_USAGE;
+ }
+
+ mmc = find_mmc_device(dev);
if (!mmc) {
printf("no mmc device at slot %x\n", dev);
return 1;
--
cgit
From f1fd957e12d9952702228c509cba1fa24858c98d Mon Sep 17 00:00:00 2001
From: Tom Rini
Date: Wed, 5 Feb 2014 10:24:20 -0500
Subject: cmd_mmc.c: Rename 'bootpart' to 'bootpart-resize'
Rename 'bootpart' to 'bootpart-resize' to better reflect what this
command is for.
Acked-by: Jaehoon Chung
Signed-off-by: Tom Rini
Signed-off-by: Pantelis Antoniou
---
common/cmd_mmc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
(limited to 'common')
diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index e118252394..a322063cf6 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -312,9 +312,9 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
/* acknowledge to be sent during boot operation */
return boot_part_access(mmc, 1, part_num, access);
- } else if (strcmp(argv[1], "bootpart") == 0) {
+ } else if (strcmp(argv[1], "bootpart-resize") == 0) {
int dev;
- struct *mmc;
+ struct mmc *mmc;
u32 bootsize, rpmbsize;
if (argc == 5) {
@@ -449,8 +449,8 @@ U_BOOT_CMD(
" - Enable boot_part for booting and enable R/W access of boot_part\n"
"mmc close \n"
" - Enable boot_part for booting and disable access to boot_part\n"
- "mmc bootpart \n"
- " - change sizes of boot and RPMB partitions of specified device\n"
+ "mmc bootpart-resize \n"
+ " - Change sizes of boot and RPMB partitions of specified device\n"
#endif
"mmc setdsr - set DSR register value\n"
);
--
cgit
From 792970b0a344d905848fb98564ed469786af11b7 Mon Sep 17 00:00:00 2001
From: Tom Rini
Date: Wed, 5 Feb 2014 10:24:21 -0500
Subject: cmd_mmc.c: Add 'partconf' command to mmc
Add a partconf sub-command to the mmc command to allow for setting
the boot_ack, boot_partition and partition_access fields of
PARTITION_CONFIG (formerly BOOT_CONFIG, EXT_CSD[179]). Part of this
requires changing the check for 'part' from an strncmp to a strcmp, like
the rest of the sub-commands.
Cc: Andy Fleming
Cc: Pantelis Antoniou
Acked-by: Jaehoon Chung
Signed-off-by: Tom Rini
Signed-off-by: Pantelis Antoniou
---
common/cmd_mmc.c | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
(limited to 'common')
diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index a322063cf6..5842e85de9 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -195,7 +195,7 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 1;
else
return 0;
- } else if (strncmp(argv[1], "part", 4) == 0) {
+ } else if (strcmp(argv[1], "part") == 0) {
block_dev_desc_t *mmc_dev;
struct mmc *mmc;
@@ -311,7 +311,33 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
/* acknowledge to be sent during boot operation */
return boot_part_access(mmc, 1, part_num, access);
+ } else if (strcmp(argv[1], "partconf") == 0) {
+ int dev;
+ struct mmc *mmc;
+ u8 ack, part_num, access;
+
+ if (argc == 6) {
+ dev = simple_strtoul(argv[2], NULL, 10);
+ ack = simple_strtoul(argv[3], NULL, 10);
+ part_num = simple_strtoul(argv[4], NULL, 10);
+ access = simple_strtoul(argv[5], NULL, 10);
+ } else {
+ return CMD_RET_USAGE;
+ }
+
+ mmc = find_mmc_device(dev);
+ if (!mmc) {
+ printf("no mmc device at slot %x\n", dev);
+ return 1;
+ }
+ if (IS_SD(mmc)) {
+ puts("PARTITION_CONFIG only exists on eMMC\n");
+ return 1;
+ }
+
+ /* acknowledge to be sent during boot operation */
+ return mmc_set_part_conf(mmc, ack, part_num, access);
} else if (strcmp(argv[1], "bootpart-resize") == 0) {
int dev;
struct mmc *mmc;
@@ -451,6 +477,8 @@ U_BOOT_CMD(
" - Enable boot_part for booting and disable access to boot_part\n"
"mmc bootpart-resize \n"
" - Change sizes of boot and RPMB partitions of specified device\n"
+ "mmc partconf dev boot_ack boot_partition partition_access\n"
+ " - Change the bits of the PARTITION_CONFIG field of the specified device\n"
#endif
"mmc setdsr - set DSR register value\n"
);
--
cgit
From 5a99b9de1a845bf254292ae4730633e6ca8a29c7 Mon Sep 17 00:00:00 2001
From: Tom Rini
Date: Wed, 5 Feb 2014 10:24:22 -0500
Subject: cmd_mmc.c: Add bootbus mmc sub-command
Add a bootbus sub-command to the mmc command to allow for setting
the boot_bus_width, reset_boot_bus_width and boot_mode fields of
BOOT_BUS_WIDTH (EXT_CSD[177]).
Acked-by: Jaehoon Chung
Signed-off-by: Tom Rini
Signed-off-by: Pantelis Antoniou
---
common/cmd_mmc.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
(limited to 'common')
diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index 5842e85de9..a028149d90 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -338,6 +338,33 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
/* acknowledge to be sent during boot operation */
return mmc_set_part_conf(mmc, ack, part_num, access);
+ } else if (strcmp(argv[1], "bootbus") == 0) {
+ int dev;
+ struct mmc *mmc;
+ u8 width, reset, mode;
+
+ if (argc == 6) {
+ dev = simple_strtoul(argv[2], NULL, 10);
+ width = simple_strtoul(argv[3], NULL, 10);
+ reset = simple_strtoul(argv[4], NULL, 10);
+ mode = simple_strtoul(argv[5], NULL, 10);
+ } else {
+ return CMD_RET_USAGE;
+ }
+
+ mmc = find_mmc_device(dev);
+ if (!mmc) {
+ printf("no mmc device at slot %x\n", dev);
+ return 1;
+ }
+
+ if (IS_SD(mmc)) {
+ puts("BOOT_BUS_WIDTH only exists on eMMC\n");
+ return 1;
+ }
+
+ /* acknowledge to be sent during boot operation */
+ return mmc_set_boot_bus_width(mmc, width, reset, mode);
} else if (strcmp(argv[1], "bootpart-resize") == 0) {
int dev;
struct mmc *mmc;
@@ -475,6 +502,8 @@ U_BOOT_CMD(
" - Enable boot_part for booting and enable R/W access of boot_part\n"
"mmc close \n"
" - Enable boot_part for booting and disable access to boot_part\n"
+ "mmc bootbus dev boot_bus_width reset_boot_bus_width boot_mode\n"
+ " - Set the BOOT_BUS_WIDTH field of the specified device\n"
"mmc bootpart-resize \n"
" - Change sizes of boot and RPMB partitions of specified device\n"
"mmc partconf dev boot_ack boot_partition partition_access\n"
--
cgit
From 614b2bf1c9bf80dbad24f5e5ce1d115bf24a831d Mon Sep 17 00:00:00 2001
From: Tom Rini
Date: Wed, 5 Feb 2014 10:24:23 -0500
Subject: cmd_mmc.c: Drop open/close mmc sub-commands
The open and close mmc sub-commands implement a hard-coded set of values
specific to the SMDK5250 platform. Remove these commands as what they
did can be done instead with a series of mmc dev / bootpart / bootbus
commands instead now.
Cc: Amar
Cc: Minkyu Kang
Acked-by: Jaehoon Chung
Signed-off-by: Tom Rini
Signed-off-by: Pantelis Antoniou
---
common/cmd_mmc.c | 72 --------------------------------------------------------
1 file changed, 72 deletions(-)
(limited to 'common')
diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index a028149d90..2d51927060 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -131,36 +131,6 @@ U_BOOT_CMD(
"- display info of the current MMC device"
);
-#ifdef CONFIG_SUPPORT_EMMC_BOOT
-static int boot_part_access(struct mmc *mmc, u8 ack, u8 part_num, u8 access)
-{
- int err;
- err = mmc_boot_part_access(mmc, ack, part_num, access);
-
- if ((err == 0) && (access != 0)) {
- printf("\t\t\t!!!Notice!!!\n");
-
- printf("!You must close EMMC boot Partition");
- printf("after all images are written\n");
-
- printf("!EMMC boot partition has continuity");
- printf("at image writing time.\n");
-
- printf("!So, do not close the boot partition");
- printf("before all images are written.\n");
- return 0;
- } else if ((err == 0) && (access == 0))
- return 0;
- else if ((err != 0) && (access != 0)) {
- printf("EMMC boot partition-%d OPEN Failed.\n", part_num);
- return 1;
- } else {
- printf("EMMC boot partition-%d CLOSE Failed.\n", part_num);
- return 1;
- }
-}
-#endif
-
static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
enum mmc_state state;
@@ -273,44 +243,6 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
#ifdef CONFIG_SUPPORT_EMMC_BOOT
- } else if ((strcmp(argv[1], "open") == 0) ||
- (strcmp(argv[1], "close") == 0)) {
- int dev;
- struct mmc *mmc;
- u8 part_num, access = 0;
-
- if (argc == 4) {
- dev = simple_strtoul(argv[2], NULL, 10);
- part_num = simple_strtoul(argv[3], NULL, 10);
- } else {
- return CMD_RET_USAGE;
- }
-
- mmc = find_mmc_device(dev);
- if (!mmc) {
- printf("no mmc device at slot %x\n", dev);
- return 1;
- }
-
- if (IS_SD(mmc)) {
- printf("SD device cannot be opened/closed\n");
- return 1;
- }
-
- if ((part_num <= 0) || (part_num > MMC_NUM_BOOT_PARTITION)) {
- printf("Invalid boot partition number:\n");
- printf("Boot partition number cannot be <= 0\n");
- printf("EMMC44 supports only 2 boot partitions\n");
- return 1;
- }
-
- if (strcmp(argv[1], "open") == 0)
- access = part_num; /* enable R/W access to boot part*/
- else
- access = 0; /* No access to boot partition */
-
- /* acknowledge to be sent during boot operation */
- return boot_part_access(mmc, 1, part_num, access);
} else if (strcmp(argv[1], "partconf") == 0) {
int dev;
struct mmc *mmc;
@@ -498,10 +430,6 @@ U_BOOT_CMD(
"mmc dev [dev] [part] - show or set current mmc device [partition]\n"
"mmc list - lists available devices\n"
#ifdef CONFIG_SUPPORT_EMMC_BOOT
- "mmc open \n"
- " - Enable boot_part for booting and enable R/W access of boot_part\n"
- "mmc close \n"
- " - Enable boot_part for booting and disable access to boot_part\n"
"mmc bootbus dev boot_bus_width reset_boot_bus_width boot_mode\n"
" - Set the BOOT_BUS_WIDTH field of the specified device\n"
"mmc bootpart-resize \n"
--
cgit
From 490ba833d5a7804ca81b13b3f8f2c37aadc40009 Mon Sep 17 00:00:00 2001
From: Stephen Warren
Date: Mon, 3 Feb 2014 13:21:02 -0700
Subject: cmd_test: use table lookup for parsing
do_test() currently uses strcmp() twice to determine which operator is
present; once to determine how many arguments the operator needs, then
a second time to actually decode the operator and implement it.
Rewrite the code so that a table lookup is used to translate the operator
string to an integer, and use a more efficient switch statement to decode
and execute the operator.
This approach also acts as enablement for the following patches.
This patch should introduce no behavioural change.
Signed-off-by: Stephen Warren
---
common/cmd_test.c | 177 +++++++++++++++++++++++++++++++++---------------------
1 file changed, 110 insertions(+), 67 deletions(-)
(limited to 'common')
diff --git a/common/cmd_test.c b/common/cmd_test.c
index bacc368406..69b1b4cee6 100644
--- a/common/cmd_test.c
+++ b/common/cmd_test.c
@@ -17,10 +17,48 @@
#include
#include
+#define OP_INVALID 0
+#define OP_OR 2
+#define OP_AND 3
+#define OP_STR_EMPTY 4
+#define OP_STR_NEMPTY 5
+#define OP_STR_EQ 6
+#define OP_STR_NEQ 7
+#define OP_STR_LT 8
+#define OP_STR_GT 9
+#define OP_INT_EQ 10
+#define OP_INT_NEQ 11
+#define OP_INT_LT 12
+#define OP_INT_LE 13
+#define OP_INT_GT 14
+#define OP_INT_GE 15
+
+const struct {
+ int arg;
+ const char *str;
+ int op;
+ int adv;
+} op_adv[] = {
+ {0, "-o", OP_OR, 1},
+ {0, "-a", OP_AND, 1},
+ {0, "-z", OP_STR_EMPTY, 2},
+ {0, "-n", OP_STR_NEMPTY, 2},
+ {1, "=", OP_STR_EQ, 3},
+ {1, "!=", OP_STR_NEQ, 3},
+ {1, "<", OP_STR_LT, 3},
+ {1, ">", OP_STR_GT, 3},
+ {1, "-eq", OP_INT_EQ, 3},
+ {1, "-ne", OP_INT_NEQ, 3},
+ {1, "-lt", OP_INT_LT, 3},
+ {1, "-le", OP_INT_LE, 3},
+ {1, "-gt", OP_INT_GT, 3},
+ {1, "-ge", OP_INT_GE, 3},
+};
+
static int do_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
char * const *ap;
- int left, adv, expr, last_expr, neg, last_cmp;
+ int i, op, left, adv, expr, last_expr, neg, last_cmp;
/* args? */
if (argc < 3)
@@ -45,83 +83,88 @@ static int do_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
neg = 0;
expr = -1;
- last_cmp = -1;
+ last_cmp = OP_INVALID;
last_expr = -1;
while (left > 0) {
-
- if (strcmp(ap[0], "-o") == 0 || strcmp(ap[0], "-a") == 0)
- adv = 1;
- else if (strcmp(ap[0], "-z") == 0 || strcmp(ap[0], "-n") == 0)
- adv = 2;
- else
- adv = 3;
-
- if (left < adv) {
+ for (i = 0; i < ARRAY_SIZE(op_adv); i++) {
+ if (left <= op_adv[i].arg)
+ continue;
+ if (!strcmp(ap[op_adv[i].arg], op_adv[i].str)) {
+ op = op_adv[i].op;
+ adv = op_adv[i].adv;
+ break;
+ }
+ }
+ if (i == ARRAY_SIZE(op_adv)) {
expr = 1;
break;
}
-
- if (adv == 1) {
- if (strcmp(ap[0], "-o") == 0) {
- last_expr = expr;
- last_cmp = 0;
- } else if (strcmp(ap[0], "-a") == 0) {
- last_expr = expr;
- last_cmp = 1;
- } else {
- expr = 1;
- break;
- }
+ if (left < adv) {
+ expr = 1;
+ break;
}
- if (adv == 2) {
- if (strcmp(ap[0], "-z") == 0)
- expr = strlen(ap[1]) == 0 ? 1 : 0;
- else if (strcmp(ap[0], "-n") == 0)
- expr = strlen(ap[1]) == 0 ? 0 : 1;
- else {
- expr = 1;
- break;
- }
-
- if (last_cmp == 0)
- expr = last_expr || expr;
- else if (last_cmp == 1)
- expr = last_expr && expr;
- last_cmp = -1;
+ switch (op) {
+ case OP_STR_EMPTY:
+ expr = strlen(ap[1]) == 0 ? 1 : 0;
+ break;
+ case OP_STR_NEMPTY:
+ expr = strlen(ap[1]) == 0 ? 0 : 1;
+ break;
+ case OP_STR_EQ:
+ expr = strcmp(ap[0], ap[2]) == 0;
+ break;
+ case OP_STR_NEQ:
+ expr = strcmp(ap[0], ap[2]) != 0;
+ break;
+ case OP_STR_LT:
+ expr = strcmp(ap[0], ap[2]) < 0;
+ break;
+ case OP_STR_GT:
+ expr = strcmp(ap[0], ap[2]) > 0;
+ break;
+ case OP_INT_EQ:
+ expr = simple_strtol(ap[0], NULL, 10) ==
+ simple_strtol(ap[2], NULL, 10);
+ break;
+ case OP_INT_NEQ:
+ expr = simple_strtol(ap[0], NULL, 10) !=
+ simple_strtol(ap[2], NULL, 10);
+ break;
+ case OP_INT_LT:
+ expr = simple_strtol(ap[0], NULL, 10) <
+ simple_strtol(ap[2], NULL, 10);
+ break;
+ case OP_INT_LE:
+ expr = simple_strtol(ap[0], NULL, 10) <=
+ simple_strtol(ap[2], NULL, 10);
+ break;
+ case OP_INT_GT:
+ expr = simple_strtol(ap[0], NULL, 10) >
+ simple_strtol(ap[2], NULL, 10);
+ break;
+ case OP_INT_GE:
+ expr = simple_strtol(ap[0], NULL, 10) >=
+ simple_strtol(ap[2], NULL, 10);
+ break;
}
- if (adv == 3) {
- if (strcmp(ap[1], "=") == 0)
- expr = strcmp(ap[0], ap[2]) == 0;
- else if (strcmp(ap[1], "!=") == 0)
- expr = strcmp(ap[0], ap[2]) != 0;
- else if (strcmp(ap[1], ">") == 0)
- expr = strcmp(ap[0], ap[2]) > 0;
- else if (strcmp(ap[1], "<") == 0)
- expr = strcmp(ap[0], ap[2]) < 0;
- else if (strcmp(ap[1], "-eq") == 0)
- expr = simple_strtol(ap[0], NULL, 10) == simple_strtol(ap[2], NULL, 10);
- else if (strcmp(ap[1], "-ne") == 0)
- expr = simple_strtol(ap[0], NULL, 10) != simple_strtol(ap[2], NULL, 10);
- else if (strcmp(ap[1], "-lt") == 0)
- expr = simple_strtol(ap[0], NULL, 10) < simple_strtol(ap[2], NULL, 10);
- else if (strcmp(ap[1], "-le") == 0)
- expr = simple_strtol(ap[0], NULL, 10) <= simple_strtol(ap[2], NULL, 10);
- else if (strcmp(ap[1], "-gt") == 0)
- expr = simple_strtol(ap[0], NULL, 10) > simple_strtol(ap[2], NULL, 10);
- else if (strcmp(ap[1], "-ge") == 0)
- expr = simple_strtol(ap[0], NULL, 10) >= simple_strtol(ap[2], NULL, 10);
- else {
- expr = 1;
- break;
- }
-
- if (last_cmp == 0)
+ switch (op) {
+ case OP_OR:
+ last_expr = expr;
+ last_cmp = OP_OR;
+ break;
+ case OP_AND:
+ last_expr = expr;
+ last_cmp = OP_AND;
+ break;
+ default:
+ if (last_cmp == OP_OR)
expr = last_expr || expr;
- else if (last_cmp == 1)
+ else if (last_cmp == OP_AND)
expr = last_expr && expr;
- last_cmp = -1;
+ last_cmp = OP_INVALID;
+ break;
}
ap += adv; left -= adv;
--
cgit
From 4c80f29edd33cc613d01c5e93dde380b98d3c20c Mon Sep 17 00:00:00 2001
From: Stephen Warren
Date: Mon, 3 Feb 2014 13:21:03 -0700
Subject: cmd_test: check for binary operators before unary
This better mirrors the behaviour of bash, for example:
$ if test -z = -z; then echo yes; else echo no; fi
yes
This is parsed as a string comparison of "-z" and "-z", since the check
for the binary "=" operator occurs first. Without this change, the
command would be parsed as a -z test of "-", followed by a syntax error;
a trailing -z without and operand.
This is a behavioural change, but I believe any commands affected were
previously invalid or bizarely formed.
Signed-off-by: Stephen Warren
---
common/cmd_test.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
(limited to 'common')
diff --git a/common/cmd_test.c b/common/cmd_test.c
index 69b1b4cee6..e65dd53187 100644
--- a/common/cmd_test.c
+++ b/common/cmd_test.c
@@ -39,10 +39,6 @@ const struct {
int op;
int adv;
} op_adv[] = {
- {0, "-o", OP_OR, 1},
- {0, "-a", OP_AND, 1},
- {0, "-z", OP_STR_EMPTY, 2},
- {0, "-n", OP_STR_NEMPTY, 2},
{1, "=", OP_STR_EQ, 3},
{1, "!=", OP_STR_NEQ, 3},
{1, "<", OP_STR_LT, 3},
@@ -53,6 +49,10 @@ const struct {
{1, "-le", OP_INT_LE, 3},
{1, "-gt", OP_INT_GT, 3},
{1, "-ge", OP_INT_GE, 3},
+ {0, "-o", OP_OR, 1},
+ {0, "-a", OP_AND, 1},
+ {0, "-z", OP_STR_EMPTY, 2},
+ {0, "-n", OP_STR_NEMPTY, 2},
};
static int do_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
--
cgit
From d9b651ce31f464605eb590db9f60dd0bf92238dc Mon Sep 17 00:00:00 2001
From: Stephen Warren
Date: Mon, 3 Feb 2014 13:21:04 -0700
Subject: cmd_test: implement ! on sub-expressions
Currently, ! can only be parsed as the first operator in an expression.
This prevents the following from working:
$ if test ! ! 1 -eq 1; then echo yes; else echo no; fi
yes
$ if test ! 1 -eq 2 -a ! 3 -eq 4; then echo yes; else echo no; fi
yes
Fix this by parsing ! like any other operator, and and handling it
similarly to -a and -o.
Signed-off-by: Stephen Warren
---
common/cmd_test.c | 43 ++++++++++++++++++++++++-------------------
1 file changed, 24 insertions(+), 19 deletions(-)
(limited to 'common')
diff --git a/common/cmd_test.c b/common/cmd_test.c
index e65dd53187..b927d09eb3 100644
--- a/common/cmd_test.c
+++ b/common/cmd_test.c
@@ -18,6 +18,7 @@
#include
#define OP_INVALID 0
+#define OP_NOT 1
#define OP_OR 2
#define OP_AND 3
#define OP_STR_EMPTY 4
@@ -49,6 +50,7 @@ const struct {
{1, "-le", OP_INT_LE, 3},
{1, "-gt", OP_INT_GT, 3},
{1, "-ge", OP_INT_GE, 3},
+ {0, "!", OP_NOT, 1},
{0, "-o", OP_OR, 1},
{0, "-a", OP_AND, 1},
{0, "-z", OP_STR_EMPTY, 2},
@@ -58,7 +60,7 @@ const struct {
static int do_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
char * const *ap;
- int i, op, left, adv, expr, last_expr, neg, last_cmp;
+ int i, op, left, adv, expr, last_expr, last_unop, last_binop;
/* args? */
if (argc < 3)
@@ -73,17 +75,11 @@ static int do_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
#endif
- last_expr = 0;
- left = argc - 1; ap = argv + 1;
- if (left > 0 && strcmp(ap[0], "!") == 0) {
- neg = 1;
- ap++;
- left--;
- } else
- neg = 0;
-
+ left = argc - 1;
+ ap = argv + 1;
expr = -1;
- last_cmp = OP_INVALID;
+ last_unop = OP_INVALID;
+ last_binop = OP_INVALID;
last_expr = -1;
while (left > 0) {
for (i = 0; i < ARRAY_SIZE(op_adv); i++) {
@@ -152,27 +148,36 @@ static int do_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
switch (op) {
case OP_OR:
last_expr = expr;
- last_cmp = OP_OR;
+ last_binop = OP_OR;
break;
case OP_AND:
last_expr = expr;
- last_cmp = OP_AND;
+ last_binop = OP_AND;
+ break;
+ case OP_NOT:
+ if (last_unop == OP_NOT)
+ last_unop = OP_INVALID;
+ else
+ last_unop = OP_NOT;
break;
default:
- if (last_cmp == OP_OR)
+ if (last_unop == OP_NOT) {
+ expr = !expr;
+ last_unop = OP_INVALID;
+ }
+
+ if (last_binop == OP_OR)
expr = last_expr || expr;
- else if (last_cmp == OP_AND)
+ else if (last_binop == OP_AND)
expr = last_expr && expr;
- last_cmp = OP_INVALID;
+ last_binop = OP_INVALID;
+
break;
}
ap += adv; left -= adv;
}
- if (neg)
- expr = !expr;
-
expr = !expr;
debug (": returns %d\n", expr);
--
cgit
From 2453de99df576fb907fe06cac58c628e3590833f Mon Sep 17 00:00:00 2001
From: Stephen Warren
Date: Mon, 3 Feb 2014 13:21:05 -0700
Subject: cmd_test: evaluate to false without any arguments
This emulates bash:
$ if test; then echo yes; else echo no; fi
no
Currently, the code sets expr = -1 in this case, which gets mapped to
0 (true) at the end of do_test() by the logical -> shell exit code
conversion.
Signed-off-by: Stephen Warren
---
common/cmd_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'common')
diff --git a/common/cmd_test.c b/common/cmd_test.c
index b927d09eb3..4c2f967c6d 100644
--- a/common/cmd_test.c
+++ b/common/cmd_test.c
@@ -77,7 +77,7 @@ static int do_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
left = argc - 1;
ap = argv + 1;
- expr = -1;
+ expr = 0;
last_unop = OP_INVALID;
last_binop = OP_INVALID;
last_expr = -1;
--
cgit
From e5e897c01b1cd496187ca56a38ff5559d27f951c Mon Sep 17 00:00:00 2001
From: Stephen Warren
Date: Mon, 3 Feb 2014 13:21:06 -0700
Subject: cmd_test: implement -e test for file existence
This is much like a regular shell's -e operator, except that it takes
multiple arguments to specify the device type and device/partition ID
in addition to the usual filename:
if test -e mmc 0:1 /boot/boot.scr; then echo yes; else echo no; fi
Signed-off-by: Stephen Warren
---
common/cmd_test.c | 6 ++++++
1 file changed, 6 insertions(+)
(limited to 'common')
diff --git a/common/cmd_test.c b/common/cmd_test.c
index 4c2f967c6d..c93fe78231 100644
--- a/common/cmd_test.c
+++ b/common/cmd_test.c
@@ -16,6 +16,7 @@
#include
#include
+#include
#define OP_INVALID 0
#define OP_NOT 1
@@ -33,6 +34,7 @@
#define OP_INT_LE 13
#define OP_INT_GT 14
#define OP_INT_GE 15
+#define OP_FILE_EXISTS 16
const struct {
int arg;
@@ -55,6 +57,7 @@ const struct {
{0, "-a", OP_AND, 1},
{0, "-z", OP_STR_EMPTY, 2},
{0, "-n", OP_STR_NEMPTY, 2},
+ {0, "-e", OP_FILE_EXISTS, 4},
};
static int do_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
@@ -143,6 +146,9 @@ static int do_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
expr = simple_strtol(ap[0], NULL, 10) >=
simple_strtol(ap[2], NULL, 10);
break;
+ case OP_FILE_EXISTS:
+ expr = file_exists(ap[1], ap[2], ap[3], FS_TYPE_ANY);
+ break;
}
switch (op) {
--
cgit
From 95f706271089088cd1359e422d15300009f2b7c6 Mon Sep 17 00:00:00 2001
From: Masahiro Yamada
Date: Wed, 29 Jan 2014 16:29:16 +0900
Subject: fdt: rename IMAAGE_OF_BOARD_SETUP to IMAGE_OF_BOARD_SETUP
Signed-off-by: Masahiro Yamada
Acked-by: Simon Glass
---
common/image-fdt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'common')
diff --git a/common/image-fdt.c b/common/image-fdt.c
index 6f9ce7d37c..a54a919a5b 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -463,7 +463,7 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
return -1;
}
arch_fixup_memory_node(blob);
- if (IMAAGE_OF_BOARD_SETUP)
+ if (IMAGE_OF_BOARD_SETUP)
ft_board_setup(blob, gd->bd);
fdt_fixup_ethernet(blob);
--
cgit
From f7740f7712b8638f08b83a7e5d00bc1d6bb086a9 Mon Sep 17 00:00:00 2001
From: Wolfgang Denk
Date: Fri, 31 Jan 2014 09:28:25 +0100
Subject: EXT4: Fix number base handling of "ext4write" command
Unlike other commands (for example, "fatwrite"), ext4write would
interpret the "sizebytes" as decimal number. This is not only
inconsistend and unexpected to most users, it also breaks usage
like this:
tftp ${addr} ${name}
ext4write mmc 0:2 ${addr} ${filename} ${filesize}
Change this to use the standard notation of base 16 input format.
See also commit b770e88
WARNING: this is a change to the user interface!!
Signed-off-by: Wolfgang Denk
Cc: Uma Shankar
Cc: Stephen Warren
---
common/cmd_ext4.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'common')
diff --git a/common/cmd_ext4.c b/common/cmd_ext4.c
index 8289d25b06..68b047ba6a 100644
--- a/common/cmd_ext4.c
+++ b/common/cmd_ext4.c
@@ -79,8 +79,8 @@ int do_ext4_write(cmd_tbl_t *cmdtp, int flag, int argc,
/* get the address in hexadecimal format (string to int) */
ram_address = simple_strtoul(argv[3], NULL, 16);
- /* get the filesize in base 10 format */
- file_size = simple_strtoul(argv[5], NULL, 10);
+ /* get the filesize in hexadecimal format */
+ file_size = simple_strtoul(argv[5], NULL, 16);
/* set the device as block device */
ext4fs_set_blk_dev(dev_desc, &info);
--
cgit
From fff40a7e02092eee11970e7001c8560df419cac1 Mon Sep 17 00:00:00 2001
From: Dan Murphy
Date: Mon, 3 Feb 2014 06:59:01 -0600
Subject: common: spl: Add spl sata boot support
Add spl_sata to read a fat partition from a bootable SATA
drive.
Signed-off-by: Dan Murphy
Reviewed-by: Roger Quadros
---
common/Makefile | 3 +++
common/cmd_scsi.c | 2 ++
common/spl/Makefile | 1 +
common/spl/spl.c | 5 +++++
common/spl/spl_sata.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 60 insertions(+)
create mode 100644 common/spl/spl_sata.c
(limited to 'common')
diff --git a/common/Makefile b/common/Makefile
index a83246ee27..2fe14ccc41 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -202,6 +202,9 @@ ifdef CONFIG_SPL_USB_HOST_SUPPORT
obj-$(CONFIG_SPL_USB_SUPPORT) += usb.o usb_hub.o
obj-$(CONFIG_USB_STORAGE) += usb_storage.o
endif
+ifdef CONFIG_SPL_SATA_SUPPORT
+obj-$(CONFIG_CMD_SCSI) += cmd_scsi.o
+endif
ifneq ($(CONFIG_SPL_NET_SUPPORT),y)
obj-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o
obj-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o
diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
index 7b97dc9332..b3f7687aee 100644
--- a/common/cmd_scsi.c
+++ b/common/cmd_scsi.c
@@ -168,7 +168,9 @@ removable:
scsi_curr_dev = -1;
printf("Found %d device(s).\n", scsi_max_devs);
+#ifndef CONFIG_SPL_BUILD
setenv_ulong("scsidevs", scsi_max_devs);
+#endif
}
int scsi_get_disk_count(void)
diff --git a/common/spl/Makefile b/common/spl/Makefile
index 65a1484fc4..64569c2cc6 100644
--- a/common/spl/Makefile
+++ b/common/spl/Makefile
@@ -18,4 +18,5 @@ obj-$(CONFIG_SPL_NET_SUPPORT) += spl_net.o
obj-$(CONFIG_SPL_MMC_SUPPORT) += spl_mmc.o
obj-$(CONFIG_SPL_USB_SUPPORT) += spl_usb.o
obj-$(CONFIG_SPL_FAT_SUPPORT) += spl_fat.o
+obj-$(CONFIG_SPL_SATA_SUPPORT) += spl_sata.o
endif
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 0645cee789..774fdad252 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -209,6 +209,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
case BOOT_DEVICE_USB:
spl_usb_load_image();
break;
+#endif
+#ifdef CONFIG_SPL_SATA_SUPPORT
+ case BOOT_DEVICE_SATA:
+ spl_sata_load_image();
+ break;
#endif
default:
debug("SPL: Un-supported Boot Device\n");
diff --git a/common/spl/spl_sata.c b/common/spl/spl_sata.c
new file mode 100644
index 0000000000..2e7adca0ca
--- /dev/null
+++ b/common/spl/spl_sata.c
@@ -0,0 +1,49 @@
+/*
+ * (C) Copyright 2013
+ * Texas Instruments,
+ *
+ * Dan Murphy
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ *
+ * Derived work from spl_usb.c
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void spl_sata_load_image(void)
+{
+ int err;
+ block_dev_desc_t *stor_dev;
+
+ err = init_sata(CONFIG_SPL_SATA_BOOT_DEVICE);
+ if (err) {
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
+ printf("spl: sata init failed: err - %d\n", err);
+#endif
+ hang();
+ } else {
+ /* try to recognize storage devices immediately */
+ stor_dev = scsi_get_dev(0);
+ }
+
+#ifdef CONFIG_SPL_OS_BOOT
+ if (spl_start_uboot() || spl_load_image_fat_os(stor_dev,
+ CONFIG_SYS_SATA_FAT_BOOT_PARTITION))
+#endif
+ err = spl_load_image_fat(stor_dev,
+ CONFIG_SYS_SATA_FAT_BOOT_PARTITION,
+ CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME);
+ if (err) {
+ puts("Error loading sata device\n");
+ hang();
+ }
+}
--
cgit
From 9e4140329ee9a787d0f96ac2829d618d47f7973f Mon Sep 17 00:00:00 2001
From: Masahiro Yamada
Date: Tue, 4 Feb 2014 17:24:24 +0900
Subject: kbuild: change out-of-tree build
This commit changes the working directory
where the build process occurs.
Before this commit, build process occurred under the source
tree for both in-tree and out-of-tree build.
That's why we needed to add $(obj) prefix to all generated
files in makefiles like follows:
$(obj)u-boot.bin: $(obj)u-boot
Here, $(obj) is empty for in-tree build, whereas it points
to the output directory for out-of-tree build.
And our old build system changes the current working directory
with "make -C " syntax when descending into the
sub-directories.
On the other hand, Kbuild uses a different idea
to handle out-of-tree build and directory descending.
The build process of Kbuild always occurs under the output tree.
When "O=dir/to/store/output/files" is given, the build system
changes the current working directory to that directory and
restarts the make.
Kbuild uses "make -f $(srctree)/scripts/Makefile.build obj="
syntax for descending into sub-directories.
(We can write it like "make $(obj)=" with a shorthand.)
This means the current working directory is always the top
of the output directory.
Signed-off-by: Masahiro Yamada
Tested-by: Gerhard Sittig
---
common/Makefile | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
(limited to 'common')
diff --git a/common/Makefile b/common/Makefile
index 2fe14ccc41..2d75843628 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -238,11 +238,10 @@ obj-$(CONFIG_FIT_SIGNATURE) += image-sig.o
obj-y += memsize.o
obj-y += stdio.o
-$(obj)env_embedded.o: $(src)env_embedded.c
+$(obj)/env_embedded.o: $(src)/env_embedded.c
$(CC) $(AFLAGS) -Wa,--no-warn \
- -DENV_CRC=$(shell $(obj)../tools/envcrc) \
- -c -o $@ $(src)env_embedded.c
+ -DENV_CRC=$(shell tools/envcrc) -c -o $@ $<
# SEE README.arm-unaligned-accesses
-$(obj)hush.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
-$(obj)fdt_support.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
+$(obj)/hush.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
+$(obj)/fdt_support.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
--
cgit
From 6825a95b0ba72c4e5667d02d8b31986e2e9abd5a Mon Sep 17 00:00:00 2001
From: Masahiro Yamada
Date: Tue, 4 Feb 2014 17:24:28 +0900
Subject: kbuild: use Linux Kernel build scripts
Now we are ready to switch over to real Kbuild.
This commit disables temporary scripts:
scripts/{Makefile.build.tmp, Makefile.host.tmp}
and enables real Kbuild scripts:
scripts/{Makefile.build,Makefile.host,Makefile.lib}.
This switch is triggered by the line in scripts/Kbuild.include
-build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build.tmp obj
+build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj
We need to adjust some build scripts for U-Boot.
But smaller amount of modification is preferable.
Additionally, we need to fix compiler flags which are
locally added or removed.
In Kbuild, it is not allowed to change CFLAGS locally.
Instead, ccflags-y, asflags-y, cppflags-y,
CFLAGS_$(basetarget).o, CFLAGS_REMOVE_$(basetarget).o
are prepared for that purpose.
Signed-off-by: Masahiro Yamada
Tested-by: Gerhard Sittig
---
common/Makefile | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
(limited to 'common')
diff --git a/common/Makefile b/common/Makefile
index 2d75843628..3b2ff9bb52 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -238,10 +238,6 @@ obj-$(CONFIG_FIT_SIGNATURE) += image-sig.o
obj-y += memsize.o
obj-y += stdio.o
-$(obj)/env_embedded.o: $(src)/env_embedded.c
- $(CC) $(AFLAGS) -Wa,--no-warn \
- -DENV_CRC=$(shell tools/envcrc) -c -o $@ $<
-
-# SEE README.arm-unaligned-accesses
-$(obj)/hush.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
-$(obj)/fdt_support.o: CFLAGS += $(PLATFORM_NO_UNALIGNED)
+CFLAGS_env_embedded.o := -Wa,--no-warn -DENV_CRC=$(shell tools/envcrc 2>/dev/null)
+CFLAGS_hush.o := $(PLATFORM_NO_UNALIGNED)
+CFLAGS_fdt_support.o := $(PLATFORM_NO_UNALIGNED)
--
cgit
From 6ab6b2afa091dbceb37719b8a81637a00834be19 Mon Sep 17 00:00:00 2001
From: Masahiro Yamada
Date: Wed, 5 Feb 2014 11:28:25 +0900
Subject: dts: re-write dts/Makefile more simply with Kbuild
Useful rules in scripts/Makefile.lib allows us to easily
generate a device tree blob and wrap it in assembly code.
We do not need to parse a linker script to get output format and arch.
This commit deletes ./u-boot.dtb since it is a copy of dts/dt.dtb.
Signed-off-by: Masahiro Yamada
---
common/board_f.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'common')
diff --git a/common/board_f.c b/common/board_f.c
index aa70c3e57d..d0ee6f7656 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -360,7 +360,7 @@ static int setup_fdt(void)
{
#ifdef CONFIG_OF_EMBED
/* Get a pointer to the FDT */
- gd->fdt_blob = _binary_dt_dtb_start;
+ gd->fdt_blob = __dtb_dt_begin;
#elif defined CONFIG_OF_SEPARATE
/* FDT is at end of image */
# ifdef CONFIG_SYS_SYM_OFFSETS
--
cgit
From 365475e6d14bc1ea9d218c0fd1fe96878a9db94e Mon Sep 17 00:00:00 2001
From: Masahiro Yamada
Date: Thu, 13 Feb 2014 18:30:26 +0900
Subject: Move #ifdef(CONFIG_DISPLAY_CPUINFO) from caller to callee
- When CONFIG_DISPLAY_CPUINFO is not enabled,
print_cpuinfo() should be defined as an empty function
in a header, include/common.h
- Remove #ifdef CONFIG_DISPLAY_CPUINFO .. #endif
from caller, common/board_f.c and arch/arm/lib/board.c
- Remove redundant prototypes in arch/arm/lib/board.c,
arch/arm/include/asm/arch-am33x/sys_proto.h and
board/nokia/rx51/rx51.h, keeping the one in include/common.h
- Add #ifdef CONFIG_DISPLAY_CPUINFO to the func definition
where it is missing
Signed-off-by: Masahiro Yamada
---
common/board_f.c | 2 --
1 file changed, 2 deletions(-)
(limited to 'common')
diff --git a/common/board_f.c b/common/board_f.c
index d0ee6f7656..02965b0df7 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -887,9 +887,7 @@ static init_fnc_t init_sequence_f[] = {
#ifdef CONFIG_PPC
checkcpu,
#endif
-#if defined(CONFIG_DISPLAY_CPUINFO)
print_cpuinfo, /* display cpu info (and speed) */
-#endif
#if defined(CONFIG_MPC5xxx)
prt_mpc5xxx_clks,
#endif /* CONFIG_MPC5xxx */
--
cgit
From f150c837041f708dbcffcf39ebc73922a57a0209 Mon Sep 17 00:00:00 2001
From: Masahiro Yamada
Date: Tue, 18 Feb 2014 15:39:21 +0900
Subject: cosmetic: FIT: fix a strange comment
There is a strange comment in fit_image_load().
This function can be used for loading Kernel Image, FDT
as well as ramdisk.
Signed-off-by: Masahiro Yamada
Cc: Simon Glass
Acked-by: Simon Glass
---
common/image-fit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'common')
diff --git a/common/image-fit.c b/common/image-fit.c
index cf4b67e3e8..b94a3fe86d 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1500,7 +1500,7 @@ int fit_image_load(bootm_headers_t *images, const char *prop_name, ulong addr,
}
bootstage_mark(bootstage_id + BOOTSTAGE_SUB_FORMAT_OK);
if (fit_uname) {
- /* get ramdisk component image node offset */
+ /* get FIT component image node offset */
bootstage_mark(bootstage_id + BOOTSTAGE_SUB_UNIT_NAME);
noffset = fit_image_get_node(fit, fit_uname);
} else {
--
cgit
From 130fbeb1c51f19a2b81c4e27d23da735b5b235d4 Mon Sep 17 00:00:00 2001
From: Tom Rini
Date: Thu, 20 Feb 2014 10:14:10 -0500
Subject: blackfin: Add to numerous drivers
With d6a320d we moved some clock externs out of blackfin_local.h and
into clock.h but now need to include in more drivers to
avoid warnings.
Cc: Sonic Zhang
Signed-off-by: Tom Rini
---
common/cmd_otp.c | 1 +
1 file changed, 1 insertion(+)
(limited to 'common')
diff --git a/common/cmd_otp.c b/common/cmd_otp.c
index 6f93335517..67808aa377 100644
--- a/common/cmd_otp.c
+++ b/common/cmd_otp.c
@@ -18,6 +18,7 @@
#include
#include
+#include
#include
static const char *otp_strerror(uint32_t err)
--
cgit
From 1530f6f51ada57a9dd24f07d0f0955a8bf84c7b8 Mon Sep 17 00:00:00 2001
From: Tom Rini
Date: Fri, 21 Feb 2014 08:42:02 -0500
Subject: fs/fdos: Remove
We have an unused FAT implementation in fs/fdos, remove.
Signed-off-by: Tom Rini
---
common/Makefile | 3 +--
common/cmd_fdc.c | 67 --------------------------------------------------------
2 files changed, 1 insertion(+), 69 deletions(-)
(limited to 'common')
diff --git a/common/Makefile b/common/Makefile
index 3b2ff9bb52..6652ad41f8 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -81,9 +81,8 @@ obj-$(CONFIG_SYS_HUSH_PARSER) += cmd_exit.o
obj-$(CONFIG_CMD_EXT4) += cmd_ext4.o
obj-$(CONFIG_CMD_EXT2) += cmd_ext2.o
obj-$(CONFIG_CMD_FAT) += cmd_fat.o
-obj-$(CONFIG_CMD_FDC)$(CONFIG_CMD_FDOS) += cmd_fdc.o
+obj-$(CONFIG_CMD_FDC) += cmd_fdc.o
obj-$(CONFIG_OF_LIBFDT) += cmd_fdt.o fdt_support.o
-obj-$(CONFIG_CMD_FDOS) += cmd_fdos.o
obj-$(CONFIG_CMD_FITUPD) += cmd_fitupd.o
obj-$(CONFIG_CMD_FLASH) += cmd_flash.o
ifdef CONFIG_FPGA
diff --git a/common/cmd_fdc.c b/common/cmd_fdc.c
index 98b3c4c001..1cfb656bc0 100644
--- a/common/cmd_fdc.c
+++ b/common/cmd_fdc.c
@@ -627,72 +627,6 @@ int fdc_setup(int drive, FDC_COMMAND_STRUCT *pCMD, FD_GEO_STRUCT *pFG)
return true;
}
-#if defined(CONFIG_CMD_FDOS)
-
-/* Low level functions for the Floppy-DOS layer */
-
-/**************************************************************************
-* int fdc_fdos_init
-* initialize the FDC layer
-*
-*/
-int fdc_fdos_init (int drive)
-{
- FD_GEO_STRUCT *pFG = (FD_GEO_STRUCT *)floppy_type;
- FDC_COMMAND_STRUCT *pCMD = &cmd;
-
- /* setup FDC and scan for drives */
- if (fdc_setup(drive, pCMD, pFG) == false) {
- printf("\n** Error in setup FDC **\n");
- return false;
- }
- if (fdc_check_drive(pCMD, pFG) == false) {
- printf("\n** Error in check_drives **\n");
- return false;
- }
- if((pCMD->flags&(1<flags&(0x10<drive=drive;
-
- /* read first block */
- pCMD->blnr=0;
- return true;
-}
-/**************************************************************************
-* int fdc_fdos_seek
-* parameter is a block number
-*/
-int fdc_fdos_seek (int where)
-{
- FD_GEO_STRUCT *pFG = (FD_GEO_STRUCT *)floppy_type;
- FDC_COMMAND_STRUCT *pCMD = &cmd;
-
- pCMD -> blnr = where ;
- return (fdc_seek (pCMD, pFG));
-}
-/**************************************************************************
-* int fdc_fdos_read
-* the length is in block number
-*/
-int fdc_fdos_read (void *buffer, int len)
-{
- FD_GEO_STRUCT *pFG = (FD_GEO_STRUCT *)floppy_type;
- FDC_COMMAND_STRUCT *pCMD = &cmd;
-
- return (fdc_read_data (buffer, len, pCMD, pFG));
-}
-#endif
-
-#if defined(CONFIG_CMD_FDC)
/****************************************************************************
* main routine do_fdcboot
*/
@@ -812,4 +746,3 @@ U_BOOT_CMD(
"boot from floppy device",
"loadAddr drive"
);
-#endif
--
cgit
From b81fdb04868e21693f5dfe9242ff6f49fcfe5a93 Mon Sep 17 00:00:00 2001
From: Stephen Warren
Date: Wed, 5 Feb 2014 20:49:20 -0700
Subject: pxe: allow compilation when !defined(CONFIG_CMD_NET)
pxe.c provides both the "pxe" command which relies on a network, and the
"sysboot" command which doesn't. Fix the file to compile when network
support isn't enabled. This is useful e.g. on the Raspberry Pi which has
no network support yet, but will soon support the sysboot command.
Signed-off-by: Stephen Warren
---
common/cmd_pxe.c | 11 +++++++++++
1 file changed, 11 insertions(+)
(limited to 'common')
diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index 29e48db204..3d13268142 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -45,6 +45,7 @@ static char *from_env(const char *envvar)
return ret;
}
+#ifdef CONFIG_CMD_NET
/*
* Convert an ethaddr from the environment to the format used by pxelinux
* filenames based on mac addresses. Convert's ':' to '-', and adds "01-" to
@@ -75,6 +76,7 @@ static int format_mac_pxe(char *outbuf, size_t outbuf_len)
return 1;
}
+#endif
/*
* Returns the directory the file specified in the bootfile env variable is
@@ -120,6 +122,7 @@ static int get_bootfile_path(const char *file_path, char *bootfile_path,
static int (*do_getfile)(cmd_tbl_t *cmdtp, const char *file_path, char *file_addr);
+#ifdef CONFIG_CMD_NET
static int do_get_tftp(cmd_tbl_t *cmdtp, const char *file_path, char *file_addr)
{
char *tftp_argv[] = {"tftp", NULL, NULL, NULL};
@@ -132,6 +135,7 @@ static int do_get_tftp(cmd_tbl_t *cmdtp, const char *file_path, char *file_addr)
return 1;
}
+#endif
static char *fs_argv[5];
@@ -249,6 +253,8 @@ static int get_pxe_file(cmd_tbl_t *cmdtp, const char *file_path, void *file_addr
return 1;
}
+#ifdef CONFIG_CMD_NET
+
#define PXELINUX_DIR "pxelinux.cfg/"
/*
@@ -397,6 +403,7 @@ do_pxe_get(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 1;
}
+#endif
/*
* Wrapper to make it easier to store the file at file_path in the location
@@ -647,6 +654,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
len += strlen(ip_str);
}
+#ifdef CONFIG_CMD_NET
if (label->ipappend & 0x2) {
int err;
strcpy(mac_str, " BOOTIF=");
@@ -655,6 +663,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
mac_str[0] = '\0';
len += strlen(mac_str);
}
+#endif
if (label->append)
len += strlen(label->append);
@@ -1500,6 +1509,7 @@ static void handle_pxe_menu(cmd_tbl_t *cmdtp, struct pxe_menu *cfg)
boot_unattempted_labels(cmdtp, cfg);
}
+#ifdef CONFIG_CMD_NET
/*
* Boots a system using a pxe file
*
@@ -1576,6 +1586,7 @@ U_BOOT_CMD(
"get - try to retrieve a pxe file using tftp\npxe "
"boot [pxefile_addr_r] - boot from the pxe file at pxefile_addr_r\n"
);
+#endif
/*
* Boots a system using a local disk syslinux/extlinux file
--
cgit
From 9c89614d3f1ea510d7fcb4a2b438fb3e0d58392c Mon Sep 17 00:00:00 2001
From: Christian Eggers
Date: Sat, 8 Feb 2014 19:27:45 +0100
Subject: common: Remove invalid endianess conversion
do_bootm_standanlone() calls ntohl(images->ep) which is wrong because
endianess conversion has already been done:
do_bootm()
\-do_bootm_states()
+-bootm_find_os()
| \-images.ep = image_get_ep();
| \-uimage_to_cpu(hdr->ih_ep);
\-boot_selected_os()
\-do_bootm_standanlone()
Without this conversion the code works correctly at least on AT91SAM9G45.
On big endian systems there should be no difference after applying this
patch because uimage_to_cpu(x) and ntohl(x) both expand to 'x'.
Signed-off-by: Christian Eggers
---
common/cmd_bootm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'common')
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index a59ee95a69..9751edc907 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -514,8 +514,8 @@ static int do_bootm_standalone(int flag, int argc, char * const argv[],
setenv_hex("filesize", images->os.image_len);
return 0;
}
- appl = (int (*)(int, char * const []))(ulong)ntohl(images->ep);
- (*appl)(argc, argv);
+ appl = (int (*)(int, char * const []))images->ep;
+ appl(argc, argv);
return 0;
}
--
cgit
From e38661634b3d60af80d85ce9eb570a45db4729ca Mon Sep 17 00:00:00 2001
From: York Sun
Date: Tue, 11 Feb 2014 11:57:26 -0800
Subject: common: Add get_effective_memsize() to memsize.c
This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.
Signed-off-by: York Sun
Acked-by: Albert ARIBAUD
---
common/board_f.c | 11 -----------
common/cmd_log.c | 2 +-
common/memsize.c | 16 +++++++++++++++-
3 files changed, 16 insertions(+), 13 deletions(-)
(limited to 'common')
diff --git a/common/board_f.c b/common/board_f.c
index 02965b0df7..a973b95334 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -223,17 +223,6 @@ static int show_dram_config(void)
return 0;
}
-ulong get_effective_memsize(void)
-{
-#ifndef CONFIG_VERY_BIG_RAM
- return gd->ram_size;
-#else
- /* limit stack to what we can reasonable map */
- return ((gd->ram_size > CONFIG_MAX_MEM_MAPPED) ?
- CONFIG_MAX_MEM_MAPPED : gd->ram_size);
-#endif
-}
-
void __dram_init_banksize(void)
{
#if defined(CONFIG_NR_DRAM_BANKS) && defined(CONFIG_SYS_SDRAM_BASE)
diff --git a/common/cmd_log.c b/common/cmd_log.c
index 8164bdf488..38d0f5edfd 100644
--- a/common/cmd_log.c
+++ b/common/cmd_log.c
@@ -52,7 +52,7 @@ static char *lbuf;
unsigned long __logbuffer_base(void)
{
- return CONFIG_SYS_SDRAM_BASE + gd->ram_size - LOGBUFF_LEN;
+ return CONFIG_SYS_SDRAM_BASE + get_effective_memsize() - LOGBUFF_LEN;
}
unsigned long logbuffer_base(void)
__attribute__((weak, alias("__logbuffer_base")));
diff --git a/common/memsize.c b/common/memsize.c
index 73b92c8a00..589400d3b1 100644
--- a/common/memsize.c
+++ b/common/memsize.c
@@ -5,7 +5,10 @@
* SPDX-License-Identifier: GPL-2.0+
*/
-#include
+#include
+
+DECLARE_GLOBAL_DATA_PTR;
+
#ifdef __PPC__
/*
* At least on G2 PowerPC cores, sequential accesses to non-existent
@@ -76,3 +79,14 @@ long get_ram_size(long *base, long maxsize)
return (maxsize);
}
+
+phys_size_t __weak get_effective_memsize(void)
+{
+#ifndef CONFIG_VERY_BIG_RAM
+ return gd->ram_size;
+#else
+ /* limit stack to what we can reasonable map */
+ return ((gd->ram_size > CONFIG_MAX_MEM_MAPPED) ?
+ CONFIG_MAX_MEM_MAPPED : gd->ram_size);
+#endif
+}
--
cgit
From 102c051fccaf43bca4245d38519c9520ee0b4ff4 Mon Sep 17 00:00:00 2001
From: David Feng
Date: Wed, 12 Feb 2014 16:10:08 +0800
Subject: fix address of error message in mtest command
This patch deal with error message of mtest command.
When test failed, the mtest command will output error information
that include memory address and value. But the address field is
not correct or misleading.
Signed-off-by: David Feng
---
common/cmd_mem.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
(limited to 'common')
diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index c3aab3d4b5..8d2cfc88ce 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -746,7 +746,8 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
if (temp != pattern) {
printf("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
" expected 0x%.8lx, actual 0x%.8lx\n",
- start_addr + offset, pattern, temp);
+ start_addr + offset*sizeof(vu_long),
+ pattern, temp);
errs++;
if (ctrlc())
return -1;
@@ -767,7 +768,8 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
printf("\nFAILURE: Address bit stuck low or"
" shorted @ 0x%.8lx: expected 0x%.8lx,"
" actual 0x%.8lx\n",
- start_addr + offset, pattern, temp);
+ start_addr + offset*sizeof(vu_long),
+ pattern, temp);
errs++;
if (ctrlc())
return -1;
@@ -807,7 +809,8 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
if (temp != pattern) {
printf("\nFAILURE (read/write) @ 0x%.8lx:"
" expected 0x%.8lx, actual 0x%.8lx)\n",
- start_addr + offset, pattern, temp);
+ start_addr + offset*sizeof(vu_long),
+ pattern, temp);
errs++;
if (ctrlc())
return -1;
@@ -827,7 +830,8 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
if (temp != anti_pattern) {
printf("\nFAILURE (read/write): @ 0x%.8lx:"
" expected 0x%.8lx, actual 0x%.8lx)\n",
- start_addr + offset, anti_pattern, temp);
+ start_addr + offset*sizeof(vu_long),
+ anti_pattern, temp);
errs++;
if (ctrlc())
return -1;
@@ -885,7 +889,7 @@ static ulong mem_test_quick(vu_long *buf, ulong start_addr, ulong end_addr,
printf("\nMem error @ 0x%08X: "
"found %08lX, expected %08lX\n",
- (uint)(uintptr_t)(start_addr + offset),
+ (uint)(uintptr_t)(start_addr + offset*sizeof(vu_long)),
readback, val);
errs++;
if (ctrlc())
--
cgit
From e22361af0758c7ebbff6fe375f805bc3697ce30f Mon Sep 17 00:00:00 2001
From: Stephen Warren
Date: Wed, 12 Feb 2014 14:30:04 -0700
Subject: pxe: prepend fdtdir to DTB name irrespective of source
The directory name from an fdtdir directive in a PXE config file should
always be pre-pended to the DTB filename; it shouldn't matter whether
the DTB filename came from the $fdtfile environment variable, or whether
it was constructed dynamically from ${soc}-${board}.dtb. Fix the code to
always prepend the directory name.
Reported-by: Dennis Gilmore
Fixes: c61d94d86035 ("pxe: implement fdtdir extlinux.conf tag")
Signed-off-by: Stephen Warren
Reviewed-by: Dennis Gilmore
Tested-by: Dennis Gilmore
---
common/cmd_pxe.c | 77 +++++++++++++++++++++++++++++---------------------------
1 file changed, 40 insertions(+), 37 deletions(-)
(limited to 'common')
diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index 29e48db204..6aabd1357c 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -700,44 +700,47 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
if (label->fdt) {
fdtfile = label->fdt;
} else if (label->fdtdir) {
- fdtfile = getenv("fdtfile");
- /*
- * For complex cases, it might be worth calling a
- * board- or SoC-provided function here to provide a
- * better default:
- *
- * if (!fdtfile)
- * fdtfile = gen_fdtfile();
- *
- * If this is added, be sure to keep the default below,
- * or move it to the default weak implementation of
- * gen_fdtfile().
- */
- if (!fdtfile) {
- char *soc = getenv("soc");
- char *board = getenv("board");
- char *slash;
-
- len = strlen(label->fdtdir);
- if (!len)
- slash = "./";
- else if (label->fdtdir[len - 1] != '/')
- slash = "/";
- else
- slash = "";
-
- len = strlen(label->fdtdir) + strlen(slash) +
- strlen(soc) + 1 + strlen(board) + 5;
- fdtfilefree = malloc(len);
- if (!fdtfilefree) {
- printf("malloc fail (FDT filename)\n");
- return 1;
- }
-
- snprintf(fdtfilefree, len, "%s%s%s-%s.dtb",
- label->fdtdir, slash, soc, board);
- fdtfile = fdtfilefree;
+ char *f1, *f2, *f3, *f4, *slash;
+
+ f1 = getenv("fdtfile");
+ if (f1) {
+ f2 = "";
+ f3 = "";
+ f4 = "";
+ } else {
+ /*
+ * For complex cases where this code doesn't
+ * generate the correct filename, the board
+ * code should set $fdtfile during early boot,
+ * or the boot scripts should set $fdtfile
+ * before invoking "pxe" or "sysboot".
+ */
+ f1 = getenv("soc");
+ f2 = "-";
+ f3 = getenv("board");
+ f4 = ".dtb";
+ }
+
+ len = strlen(label->fdtdir);
+ if (!len)
+ slash = "./";
+ else if (label->fdtdir[len - 1] != '/')
+ slash = "/";
+ else
+ slash = "";
+
+ len = strlen(label->fdtdir) + strlen(slash) +
+ strlen(f1) + strlen(f2) + strlen(f3) +
+ strlen(f4) + 1;
+ fdtfilefree = malloc(len);
+ if (!fdtfilefree) {
+ printf("malloc fail (FDT filename)\n");
+ return 1;
}
+
+ snprintf(fdtfilefree, len, "%s%s%s%s%s%s",
+ label->fdtdir, slash, f1, f2, f3, f4);
+ fdtfile = fdtfilefree;
}
if (fdtfile) {
--
cgit
From 76698b4e6c598f5e90e3c1383eec72382aee95a2 Mon Sep 17 00:00:00 2001
From: York Sun
Date: Wed, 12 Feb 2014 15:55:35 -0800
Subject: Fix memory commands for 64-bit platforms
For aarch64, unsigned long is 64-bit data. Memory commands should be fixed
with u32 for 32-bit address access. To be clear, ushort is replace with
u16, u_char is replaced with u8.
Signed-off-by: York Sun
Acked-by: Wolfgang Denk
---
common/cmd_mem.c | 72 ++++++++++++++++++++++++++++----------------------------
1 file changed, 36 insertions(+), 36 deletions(-)
(limited to 'common')
diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index 8d2cfc88ce..6d75d025bd 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -188,11 +188,11 @@ static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
buf = map_sysmem(addr, bytes);
while (count-- > 0) {
if (size == 4)
- *((ulong *)buf) = (ulong)writeval;
+ *((u32 *)buf) = (u32)writeval;
else if (size == 2)
- *((ushort *)buf) = (ushort)writeval;
+ *((u16 *)buf) = (u16)writeval;
else
- *((u_char *)buf) = (u_char)writeval;
+ *((u8 *)buf) = (u8)writeval;
buf += size;
}
unmap_sysmem(buf);
@@ -300,14 +300,14 @@ static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
for (ngood = 0; ngood < count; ++ngood) {
ulong word1, word2;
if (size == 4) {
- word1 = *(ulong *)buf1;
- word2 = *(ulong *)buf2;
+ word1 = *(u32 *)buf1;
+ word2 = *(u32 *)buf2;
} else if (size == 2) {
- word1 = *(ushort *)buf1;
- word2 = *(ushort *)buf2;
+ word1 = *(u16 *)buf1;
+ word2 = *(u16 *)buf2;
} else {
- word1 = *(u_char *)buf1;
- word2 = *(u_char *)buf2;
+ word1 = *(u8 *)buf1;
+ word2 = *(u8 *)buf2;
}
if (word1 != word2) {
ulong offset = buf1 - base;
@@ -433,11 +433,11 @@ static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
src = map_sysmem(addr, bytes);
while (count-- > 0) {
if (size == 4)
- *((ulong *)buf) = *((ulong *)src);
+ *((u32 *)buf) = *((u32 *)src);
else if (size == 2)
- *((ushort *)buf) = *((ushort *)src);
+ *((u16 *)buf) = *((u16 *)src);
else
- *((u_char *)buf) = *((u_char *)src);
+ *((u8 *)buf) = *((u8 *)src);
src += size;
buf += size;
@@ -467,9 +467,9 @@ static int do_mem_loop(cmd_tbl_t *cmdtp, int flag, int argc,
{
ulong addr, length, i, bytes;
int size;
- volatile uint *longp;
- volatile ushort *shortp;
- volatile u_char *cp;
+ volatile u32 *longp;
+ volatile u16 *shortp;
+ volatile u8 *cp;
const void *buf;
if (argc < 3)
@@ -498,23 +498,23 @@ static int do_mem_loop(cmd_tbl_t *cmdtp, int flag, int argc,
*/
if (length == 1) {
if (size == 4) {
- longp = (uint *)buf;
+ longp = (u32 *)buf;
for (;;)
i = *longp;
}
if (size == 2) {
- shortp = (ushort *)buf;
+ shortp = (u16 *)buf;
for (;;)
i = *shortp;
}
- cp = (u_char *)buf;
+ cp = (u8 *)buf;
for (;;)
i = *cp;
}
if (size == 4) {
for (;;) {
- longp = (uint *)buf;
+ longp = (u32 *)buf;
i = length;
while (i-- > 0)
*longp++;
@@ -522,14 +522,14 @@ static int do_mem_loop(cmd_tbl_t *cmdtp, int flag, int argc,
}
if (size == 2) {
for (;;) {
- shortp = (ushort *)buf;
+ shortp = (u16 *)buf;
i = length;
while (i-- > 0)
*shortp++;
}
}
for (;;) {
- cp = (u_char *)buf;
+ cp = (u8 *)buf;
i = length;
while (i-- > 0)
*cp++;
@@ -544,9 +544,9 @@ int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
ulong addr, length, i, data, bytes;
int size;
- volatile uint *longp;
- volatile ushort *shortp;
- volatile u_char *cp;
+ volatile u32 *longp;
+ volatile u16 *shortp;
+ volatile u8 *cp;
void *buf;
if (argc < 4)
@@ -578,23 +578,23 @@ int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
*/
if (length == 1) {
if (size == 4) {
- longp = (uint *)buf;
+ longp = (u32 *)buf;
for (;;)
*longp = data;
}
if (size == 2) {
- shortp = (ushort *)buf;
+ shortp = (u16 *)buf;
for (;;)
*shortp = data;
}
- cp = (u_char *)buf;
+ cp = (u8 *)buf;
for (;;)
*cp = data;
}
if (size == 4) {
for (;;) {
- longp = (uint *)buf;
+ longp = (u32 *)buf;
i = length;
while (i-- > 0)
*longp++ = data;
@@ -602,14 +602,14 @@ int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
if (size == 2) {
for (;;) {
- shortp = (ushort *)buf;
+ shortp = (u16 *)buf;
i = length;
while (i-- > 0)
*shortp++ = data;
}
}
for (;;) {
- cp = (u_char *)buf;
+ cp = (u8 *)buf;
i = length;
while (i-- > 0)
*cp++ = data;
@@ -1054,11 +1054,11 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
ptr = map_sysmem(addr, size);
printf("%08lx:", addr);
if (size == 4)
- printf(" %08x", *((uint *)ptr));
+ printf(" %08x", *((u32 *)ptr));
else if (size == 2)
- printf(" %04x", *((ushort *)ptr));
+ printf(" %04x", *((u16 *)ptr));
else
- printf(" %02x", *((u_char *)ptr));
+ printf(" %02x", *((u8 *)ptr));
nbytes = readline (" ? ");
if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
@@ -1088,11 +1088,11 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
reset_cmd_timeout();
#endif
if (size == 4)
- *((uint *)ptr) = i;
+ *((u32 *)ptr) = i;
else if (size == 2)
- *((ushort *)ptr) = i;
+ *((u16 *)ptr) = i;
else
- *((u_char *)ptr) = i;
+ *((u8 *)ptr) = i;
if (incrflag)
addr += size;
}
--
cgit
From f9f4d809a0897317a0235661e934b69040e93e14 Mon Sep 17 00:00:00 2001
From: Heiko Schocher
Date: Sat, 25 Jan 2014 07:27:11 +0100
Subject: common, ubi: add ubi check volumename command
check with this ubi command, if a UBI volume with "volumename"
exists in current ubi device.
Signed-off-by: Heiko Schocher
---
common/cmd_ubi.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
(limited to 'common')
diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c
index 122ba7e171..7c4d950e96 100644
--- a/common/cmd_ubi.c
+++ b/common/cmd_ubi.c
@@ -123,6 +123,27 @@ static int ubi_info(int layout)
return 0;
}
+static int ubi_check_volumename(const struct ubi_volume *vol, char *name)
+{
+ return strcmp(vol->name, name);
+}
+
+static int ubi_check(char *name)
+{
+ int i;
+
+ for (i = 0; i < (ubi->vtbl_slots + 1); i++) {
+ if (!ubi->volumes[i])
+ continue; /* Empty record */
+
+ if (!ubi_check_volumename(ubi->volumes[i], name))
+ return 0;
+ }
+
+ return -EEXIST;
+}
+
+
static int verify_mkvol_req(const struct ubi_device *ubi,
const struct ubi_mkvol_req *req)
{
@@ -558,6 +579,14 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return ubi_info(layout);
}
+ if (strcmp(argv[1], "check") == 0) {
+ if (argc > 2)
+ return ubi_check(argv[2]);
+
+ printf("Error, no volume name passed\n");
+ return 1;
+ }
+
if (strncmp(argv[1], "create", 6) == 0) {
int dynamic = 1; /* default: dynamic volume */
@@ -663,6 +692,8 @@ U_BOOT_CMD(
" header offset)\n"
"ubi info [l[ayout]]"
" - Display volume and ubi layout information\n"
+ "ubi check volumename"
+ " - check if volumename exists\n"
"ubi create[vol] volume [size] [type]"
" - create volume name with size\n"
"ubi write[vol] address volume size"
--
cgit
From 06109f498faeae023f30254ed145030458ef1c41 Mon Sep 17 00:00:00 2001
From: Heiko Schocher
Date: Sat, 25 Jan 2014 07:27:12 +0100
Subject: common, itest: pass u-boot env variables to itest.s
compare two U-Boot Environment variables with itest.s, example:
=> print tmp ver
tmp=U-Boot 2013.10-g75e
ver=U-Boot 2013.10-g75eb4bc (Jan 21 2014 - 10:35:39)MPC83XX
=> print check_ub_ver
check_ub_ver=if itest.s \${tmp} == \${ver}; then echo equal; else echo diff ;fi
=> run check_ub_ver
diff
=> setenv tmp U-Boot 2013.10-g75eb4bc (Jan 21 2014 - 10:35:39)MPC83XX
=> print tmp ver
tmp=U-Boot 2013.10-g75eb4bc (Jan 21 2014 - 10:35:39)MPC83XX
ver=U-Boot 2013.10-g75eb4bc (Jan 21 2014 - 10:35:39)MPC83XX
=> run check_ub_ver
equal
Signed-off-by: Heiko Schocher
---
common/cmd_itest.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
(limited to 'common')
diff --git a/common/cmd_itest.c b/common/cmd_itest.c
index 29f8076f82..ae2527bfec 100644
--- a/common/cmd_itest.c
+++ b/common/cmd_itest.c
@@ -71,6 +71,19 @@ static char * evalstr(char *s)
/* if the parameter starts with a * then assume a string pointer else its a literal */
if (s[0] == '*') {
return (char *)simple_strtoul(&s[1], NULL, 16);
+ } else if (s[0] == '$') {
+ int i = 2;
+
+ if (s[1] != '{')
+ return NULL;
+
+ while (s[i] != '}') {
+ if (s[i] == 0)
+ return NULL;
+ i++;
+ }
+ s[i] = 0;
+ return getenv((const char *)&s[2]);
} else {
return s;
}
--
cgit
From 1674df60d17e0e72396c961d5390bb62b184ad95 Mon Sep 17 00:00:00 2001
From: "Karicheri, Muralidharan"
Date: Mon, 20 Jan 2014 17:10:07 -0500
Subject: ubifs: fix checkpatch warning
Fix the following checkpatch warning:-
WARNING: externs should be avoided in .c files
Signed-off-by: Murali Karicheri
---
common/cmd_ubifs.c | 9 ---------
1 file changed, 9 deletions(-)
(limited to 'common')
diff --git a/common/cmd_ubifs.c b/common/cmd_ubifs.c
index d9af023d70..fdc8bfe46a 100644
--- a/common/cmd_ubifs.c
+++ b/common/cmd_ubifs.c
@@ -21,15 +21,6 @@
static int ubifs_initialized;
static int ubifs_mounted;
-extern struct super_block *ubifs_sb;
-
-/* Prototypes */
-int ubifs_init(void);
-int ubifs_mount(char *vol_name);
-void ubifs_umount(struct ubifs_info *c);
-int ubifs_ls(char *dir_name);
-int ubifs_load(char *filename, u32 addr, u32 size);
-
int do_ubifs_mount(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
char *vol_name;
--
cgit
From 5a89fa927cf6c54efe36918a4894ce31274d9ef1 Mon Sep 17 00:00:00 2001
From: Ying Zhang
Date: Fri, 24 Jan 2014 15:50:07 +0800
Subject: SPL: P2020RDB: fix the problem booting from spi flash
There was no enough stack in SPL, so the buffer needed in SPL is to malloc
from memory pool and to repalce the temporary variable.
Signed-off-by: Ying Zhang
Reviewed-by: York Sun
---
common/env_sf.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
(limited to 'common')
diff --git a/common/env_sf.c b/common/env_sf.c
index 9f806fb090..be270f21bc 100644
--- a/common/env_sf.c
+++ b/common/env_sf.c
@@ -299,13 +299,16 @@ int saveenv(void)
void env_relocate_spec(void)
{
- char buf[CONFIG_ENV_SIZE];
int ret;
+ char *buf = NULL;
+ buf = (char *)malloc(CONFIG_ENV_SIZE);
env_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS,
CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
if (!env_flash) {
set_default_env("!spi_flash_probe() failed");
+ if (buf)
+ free(buf);
return;
}
@@ -321,6 +324,8 @@ void env_relocate_spec(void)
gd->env_valid = 1;
out:
spi_flash_free(env_flash);
+ if (buf)
+ free(buf);
env_flash = NULL;
}
#endif
--
cgit
From b60eff31f3bd71a6f14b6c6efc8ad5fb3705de6d Mon Sep 17 00:00:00 2001
From: Albert ARIBAUD
Date: Sat, 22 Feb 2014 17:53:43 +0100
Subject: arm: remove unneeded symbol offsets and _TEXT_BASE
Remove the last uses of symbol offsets in ARM U-Boot.
Remove some needless uses of _TEXT_BASE.
Remove all _TEXT_BASE definitions.
Signed-off-by: Albert ARIBAUD
---
common/board_f.c | 14 +++-----------
common/board_r.c | 4 ++--
2 files changed, 5 insertions(+), 13 deletions(-)
(limited to 'common')
diff --git a/common/board_f.c b/common/board_f.c
index 02965b0df7..5b9ba07d63 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -149,13 +149,9 @@ static int display_text_info(void)
#ifndef CONFIG_SANDBOX
ulong bss_start, bss_end;
-#ifdef CONFIG_SYS_SYM_OFFSETS
- bss_start = _bss_start_ofs + _TEXT_BASE;
- bss_end = _bss_end_ofs + _TEXT_BASE;
-#else
bss_start = (ulong)&__bss_start;
bss_end = (ulong)&__bss_end;
-#endif
+
debug("U-Boot code: %08X -> %08lX BSS: -> %08lX\n",
CONFIG_SYS_TEXT_BASE, bss_start, bss_end);
#endif
@@ -279,8 +275,8 @@ static int zero_global_data(void)
static int setup_mon_len(void)
{
-#ifdef CONFIG_SYS_SYM_OFFSETS
- gd->mon_len = _bss_end_ofs;
+#ifdef __ARM__
+ gd->mon_len = (ulong)&__bss_end - (ulong)_start;
#elif defined(CONFIG_SANDBOX)
gd->mon_len = (ulong)&_end - (ulong)_init;
#else
@@ -363,11 +359,7 @@ static int setup_fdt(void)
gd->fdt_blob = __dtb_dt_begin;
#elif defined CONFIG_OF_SEPARATE
/* FDT is at end of image */
-# ifdef CONFIG_SYS_SYM_OFFSETS
- gd->fdt_blob = (void *)(_end_ofs + CONFIG_SYS_TEXT_BASE);
-# else
gd->fdt_blob = (ulong *)&_end;
-# endif
#elif defined(CONFIG_OF_HOSTFILE)
if (read_fdt_from_file()) {
puts("Failed to read control FDT\n");
diff --git a/common/board_r.c b/common/board_r.c
index c2d0763b57..899f377e17 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -128,8 +128,8 @@ __weak int fixup_cpu(void)
static int initr_reloc_global_data(void)
{
-#ifdef CONFIG_SYS_SYM_OFFSETS
- monitor_flash_len = _end_ofs;
+#ifdef __ARM__
+ monitor_flash_len = _end - __image_copy_start;
#elif !defined(CONFIG_SANDBOX)
monitor_flash_len = (ulong)&__init_end - gd->relocaddr;
#endif
--
cgit
From 1551df35f296f0a8df32f4f2054254f46e8be252 Mon Sep 17 00:00:00 2001
From: Tom Rini
Date: Tue, 25 Feb 2014 10:27:01 -0500
Subject: arm: Switch to -mno-unaligned-access when supported by the compiler
When we tell the compiler to optimize for ARMv7 (and ARMv6 for that
matter) it assumes a default of SCTRL.A being cleared and unaligned
accesses being allowed and fast at the hardware level. We set this bit
and must pass along -mno-unaligned-access so that the compiler will
still breakdown accesses and not trigger a data abort.
To better help understand the requirements of the project with respect
to unaligned memory access, the
Documentation/unaligned-memory-access.txt file has been added as
doc/README.unaligned-memory-access.txt and is taken from the v3.14-rc1
tag of the kernel.
Cc: Albert ARIBAUD
Cc: Mans Rullgard
Signed-off-by: Tom Rini
---
common/Makefile | 2 --
1 file changed, 2 deletions(-)
(limited to 'common')
diff --git a/common/Makefile b/common/Makefile
index 3b2ff9bb52..70f813e8b9 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -239,5 +239,3 @@ obj-y += memsize.o
obj-y += stdio.o
CFLAGS_env_embedded.o := -Wa,--no-warn -DENV_CRC=$(shell tools/envcrc 2>/dev/null)
-CFLAGS_hush.o := $(PLATFORM_NO_UNALIGNED)
-CFLAGS_fdt_support.o := $(PLATFORM_NO_UNALIGNED)
--
cgit