
On 03/19/2012 02:27 PM, Simon Glass wrote:
This function is made available to board which want to display a message when a panic() occurs before the console is set up. This would otherwise result in a silent hang or reboot.
Boards should call tegra_pre_console_panic() and pass the UARTs which are available and safe for a message, as well as the selected clock and serial multiplier values. Defaults are available as CONFIG_DEFAULT_NS16550_CLK and CONFIG_DEFAULT_NS16550_MULT.
...
diff --git a/arch/arm/cpu/armv7/tegra2/board.c b/arch/arm/cpu/armv7/tegra2/board.c
...
+void tegra_pre_console_panic(int uart_ids, unsigned clock_freq,
unsigned multiplier, const char *str)
+{
- int baudrate, divisor;
- const u32 *uart_addr;
- /* Enable all permitted UARTs */
- tegra_setup_uarts(uart_ids);
That call honors uart_ids. ...
- /*
* Now send the string out all the selected UARTs. We don't try all
* possible configurations, but this could be added if required.
*/
- baudrate = CONFIG_BAUDRATE;
- divisor = (clock_freq + (baudrate * (multiplier / 2))) /
(multiplier * baudrate);
- for (uart_addr = uart_reg_addr; *uart_addr; uart_addr++) {
Shouldn't this loop also honor uart_ids, and skip sending data to UARTS not in uart_ids? Sure, they aren't set up above, but perhaps they were set up elsewhere in the code and hence are capable of sending out data anyway?
NS16550_t regs = (NS16550_t)*uart_addr;
const char *s;
NS16550_init(regs, divisor);
for (s = str; *s; s++) {
NS16550_putc(regs, *s);
if (*s == '\n')
NS16550_putc(regs, '\r');
}
NS16550_putc(regs, '\n');
NS16550_putc(regs, '\r');
- }
+}