u-boot-brain/board/xes/common/board.c
Wolfgang Denk f0c0b3a9e6 Fix incorrect use of getenv() before relocation
A large number of boards incorrectly used getenv() in their board init
code running before relocation.  In some cases this caused U-Boot to
hang when certain environment variables grew too long.
Fix the code to use getenv_r().

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: The LEOX team <team@leox.org>
Cc: Michael Schwingen <michael@schwingen.org>
Cc: Georg Schardt <schardt@team-ctech.de>
Cc: Werner Pfister <Pfister_Werner@intercontrol.de>
Cc: Dirk Eibach <eibach@gdsys.de>
Cc: Peter De Schrijver <p2@mind.be>
Cc: John Zhan <zhanz@sinovee.com>
Cc: Rishi Bhattacharya <rishi@ti.com>
Cc: Peter Tyser <ptyser@xes-inc.com>
2011-05-12 19:48:42 +02:00

70 lines
1.5 KiB
C

/*
* Copyright 2009 Extreme Engineering Solutions, Inc.
*
* 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.
*/
#include <common.h>
#include "fsl_8xxx_misc.h"
int checkboard(void)
{
char name[] = CONFIG_SYS_BOARD_NAME;
char buf[64];
char *s;
int i;
#ifdef CONFIG_SYS_FORM_CUSTOM
s = "Custom";
#elif CONFIG_SYS_FORM_6U_CPCI
s = "6U CompactPCI";
#elif CONFIG_SYS_FORM_ATCA_PMC
s = "ATCA w/PMC";
#elif CONFIG_SYS_FORM_ATCA_AMC
s = "ATCA w/AMC";
#elif CONFIG_SYS_FORM_VME
s = "VME";
#elif CONFIG_SYS_FORM_6U_VPX
s = "6U VPX";
#elif CONFIG_SYS_FORM_PMC
s = "PMC";
#elif CONFIG_SYS_FORM_PCI
s = "PCI";
#elif CONFIG_SYS_FORM_3U_CPCI
s = "3U CompactPCI";
#elif CONFIG_SYS_FORM_AMC
s = "AdvancedMC";
#elif CONFIG_SYS_FORM_XMC
s = "XMC";
#elif CONFIG_SYS_FORM_PMC_XMC
s = "PMC/XMC";
#elif CONFIG_SYS_FORM_PCI_EXPRESS
s = "PCI Express";
#elif CONFIG_SYS_FORM_3U_VPX
s = "3U VPX";
#else
#error "Form factor not defined"
#endif
name[strlen(name) - 1] += get_board_derivative();
printf("Board: X-ES %s %s SBC\n", name, s);
/* Display board specific information */
puts(" ");
i = getenv_f("board_rev", buf, sizeof(buf));
if (i > 0)
printf("Rev %s, ", buf);
i = getenv_f("serial#", buf, sizeof(buf));
if (i > 0)
printf("Serial# %s, ", buf);
i = getenv_f("board_cfg", buf, sizeof(buf));
if (i > 0)
printf("Cfg %s", buf);
puts("\n");
return 0;
}