* "last user address" is set even if bootp is used without parameters
(and it uses default address).
+======================================================================
+Modifications since 0.8.2:
+======================================================================
+
+* Fix watchdog support when used with IDE / PCMCIA
+
+* Add KGDB support for IBM 4xx (Anne-Sophie Harnois): configure one
+ of the two serial ports for KGDB according to CONFIG_KGDB_SER_INDEX
+ variable defined in "include/config_WALNUT405.h"
+
+* 'bootd' recursion checking was broken (did nothing).
+
+* 'run' recursion checking was broken.
+
+* There were some problems with 'run' caused by run_command() not
+ being reentrant. This is fixed.
+
+* New configuration options are to make autobooting more dependable
+ for production systems. They allow the PPCBoot prompt to time out
+ and retry the autoboot, and can make it harder to accidentally stop
+ the autoboot. The options and the reasons to use them are explained
+ in doc/README.autoboot. (Dave Ellis)
+
======================================================================
Modifications for 0.8.2:
======================================================================
- cpu/mpc8xx Files specific to Motorola MPC8xx CPUs
- cpu/mpc8240 Files specific to Motorola MPC8240 CPU
- cpu/mpc8260 Files specific to Motorola MPC8260 CPU
-- cpu/ppc4xx Files specific to IBM 4xx CPUs
+- cpu/ppc4xx Files specific to IBM 4xx CPUs
- board/adciop Files specific to ADCIOP boards
- board/cogent Files specific to Cogent boards
(need further configuration)
-- board/cpci405 Files specific to CPCI405 boards
+- board/cpci405 Files specific to CPCI405 boards
- board/etx094 Files specific to ETX_094 boards
-- board/fads Files specific to FADS boards
+- board/fads Files specific to FADS boards
- board/sixnet Files specific to SIXNET boards
-- board/genietv Files specific to GENIETV boards
+- board/genietv Files specific to GENIETV boards
- board/hermes Files specific to HERMES boards
-- board/hymod Files specific to HYMOD boards
-- board/ip860 Files specific to IP860 boards
-- board/ivms8 Files specific to IVMS8 boards
-- board/mbx8xx Files specific to MBX boards
+- board/hymod Files specific to HYMOD boards
+- board/ip860 Files specific to IP860 boards
+- board/ivms8 Files specific to IVMS8 boards
+- board/mbx8xx Files specific to MBX boards
- board/spd8xx Files specific to SPD8xxTS boards
- board/sandpoint
Files specific to Sandpoint boards
- CPU Type: Define exactly one of
CONFIG_MPC823, CONFIG_MPC850, CONFIG_MPC855, CONFIG_MPC860
- or CONFIG_MPC8240, CONFIG_MPC8260
+ or CONFIG_MPC8240, CONFIG_MPC8260
or CONFIG_IOP480
or CONFIG_PPC405GP
- Board Type: Define exactly one of
- CONFIG_ADCIOP, CONFIG_COGENT, CONFIG_CPCI405, CONFIG_ETX094,
- CONFIG_FADS, CONFIG_FPS850L, CONFIG_HERMES, CONFIG_IP860,
+ CONFIG_ADCIOP, CONFIG_COGENT, CONFIG_CPCI405, CONFIG_ETX094,
+ CONFIG_FADS, CONFIG_FPS850L, CONFIG_HERMES, CONFIG_IP860,
CONFIG_IVMS8, CONFIG_MBX, CONFIG_SM850, CONFIG_SPD823TS,
- CONFIG_TQM823L, CONFIG_TQM850L, CONFIG_TQM855L, CONFIG_TQM860L,
+ CONFIG_TQM823L, CONFIG_TQM850L, CONFIG_TQM855L, CONFIG_TQM860L,
CONFIG_SXNI855T
--- FIXME --- not tested yet:
CONFIG_TQM860, CONFIG_ADS,
CONFIG_8xx_CONS_SMC1, CONFIG_8xx_CONS_SMC2 or
CONFIG_8xx_CONS_NONE
- Note: if CONFIG_8xx_CONS_NONE is defined, the serial
- port routines must be defined elsewhere
+ Note: if CONFIG_8xx_CONS_NONE is defined, the serial
+ port routines must be defined elsewhere
(i.e. serial_init(), serial_getc(), ...)
- Console Baudrate:
CONFIG_BAUDRATE - in bps
- Select one of the baudrates listed in
+ Select one of the baudrates listed in
CFG_BAUDRATE_TABLE, see below.
- Boot Delay: CONFIG_BOOTDELAY - in seconds
Delay before automatically booting the default image;
set to -1 to disable autoboot.
+ See doc/README.autoboot for these options that
+ work with CONFIG_BOOTDELAY. None are required.
+ CONFIG_BOOT_RETRY_TIME
+ CONFIG_BOOT_RETRY_MIN
+ CONFIG_AUTOBOOT_KEYED
+ CONFIG_AUTOBOOT_PROMPT
+ CONFIG_AUTOBOOT_DELAY_STR
+ CONFIG_AUTOBOOT_STOP_STR
+
- Autoboot Command:
CONFIG_BOOTCOMMAND
Only needed when CONFIG_BOOTDELAY is enabled;
time on others. This setting #define's the initial
value of the "loads_echo" environment variable.
-- Binary File Download (Kermit mode):
- CONFIG_LOADB
- If defined, the "loadb" command will be added which
- allows to download binary files over the serial line
- using Kermit protocol.
-
-- Kgdb Serial Baudrate: (if CFG_CMD_KGDB is defined)
+- Kgdb Serial Baudrate: (if CFG_CMD_KGDB is defined)
CONFIG_KGDB_BAUDRATE
- Select one of the baudrates listed in
+ Select one of the baudrates listed in
CFG_BAUDRATE_TABLE, see below.
- Monitor Functions:
CONFIG_COMMANDS
- Most monitor functions can be selected (or
- de-selected) by adjusting the definition of
- CONFIG_COMMANDS; to select individual functions,
- #define CONFIG_COMMANDS by "OR"ing any of the
- following values:
+ Most monitor functions can be selected (or
+ de-selected) by adjusting the definition of
+ CONFIG_COMMANDS; to select individual functions,
+ #define CONFIG_COMMANDS by "OR"ing any of the
+ following values:
#define enables commands:
-------------------------
- CFG_CMD_BDI bdinfo
- CFG_CMD_LOADS loads
- CFG_CMD_LOADB loadb
- CFG_CMD_IMI iminfo
- CFG_CMD_CACHE icache, dcache
- CFG_CMD_FLASH flinfo, erase, protect
- CFG_CMD_MEMORY md, mm, nm, mw, cp, cmp, crc, base,
- loop, mtest
- CFG_CMD_NET bootp, tftpboot, rarpboot
- CFG_CMD_ENV saveenv
- CFG_CMD_KGDB kgdb
+ CFG_CMD_BDI bdinfo
+ CFG_CMD_LOADS loads
+ CFG_CMD_LOADB loadb
+ CFG_CMD_IMI iminfo
+ CFG_CMD_CACHE icache, dcache
+ CFG_CMD_FLASH flinfo, erase, protect
+ CFG_CMD_MEMORY md, mm, nm, mw, cp, cmp, crc, base,
+ loop, mtest
+ CFG_CMD_NET bootp, tftpboot, rarpboot
+ CFG_CMD_ENV saveenv
+ CFG_CMD_KGDB * kgdb
+ CFG_CMD_PCMCIA * PCMCIA support
+ CFG_CMD_IDE * IDE harddisk support
+ CFG_CMD_PCI * pciinfo
+ CFG_CMD_IRQ * irqinfo
+ CFG_CMD_BOOTD bootd
+ CFG_CMD_CONSOLE coninfo
+ CFG_CMD_EEPROM * EEPROM read/write support
+ CFG_CMD_ASKENV * ask for env variable
+ CFG_CMD_RUN run command in env variable
+ CFG_CMD_ECHO * echo arguments
+ CFG_CMD_I2C * I2C serial bus support
+ CFG_CMD_REGINFO * Register dump
-------------------------
CFG_CMD_ALL all
- CFG_CMD_DFL Default configuration; at the moment
- this is defined as
- (CFG_CMD_ALL & ~(CFG_CMD_KGDB))
- = everything except KGDB
+ CFG_CMD_DFL Default configuration; at the moment
+ this is includes all commands, except
+ the ones marked with "*" in the list
+ above.
If you don't define CONFIG_COMMANDS it defaults to
- CFG_CMD_DFL .
+ CFG_CMD_DFL in include/cmd_confdefs.h. A board can
+ override the default settings in the respective
+ include file.
EXAMPLE: If you want all functions except of network
support you can write:
- #define CONFIG_COMMANDS (CFG_CMD_ALL & ~CFG_CMD_NET)
+ #define CONFIG_COMMANDS (CFG_CMD_ALL & ~CFG_CMD_NET)
- Watchdog:
CONFIG_WATCHDOG
- If this variable is defined, it enables watchdog
- support. There must support in the platform specific
- code for a watchdog. For the 8xx and 8260 CPUs, the
- SIU Watchdog feature is enabled in the SYPCR
- register.
+ If this variable is defined, it enables watchdog
+ support. There must support in the platform specific
+ code for a watchdog. For the 8xx and 8260 CPUs, the
+ SIU Watchdog feature is enabled in the SYPCR
+ register.
Physical start address of Flash memory.
- CFG_MONITOR_BASE:
- Physical start address of boot monitor code (set by
- make config files to be same as the text base address
- (TEXT_BASE) used when linking) - same as
- CFG_FLASH_BASE when booting from flash.
+ Physical start address of boot monitor code (set by
+ make config files to be same as the text base address
+ (TEXT_BASE) used when linking) - same as
+ CFG_FLASH_BASE when booting from flash.
- CFG_MONITOR_LEN:
Size of memory reserved for monitor code
Size of DRAM reserved for malloc() use.
- CFG_BOOTMAPSZ:
- Maximum size of memory mapped by the startup code of
- the Linux kernel; all data that must be processed by
- the Linux kernel (bd_info, boot arguments, eventually
- initrd image) must be put below this limit.
+ Maximum size of memory mapped by the startup code of
+ the Linux kernel; all data that must be processed by
+ the Linux kernel (bd_info, boot arguments, eventually
+ initrd image) must be put below this limit.
- CFG_MAX_FLASH_BANKS:
Max number of Flash memory banks
Define this if the environment is in flash memory.
- a) The environment occupies one whole flash sector, which is
- "embedded" in the text segment with the PPCBoot code. This
- happens usually with "bottom boot sector" or "top boot
- sector" type flash chips, which have several smaller
- sectors at the start or the end. For instance, such a
- layout can have sector sizes of 8, 2x4, 16, Nx32 kB. In
- such a case you would place the environment in one of the
- 4 kB sectors - with PPCBoot code before and after it. With
- "top boot sector" type flash chips, you would put the
- environment in one of the last sectors, leaving a gap
- between PPCBoot and the environment.
+ a) The environment occupies one whole flash sector, which is
+ "embedded" in the text segment with the PPCBoot code. This
+ happens usually with "bottom boot sector" or "top boot
+ sector" type flash chips, which have several smaller
+ sectors at the start or the end. For instance, such a
+ layout can have sector sizes of 8, 2x4, 16, Nx32 kB. In
+ such a case you would place the environment in one of the
+ 4 kB sectors - with PPCBoot code before and after it. With
+ "top boot sector" type flash chips, you would put the
+ environment in one of the last sectors, leaving a gap
+ between PPCBoot and the environment.
- CFG_ENV_OFFSET:
- Offset of environment data (variable area) to the
- beginning of flash memory; for instance, with bottom boot
- type flash chips the second sector can be used: the offset
- for this sector is given here.
+ Offset of environment data (variable area) to the
+ beginning of flash memory; for instance, with bottom boot
+ type flash chips the second sector can be used: the offset
+ for this sector is given here.
CFG_ENV_OFFSET is used relative to CFG_FLASH_BASE.
- CFG_ENV_ADDR:
- This is just another way to specify the start address of
- the flash sector containing the environment (instead of
- CFG_ENV_OFFSET).
+ This is just another way to specify the start address of
+ the flash sector containing the environment (instead of
+ CFG_ENV_OFFSET).
- CFG_ENV_SECT_SIZE:
- CFG_ENV_SIZE:
- If you use this in combination with CFG_ENV_IS_IN_FLASH
- and CFG_ENV_SECT_SIZE, you can specify to use only a part
- of this flash sector for the environment. This saves
- memory for the RAM copy of the environment.
+ If you use this in combination with CFG_ENV_IS_IN_FLASH
+ and CFG_ENV_SECT_SIZE, you can specify to use only a part
+ of this flash sector for the environment. This saves
+ memory for the RAM copy of the environment.
- It may also save flash memory if you decide to use this
- when your environment is "embedded" within PPCBoot code,
- since then the remainder of the flash sector could be used
- for PPCBoot code. It should be pointed out that this is
- STRONGLY DISCOURAGED from a robustness point of view:
- updating the environment in flash makes it always
- necessary to erase the WHOLE sector. If something goes
- wrong before the contents has been restored from a copy in
- RAM, your target system will be dead.
+ It may also save flash memory if you decide to use this
+ when your environment is "embedded" within PPCBoot code,
+ since then the remainder of the flash sector could be used
+ for PPCBoot code. It should be pointed out that this is
+ STRONGLY DISCOURAGED from a robustness point of view:
+ updating the environment in flash makes it always
+ necessary to erase the WHOLE sector. If something goes
+ wrong before the contents has been restored from a copy in
+ RAM, your target system will be dead.
BE CAREFUL! Any changes to the flash layout, and some changes to the
- CFG_ENV_IS_IN_NVRAM:
- Define this if you have some non-volatile memory device
- (NVRAM, battery buffered SRAM) which you want to use for the
- environment.
+ Define this if you have some non-volatile memory device
+ (NVRAM, battery buffered SRAM) which you want to use for the
+ environment.
- CFG_ENV_ADDR:
- CFG_ENV_SIZE:
- These two #defines are used to determin the memory area you
- want to use for environment. It is assumed that this memory
- can just be read and written to, without any special
- provision.
+ These two #defines are used to determin the memory area you
+ want to use for environment. It is assumed that this memory
+ can just be read and written to, without any special
+ provision.
BE CAREFUL! The first access to the environment happens quite early
in PPCboot initalization (when we try to get the setting of for the
- CFG_ENV_IS_IN_EEPROM:
- Use this if you have an EEPROM or similar serial access
- device and a driver for it.
+ Use this if you have an EEPROM or similar serial access
+ device and a driver for it.
- CFG_ENV_OFFSET:
- CFG_ENV_SIZE:
- These two #defines specify the offset and size of the
- environment area within the total memory of your EEPROM.
+ These two #defines specify the offset and size of the
+ environment area within the total memory of your EEPROM.
Please note that the environment is read-only as long as the monitor
============================
go - start application at address 'addr'
+run - run commands in an environment variable
bootm - boot application image from memory
bootp - boot image via network using BootP/TFTP protocol
tftpboot- boot image via network using TFTP protocol
and env variables ipaddr and serverip
rarpboot- boot image via network using RARP/TFTP protocol
+diskboot- boot from IDE devicebootd - boot default, i.e., run 'bootcmd'
loads - load S-Record file over serial line
+loadb - load binary file over serial line (kermit mode)
md - memory display
mm - memory modify (auto-incrementing)
nm - memory modify (constant address)
mw - memory write (fill)
cp - memory copy
+cmp - memory compare
crc32 - checksum calculation
base - print or set address offset
printenv- print environment variables
setenv - set environment variables
saveenv - save environment variables to persistent storage
-bdinfo - print Board Info structure
+protect - enable or disable FLASH write protection
+erase - erase FLASH memory
flinfo - print FLASH memory information
+bdinfo - print Board Info structure
iminfo - print header information for application image
-erase - erase FLASH memory
-protect - enable or disable FLASH write protection
+coninfo - print console devices and informations
+ide - IDE sub-system
loop - infinite loop on address range
mtest - simple RAM test
icache - enable or disable instruction cache
dcache - enable or disable data cache
reset - Perform RESET of the CPU
+echo - echo args to console
version - print monitor version
help - print online help
? - alias for 'help'
bootfile - Name of the image to load with TFTP
autoload - if set to "no" (any string beginning with 'n'),
- "bootp" will just load perform a lookup of the
- configuration from the BOOTP server, but not try to
- load any image using TFTP
+ "bootp" will just load perform a lookup of the
+ configuration from the BOOTP server, but not try to
+ load any image using TFTP
autostart - if set to "yes", an image loaded using the "bootp",
- "rarpboot", "tftpboot" or "diskboot" commands will
- be automatically started (by internally calling
- "bootm")
+ "rarpboot", "tftpboot" or "diskboot" commands will
+ be automatically started (by internally calling
+ "bootm")
initrd_high - restrict positioning of initrd images:
- If this variable is not set, initrd images will be
- copied to the highest possible address in RAM; this
- is usually what you want since it allows for
- maximum initrd size. If for some reason you want to
- make sure that the initrd image is loaded below the
- CFG_BOOTMAPSZ limit, you can set this environment
- variable to a value of "no" or "off" or "0".
- Alternatively, you can set it to a maximum upper
- address to use (PPCBoot will still check that it
- does not overwrite the PCBoot stack and data).
-
- For instance, when you have a system with 16 MB
- RAM, and want to reseve 4 MB from use by Linux,
- you can do this by adding "mem=12M" to the value of
- the "bootargs" variable. However, now you must make
- sure, that the initrd image is placed in the first
- 12 MB as well - this can be done with
+ If this variable is not set, initrd images will be
+ copied to the highest possible address in RAM; this
+ is usually what you want since it allows for
+ maximum initrd size. If for some reason you want to
+ make sure that the initrd image is loaded below the
+ CFG_BOOTMAPSZ limit, you can set this environment
+ variable to a value of "no" or "off" or "0".
+ Alternatively, you can set it to a maximum upper
+ address to use (PPCBoot will still check that it
+ does not overwrite the PCBoot stack and data).
+
+ For instance, when you have a system with 16 MB
+ RAM, and want to reseve 4 MB from use by Linux,
+ you can do this by adding "mem=12M" to the value of
+ the "bootargs" variable. However, now you must make
+ sure, that the initrd image is placed in the first
+ 12 MB as well - this can be done with
setenv initrd_high 00c00000
ipaddr - IP address; needed for tftpboot command
loadaddr - Default load address for commands like "bootp",
- "rarpboot", "tftpboot" or "diskboot"
+ "rarpboot", "tftpboot" or "diskboot"
loads_echo - see CONFIG_LOADS_ECHO
serverip - TFTP server IP address; needed for tftpboot command
+ bootretry - see CONFIG_BOOT_RETRY_TIME
+
+ bootdelaykey - see CONFIG_AUTOBOOT_DELAY_STR
+
+ bootstopkey - see CONFIG_AUTOBOOT_STOP_STR
+
The following environment variables may be used and automatically
updated by the network boot commands ("bootp" and "rarpboot"),
-n ==> set image name to 'name'
-d ==> use image data from 'datafile'
-Right now, all Linux kernels use the same load address (0x00000000),
+Right now, all Linux kernels use the same load address (0x00000000),
but the entry point address depends on the kernel version:
- 2.2.x kernels have the entry point at 0x0000000C,
/* Initialization complete - start the monitor */
- main_loop (bd);
+ /* main_loop() can return to retry autoboot, if so just run it again. */
+ for (;;)
+ main_loop (bd);
- /* NOTREACHED - start_main does not return; just in case: loop here */
- for (;;);
+ /* NOTREACHED - no way out of command loop except booting */
}
void hang(void)
#include <zlib.h>
int gunzip (void *, int, unsigned char *, int *);
-void run_command (const char *cmd, cmd_tbl_t *cmdtp, bd_t *bd, int flag);
static void *zalloc(void *, unsigned, unsigned);
static void zfree(void *, void *, unsigned);
#if (CONFIG_COMMANDS & CFG_CMD_BOOTD)
void do_bootd (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
{
- run_command ("bootcmd", cmdtp, bd, flag);
+ run_command (getenv ("bootcmd"), bd, flag);
}
#endif
#ifdef CONFIG_IDE_PCCARD
extern int pcmcia_on (void);
+# if defined(CONFIG_WATCHDOG)
+ watchdog_reset ();
+# endif /* CONFIG_WATCHDOG */
/* initialize the PCMCIA IDE adapter card */
if (pcmcia_on())
return;
puts (" ");
#endif
+#if defined(CONFIG_WATCHDOG)
+ watchdog_reset ();
+#endif /* CONFIG_WATCHDOG */
+
/* Initialize PIO timing tables */
for (i=0; i <= IDE_MAX_PIO_MODE; ++i) {
pio_config_clk[i].t_setup = PCMCIA_MK_CLKS(pio_config_ns[i].t_setup,
/* Select device
*/
+#if defined(CONFIG_WATCHDOG)
+ watchdog_reset ();
+#endif /* CONFIG_WATCHDOG */
udelay (100000); /* 100 ms */
outb (dev, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(dev));
+#if defined(CONFIG_WATCHDOG)
+ watchdog_reset ();
+#endif /* CONFIG_WATCHDOG */
udelay (100000); /* 100 ms */
i = 0;
do {
+#if defined(CONFIG_WATCHDOG)
+ watchdog_reset ();
+#endif /* CONFIG_WATCHDOG */
udelay (10000); /* 10 ms */
c = inb (dev, ATA_STATUS);
puts ("OK ");
ide_bus_ok[bus] = 1;
}
+#if defined(CONFIG_WATCHDOG)
+ watchdog_reset ();
+#endif /* CONFIG_WATCHDOG */
}
putc ('\n');
curr_device = i;
}
}
+#if defined(CONFIG_WATCHDOG)
+ watchdog_reset ();
+#endif /* CONFIG_WATCHDOG */
}
/* ------------------------------------------------------------------------- */
#error IDE reset pin not configured
#endif /* CFG_PC_IDE_RESET */
+#if defined(CONFIG_WATCHDOG)
+ watchdog_reset ();
+#endif /* CONFIG_WATCHDOG */
+
#ifdef CFG_PB_12V_ENABLE
/* We must wait at least 500 ms for the voltage to stabilize;
*/
for (i=0; i<50; ++i) {
udelay (10000);
}
+#if defined(CONFIG_WATCHDOG)
+ watchdog_reset ();
+#endif /* CONFIG_WATCHDOG */
immr->im_cpm.cp_pbdat |= CFG_PB_12V_ENABLE; /* 12V Enable output ON */
immr->im_cpm.cp_pbpar &= ~(CFG_PB_12V_ENABLE);
immr->im_cpm.cp_pbodr &= ~(CFG_PB_12V_ENABLE);
}
#endif /* CFG_PB_IDE_MOTOR */
+#if defined(CONFIG_WATCHDOG)
+ watchdog_reset ();
+#endif /* CONFIG_WATCHDOG */
+
/* wait 250 ms */
for (i=0; i<25; ++i) {
udelay (10000);
}
+
+#if defined(CONFIG_WATCHDOG)
+ watchdog_reset ();
+#endif /* CONFIG_WATCHDOG */
}
#endif /* CONFIG_IDE_RESET */
}
if ((flag & CMD_FLAG_REPEAT) == 0) {
- /* New command specified. Check for a size spefication.
+ /* New command specified. Check for a size specification.
* Defaults to long if no or incorrect specification.
*/
size = 4;
mod_mem(int incrflag, int flag, int argc, char *argv[])
{
ulong addr, size, i;
- uint nbytes;
+ int nbytes;
extern char console_buffer[];
+#ifdef CONFIG_BOOT_RETRY_TIME
+ reset_cmd_timeout(); /* got a good command to get here */
+#endif
/* We use the last specified parameters, unless new ones are
* entered.
*/
size = mm_last_size;
if ((flag & CMD_FLAG_REPEAT) == 0) {
- /* New command specified. Check for a size spefication.
+ /* New command specified. Check for a size specification.
* Defaults to long if no or incorrect specification.
*/
size = 4;
printf(" %04x", *((ushort *)addr));
else
printf(" %02x", *((u_char *)addr));
- nbytes = readline (" ? ");
- /* If <CR> is pressed as only input, don't modify current
- * location and move to next.
- */
- if (!nbytes) {
+ nbytes = readline (" ? ");
+ if (nbytes == 0) {
+ /* <CR> pressed as only input, don't modify current
+ * location and move to next.
+ */
if (incrflag)
addr += size;
nbytes = 1;
+#ifdef CONFIG_BOOT_RETRY_TIME
+ reset_cmd_timeout(); /* good enough to not time out */
+#endif
+ }
+#ifdef CONFIG_BOOT_RETRY_TIME
+ else if (nbytes == -2) {
+ break; /* timed out, exit the command */
}
+#endif
else {
char *endp;
i = simple_strtoul(console_buffer, &endp, 16);
nbytes = endp - console_buffer;
if (nbytes) {
+#ifdef CONFIG_BOOT_RETRY_TIME
+ /* good enough to not time out
+ */
+ reset_cmd_timeout();
+#endif
if (size == 4)
*((uint *)addr) = i;
else if (size == 2)
* command help (long version)
*/
for (i=1; i<argc; ++i) {
- for (cmdtp=&cmd_tbl[0]; cmdtp->name; cmdtp++) {
- if (strncmp(argv[i], cmdtp->name, cmdtp->lmin) == 0) {
+ if ((cmdtp = find_cmd(argv[i])) != NULL) {
#ifdef CFG_LONGHELP
- /* found - print (long) help info */
- puts (cmdtp->name);
- putc (' ');
- if (cmdtp->help) {
- puts (cmdtp->help);
- } else {
- puts ("- No help available.\n");
- }
- putc ('\n');
+ /* found - print (long) help info */
+ puts (cmdtp->name);
+ putc (' ');
+ if (cmdtp->help) {
+ puts (cmdtp->help);
+ } else {
+ puts ("- No help available.\n");
+ }
+ putc ('\n');
#else /* no long help available */
- if (cmdtp->usage)
- puts (cmdtp->usage);
+ if (cmdtp->usage)
+ puts (cmdtp->usage);
#endif /* CFG_LONGHELP */
- goto done;
- }
}
- printf ("Unknown command '%s' - try 'help'"
- " without arguments for list of all known commands\n\n",
- argv[i]
- );
-done: ;
+ else {
+ printf ("Unknown command '%s' - try 'help'"
+ " without arguments for list of all"
+ " known commands\n\n",
+ argv[i]
+ );
+ }
+ }
+}
+
+/***************************************************************************
+ * find command table entry for a command
+ */
+cmd_tbl_t *find_cmd(const char *cmd)
+{
+ cmd_tbl_t *cmdtp;
+
+ /* Search command table - Use linear search - it's a small table */
+ for (cmdtp = &cmd_tbl[0]; cmdtp->name; cmdtp++) {
+ if (strncmp (cmd, cmdtp->name, cmdtp->lmin) == 0)
+ return cmdtp;
}
+ return NULL; /* not found */
}
cmd_tbl_t cmd_tbl[] = {
#include <ppcboot.h>
#include <command.h>
-
-int readline (const char *const prompt);
-void run_command (const char *cmd, cmd_tbl_t *cmdtp, bd_t *bd, int flag);
+#include <cmd_nvedit.h>
+#include <cmd_bootm.h>
static char * delete_char (char *buffer, char *p, int *colp, int *np, int plen);
static int parse_line (char *, char *[]);
+#if (CONFIG_BOOTDELAY >= 0)
+static int abortboot(int);
+#endif
char console_buffer[CFG_CBSIZE]; /* console I/O buffer */
static char erase_seq[] = "\b \b"; /* erase sequence */
static char tab_seq[] = " "; /* used to expand TABs */
-#if (CONFIG_COMMANDS & CFG_CMD_RUN)
-void do_run (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]);
+#ifdef CONFIG_BOOT_RETRY_TIME
+static uint64_t endtime = 0; /* must be set, default is instant timeout */
+static int retry_time;
#endif
-/****************************************************************************/
+#define endtick(seconds) (get_ticks() + (uint64_t)(seconds) * get_tbclk())
-void main_loop(bd_t *bd)
-{
- cmd_tbl_t *cmdtp;
+#ifndef CONFIG_BOOT_RETRY_MIN
+#define CONFIG_BOOT_RETRY_MIN CONFIG_BOOT_RETRY_TIME
+#endif
+
+
+/***************************************************************************
+ * Watch for 'delay' seconds for autoboot stop or autoboot delay string.
+ * returns: 0 - no key string, allow autoboot
+ * 1 - got key string, abort
+ */
#if (CONFIG_BOOTDELAY >= 0)
- char *s = getenv ("bootdelay");
- int bootdelay = s ? (int)simple_strtoul(s, NULL, 10) : 0;
- int autoboot = 1;
+# if defined(CONFIG_AUTOBOOT_KEYED)
+static __inline__ int abortboot(int bootdelay)
+{
+ int abort = 0;
+ char ch;
+ uint64_t etime = endtick(bootdelay);
+ char* delaykey = getenv ("bootdelaykey");
+ char* delaymatch;
+ char* stopkey = getenv ("bootstopkey");
+ char* stopmatch;
+
+# ifdef CONFIG_AUTOBOOT_PROMPT
+ printf (CONFIG_AUTOBOOT_PROMPT, bootdelay);
+# endif
+
+# ifdef CONFIG_AUTOBOOT_DELAY_STR
+ if (delaykey == NULL)
+ delaykey = CONFIG_AUTOBOOT_DELAY_STR;
+# endif
+# ifdef CONFIG_AUTOBOOT_STOP_STR
+ if (stopkey == NULL)
+ stopkey = CONFIG_AUTOBOOT_STOP_STR;
+# endif
+
+# if DEBUG_BOOTKEYS
+ printf("delay key:<%s>\n",delaykey?delaykey:"NULL");
+ printf("stop key:<%s>\n",stopkey?stopkey:"NULL");
+# endif
+ delaymatch = delaykey;
+ stopmatch = stopkey;
+
+ /* In order to keep up with incoming data, check timeout only
+ * when catch up.
+ */
+ while (!abort && get_ticks() <= etime) {
+ /* abort if matched all of one of the keys */
+ if (delaymatch && !*delaymatch) {
+# if DEBUG_BOOTKEYS
+ printf("got delaykey\n");
+# endif
+ abort = 1;
+ }
+ if (stopmatch && !*stopmatch) {
+# if DEBUG_BOOTKEYS
+ printf("got stopkey\n");
+# endif
+# ifdef CONFIG_BOOT_RETRY_TIME
+ /* don't retry auto boot */
+ retry_time = -1;
+# endif
+ abort = 1;
+ }
+ if (tstc()) {
+ ch = getc(); /* get the incoming char */
+
+ if (stopmatch) {
+ if (*stopmatch != ch)
+ stopmatch = stopkey; /* start over */
+ if (*stopmatch == ch)
+ ++stopmatch; /* matched 1 more */
+ }
- if (getenv ("bootcmd") == NULL) { /* don't try to autoboot */
- bootdelay = 0;
- autoboot = 0;
+ if (delaymatch) {
+ if (*delaymatch != ch)
+ delaymatch = delaykey; /* start over */
+ if (*delaymatch == ch)
+ ++delaymatch; /* matched 1 more */
+ }
+ }
}
+# if DEBUG_BOOTKEYS
+ if (!abort)
+ printf("key timeout\n");
+# endif
-#endif /* CONFIG_BOOTDELAY */
+ return abort;
+}
-#if 0
- printf ("### main_loop entered:\n\n");
-#endif
+# else /* !defined(CONFIG_AUTOBOOT_KEYED) */
- /*
- * Main Loop for Monitor Command Processing
- */
+static __inline__ int abortboot(int bootdelay)
+{
+ int abort = 0;
- for (;;) {
- int flag = 0;
- int len;
+ printf("Hit any key to stop autoboot: %2d ", bootdelay);
-#if (CONFIG_BOOTDELAY >= 0)
+ while (bootdelay > 0) {
+ int i;
- if (autoboot)
- printf ("Hit any key to stop autoboot: %2d ", bootdelay);
+ --bootdelay;
+ /* delay 100 * 10ms */
+ for (i=0; !abort && i<100; ++i) {
+ if (tstc()) { /* we got a key press */
+ abort = 1; /* don't auto boot */
+ bootdelay = 0; /* no more delay */
+ (void) getc(); /* consume input */
+ break;
+ }
+ udelay (10000);
+ }
- while (bootdelay > 0) {
- int i;
+ printf ("\b\b\b%2d ", bootdelay);
+ }
- --bootdelay;
- /* delay 100 * 10ms */
- for (i=0; i<100; ++i) {
- if (tstc()) { /* we got a key press */
- bootdelay = 0; /* no more delays */
- autoboot = 0; /* don't auto boot */
- (void) getc(); /* consume input */
- break;
- }
- udelay (10000);
- }
+ putc ('\n');
- printf ("\b\b\b%2d ", bootdelay);
- }
+ return abort;
+}
+# endif /* CONFIG_AUTOBOOT_KEYED */
+#endif /* CONFIG_BOOTDELAY >= 0 */
- putc ('\n');
+/****************************************************************************/
- if (autoboot) {
- autoboot = 0;
+void main_loop(bd_t *bd)
+{
+ static char lastcommand[CFG_CBSIZE] = { 0, };
+ int len;
+ int rc = 1;
+ int flag;
- run_command ("bootcmd", cmdtp, bd, flag);
+#if (CONFIG_BOOTDELAY >= 0)
+ char *s = getenv ("bootdelay");
+ int bootdelay = s ? (int)simple_strtoul(s, NULL, 10) : 0;
- continue;
- }
- else /* No autoboot: read input */
+#if 0
+ printf ("### main_loop entered:\n\n");
+#endif
+
+# ifdef CONFIG_BOOT_RETRY_TIME
+ s = getenv ("bootretry");
+ if (s != NULL)
+ retry_time = (int)simple_strtoul(s, NULL, 10);
+ else
+ retry_time = CONFIG_BOOT_RETRY_TIME;
+ if (retry_time >= 0 && retry_time < CONFIG_BOOT_RETRY_MIN)
+ retry_time = CONFIG_BOOT_RETRY_MIN;
+# endif /* CONFIG_BOOT_RETRY_TIME */
+
+ s = getenv ("bootcmd");
+ if (bootdelay >= 0 && s && !abortboot (bootdelay))
+ run_command (s, bd, 0);
#endif /* CONFIG_BOOTDELAY */
- if ((len = readline (CFG_PROMPT)) < 0) {
+
+ /*
+ * Main Loop for Monitor Command Processing
+ */
+ for (;;) {
+#ifdef CONFIG_BOOT_RETRY_TIME
+ if (rc >= 0) {
+ /* Saw enough of a valid command to
+ * restart the timeout.
+ */
+ reset_cmd_timeout();
+ }
+#endif
+ len = readline (CFG_PROMPT);
+
+ flag = 0; /* assume no special flags for now */
+ if (len > 0)
+ strcpy (lastcommand, console_buffer);
+ else if (len == 0)
+ flag |= CMD_FLAG_REPEAT;
+#ifdef CONFIG_BOOT_RETRY_TIME
+ else if (len == -2) {
+ /* -2 means timed out, retry autoboot
+ */
+ printf("\nTimed out waiting for command\n");
+ return; /* retry autoboot */
+ }
+#endif
+
+ if (len == -1)
printf ("<INTERRUPT>\n");
- continue;
+ else
+ rc = run_command (lastcommand, bd, 0);
+
+ if (rc <= 0) {
+ /* invalid command or not repeatable, forget it */
+ lastcommand[0] = 0;
}
- run_command (len ? NULL : "", cmdtp, bd, flag);
}
}
+/***************************************************************************
+ * reset command line timeout to retry_time seconds
+ */
+#ifdef CONFIG_BOOT_RETRY_TIME
+void reset_cmd_timeout(void)
+{
+ endtime = endtick(retry_time);
+}
+#endif
+
/****************************************************************************/
/*
* Prompt for input and read a line.
- * Return number of read characters
+ * If CONFIG_BOOT_RETRY_TIME is defined and retry_time >= 0,
+ * time out when time goes past endtime (timebase time in ticks).
+ * Return: number of read characters
+ * -1 if break
+ * -2 if timed out
*/
int readline (const char *const prompt)
{
col = plen;
for (;;) {
+#ifdef CONFIG_BOOT_RETRY_TIME
+ while (!tstc()) { /* while no incoming data */
+ if (retry_time >= 0 && get_ticks() > endtime)
+ return (-2); /* timed out */
+ }
+#endif
c = getc();
/*
return (p - console_buffer);
case 0x03: /* ^C - break */
+ console_buffer[0] = '\0'; /* discard input */
return (-1);
case 0x15: /* ^U - erase line */
#endif
}
-/****************************************************************************/
-
-
-static int process_separators (char *s, int len,
- cmd_tbl_t *cmdtp, bd_t *bd, int flag)
+/****************************************************************************
+ * returns:
+ * 1 - command executed, repeatable
+ * 0 - command executed but not repeatable, interrupted commands are
+ * always considered not repeatable
+ * -1 - not executed (unrecognized, bootd recursion or too many args)
+ * (If cmd is NULL or "" it is considered unrecognized)
+ */
+int run_command (const char *cmd, bd_t *bd, int flag)
{
- extern void do_bootd (cmd_tbl_t *, bd_t *, int, int, char *[]);
-
+ cmd_tbl_t *cmdtp;
char token[CFG_CBSIZE];
char finaltoken[CFG_CBSIZE];
- char *str = s;
+ const char *str = cmd;
char *argv[CFG_MAXARGS + 1]; /* NULL terminated */
int argc;
- int found;
int repeatable = 1;
+#ifdef DEBUG_PARSER
+ printf ("[RUN_COMMAND] cmd=\"%s\"\n", cmd ? cmd : "NULL");
+#endif
+ if (!cmd || !*cmd)
+ return -1; /* empty command, do nothing */
+
+ /* Process separators and check for invalid
+ * repeatable commands
+ */
+
#ifdef DEBUG_PARSER
printf ("[PROCESS_SEPARATORS] %s\n", s);
#endif
- while (*s) {
- char *sep;
+ while (*str) {
+ const char *sep;
char *t;
/*
printf ("token: \"%s\"\n", token);
#endif
- /* Process macros into this token and replace them */
+ /* find macros in this token and replace them */
process_macros (token, finaltoken);
/* Extract arguments */
argc = parse_line (finaltoken, argv);
- /* Search command table - Use linear search - it's a small table */
- found = 0;
- for (cmdtp = &cmd_tbl[0]; (!found) && cmdtp->name; cmdtp++) {
- if (strncmp (argv[0], cmdtp->name, cmdtp->lmin) == 0) {
- /* found - check max args */
- if (argc > cmdtp->maxargs) {
- printf ("Usage:\n%s\n", cmdtp->usage);
- return 0;
- }
+ /* Look up command in command table */
+ if ((cmdtp = find_cmd(argv[0])) == NULL) {
+ printf ("Unknown command '%s' - try 'help'\n", argv[0]);
+ return -1; /* give up after bad command */
+ }
+
+ /* found - check max args */
+ if (argc > cmdtp->maxargs) {
+ printf ("Usage:\n%s\n", cmdtp->usage);
+ return -1;
+ }
#if (CONFIG_COMMANDS & CFG_CMD_BOOTD)
- /* avoid "bootd" recursion */
- if ((len == -1) && (cmdtp->cmd == do_bootd)) {
+ /* avoid "bootd" recursion */
+ if (cmdtp->cmd == do_bootd) {
#ifdef DEBUG_PARSER
- printf ("[%s]\n", finaltoken);
+ printf ("[%s]\n", finaltoken);
#endif
- printf ("'bootd' recursion detected\n");
- return 0;
- }
+ if (flag & CMD_FLAG_BOOTD) {
+ printf ("'bootd' recursion detected\n");
+ return -1;
+ }
+ else
+ flag |= CMD_FLAG_BOOTD;
+ }
#endif /* CFG_CMD_BOOTD */
-#if (CONFIG_COMMANDS & CFG_CMD_RUN)
- /* avoid "run" recursion */
- if ((len == -2) && (cmdtp->cmd == do_run)) {
-#ifdef DEBUG_PARSER
- printf ("[%s]\n", finaltoken);
-#endif
- printf ("'run' recursion detected\n");
- return 0;
- }
-#endif /* CFG_CMD_RUN */
- /* OK - call function */
- (cmdtp->cmd) (cmdtp, bd, flag, argc, argv);
+ /* OK - call function to do the command */
+ (cmdtp->cmd) (cmdtp, bd, flag, argc, argv);
- repeatable &= cmdtp->repeatable;
- found = 1;
- }
- }
- if (!found)
- printf ("Unknown command '%s' - try 'help'\n", argv[0]);
+ repeatable &= cmdtp->repeatable;
/* Did the user stop this? */
if (tstc ())
- return 0;
-
- if (*sep == '\0')
- break;
+ return 0; /* if stopped then not repeatable */
- str = sep + 1;
+ if (*sep != '\0')
+ ++str;
}
return repeatable;
/****************************************************************************/
-/*
- * "cmd" is used to indicate if we are executing normal user input
- * (cmd == NULL), re-executing the last command when the user presses
- * only ENTER (cmd != NULL && strlen(cmd) == 0), or running a command
- * stored in an environment variable ("cmd" contains the name of that
- * variable).
- */
-
-void run_command (const char *cmd,
- cmd_tbl_t *cmdtp, bd_t *bd, int flag)
-{
- static char lastcommand[CFG_CBSIZE] = { 0, };
- static const char *last_cmd;
-
- if (cmd) {
- if (*cmd) { /* got the name of a variable to run */
- char *str = getenv ((char *)cmd);
-
- if (!str)
- return;
-
- strcpy (lastcommand, str);
- last_cmd = cmd;
- } else { /* re-executing previous command */
-
- /* Check if we have a valid command stored */
- if (lastcommand[0] == 0)
- return;
-
- flag |= CMD_FLAG_REPEAT;
- last_cmd = "";
- }
- } else { /* cmd == NULL: process user input */
- strcpy (lastcommand, console_buffer);
- last_cmd = NULL;
- }
-#ifdef DEBUG_PARSER
- printf ("[RUN_COMMAND] last_cmd=\"%s\" -> %s\n",
- last_cmd ? last_cmd : "NULL", lastcommand);
-#endif
- /* Process separators and check for non-valid repeatable commands */
- if (process_separators (lastcommand, strlen(lastcommand),
- cmdtp, bd, flag) == 0) {
- lastcommand[0] = 0;
- last_cmd = "";
- }
-}
-
-/****************************************************************************/
-
#if (CONFIG_COMMANDS & CFG_CMD_RUN)
void do_run (cmd_tbl_t * cmdtp, bd_t * bd, int flag, int argc, char *argv[])
{
}
for (i=1; i<argc; ++i) {
- run_command (argv[i], cmdtp, bd, flag);
+ run_command (getenv (argv[i]), bd, flag);
}
}
#endif
}
#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+/*
+ AS HARNOIS : according to CONFIG_KGDB_SER_INDEX kgdb uses serial port
+ number 0 or number 1
+ - if CONFIG_KGDB_SER_INDEX = 1 => serial port number 0 :
+ configuration has been already done
+ - if CONFIG_KGDB_SER_INDEX = 2 => serial port number 1 :
+ configure port 1 for serial I/O with rate = CONFIG_KGDB_BAUDRATE
+*/
+#if (CONFIG_KGDB_SER_INDEX & 2)
+void
+kgdb_serial_init(void)
+{
+ volatile char val;
+ unsigned short br_reg;
+ ulong cpu_clk;
+
+ cpu_clk = get_gclk_freq ();
+ br_reg = (((((cpu_clk/16)/18) * 10) / CONFIG_KGDB_BAUDRATE) + 5) / 10 ;
+ /*
+ * Init onboard 16550 UART
+ */
+ out8(UART1_BASE + UART_LCR, 0x80); /* set DLAB bit */
+ out8(UART1_BASE + UART_DLL, (br_reg & 0x00ff)); /* set divisor for 9600 baud */
+ out8(UART1_BASE + UART_DLM, ((br_reg & 0xff00) >> 8)); /* set divisor for 9600 baud */
+ out8(UART1_BASE + UART_LCR, 0x03); /* line control 8 bits no parity */
+ out8(UART1_BASE + UART_FCR, 0x00); /* disable FIFO */
+ out8(UART1_BASE + UART_MCR, 0x00); /* no modem control DTR RTS */
+ val = in8(UART1_BASE + UART_LSR); /* clear line status */
+ val = in8(UART1_BASE + UART_RBR); /* read receive buffer */
+ out8(UART1_BASE + UART_SCR, 0x00); /* set scratchpad */
+ out8(UART1_BASE + UART_IER, 0x00); /* set interrupt enable reg */
+}
+
+
+void putDebugChar
+(const char c)
+{
+ if (c == '\n')
+ serial_putc ('\r');
+
+ out8(UART1_BASE + UART_THR, c); /* put character out */
+
+ /* check THRE bit, wait for transfer done */
+ while ((in8(UART1_BASE + UART_LSR) & 0x20) != 0x20)
+ ;
+}
+
+
+void
+putDebugStr (const char *s)
+{
+ while (*s)
+ {
+ serial_putc (*s++);
+ }
+}
+
+
+int
+getDebugChar(void)
+{
+ unsigned char status=0;
+
+ while(1)
+ {
+ status = in8(UART1_BASE + UART_LSR);
+ if ((status&asyncLSRDataReady1)!=0x0)
+ {
+ break;
+ }
+ else if ((status&(asyncLSRFramingError1|asyncLSROverrunError1|
+ asyncLSRParityError1|asyncLSRBreakInterrupt1))!=0)
+ {
+ out8(UART1_BASE + UART_LSR, asyncLSRFramingError1|asyncLSROverrunError1|
+ asyncLSRParityError1|asyncLSRBreakInterrupt1);
+ }
+ }
+ return(0x000000ff&(int)in8(UART1_BASE));
+}
+
+
+void
+kgdb_interruptible(int yes)
+{
+return;
+}
+
+#else
void
kgdb_serial_init(void)
{
return;
}
+#endif
#endif /* CFG_CMD_KGDB */
#endif /* CONFIG_PPC405 */
--- /dev/null
+/*
+ * (C) Copyright 2001
+ * Dave Ellis, SIXNET, dge@sixnetio.com
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+Using autoboot configuration options
+====================================
+
+The basic autoboot configuration options are documented in the main
+PPCBoot README. See it for details. They are:
+
+ bootdelay
+ bootcmd
+ CONFIG_BOOTDELAY
+ CONFIG_BOOTCOMMAND
+
+Some additional options that make autoboot safer in a production
+product are documented here.
+
+Why use them?
+-------------
+
+The basic autoboot feature allows a system to automatically boot to
+the real application (such as Linux) without a user having to enter
+any commands. If any key is pressed before the boot delay time
+expires, PPCBoot stops the autoboot process, gives a PPCBoot prompt
+and waits forever for a command. That's a good thing if you pressed a
+key because you wanted to get the prompt.
+
+It's not so good if the key press was a stray character on the
+console serial port, say because a user who knows nothing about
+PPCBoot pressed a key before the system had time to boot. It's even
+worse on an embedded product that doesn't have a console during
+normal use. The modem plugged into that console port sends a
+character at the wrong time and the system hangs, with no clue as to
+why it isn't working.
+
+You might want the system to autoboot to recover after an external
+configuration program stops autoboot. If the configuration program
+dies or loses its connection (modems can disconnect at the worst
+time) PPCBoot will patiently wait forever for it to finish.
+
+These additional configuration options can help provide a system that
+boots when it should, but still allows access to PPCBoot.
+
+What they do
+------------
+
+ CONFIG_BOOT_RETRY_TIME
+ CONFIG_BOOT_RETRY_MIN
+
+ bootretry environment variable
+
+ These options determine what happens after autoboot is
+ stopped and PPCBoot is waiting for commands.
+
+ CONFIG_BOOT_RETRY_TIME must be defined to enable the boot
+ retry feature. If the environment variable 'bootretry' is
+ found then its value is used, otherwise the retry timeout is
+ CONFIG_BOOT_RETRY_TIME. CONFIG_BOOT_RETRY_MIN is optional and
+ defaults to CONFIG_BOOT_RETRY_TIME. All times are in seconds.
+
+ If the retry timeout is negative, the PPCBoot command prompt
+ never times out. Otherwise it is forced to be at least
+ CONFIG_BOOT_RETRY_MIN seconds. If no valid PPCBoot command is
+ entered before the specified time the boot delay sequence is
+ restarted. Each command that PPCBoot executes restarts the
+ timeout.
+
+ If CONFIG_BOOT_RETRY_TIME < 0 the feature is there, but
+ doesn't do anything unless the environment variable
+ 'bootretry' is >= 0.
+
+ CONFIG_AUTOBOOT_KEYED
+ CONFIG_AUTOBOOT_PROMPT
+ CONFIG_AUTOBOOT_DELAY_STR
+ CONFIG_AUTOBOOT_STOP_STR
+
+ bootdelaykey environment variable
+ bootstopkey environment variable
+
+ These options give more control over stopping autoboot. When
+ they are used a specific character or string is required to
+ stop or delay autoboot.
+
+ Define CONFIG_AUTOBOOT_KEYED (no value required) to enable
+ this group of options. CONFIG_AUTOBOOT_DELAY_STR,
+ CONFIG_AUTOBOOT_STOP_STR or both should be specified (or
+ specified by the corresponding environment variable),
+ otherwise there is no way to stop autoboot.
+
+ CONFIG_AUTOBOOT_PROMPT is displayed before the boot delay
+ selected by CONFIG_BOOTDELAY starts. If it is not defined
+ there is no output indicating that autoboot is in progress.
+ If "%d" is included, it is replaced by the number of seconds
+ remaining before autoboot will start, but it does not count
+ down the seconds. "autoboot in %d seconds\n" is a reasonable
+ prompt.
+
+ If CONFIG_AUTOBOOT_DELAY_STR or bootdelaykey is specified and
+ this string is received from console input before autoboot
+ starts booting, PPCBoot gives a command prompt. The PPCBoot
+ prompt will time out if CONFIG_BOOT_RETRY_TIME is used,
+ otherwise it never times out.
+
+ If CONFIG_AUTOBOOT_STOP_STR or bootstopkey is specified and
+ this string is received from console input before autoboot
+ starts booting, PPCBoot gives a command prompt. The PPCBoot
+ prompt never times out, even if CONFIG_BOOT_RETRY_TIME is
+ used.
+
+ The string recognition is not very sophisticated. If a
+ partial match is detected, the first non-matching character
+ is checked to see if starts a new match. There is no check
+ for a shorter partial match, so it's best if the first
+ character of a key string does not appear in the rest of the
+ string.
+
{ name, lmin, maxargs, rep, cmd, usage }
#endif
-
+/* common/command.c */
+cmd_tbl_t *find_cmd(const char *cmd);
/*
* Monitor Command
* Command Flags:
*/
#define CMD_FLAG_REPEAT 0x0001 /* repeat last command */
+#define CMD_FLAG_BOOTD 0x0002 /* command is from bootd */
/*
* Configurable monitor commands definitions have been moved
/* Atmel 24C64 has 32-byte page write mode using last 5 bits of the address */
#define CFG_EEPROM_PAGE_WRITE_BITS 5
-#if 0
-#define CONFIG_BOOT_RETRY_TIME 120 /* boot if no command in 120 seconds */
+#if 1
+#define CONFIG_BOOT_RETRY_TIME 60 /* boot if no command in 60 seconds */
+#endif
+
+#if 1
+#define CONFIG_AUTOBOOT_KEYED /* use key strings to stop autoboot */
+#define CONFIG_AUTOBOOT_PROMPT "autoboot in %d seconds\n"
+#define CONFIG_AUTOBOOT_DELAY_STR "delayabit"
+#define CONFIG_AUTOBOOT_STOP_STR " " /* easy to stop for now */
#endif
#endif /* __CONFIG_H */
/*
* Function Prototypes
*/
-
-void main_loop (bd_t *);
void hang (void);
void display_options (void);
/* common/main.c */
-int readline (const char *const prompt);
-void command_repeat_off (void);
+void main_loop (bd_t *bd);
+int run_command (const char *cmd, bd_t *bd, int flag);
+int readline (const char *const prompt);
+void reset_cmd_timeout(void);
/* common/board.c */
void board_init_f (ulong);
e += 32;
#endif
- *e = 255; /* End of the list */
+ *e++ = 255; /* End of the list */
return e - start ;
}