Rename getenv_r() into getenv_f()
Subsystems (6)
PATCH 1/1 Rename getenv_r() into getenv_f()
While running from flash, i. e. before relocation, we have only a limited C runtime environment without writable data segment. In this phase, some configurations (for example with environment in EEPROM) must not use the normal getenv(), but a special function. This function had been called getenv_r(), with the idea that the "_r" suffix would mean the same as in the _r_eentrant versions of some of the C library functions (for example getdate vs. getdate_r, getgrent vs. getgrent_r, etc.).
Unfortunately this was a misleading name, as in U-Boot the "_r" generally means "running from RAM", i. e. _after_ relocation.
To avoid confusion, rename into getenv_f() [as "running from flash"]
--- README | 2 +- arch/arm/lib/board.c | 2 +- arch/avr32/lib/board.c | 2 +- arch/blackfin/lib/board.c | 2 +- arch/blackfin/lib/post.c | 2 +- arch/i386/lib/board.c | 2 +- arch/m68k/lib/board.c | 6 +++--- arch/mips/cpu/incaip_clock.c | 2 +- arch/mips/lib/board.c | 2 +- arch/powerpc/cpu/mpc8xx/speed.c | 2 +- arch/powerpc/cpu/ppc4xx/4xx_ibm_ddr2_autocalib.c | 2 +- arch/powerpc/lib/board.c | 6 +++--- arch/sparc/lib/board.c | 2 +- board/Marvell/db64360/mv_eth.c | 4 ++-- board/Marvell/db64460/mv_eth.c | 4 ++-- board/avnet/fx12mm/fx12mm.c | 2 +- board/cray/L1/L1.c | 2 +- board/dave/PPChameleonEVB/PPChameleonEVB.c | 2 +- board/esd/adciop/adciop.c | 2 +- board/esd/apc405/apc405.c | 2 +- board/esd/ar405/ar405.c | 2 +- board/esd/ash405/ash405.c | 2 +- board/esd/canbt/canbt.c | 2 +- board/esd/cms700/cms700.c | 2 +- board/esd/cpci2dp/cpci2dp.c | 2 +- board/esd/cpci405/cpci405.c | 2 +- board/esd/cpci750/mv_eth.c | 4 ++-- board/esd/cpciiser4/cpciiser4.c | 2 +- board/esd/dasa_sim/dasa_sim.c | 2 +- board/esd/dp405/dp405.c | 2 +- board/esd/du405/du405.c | 2 +- board/esd/du440/du440.c | 2 +- board/esd/hh405/hh405.c | 8 ++++---- board/esd/hub405/hub405.c | 4 ++-- board/esd/meesc/meesc.c | 2 +- board/esd/ocrtc/ocrtc.c | 2 +- board/esd/otc570/otc570.c | 4 ++-- board/esd/pci405/pci405.c | 2 +- board/esd/plu405/plu405.c | 2 +- board/esd/pmc405/pmc405.c | 2 +- board/esd/voh405/voh405.c | 4 ++-- board/esd/vom405/vom405.c | 2 +- board/esd/wuh405/wuh405.c | 2 +- board/evb64260/eth.c | 2 +- board/g2000/g2000.c | 2 +- board/gen860t/gen860t.c | 6 +++--- board/inka4x0/inka4x0.c | 2 +- board/ip860/ip860.c | 2 +- board/kup/kup4k/kup4k.c | 4 ++-- board/mpl/common/common_util.c | 4 ++-- board/mpl/common/memtst.c | 2 +- board/mpl/mip405/mip405.c | 2 +- board/mpl/pati/pati.c | 2 +- board/mpl/pip405/pip405.c | 2 +- board/mpl/vcma9/vcma9.c | 4 ++-- board/ppmc8260/ppmc8260.c | 2 +- board/prodrive/p3mx/mv_eth.c | 4 ++-- board/sbc405/sbc405.c | 2 +- board/sbc8260/sbc8260.c | 2 +- board/siemens/CCM/ccm.c | 2 +- board/siemens/SCM/scm.c | 2 +- board/snmc/qs850/qs850.c | 2 +- board/snmc/qs860t/qs860t.c | 2 +- board/tqc/tqm8260/tqm8260.c | 2 +- board/trab/trab.c | 2 +- board/uc100/uc100.c | 2 +- common/cmd_nvedit.c | 2 +- drivers/mtd/cfi_flash.c | 2 +- include/common.h | 2 +- post/post.c | 2 +- 70 files changed, 89 insertions(+), 89 deletions(-)
README +1 -1
@@ -2572,7 +2572,7 @@ to save the current settings. Please note that the environment is read-only until the monitor has been relocated to RAM and a RAM copy of the environment has been -created; also, when using EEPROM you will have to use getenv_r() +created; also, when using EEPROM you will have to use getenv_f() until then to read environment variables. The environment is protected by a CRC32 checksum. Before the monitor
arch/arm/lib/board.c +1 -1
@@ -125,7 +125,7 @@ void blue_LED_off(void) __attribute__((weak, alias("__blue_LED_off")));static int init_baudrate (void ) {char tmp[64 ];/* long enough for environment variables */ -int i =getenv_r ("baudrate" , tmp,sizeof (tmp)); +int i =getenv_f ("baudrate" , tmp,sizeof (tmp)); gd->bd->bi_baudrate = gd->baudrate = (i >0 ) ? (int )simple_strtoul (tmp,NULL ,10 ) :CONFIG_BAUDRATE ;
arch/avr32/lib/board.c +1 -1
@@ -102,7 +102,7 @@ static int init_baudrate(void)char tmp[64 ];int i; - i =getenv_r ("baudrate" , tmp,sizeof (tmp)); + i =getenv_f ("baudrate" , tmp,sizeof (tmp));if (i >0 ) { gd->baudrate =simple_strtoul (tmp,NULL ,10 ); }else {
arch/blackfin/lib/board.c +1 -1
@@ -64,7 +64,7 @@ static int display_banner(void)static int init_baudrate (void ) {char baudrate[15 ]; -int i =getenv_r ("baudrate" , baudrate,sizeof (baudrate)); +int i =getenv_f ("baudrate" , baudrate,sizeof (baudrate)); gd->bd->bi_baudrate = gd->baudrate = (i >0 ) ?simple_strtoul (baudrate,NULL ,10 ) :CONFIG_BAUDRATE ;
arch/blackfin/lib/post.c +1 -1
@@ -168,7 +168,7 @@ static void post_get_flags(int *test_flags) }for (i =0 ; i < varnum; i++) { -if (getenv_r (var[i], list,sizeof (list)) <=0 ) +if (getenv_f (var[i], list,sizeof (list)) <=0 )continue ;for (j =0 ; j < post_list_size; j++) {
arch/i386/lib/board.c +1 -1
@@ -69,7 +69,7 @@ const char version_string[] =static int init_baudrate (void ) {char tmp[64 ];/* long enough for environment variables */ -int i =getenv_r ("baudrate" , tmp,64 ); +int i =getenv_f ("baudrate" , tmp,64 ); gd->baudrate = (i !=0 ) ? (int) simple_strtoul (tmp, NULL, 10)
arch/m68k/lib/board.c +3 -3
@@ -134,7 +134,7 @@ typedef int (init_fnc_t) (void);static int init_baudrate (void ) {char tmp[64 ];/* long enough for environment variables */ -int i =getenv_r ("baudrate" , tmp,sizeof (tmp)); +int i =getenv_f ("baudrate" , tmp,sizeof (tmp)); gd->baudrate = (i >0 ) ? (int) simple_strtoul (tmp, NULL, 10)
@@ -278,7 +278,7 @@ board_init_f (ulong bootflag)/* * reserve protected RAM */ - i =getenv_r ("pram" , tmp,sizeof (tmp)); + i =getenv_f ("pram" , tmp,sizeof (tmp)); reg = (i >0 ) ?simple_strtoul (tmp,NULL ,10 ) :CONFIG_PRAM ; addr -= (reg <<10 );/* size is in kB */ debug ("Reserving %ldk for protected RAM@%08lx\n" , reg, addr);
@@ -549,7 +549,7 @@ void board_init_r (gd_t *id, ulong dest_addr)* Fill in missing fields of bd_info. * We do this here, where we have "normal" access to the * environment; we used to do this still running from ROM, -* where had to use getenv_r(), which can be pretty slow when +* where had to use getenv_f(), which can be pretty slow when * the environment is in EEPROM. */ bd->bi_ip_addr =getenv_IPaddr ("ipaddr" );
arch/mips/cpu/incaip_clock.c +1 -1
@@ -105,7 +105,7 @@ int incaip_set_cpuclk (void)char tmp[64 ];ulong cpuclk; -if (getenv_r ("cpuclk" , tmp,sizeof (tmp)) >0 ) { +if (getenv_f ("cpuclk" , tmp,sizeof (tmp)) >0 ) { cpuclk =simple_strtoul (tmp,NULL ,10 ) *1000000 ;cgu_init (cpuclk);ebu_init (cpuclk);
arch/mips/lib/board.c +1 -1
@@ -114,7 +114,7 @@ static void display_flash_config(ulong size)static int init_baudrate (void ) {char tmp[64 ];/* long enough for environment variables */ -int i =getenv_r ("baudrate" , tmp,sizeof (tmp)); +int i =getenv_f ("baudrate" , tmp,sizeof (tmp)); gd->baudrate = (i >0 ) ? (int) simple_strtoul (tmp, NULL, 10)
arch/powerpc/cpu/mpc8xx/speed.c +1 -1
@@ -266,7 +266,7 @@ int get_clocks_866 (void)long cpuclk =0 ;long sccr_reg; -if (getenv_r ("cpuclk" , tmp,sizeof (tmp)) >0 ) +if (getenv_f ("cpuclk" , tmp,sizeof (tmp)) >0 ) cpuclk =simple_strtoul (tmp,NULL ,10 ) *1000000 ;if ((CONFIG_SYS_8xx_CPUCLK_MIN > cpuclk) || (CONFIG_SYS_8xx_CPUCLK_MAX < cpuclk))
arch/powerpc/cpu/ppc4xx/4xx_ibm_ddr2_autocalib.c +1 -1
@@ -985,7 +985,7 @@ u32 DQS_autocalibration(void)puts (str);#if defined(DEBUG_PPC4xx_DDR_AUTOCALIBRATION) - i =getenv_r ("autocalib" , tmp,sizeof (tmp)); + i =getenv_f ("autocalib" , tmp,sizeof (tmp));if (i <0 )strcpy (tmp,CONFIG_AUTOCALIB );
arch/powerpc/lib/board.c +3 -3
@@ -169,7 +169,7 @@ typedef int (init_fnc_t) (void);static int init_baudrate (void ) {char tmp[64 ];/* long enough for environment variables */ -int i =getenv_r ("baudrate" , tmp,sizeof (tmp)); +int i =getenv_f ("baudrate" , tmp,sizeof (tmp)); gd->baudrate = (i >0 ) ? (int) simple_strtoul (tmp, NULL, 10)
@@ -442,7 +442,7 @@ void board_init_f (ulong bootflag)/* * reserve protected RAM */ - i =getenv_r ("pram" , (char *)tmp,sizeof (tmp)); + i =getenv_f ("pram" , (char *)tmp,sizeof (tmp)); reg = (i >0 ) ?simple_strtoul ((const char *)tmp,NULL ,10 ) :CONFIG_PRAM ; addr -= (reg <<10 );/* size is in kB */ debug ("Reserving %ldk for protected RAM@%08lx\n" , reg, addr);
@@ -790,7 +790,7 @@ void board_init_r (gd_t *id, ulong dest_addr)* Fill in missing fields of bd_info. * We do this here, where we have "normal" access to the * environment; we used to do this still running from ROM, -* where had to use getenv_r(), which can be pretty slow when +* where had to use getenv_f(), which can be pretty slow when * the environment is in EEPROM. */
arch/sparc/lib/board.c +1 -1
@@ -88,7 +88,7 @@ ulong monitor_flash_len;static int init_baudrate (void ) {char tmp[64 ];/* long enough for environment variables */ -int i =getenv_r ("baudrate" , tmp,sizeof (tmp)); +int i =getenv_f ("baudrate" , tmp,sizeof (tmp)); gd->baudrate = (i >0 ) ? (int)simple_strtoul(tmp, NULL, 10)
board/Marvell/db64360/mv_eth.c +2 -2
@@ -248,7 +248,7 @@ void mv6436x_eth_initialize (bd_t * bis)return ; } - temp =getenv_r (s, buf,sizeof (buf)); + temp =getenv_f (s, buf,sizeof (buf)); s = (temp >0 ) ? buf :NULL ;#ifdef DEBUG
@@ -351,7 +351,7 @@ void mv6436x_eth_initialize (bd_t * bis)return ; } - temp =getenv_r (s, buf,sizeof (buf)); + temp =getenv_f (s, buf,sizeof (buf)); s = (temp >0 ) ? buf :NULL ;#ifdef DEBUG
board/Marvell/db64460/mv_eth.c +2 -2
@@ -248,7 +248,7 @@ void mv6446x_eth_initialize (bd_t * bis)return ; } - temp =getenv_r (s, buf,sizeof (buf)); + temp =getenv_f (s, buf,sizeof (buf)); s = (temp >0 ) ? buf :NULL ;#ifdef DEBUG
@@ -350,7 +350,7 @@ void mv6446x_eth_initialize (bd_t * bis)return ; } - temp =getenv_r (s, buf,sizeof (buf)); + temp =getenv_f (s, buf,sizeof (buf)); s = (temp >0 ) ? buf :NULL ;#ifdef DEBUG
board/avnet/fx12mm/fx12mm.c +1 -1
@@ -34,7 +34,7 @@ int checkboard(void) {char tmp[64 ];char *s, *e; -int i =getenv_r ("serial" , tmp,sizeof (tmp)); +int i =getenv_f ("serial" , tmp,sizeof (tmp));if (i <0 ) {printf ("Avnet Virtex4 FX12 with no serial #" );
board/cray/L1/L1.c +1 -1
@@ -245,7 +245,7 @@ int testdram (void)uint *pend = (uint *)L1_MEMSIZE ;uint *p; -if (getenv_r ("booted" ,NULL ,0 ) <=0 ) +if (getenv_f ("booted" ,NULL ,0 ) <=0 ) {printf ("testdram.." );/*AA*/
board/dave/PPChameleonEVB/PPChameleonEVB.c +1 -1
@@ -183,7 +183,7 @@ int misc_init_r (void)int checkboard (void ) {char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));puts ("Board: " );
board/esd/adciop/adciop.c +1 -1
@@ -62,7 +62,7 @@ int board_early_init_f (void)int checkboard (void ) {char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));puts ("Board: " );
board/esd/apc405/apc405.c +1 -1
@@ -404,7 +404,7 @@ int misc_init_r(void)int checkboard (void ) {char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));puts ("Board: " );
board/esd/ar405/ar405.c +1 -1
@@ -151,7 +151,7 @@ int checkboard (void)int index;int len;char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));const unsigned char *fpga;puts ("Board: " );
board/esd/ash405/ash405.c +1 -1
@@ -173,7 +173,7 @@ int misc_init_r (void)int checkboard (void ) {char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));puts ("Board: " );
board/esd/canbt/canbt.c +1 -1
@@ -157,7 +157,7 @@ int checkboard (void)int index;int len;char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));puts ("Board: " );
board/esd/cms700/cms700.c +1 -1
@@ -96,7 +96,7 @@ int checkboard (void)puts ("Board: " ); -if (getenv_r ("serial#" , str,sizeof (str)) ==-1 ) { +if (getenv_f ("serial#" , str,sizeof (str)) ==-1 ) {puts ("### No HW ID - assuming CMS700" ); }else {puts (str);
board/esd/cpci2dp/cpci2dp.c +1 -1
@@ -94,7 +94,7 @@ int misc_init_r (void)int checkboard (void ) {char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));puts ("Board: " );
board/esd/cpci405/cpci405.c +1 -1
@@ -416,7 +416,7 @@ int checkboard(void)int len;#endif char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));unsigned short ver;puts ("Board: " );
board/esd/cpci750/mv_eth.c +2 -2
@@ -248,7 +248,7 @@ void mv6436x_eth_initialize (bd_t * bis)return ; } - temp =getenv_r (s, buf,sizeof (buf)); + temp =getenv_f (s, buf,sizeof (buf)); s = (temp >0 ) ? buf :NULL ;#ifdef DEBUG
@@ -352,7 +352,7 @@ void mv6436x_eth_initialize (bd_t * bis)return ; } - temp =getenv_r (s, buf,sizeof (buf)); + temp =getenv_f (s, buf,sizeof (buf)); s = (temp >0 ) ? buf :NULL ;#ifdef DEBUG
board/esd/cpciiser4/cpciiser4.c +1 -1
@@ -153,7 +153,7 @@ int checkboard (void)int index;int len;char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));puts ("Board: " );
board/esd/dasa_sim/dasa_sim.c +1 -1
@@ -168,7 +168,7 @@ int checkboard (void)int index;int len;char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));int fpga;unsigned short val;
board/esd/dp405/dp405.c +1 -1
@@ -86,7 +86,7 @@ int misc_init_r (void)int checkboard (void ) {char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));unsigned char trans[16 ] = {0x0 ,0x8 ,0x4 ,0xc ,0x2 ,0xa ,0x6 ,0xe ,0x1 ,0x9 ,0x5 ,0xd ,0x3 ,0xb ,0x7 ,0xf };unsigned char id1, id2, rev;
board/esd/du405/du405.c +1 -1
@@ -163,7 +163,7 @@ int checkboard (void)int index;int len;char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));puts ("Board: " );
board/esd/du440/du440.c +1 -1
@@ -350,7 +350,7 @@ int checkboard(void)puts ("Board: DU440" ); -if (getenv_r ("serial#" , serno,sizeof (serno)) >0 ) { +if (getenv_f ("serial#" , serno,sizeof (serno)) >0 ) {puts (", serial# " );puts (serno); }
board/esd/hh405/hh405.c +4 -4
@@ -650,7 +650,7 @@ int misc_init_r (void)int checkboard (void ) {char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));puts ("Board: " );
@@ -660,7 +660,7 @@ int checkboard (void)puts (str); } -if (getenv_r ("bd_type" , str,sizeof (str)) !=-1 ) { +if (getenv_f ("bd_type" , str,sizeof (str)) !=-1 ) {printf (" (%s" , str); }else {puts (" (Missing bd_type!" );
@@ -780,7 +780,7 @@ void video_get_info_str (int line_number, char *info) {char str[64 ];char str2[64 ]; -int i =getenv_r ("serial#" , str2,sizeof (str)); +int i =getenv_f ("serial#" , str2,sizeof (str));if (line_number ==1 ) {sprintf (str," Board: " );
@@ -791,7 +791,7 @@ void video_get_info_str (int line_number, char *info)strcat (str, str2); } -if (getenv_r ("bd_type" , str2,sizeof (str2)) !=-1 ) { +if (getenv_f ("bd_type" , str2,sizeof (str2)) !=-1 ) {strcat (str," (" );strcat (str, str2); }else {
board/esd/hub405/hub405.c +2 -2
@@ -196,7 +196,7 @@ int misc_init_r (void)int checkboard (void ) {char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));puts ("Board: " );
@@ -206,7 +206,7 @@ int checkboard (void)puts (str); } -if (getenv_r ("bd_type" , str,sizeof (str)) !=-1 ) { +if (getenv_f ("bd_type" , str,sizeof (str)) !=-1 ) {printf (" (%s" , str); }else {puts (" (Missing bd_type!" );
board/esd/meesc/meesc.c +1 -1
@@ -184,7 +184,7 @@ int checkboard(void)puts ("Board: EtherCAN/2 Gateway" );break ; } -if (getenv_r ("serial#" , str,sizeof (str)) >0 ) { +if (getenv_f ("serial#" , str,sizeof (str)) >0 ) {puts (", serial# " );puts (str); }
board/esd/ocrtc/ocrtc.c +1 -1
@@ -68,7 +68,7 @@ int board_early_init_f (void)int checkboard (void ) {char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));puts ("Board: " );
board/esd/otc570/otc570.c +2 -2
@@ -258,7 +258,7 @@ int checkboard(void)char str[32 ];puts ("Board: esd ARM9 HMI Panel - OTC570" ); -if (getenv_r ("serial#" , str,sizeof (str)) >0 ) { +if (getenv_f ("serial#" , str,sizeof (str)) >0 ) {puts (", serial# " );puts (str); }
@@ -308,7 +308,7 @@ int misc_init_r(void)printf ("USART0: " ); -if (getenv_r ("usart0" , str,sizeof (str)) ==-1 ) { +if (getenv_f ("usart0" , str,sizeof (str)) ==-1 ) {printf ("No entry - assuming 1-wire\n" );/* CTS pin, works as mode select pin (0 = 1-wire; 1 = RS485) */ at91_set_pio_output (AT91_PIO_PORTA ,29 ,0 );
board/esd/pci405/pci405.c +1 -1
@@ -298,7 +298,7 @@ int misc_init_r (void)int checkboard (void ) {char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));puts ("Board: " );
board/esd/plu405/plu405.c +1 -1
@@ -240,7 +240,7 @@ int misc_init_r(void)int checkboard (void ) {char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));puts ("Board: " );
board/esd/pmc405/pmc405.c +1 -1
@@ -123,7 +123,7 @@ int checkboard (void) {ulong val;char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));puts ("Board: " );
board/esd/voh405/voh405.c +2 -2
@@ -271,7 +271,7 @@ int misc_init_r (void)int checkboard (void ) {char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));puts ("Board: " );
@@ -281,7 +281,7 @@ int checkboard (void)puts (str); } -if (getenv_r ("bd_type" , str,sizeof (str)) !=-1 ) { +if (getenv_f ("bd_type" , str,sizeof (str)) !=-1 ) {printf (" (%s)" , str); }else {puts (" (Missing bd_type!)" );
board/esd/vom405/vom405.c +1 -1
@@ -121,7 +121,7 @@ int misc_init_r (void)int checkboard (void ) {char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));int flashcnt;int delay;u8 *led_reg = (u8 *)(CAN_BA +0x1000 );
board/esd/wuh405/wuh405.c +1 -1
@@ -173,7 +173,7 @@ int misc_init_r (void)int checkboard (void ) {char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));puts ("Board: " );
board/evb64260/eth.c +1 -1
@@ -708,7 +708,7 @@ gt6426x_eth_initialize(bd_t *bis)return ; } - temp =getenv_r (s, buf,sizeof (buf)); + temp =getenv_f (s, buf,sizeof (buf)); s = (temp >0 ) ? buf :NULL ;#ifdef DEBUG
board/g2000/g2000.c +1 -1
@@ -91,7 +91,7 @@ int misc_init_r (void)int checkboard (void ) {char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));puts ("Board: " );
board/gen860t/gen860t.c +3 -3
@@ -132,7 +132,7 @@ int checkboard (void)char buf[64 ];int i; - i =getenv_r ("board_id" , buf,sizeof (buf)); + i =getenv_f ("board_id" , buf,sizeof (buf)); s = (i >0 ) ? buf :NULL ;if (s) {
@@ -141,7 +141,7 @@ int checkboard (void)printf ("<unknown> " ); } - i =getenv_r ("serial#" , buf,sizeof (buf)); + i =getenv_f ("serial#" , buf,sizeof (buf)); s = (i >0 ) ? buf :NULL ;if (s) {
@@ -276,7 +276,7 @@ int last_stage_init (void)/* * Read the environment to see what to do with the beeper */ - i =getenv_r ("beeper" , buf,sizeof (buf)); + i =getenv_f ("beeper" , buf,sizeof (buf));if (i >0 ) {do_beeper (buf); }
board/inka4x0/inka4x0.c +1 -1
@@ -187,7 +187,7 @@ int misc_init_f (void)char tmp[10 ];int i, br; - i =getenv_r ("brightness" , tmp,sizeof (tmp)); + i =getenv_f ("brightness" , tmp,sizeof (tmp)); br = (i >0 ) ? (int )simple_strtoul (tmp,NULL ,10 ) :CONFIG_SYS_BRIGHTNESS ;
board/ip860/ip860.c +1 -1
@@ -114,7 +114,7 @@ int checkboard (void)puts ("Board: " ); - i =getenv_r ("serial#" , (char *)buf,sizeof (buf)); + i =getenv_f ("serial#" , (char *)buf,sizeof (buf)); s = (i >0 ) ? buf :NULL ;if (!s ||strncmp ((char *)s,"IP860" ,5 )) {
board/kup/kup4k/kup4k.c +2 -2
@@ -314,7 +314,7 @@ void lcd_logo (bd_t * bd) } - n =getenv_r ("lcd" , tmp,sizeof (tmp)); + n =getenv_f ("lcd" , tmp,sizeof (tmp));if (n >0 ) {if (!strcmp ("tft" , tmp)) tft =1 ;
@@ -342,7 +342,7 @@ void lcd_logo (bd_t * bd) ((S1D_VALUE *) fb_info.RegAddr)[s1dReg /sizeof (S1D_VALUE )] = s1dValue; } - n =getenv_r ("contrast" , tmp,sizeof (tmp)); + n =getenv_f ("contrast" , tmp,sizeof (tmp)); ((S1D_VALUE *) fb_info.RegAddr)[0xB3 ] = (n >0 ) ? (uchar )simple_strtoul (tmp,NULL ,10 ) *255 /100 :0xA0 ;switch (bd->bi_busfreq) {
board/mpl/common/common_util.c +2 -2
@@ -284,13 +284,13 @@ void set_backup_values(int overwrite) } }memcpy (back.signature,"MPL\0" ,4 ); - i =getenv_r ("serial#" ,back.serial_name,16 ); + i =getenv_f ("serial#" ,back.serial_name,16 );if (i <0 ) {puts ("Not possible to write Backup\n" );return ; } back.serial_name[16 ]=0 ; - i =getenv_r ("ethaddr" ,back.eth_addr,20 ); + i =getenv_f ("ethaddr" ,back.eth_addr,20 );if (i <0 ) {puts ("Not possible to write Backup\n" );return ;
board/mpl/common/memtst.c +1 -1
@@ -29,7 +29,7 @@ int testdram (void)unsigned char s[32 ];int i; - i =getenv_r ("testmem" , s,32 ); + i =getenv_f ("testmem" , s,32 );if (i !=0 ) { i = (int )simple_strtoul (s,NULL ,10 );if ((i >0 ) && (i <0xf )) {
board/mpl/mip405/mip405.c +1 -1
@@ -589,7 +589,7 @@ int checkboard (void)puts ("Board: " );get_pcbrev_var (&bc,&var); - i =getenv_r ("serial#" , (char *)s,32 ); + i =getenv_f ("serial#" , (char *)s,32 );if ((i ==0 ) ||strncmp ((char *)s,BOARD_NAME ,sizeof (BOARD_NAME ))) {get_backup_values (b);if (strncmp (b->signature,"MPL\0" ,4 ) !=0 ) {
board/mpl/pati/pati.c +1 -1
@@ -353,7 +353,7 @@ int checkboard (void)puts ("\nBoard: " ); reg=in32 (PLD_CONFIG_BASE +PLD_BOARD_TIMING ); rev=(char )(SYSCNTR_BREV (reg)+'A' ); - i =getenv_r ("serial#" , s,32 ); + i =getenv_f ("serial#" , s,32 );if ((i ==-1 )) {puts ("### No HW ID - assuming " BOARD_NAME );printf (" Rev. %c\n" ,rev);
board/mpl/pip405/pip405.c +1 -1
@@ -579,7 +579,7 @@ int checkboard (void)puts ("Board: " ); - i =getenv_r ("serial#" , (char *)s,32 ); + i =getenv_f ("serial#" , (char *)s,32 );if ((i ==0 ) ||strncmp ((char *)s,"PIP405" ,6 )) {get_backup_values (b);if (strncmp (b->signature,"MPL\0" ,4 ) !=0 ) {
board/mpl/vcma9/vcma9.c +2 -2
@@ -295,7 +295,7 @@ int checkboard(void)int i;backup_t *b = (backup_t *) s; - i =getenv_r ("serial#" , s,32 ); + i =getenv_f ("serial#" , s,32 );if ((i <0 ) ||strncmp (s,"VCMA9" ,5 )) {get_backup_values (b);if (strncmp (b->signature,"MPL\0" ,4 ) !=0 ) {
@@ -340,7 +340,7 @@ void print_vcma9_info(void)char s[50 ];int i; -if ((i =getenv_r ("serial#" , s,32 )) <0 ) { +if ((i =getenv_f ("serial#" , s,32 )) <0 ) {puts ("### No HW ID - assuming VCMA9" );printf ("i %d" , i*24 ); }else {
board/ppmc8260/ppmc8260.c +1 -1
@@ -285,7 +285,7 @@ int misc_init_r (void)int res;if ((ds !=0 ) && (ds !=0xff )) { - res =getenv_r ("ethaddr" , (char *)tmp,sizeof (tmp)); + res =getenv_f ("ethaddr" , (char *)tmp,sizeof (tmp));if (res >0 ) { ss = ((ds >>4 ) &0x0f ); ss += ss <0x0a ?'0' : ('a' -10 );
board/prodrive/p3mx/mv_eth.c +2 -2
@@ -298,7 +298,7 @@ void mv6446x_eth_initialize (bd_t * bis)return ; } - temp =getenv_r (s, buf,sizeof (buf)); + temp =getenv_f (s, buf,sizeof (buf)); s = (temp >0 ) ? buf :NULL ;#ifdef DEBUG
@@ -397,7 +397,7 @@ void mv6446x_eth_initialize (bd_t * bis)return ; } - temp =getenv_r (s, buf,sizeof (buf)); + temp =getenv_f (s, buf,sizeof (buf)); s = (temp >0 ) ? buf :NULL ;#ifdef DEBUG
board/sbc405/sbc405.c +1 -1
@@ -79,7 +79,7 @@ int misc_init_r (void)int checkboard (void ) {char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));puts ("Board: " );
board/sbc8260/sbc8260.c +1 -1
@@ -267,7 +267,7 @@ int misc_init_r (void)int res;if ((ds !=0 ) && (ds !=0xff )) { - res =getenv_r ("ethaddr" , tmp,sizeof (tmp)); + res =getenv_f ("ethaddr" , tmp,sizeof (tmp));if (res >0 ) { ss = ((ds >>4 ) &0x0f ); ss += ss <0x0a ?'0' : ('a' -10 );
board/siemens/CCM/ccm.c +1 -1
@@ -102,7 +102,7 @@ int checkboard (void)unsigned char *s;unsigned char buf[64 ]; - s = (getenv_r ("serial#" , (char *)&buf,sizeof (buf)) >0 ) ? buf :NULL ; + s = (getenv_f ("serial#" , (char *)&buf,sizeof (buf)) >0 ) ? buf :NULL ;puts ("Board: Siemens CCM" );
board/siemens/SCM/scm.c +1 -1
@@ -209,7 +209,7 @@ const iop_conf_t iop_conf_tab[4][32] = {int checkboard (void ) {char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));puts ("Board: " );
board/snmc/qs850/qs850.c +1 -1
@@ -100,7 +100,7 @@ int checkboard (void)char buf[64 ];int i; - i =getenv_r ("serial#" , buf,sizeof (buf)); + i =getenv_f ("serial#" , buf,sizeof (buf)); s = (i>0 ) ? buf :NULL ;if (!s ||strncmp (s,BOARD_IDENTITY ,5 )) {
board/snmc/qs860t/qs860t.c +1 -1
@@ -93,7 +93,7 @@ int checkboard (void)char buf[64 ];int i; - i =getenv_r ("serial#" , buf,sizeof (buf)); + i =getenv_f ("serial#" , buf,sizeof (buf)); s = (i>0 ) ? buf :NULL ;if (!s ||strncmp (s,"QS860T" ,6 )) {
board/tqc/tqm8260/tqm8260.c +1 -1
@@ -196,7 +196,7 @@ const iop_conf_t iop_conf_tab[4][32] = {int checkboard (void ) {char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));puts ("Board: " );
board/trab/trab.c +1 -1
@@ -414,7 +414,7 @@ static void tsc2000_set_brightness(void)spi_init ();tsc2000_write (1 ,2 ,0x0 );/* Power up DAC */ - i =getenv_r ("brightness" , tmp,sizeof (tmp)); + i =getenv_f ("brightness" , tmp,sizeof (tmp)); br = (i >0 ) ? (int )simple_strtoul (tmp,NULL ,10 ) :CONFIG_SYS_BRIGHTNESS ;
board/uc100/uc100.c +1 -1
@@ -150,7 +150,7 @@ int board_switch(void)int checkboard (void ) {char str[64 ]; -int i =getenv_r ("serial#" , str,sizeof (str)); +int i =getenv_f ("serial#" , str,sizeof (str));puts ("Board: " );
common/cmd_nvedit.c +1 -1
@@ -543,7 +543,7 @@ char *getenv (char *name)return (NULL ); } -int getenv_r (char *name,char *buf,unsigned len) +int getenv_f (char *name,char *buf,unsigned len) {int i, nxt;
drivers/mtd/cfi_flash.c +1 -1
@@ -1993,7 +1993,7 @@ unsigned long flash_init (void)#ifdef CONFIG_SYS_FLASH_PROTECTION /* read environment from EEPROM */ char s[64 ]; -getenv_r ("unlock" , s,sizeof (s)); +getenv_f ("unlock" , s,sizeof (s));#endif #define BANK_BASE (i) (((phys_addr_t [CFI_MAX_FLASH_BANKS])CONFIG_SYS_FLASH_BANKS_LIST)[i])
include/common.h +1 -1
@@ -256,7 +256,7 @@ int env_init (void);void env_relocate (void );int envmatch (uchar *,int );char *getenv (char *); -int getenv_r (char *name,char *buf,unsigned len); +int getenv_f (char *name,char *buf,unsigned len);int saveenv (void );#ifdef CONFIG_PPC /* ARM version to be fixed! */ int inline setenv (char *,char *);
post/post.c +1 -1
@@ -187,7 +187,7 @@ static void post_get_flags (int *test_flags) }for (i =0 ; i < varnum; i++) { -if (getenv_r (var[i], list,sizeof (list)) <=0 ) +if (getenv_f (var[i], list,sizeof (list)) <=0 )continue ;for (j =0 ; j < post_list_size; j++) {
Signature · 1 line
1.7.1.1
PATCH 1/1 Rename getenv_r() into getenv_f()
Hi Wolfgang,
Quoted 9 lines
While running from flash, i. e. before relocation, we have only a limited C runtime environment without writable data segment. In this phase, some configurations (for example with environment in EEPROM) must not use the normal
getenv(), but a special function. This function had been calledgetenv_r(), with the idea that the "_r" suffix would mean the same as in the_r_eentrantversions of some of the C library functions (for example getdate vs.getdate_r, getgrent vs.getgrent_r, etc.).
Quoted 4 lines
Unfortunately this was a misleading name, as in U-Boot the "_r" generally means "running from RAM", i. e. _after_ relocation.
To avoid confusion, rename into
getenv_f()[as "running from flash"]
I appreciatethis change as I was mislead also once about the nameing.
Quoted 1 line
Signed-off-by Wolfgang Denk <[email protected]>
Cheers
Detlev
Signature · 8 lines
Q: Does that mean we also shouldn't be using IRQF_SAMPLE_RANDOM on
interrupt [sources]?
A: Yes. The flag needs to be taken out and shot.
-- Matt Mackall <1239116251.14392.133.camel@calx>
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.deWolfgang Denk
AppliedPATCH 1/1 Rename getenv_r() into getenv_f()
In reply to Wolfgang DenkDear Wolfgang Denk,
Quoted 79 lines · In message <[email protected]> you wrote:
While running from flash, i. e. before relocation, we have only a limited C runtime environment without writable data segment. In this phase, some configurations (for example with environment in EEPROM) must not use the normal
getenv(), but a special function. This function had been calledgetenv_r(), with the idea that the "_r" suffix would mean the same as in the_r_eentrantversions of some of the C library functions (for example getdate vs.getdate_r, getgrent vs.getgrent_r, etc.).Unfortunately this was a misleading name, as in U-Boot the "_r" generally means "running from RAM", i. e. _after_ relocation.
To avoid confusion, rename into
getenv_f()[as "running from flash"]Signed-off-by Wolfgang Denk <[email protected]>--- README | 2 +- arch/arm/lib/board.c | 2 +- arch/avr32/lib/board.c | 2 +- arch/blackfin/lib/board.c | 2 +- arch/blackfin/lib/post.c | 2 +- arch/i386/lib/board.c | 2 +- arch/m68k/lib/board.c | 6 +++--- arch/mips/cpu/incaip_clock.c | 2 +- arch/mips/lib/board.c | 2 +- arch/powerpc/cpu/mpc8xx/speed.c | 2 +- arch/powerpc/cpu/ppc4xx/4xx_ibm_ddr2_autocalib.c | 2 +- arch/powerpc/lib/board.c | 6 +++--- arch/sparc/lib/board.c | 2 +- board/Marvell/db64360/mv_eth.c | 4 ++-- board/Marvell/db64460/mv_eth.c | 4 ++-- board/avnet/fx12mm/fx12mm.c | 2 +- board/cray/L1/L1.c | 2 +- board/dave/PPChameleonEVB/PPChameleonEVB.c | 2 +- board/esd/adciop/adciop.c | 2 +- board/esd/apc405/apc405.c | 2 +- board/esd/ar405/ar405.c | 2 +- board/esd/ash405/ash405.c | 2 +- board/esd/canbt/canbt.c | 2 +- board/esd/cms700/cms700.c | 2 +- board/esd/cpci2dp/cpci2dp.c | 2 +- board/esd/cpci405/cpci405.c | 2 +- board/esd/cpci750/mv_eth.c | 4 ++-- board/esd/cpciiser4/cpciiser4.c | 2 +- board/esd/dasa_sim/dasa_sim.c | 2 +- board/esd/dp405/dp405.c | 2 +- board/esd/du405/du405.c | 2 +- board/esd/du440/du440.c | 2 +- board/esd/hh405/hh405.c | 8 ++++---- board/esd/hub405/hub405.c | 4 ++-- board/esd/meesc/meesc.c | 2 +- board/esd/ocrtc/ocrtc.c | 2 +- board/esd/otc570/otc570.c | 4 ++-- board/esd/pci405/pci405.c | 2 +- board/esd/plu405/plu405.c | 2 +- board/esd/pmc405/pmc405.c | 2 +- board/esd/voh405/voh405.c | 4 ++-- board/esd/vom405/vom405.c | 2 +- board/esd/wuh405/wuh405.c | 2 +- board/evb64260/eth.c | 2 +- board/g2000/g2000.c | 2 +- board/gen860t/gen860t.c | 6 +++--- board/inka4x0/inka4x0.c | 2 +- board/ip860/ip860.c | 2 +- board/kup/kup4k/kup4k.c | 4 ++-- board/mpl/common/common_util.c | 4 ++-- board/mpl/common/memtst.c | 2 +- board/mpl/mip405/mip405.c | 2 +- board/mpl/pati/pati.c | 2 +- board/mpl/pip405/pip405.c | 2 +- board/mpl/vcma9/vcma9.c | 4 ++-- board/ppmc8260/ppmc8260.c | 2 +- board/prodrive/p3mx/mv_eth.c | 4 ++-- board/sbc405/sbc405.c | 2 +- board/sbc8260/sbc8260.c | 2 +- board/siemens/CCM/ccm.c | 2 +- board/siemens/SCM/scm.c | 2 +- board/snmc/qs850/qs850.c | 2 +- board/snmc/qs860t/qs860t.c | 2 +-
Quoted 8 lines
board/tqc/tqm8260/tqm8260.c | 2 +- board/trab/trab.c | 2 +- board/uc100/uc100.c | 2 +- common/cmd_nvedit.c | 2 +- drivers/mtd/cfi_flash.c | 2 +- include/common.h | 2 +- post/post.c | 2 +- 70 files changed, 89 insertions(+), 89 deletions(-)
Applied.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Beware of the Turing Tar-pit in which everything is possible but nothing of interest is easy.