All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] cmd: add a panic command
@ 2020-06-29 23:05 Heiko Stuebner
  2020-06-30 15:20 ` Tom Rini
  2020-07-09  0:24 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Heiko Stuebner @ 2020-06-29 23:05 UTC (permalink / raw)
  To: u-boot

From: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>

Even in boot scripts it may be needed to "panic" when all options
are exhausted and the device specification specifies hanging
instead of resetting the board.

So add a new panic command that just wraps around the core panic
call in U-Boot and can take an optional message.

Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
changes in v2:
- add blank line before return (Simon)
- fix U-Boot spelling (Simon)

 cmd/Makefile |  1 +
 cmd/panic.c  | 23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100644 cmd/panic.c

diff --git a/cmd/Makefile b/cmd/Makefile
index ac843b4b16..027fa9083a 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -8,6 +8,7 @@ ifndef CONFIG_SPL_BUILD
 obj-y += boot.o
 obj-$(CONFIG_CMD_BOOTM) += bootm.o
 obj-y += help.o
+obj-y += panic.o
 obj-y += version.o
 
 # command
diff --git a/cmd/panic.c b/cmd/panic.c
new file mode 100644
index 0000000000..329231fb66
--- /dev/null
+++ b/cmd/panic.c
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2020 Theobroma Systems Design und Consulting GmbH
+ */
+
+#include <common.h>
+#include <command.h>
+
+static int do_panic(cmd_tbl_t *cmdtp, int flag, int argc,
+		    char * const argv[])
+{
+	char *text = (argc < 2) ? "" : argv[1];
+
+	panic(text);
+
+	return CMD_RET_SUCCESS;
+}
+
+U_BOOT_CMD(
+	panic,	2,	1,	do_panic,
+	"Panic with optional message",
+	"[message]"
+);
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2] cmd: add a panic command
  2020-06-29 23:05 [PATCH v2] cmd: add a panic command Heiko Stuebner
@ 2020-06-30 15:20 ` Tom Rini
  2020-07-09  0:24 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2020-06-30 15:20 UTC (permalink / raw)
  To: u-boot

On Tue, Jun 30, 2020 at 01:05:45AM +0200, Heiko Stuebner wrote:

> From: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
> 
> Even in boot scripts it may be needed to "panic" when all options
> are exhausted and the device specification specifies hanging
> instead of resetting the board.
> 
> So add a new panic command that just wraps around the core panic
> call in U-Boot and can take an optional message.
> 
> Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200630/cd164aff/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] cmd: add a panic command
  2020-06-29 23:05 [PATCH v2] cmd: add a panic command Heiko Stuebner
  2020-06-30 15:20 ` Tom Rini
@ 2020-07-09  0:24 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2020-07-09  0:24 UTC (permalink / raw)
  To: u-boot

On Tue, Jun 30, 2020 at 01:05:45AM +0200, Heiko Stuebner wrote:

> From: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
> 
> Even in boot scripts it may be needed to "panic" when all options
> are exhausted and the device specification specifies hanging
> instead of resetting the board.
> 
> So add a new panic command that just wraps around the core panic
> call in U-Boot and can take an optional message.
> 
> Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200708/412ad3ce/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-09  0:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-29 23:05 [PATCH v2] cmd: add a panic command Heiko Stuebner
2020-06-30 15:20 ` Tom Rini
2020-07-09  0:24 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.