public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Andreas Bießmann" <andreas.devel@googlemail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] make hang() a weak function
Date: Tue, 16 Apr 2013 15:32:30 +0200	[thread overview]
Message-ID: <516D52EE.1040402@gmail.com> (raw)
In-Reply-To: <20130416130515.04A83200568@gemini.denx.de>

Dear Wolfgang,

On 04/16/2013 03:05 PM, Wolfgang Denk wrote:
> Dear Andreas,
> 
> In message <516D4B00.9030102@gmail.com> you wrote:
>>
>>> So it is dead code in mainline, and we will not add it.
>>
>> Well, I don't think it is dead code cause the hang() is called in some ways.
>> This patch opens just the possibility to specialize the hang() by for
>> example a specific board. Maybe this could also be used for specific
>> hang() for different arches when we get closer to the common board files.
> 
> I think it is dead code, and not needed nor useful in mainline.  I
> cannot even see how it would be useful for you.  hang() is defined to
> "hang" the CPU, i. e. to make sure the system will remain in the
> current state.  To me this naturally translates into an infinite loop,
> the implementation of which is completely hardware and architecture
> independent.

Yes it is independent (or should at least). But there are still slightly
different versions:

---8<---
arch/blackfin/lib/board.c:void hang(void)
arch/blackfin/lib/board.c-{
arch/blackfin/lib/board.c-#ifdef CONFIG_STATUS_LED
arch/blackfin/lib/board.c-      status_led_set(STATUS_LED_BOOT,
STATUS_LED_OFF);
arch/blackfin/lib/board.c-      status_led_set(STATUS_LED_CRASH,
STATUS_LED_BLINKING);
--->8---

---8<---
arch/arm/lib/board.c:void __hang(void)
arch/arm/lib/board.c-{
arch/arm/lib/board.c-   puts("### ERROR ### Please RESET the board ###\n");
arch/arm/lib/board.c-   for (;;);
arch/arm/lib/board.c-}
--->8---

---8<---
arch/powerpc/lib/board.c:void __hang(void)
arch/powerpc/lib/board.c-{
arch/powerpc/lib/board.c-       puts("### ERROR ### Please RESET the
board ###\n");
arch/powerpc/lib/board.c-       bootstage_error(BOOTSTAGE_ID_NEED_RESET);
arch/powerpc/lib/board.c-       for (;;)
--->8---

> Note that hang() is not supposed to do anything else, it just hangs
> the system.  If you have a debugger attached, you will be able to do a
> simple stack backtrace and see exactly where you are hanging, and why.

Well, for this specific board I plan to panic() on wrong hardware
detection (which will in turn call hang()). My requirements say that I
have to visualize this state then, I thought it would be a good idea to
blink some lights in the endless loop in hang() for this specific board.

> If you think you need to have specialized code, you are doing
> something wrong.

Really? How would you solve this requirement?

Best regards

Andreas Bie?mann

  reply	other threads:[~2013-04-16 13:32 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-16 10:14 [U-Boot] [PATCH] make hang() a weak function Andreas Bießmann
2013-04-16 10:29 ` Stefan Roese
2013-04-16 11:10 ` Graeme Russ
2013-04-16 11:36 ` Albert ARIBAUD
2013-04-16 11:45   ` Andreas Bießmann
2013-04-16 12:22     ` Wolfgang Denk
2013-04-16 12:58       ` Andreas Bießmann
2013-04-16 13:05         ` Wolfgang Denk
2013-04-16 13:32           ` Andreas Bießmann [this message]
2013-04-16 13:35             ` Graeme Russ
2013-04-16 14:15               ` Andreas Bießmann
2013-04-16 14:20                 ` Graeme Russ
2013-04-16 14:23                 ` Wolfgang Denk
2013-04-16 14:40                   ` Andreas Bießmann
2013-04-16 15:14                     ` Wolfgang Denk
2013-04-16 15:34                       ` Andreas Bießmann
2013-04-16 16:00                         ` Wolfgang Denk
2013-04-16 16:14                           ` Andreas Bießmann
2013-04-16 14:17             ` Wolfgang Denk
2013-04-17 11:02 ` [U-Boot] [PATCH v2 0/5] consolidate hang() Andreas Bießmann
2013-04-17 11:02   ` [U-Boot] [PATCH v2 1/5] microblaze: fix style in board.c Andreas Bießmann
2013-04-17 11:44     ` Michal Simek
2013-04-17 11:54       ` Andreas Bießmann
2013-04-17 11:56         ` Michal Simek
2013-04-17 11:02   ` [U-Boot] [PATCH v2 2/5] nios2: " Andreas Bießmann
2013-04-17 11:02   ` [U-Boot] [PATCH v2 3/5] mx31pdk: add CONFIG_SPL_LIBGENERIC_SUPPORT Andreas Bießmann
2013-04-17 11:02   ` [U-Boot] [PATCH v2 4/5] tx25: " Andreas Bießmann
2013-04-17 11:02   ` [U-Boot] [PATCH v2 5/5] lib: consolidate hang() Andreas Bießmann
2013-04-17 12:58     ` Benoît Thébaudeau
2013-04-18 19:40   ` [U-Boot] [PATCH v2 0/5] " Wolfgang Denk
2013-04-19  8:48   ` [U-Boot] [PATCH v3 " Andreas Bießmann
2013-04-19  8:48     ` [U-Boot] [PATCH v3 1/5] microblaze: fix style in board.c Andreas Bießmann
2013-04-19  8:48     ` [U-Boot] [PATCH v3 2/5] nios2: " Andreas Bießmann
2013-04-19  8:48     ` [U-Boot] [PATCH v3 3/5] mx31pdk: add CONFIG_SPL_LIBGENERIC_SUPPORT Andreas Bießmann
2013-04-19  8:48     ` [U-Boot] [PATCH v3 4/5] tx25: " Andreas Bießmann
2013-04-19  9:00       ` Benoît Thébaudeau
2013-04-19  9:43         ` Andreas Bießmann
2013-04-19  8:48     ` [U-Boot] [PATCH v3 5/5] lib: consolidate hang() Andreas Bießmann
2013-04-19  8:57       ` Albert ARIBAUD
2013-05-02 16:05       ` Tom Rini
2013-04-25 21:44     ` [U-Boot] [PATCH v3 0/5] " Simon Glass
2013-05-02 16:06     ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=516D52EE.1040402@gmail.com \
    --to=andreas.devel@googlemail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox