]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
powerpc/boot: Parse chosen/cmdline-timeout parameter
authorSimon Kagstrom <simon.kagstrom@netinsight.net>
Tue, 28 Oct 2014 11:19:00 +0000 (12:19 +0100)
committerMichael Ellerman <mpe@ellerman.id.au>
Sun, 9 Nov 2014 22:59:30 +0000 (09:59 +1100)
On some platforms a 5 second timeout during boot might be quite long, so
make it configurable. Run the loop at least once to let the user stop
the boot by holding a key pressed. If the timeout is set to 0, don't
wait for input, which can be used as a workaround if the boot hangs on
random data coming in on the serial port.

Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
[mpe: Changelog wording & whitespace]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/boot/main.c
arch/powerpc/boot/ops.h
arch/powerpc/boot/serial.c

index d367a0aece2aac8b067a6c7bf51c43ef3d488eda..d80161b633f49fad210909a65791979f7a3298e7 100644 (file)
@@ -144,13 +144,24 @@ static char cmdline[BOOT_COMMAND_LINE_SIZE]
 
 static void prep_cmdline(void *chosen)
 {
+       unsigned int getline_timeout = 5000;
+       int v;
+       int n;
+
+       /* Wait-for-input time */
+       n = getprop(chosen, "linux,cmdline-timeout", &v, sizeof(v));
+       if (n == sizeof(v))
+               getline_timeout = v;
+
        if (cmdline[0] == '\0')
                getprop(chosen, "bootargs", cmdline, BOOT_COMMAND_LINE_SIZE-1);
 
        printf("\n\rLinux/PowerPC load: %s", cmdline);
+
        /* If possible, edit the command line */
-       if (console_ops.edit_cmdline)
-               console_ops.edit_cmdline(cmdline, BOOT_COMMAND_LINE_SIZE);
+       if (console_ops.edit_cmdline && getline_timeout)
+               console_ops.edit_cmdline(cmdline, BOOT_COMMAND_LINE_SIZE, getline_timeout);
+
        printf("\n\r");
 
        /* Put the command line back into the devtree for the kernel */
index 8aad3c55aeda2885e331b8c7ebd52436c219e74b..5e75e1c5518e8a986dd9bce6b43a2b564112e120 100644 (file)
@@ -58,7 +58,7 @@ extern struct dt_ops dt_ops;
 struct console_ops {
        int     (*open)(void);
        void    (*write)(const char *buf, int len);
-       void    (*edit_cmdline)(char *buf, int len);
+       void    (*edit_cmdline)(char *buf, int len, unsigned int getline_timeout);
        void    (*close)(void);
        void    *data;
 };
index f2156f07571f995f3673f67a59d0d20606b27e09..167ee9433de6d3be580ce48b7a31ed27b5bafcd7 100644 (file)
@@ -33,7 +33,7 @@ static void serial_write(const char *buf, int len)
                scdp->putc(*buf++);
 }
 
-static void serial_edit_cmdline(char *buf, int len)
+static void serial_edit_cmdline(char *buf, int len, unsigned int timeout)
 {
        int timer = 0, count;
        char ch, *cp;
@@ -44,7 +44,7 @@ static void serial_edit_cmdline(char *buf, int len)
        cp = &buf[count];
        count++;
 
-       while (timer++ < 5*1000) {
+       do {
                if (scdp->tstc()) {
                        while (((ch = scdp->getc()) != '\n') && (ch != '\r')) {
                                /* Test for backspace/delete */
@@ -70,7 +70,7 @@ static void serial_edit_cmdline(char *buf, int len)
                        break;  /* Exit 'timer' loop */
                }
                udelay(1000);  /* 1 msec */
-       }
+       } while (timer++ < timeout);
        *cp = 0;
 }