Commit Graph

27 Commits

Author SHA1 Message Date
Mike Frysinger e2fad3fce9 cmd_mmc: use common usage function
Rather than using a custom "Usage:", use the common cmd_usage() function,
and tail into it now that it returns 1 for us.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-09-21 21:37:08 +02:00
Lei Wen 8f3b96427a mmc: print out partition table
Signed-off-by: Lei Wen <leiwen@marvell.com>
2010-09-18 23:47:28 +02:00
Wolfgang Denk 2d941de9d5 Prepare v2010.09-rc1
Coding style cleanup.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-09-10 00:16:19 +02:00
Reinhard Meyer a9804be868 fix cmd_mmc.c, line 136 missing "
Remove warning for missing " at the end of line 136

Signed-off-by: Reinhard Meyer <u-boot@emk-elektronik.de>
2010-08-10 09:43:26 +02:00
Frans Meulenbroeks 388a29d024 various cmd_* files: fixed layout a little bit
Most of the files have U_BOOT_CMD on a separate line,
but a few didn't and had the first line on the same line
as U_BOOT_CMD.

This changes these files by adding a line break and a tab

Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-08-09 01:07:37 +02:00
Frans Meulenbroeks cc9f607beb various cmd_* files: remove the command name from the help message
removed the command name from the help message as it is already printed.
for cmd_mmc also rewrote the message a little bit

Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-08-09 01:06:34 +02:00
Wolfgang Denk 47e26b1bf9 cmd_usage(): simplify return code handling
Lots of code use this construct:

	cmd_usage(cmdtp);
	return 1;

Change cmd_usage() let it return 1 - then we can replace all these
ocurrances by

	return cmd_usage(cmdtp);

This fixes a few places with incorrect return code handling, too.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-07-24 20:43:57 +02:00
Wolfgang Denk 54841ab50c Make sure that argv[] argument pointers are not modified.
The hush shell dynamically allocates (and re-allocates) memory for the
argument strings in the "char *argv[]" argument vector passed to
commands.  Any code that modifies these pointers will cause serious
corruption of the malloc data structures and crash U-Boot, so make
sure the compiler can check that no such modifications are being done
by changing the code into "char * const argv[]".

This modification is the result of debugging a strange crash caused
after adding a new command, which used the following argument
processing code which has been working perfectly fine in all Unix
systems since version 6 - but not so in U-Boot:

int main (int argc, char **argv)
{
	while (--argc > 0 && **++argv == '-') {
/* ====> */	while (*++*argv) {
			switch (**argv) {
			case 'd':
				debug++;
				break;
			...
			default:
				usage ();
			}
		}
	}
	...
}

The line marked "====>" will corrupt the malloc data structures and
usually cause U-Boot to crash when the next command gets executed by
the shell.  With the modification, the compiler will prevent this with
an
	error: increment of read-only location '*argv'

N.B.: The code above can be trivially rewritten like this:

	while (--argc > 0 && **++argv == '-') {
		char *arg = *argv;
		while (*++arg) {
			switch (*arg) {
			...

Signed-off-by: Wolfgang Denk <wd@denx.de>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2010-07-04 23:55:42 +02:00
Frans Meulenbroeks 9d90a93d36 cmd_mmc remove \n
This patch removes the \n after the help message for mmcinfo.
This resulted in an empty line being displayed after the mmcinfo line
when the help command was given.

Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-03-21 16:44:04 +01:00
Mike Frysinger 02e22c2de1 cmd_mmc: make curr_device static
The curr_device variable isn't used outside of cmd_mmc, so mark it static
to avoid conflicts with other pieces of code (like sata which also exports
a curr_device).  Otherwise we end up with stuff like:
common/libcommon.a(cmd_sata.o):(.data.curr_device+0x0):
	multiple definition of `curr_device'
common/libcommon.a(cmd_mmc.o):(.data.curr_device+0x0): first defined here

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-07-17 22:14:41 +02:00
Wolfgang Denk a89c33db96 General help message cleanup
Many of the help messages were not really helpful; for example, many
commands that take no arguments would not print a correct synopsis
line, but "No additional help available." which is not exactly wrong,
but not helpful either.

Commit ``Make "usage" messages more helpful.'' changed this
partially. But it also became clear that lots of "Usage" and "Help"
messages (fields "usage" and "help" in struct cmd_tbl_s respective)
were actually redundant.

This patch cleans this up - for example:

Before:
	=> help dtt
	dtt - Digital Thermometer and Thermostat

	Usage:
	dtt         - Read temperature from digital thermometer and thermostat.

After:
	=> help dtt
	dtt - Read temperature from Digital Thermometer and Thermostat

	Usage:
	dtt

Signed-off-by: Wolfgang Denk <wd@denx.de>
2009-06-12 20:47:16 +02:00
Rabin Vincent e85649c7e6 mmc: check find_mmc_device return value
find_mmc_device returns NULL if an invalid device number is specified.
Check for this to avoid dereferencing NULL pointers.

Signed-off-by: Rabin Vincent <rabin@rab.in>
2009-06-02 17:18:56 -05:00
Rabin Vincent ac0865ff33 mmc: clean up help texts
Remove some repeated words and superfluous newlines in the mmc command
help entries.

Signed-off-by: Rabin Vincent <rabin@rab.in>
2009-06-02 17:18:56 -05:00
Minkyu Kang 869f6bf4de cmd_mmc: add support for device command for selecting mmc device
This patch improves device command for selecting mmc device

Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2009-04-04 23:07:19 +02:00
Mike Frysinger 852dbfdd56 more command usage cleanup
Fix up a few dangling commands like in "Command usage cleanup" commit.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-04-04 22:42:54 +02:00
Dirk Behme 3511b4e208 MMC: Don't use new framework code if not enabled
Don't use code of new MMC framework in cmd_mmc if CONFIG_GENERIC_MMC
isn't enabled.

Signed-off-by: Dirk Behme <dirk.behme@googlemail.com>
2009-02-19 21:12:03 +01:00
Wolfgang Denk 1bba30efe1 Coding style cleanup, update CHANGELOG
Signed-off-by: Wolfgang Denk <wd@denx.de>
2009-02-19 00:41:08 +01:00
Andy Fleming 272cc70b21 Add MMC Framework
Here's a new framework (based roughly off the linux one) for managing
MMC controllers.  It handles all of the standard SD/MMC transactions,
leaving the host drivers to implement only what is necessary to
deal with their specific hardware.

This also hooks the infrastructure into the PowerPC board code
(similar to how the ethernet infrastructure now hooks in)

Some of this code was contributed by Dave Liu <daveliu@freescale.com>

Signed-off-by: Andy Fleming <afleming@freescale.com>
2009-02-16 18:07:41 -06:00
Andy Fleming abb5466ccf Convert mmc_init to mmc_legacy_init
This is to get it out of the way of incoming MMC framework

Signed-off-by: Andy Fleming <afleming@freescale.com>
2009-02-16 18:07:40 -06:00
Peter Tyser 2fb2604d5c Command usage cleanup
Remove command name from all command "usage" fields and update
common/command.c to display "name - usage" instead of
just "usage". Also remove newlines from command usage fields.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2009-01-28 08:49:52 +01:00
Grant Likely 4a43719a77 [BUILD] conditionally compile common/cmd_*.c in common/Makefile
Modify common/Makefile to conditionally compile the cmd_*.c files based
on the board config.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2007-11-20 22:33:54 -07:00
Jon Loeliger 9025317883 common/: Remove lingering references to CFG_CMD_* symbols.
Fixed some broken instances of "#ifdef CMD_CFG_IDE" too.
Those always evaluated TRUE, and thus were always compiled
even when IDE really wasn't defined/wanted.

Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-07-10 11:02:44 -05:00
Jon Loeliger c76fe47425 common/cmd_[i-n]*: Remove obsolete references to CONFIG_COMMANDS.
Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-07-08 18:02:23 -05:00
Jon Loeliger 65c450b47a common/cmd_[i-z]* : Augment CONFIG_COMMANDS tests with defined(CONFIG_CMD_*).
This is a compatibility step that allows both the older form
and the new form to co-exist for a while until the older can
be removed entirely.

All transformations are of the form:
Before:
    #if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT)
After:
    #if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT) || defined(CONFIG_CMD_AUTOSCRIPT)

Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-07-04 00:23:09 +02:00
wdenk 0d4983930a Patch by Kenneth Johansson, 30 Jun 2003:
get rid of MK_CMD_ENTRY macro; update doc/README.command
2003-07-01 21:06:45 +00:00
wdenk b0fce99bfc Fix some missing commands, cleanup header files
(autoscript, bmp, bsp, fat, mmc, nand, portio, ...)
2003-06-29 21:03:46 +00:00
wdenk 71f9511803 * Fix CONFIG_NET_MULTI support in include/net.h
* Patches by Kyle Harris, 13 Mar 2003:
  - Add FAT partition support
  - Add command support for FAT
  - Add command support for MMC
  ----
  - Add Intel PXA support for video
  - Add Intel PXA support for MMC
  ----
  - Enable MMC and FAT for lubbock board
  - Other misc changes for lubbock board
2003-06-15 22:40:42 +00:00